/[libspopc]/format.c
ViewVC logotype

Diff of /format.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5 by ben, Thu Oct 8 15:37:49 2009 UTC revision 6 by ben, Sun Apr 18 11:05:58 2010 UTC
# Line 30  Line 30 
30   * libspopc functions to format pop data returned by server *   * libspopc functions to format pop data returned by server *
31   ************************************************************/   ************************************************************/
32    
33  char* nextline(char* string){  DLLIMPORT char* nextline(char* string){
34  /* returns a pointer to the next line of given string */  /* returns a pointer to the next line of given string */
35          while(((*string) != '\n')&&((*string) != '\0')){          while(((*string) != '\n')&&((*string) != '\0')){
36                  string++;                  string++;
# Line 41  char* nextline(char* string){ Line 41  char* nextline(char* string){
41          return(string+1);          return(string+1);
42  }  }
43    
44  char* retr2msg(char* data){  DLLIMPORT char* retr2msg(char* data){
45  /* retruns formatted mail from a pop RETR X query */  /* retruns formatted mail from a pop RETR X query */
46  /* should only be called on data returned by pop3_retr() */  /* should only be called on data returned by pop3_retr() */
47          char* msg=NULL;          char* msg=NULL;
# Line 75  char* retr2msg(char* data){ Line 75  char* retr2msg(char* data){
75          return(msg);          return(msg);
76  }  }
77    
78  void freemsg(char* msg){  DLLIMPORT void freemsg(char* msg){
79          free(msg);          free(msg);
         msg=NULL;  
80  }  }
81    
82  int* list2array(char* poplist){  DLLIMPORT int* list2array(char* poplist){
83  /* returns an int array of sizes of messages from a LIST pop query */  /* returns an int array of sizes of messages from a LIST pop query */
84  /* array[0] holds id of the array's element */  /* array[0] holds id of the array's element */
85  /* should only be called on data received by a pop3_list() request */  /* should only be called on data received by a pop3_list() request */
# Line 131  int* list2array(char* poplist){ Line 130  int* list2array(char* poplist){
130          return(array);          return(array);
131  }  }
132    
133  void freelistarray(int* array){  DLLIMPORT void freelistarray(int* array){
134  /* free array allocated by list2array() */  /* free array allocated by list2array() */
135          free(array);          free(array);
136  }  }
137    
138  int listi2size(char* resp){  DLLIMPORT int listi2size(char* resp){
139  /* grep the given size (in bytes) in resp after a pop3_list(sock,ID) request */  /* grep the given size (in bytes) in resp after a pop3_list(sock,ID) request */
140          int i;          int i;
141          int r;          int r;
# Line 151  int listi2size(char* resp){ Line 150  int listi2size(char* resp){
150          return(i);          return(i);
151  }  }
152    
153  int stat2num(char* resp){  DLLIMPORT int stat2num(char* resp){
154  /* returns the num of retrievable (non-deleted) messages */  /* returns the num of retrievable (non-deleted) messages */
155  /* should only be called just after a pop3_stat() request */  /* should only be called just after a pop3_stat() request */
156          int n,s,r;          int n,s,r;
# Line 166  int stat2num(char* resp){ Line 165  int stat2num(char* resp){
165                  return -1;                  return -1;
166  }  }
167    
168  int stat2bytes(char* resp){  DLLIMPORT int stat2bytes(char* resp){
169  /* returns the sumsize in bytes of all stored messages on server */  /* returns the sumsize in bytes of all stored messages on server */
170  /* should only be called just after a pop3_stat() request */  /* should only be called just after a pop3_stat() request */
171          int n,s,r;          int n,s,r;
# Line 181  int stat2bytes(char* resp){ Line 180  int stat2bytes(char* resp){
180                  return -1;                  return -1;
181  }  }
182    
183  char** uidl2array(char* resp){  DLLIMPORT char** uidl2array(char* resp){
184  /* returns an array of unique strings for each message id */  /* returns an array of unique strings for each message id */
185  /* array[0] gives array's last id */  /* array[0] gives array's last id */
186  /* should only be called just after a pop3_uidl() request */  /* should only be called just after a pop3_uidl() request */
# Line 243  char** uidl2array(char* resp){ Line 242  char** uidl2array(char* resp){
242          return(array);          return(array);
243  }  }
244    
245  void freeuidlarray(char** array){  DLLIMPORT void freeuidlarray(char** array){
246  /* free the array allocated by uidl2array() */  /* free the array allocated by uidl2array() */
247          int i,last;          int i,last;
248    
# Line 255  void freeuidlarray(char** array){ Line 254  void freeuidlarray(char** array){
254          free(array);          free(array);
255  }  }
256    
257  char* uidli2sig(char* resp){  DLLIMPORT char* uidli2sig(char* resp){
258  /* greps signature from server resp */  /* greps signature from server resp */
259  /* should only be called after a pop3_uidl(sock,ID) */  /* should only be called after a pop3_uidl(sock,ID) */
260          char* sig=NULL;          char* sig=NULL;

Legend:
Removed from v.5  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.26