00001 #ifndef FTPPARSE_H 00002 #define FTPPARSE_H 00003 00004 /* 00005 ftpparse(&fp,buf,len) tries to parse one line of LIST output. 00006 00007 The line is an array of len characters stored in buf. 00008 It should not include the terminating CR LF; so buf[len] is typically CR. 00009 00010 If ftpparse() can't find a filename, it returns 0. 00011 00012 If ftpparse() can find a filename, it fills in fp and returns 1. 00013 fp is a struct ftpparse, defined below. 00014 The name is an array of fp.namelen characters stored in fp.name; 00015 fp.name points somewhere within buf. 00016 */ 00017 00021 struct ftpparse { 00022 char *name; 00023 int namelen; 00024 int flagtrycwd; 00025 int flagtryretr; 00026 int sizetype; 00027 long size; 00028 int mtimetype; 00029 time_t mtime; 00030 int idtype; 00031 char *id; 00032 int idlen; 00033 } ; 00034 00035 #define FTPPARSE_SIZE_UNKNOWN 0 00036 #define FTPPARSE_SIZE_BINARY 1 /* size is the number of octets in 'TYPE I' command */ 00037 #define FTPPARSE_SIZE_ASCII 2 /* size is the number of octets in 'TYPE A' command */ 00038 00039 #define FTPPARSE_MTIME_UNKNOWN 0 00040 #define FTPPARSE_MTIME_LOCAL 1 /* time is correct */ 00041 #define FTPPARSE_MTIME_REMOTEMINUTE 2 /* time zone and secs are unknown */ 00042 #define FTPPARSE_MTIME_REMOTEDAY 3 /* time zone and time of day are unknown */ 00043 /* 00044 When a time zone is unknown, it is assumed to be GMT. You may want 00045 to use localtime() for LOCAL times, along with an indication that the 00046 time is correct in the local time zone, and gmtime() for REMOTE* times. 00047 */ 00048 00049 #define FTPPARSE_ID_UNKNOWN 0 00050 #define FTPPARSE_ID_FULL 1 /* unique identifier for files on this FTP server */ 00051 00052 extern int ftpparse(struct ftpparse *,const char *,int); 00053 00054 #endif 00055 00056