BOOL WINAPI idPRParceMVS(const FTPServerInfo* Server, FTPFileInfo* p, char *entry, int entry_len) { NET_FileEntryInfo ei; BOOL needDot = FALSE; BOOL hidden = FALSE; memset(&ei,0,sizeof(ei)); if(strncmp(entry,"Volume Unit Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname",63)==0) return FALSE; if(strncmp(entry," Name VV.MM Created Changed Size Init Mod Id",66)==0) return FALSE; if(strncmp(entry," Name Size TTR Alias-of AC --------- Attributes --------- Amode Rmode",78)==0) return FALSE; if(strncmp(entry,"No jobs found on Held queue",27)==0) return FALSE; if(strlen(entry)>51&&(strncmp(entry+51," PO ",4)==0)) ei.FileType = NET_DIRECTORY; else if(strncmp(entry,"Pseudo Directory",16)==0) { ei.FileType = NET_DIRECTORY; // ei.FileType = NET_SYM_LINK_TO_DIR; needDot = TRUE; } else if(strncmp(entry,"User catalog connector",22)==0) { ei.FileType = NET_DIRECTORY; hidden = TRUE; strcpy(ei.UnixMode,"VSAM"); // ei.FileType = NET_SYM_LINK_TO_DIR; needDot = TRUE; } else if(strncmp(entry+7,"Error determining attributes",28)==0|| strncmp(entry+7,"Not Mounted",11)==0) { strcpy(ei.UnixMode,"-offline-"); hidden = TRUE; } #define BYTES_PER_TRACK_3380 47476 #define BYTES_PER_TRACK_3390 56664 if(entry_len>8&&entry[6]!=' '&&entry[8]!=' '&&!needDot) // UNIX like { memcpy(ei.UnixMode,entry,10); ei.UnixMode[10]=0; if((entry[0]|0x20)=='d') ei.FileType = NET_DIRECTORY; if((entry[0]|0x20)=='l') ei.FileType = NET_SYM_LINK; if(entry[39]) { int sz; sscanf(entry+33,"%d",&sz); ei.size=sz; } char* pdata = entry + 41; net_convert_unix_date(pdata, ei.date); if(entry[15]!=' ') { memcpy(ei.FTPOwner,entry+15,8+1+8); ei.FTPOwner[8+1+8]=0; } entry += 54; entry_len-=54; char* s = strstr(entry," -> "); if(s) { *s=0; if(s[4]) sscanf(s+4,"%s",ei.Link); } } else if(entry_len>56&&entry[56]!=' ') { int usedTrk, lrecl, blkSize, type; usedTrk=lrecl=blkSize=type=0; if(entry[7]!=' ') sscanf(entry+7,"%d",&type); if(entry[31]!=' ') sscanf(entry+27,"%d",&usedTrk); if(entry[43]!=' ') sscanf(entry+39,"%d",&lrecl); if(entry[49]!=' ') sscanf(entry+45,"%d",&blkSize); if(type==3380) ei.size = usedTrk * BYTES_PER_TRACK_3380; if(type==3390) ei.size = usedTrk * BYTES_PER_TRACK_3390; net_parse_mvs_date_time(entry + 14, ei.acc_date); if(!needDot) sscanf(entry,"%s",ei.FTPOwner); if(entry[52]!=' ') { memcpy(ei.UnixMode,entry+51,5); memcpy(ei.UnixMode+5,entry+33,5); ei.UnixMode[10]=0; if(strncmp(ei.UnixMode,"VSAM",4)==0|| strncmp(ei.UnixMode,"PATH",4)==0|| strncmp(ei.UnixMode,"GDG",3)==0) hidden=TRUE; } entry += 56; entry_len-=56; } else if(entry_len>8) // PO { if(entry_len>62) { if(entry[15]==' ') // PO F { net_parse_mvs_date_time(entry + 27, ei.date, TRUE); net_parse_mvs_date_time(entry + 16, ei.cr_date); int sz; sscanf(entry+44,"%d",&sz); ei.size=sz; sscanf(entry+62,"%s",ei.FTPOwner); } else if(entry[19]!=' ') // PO U { UINT sz; sscanf(entry+10,"%X",&sz); ei.size=sz; if(entry[24]!=' ') sscanf(entry+24,"%s",ei.Link); } else // JES { UINT sz; sscanf(entry+30,"%X",&sz); ei.size=sz; entry+=10; } } entry[8]=0; } //Name entry = SkipSpace(entry); if(*entry=='\'') entry++; StrCpy(ei.FindData.cFileName, entry, ARRAYSIZE(ei.FindData.cFileName)); size_t le = strlen(ei.FindData.cFileName); if(le&&ei.FindData.cFileName[le-1]=='\'')ei.FindData.cFileName[le-1]=0; //e=strchr(ei.FindData.cFileName,'.'); //if(e) { *(e+1)=0; ei.FileType = NET_DIRECTORY; } if(needDot) strcat(ei.FindData.cFileName, "."); XP_StripLine(ei.FindData.cFileName); if(hidden) ei.FindData.dwFileAttributes|=FILE_ATTRIBUTE_HIDDEN; // if(ei.FileType == NET_SYM_LINK_TO_DIR ) // strcpy(ei.Link,ei.FindData.cFileName); return ConvertEntry(&ei,p); }
char * stripCopy (char* str) { return copyString(XP_StripLine(str)); }
/* parse lines in an HTML help mapping file. * get window_size and name, etc... * * when the id is found function returns HTML_HELP_ID_FOUND * on error function returns negative error code. */ PRIVATE int net_ParseHTMLHelpLine(HTMLHelpParseObj *obj, char *line_data) { char *line = XP_StripLine(line_data); char *token; char *next_word; if(*line == '<') { /* find and terminate the end '>' */ XP_STRTOK(line, ">"); token = XP_StripLine(line+1); if(!strncasecomp(token, ID_MAP_TOKEN, sizeof(ID_MAP_TOKEN)-1)) { obj->in_id_mapping = TRUE; } else if(!strncasecomp(token, END_ID_MAP_TOKEN, sizeof(END_ID_MAP_TOKEN)-1)) { obj->in_id_mapping = FALSE; } else if(!strncasecomp(token, FRAME_GROUP_TOKEN, sizeof(FRAME_GROUP_TOKEN)-1)) { char *cp = token + sizeof(FRAME_GROUP_TOKEN)-1; frame_set_struct * fgs = XP_NEW(frame_set_struct); while(isspace(*cp)) cp++; if(fgs) { XP_MEMSET(fgs, 0, sizeof(frame_set_struct)); next_word=NULL; /* init */ do { if(!strncasecomp(cp, SRC_TOKEN, sizeof(SRC_TOKEN)-1)) { char *address = net_get_html_help_token( cp+sizeof(SRC_TOKEN)-1, &next_word); cp = next_word; fgs->address = XP_STRDUP(address); } else if(!strncasecomp(cp, WINDOW_TOKEN, sizeof(WINDOW_TOKEN)-1)) { char *window = net_get_html_help_token( cp+sizeof(WINDOW_TOKEN)-1, &next_word); cp = next_word; fgs->target = XP_STRDUP(window); } else { /* unknown attribute. Skip to next whitespace */ while(*cp && !isspace(*cp)) cp++; if(*cp) { while(isspace(*cp)) cp++; next_word = cp; } else { next_word = NULL; } } } while(next_word); XP_ListAddObject(obj->frame_group_stack, fgs); } } else if(!strncasecomp(token, END_FRAME_GROUP_TOKEN, sizeof(END_FRAME_GROUP_TOKEN)-1)) { frame_set_struct *fgs; fgs = XP_ListRemoveTopObject(obj->frame_group_stack); if(fgs) net_help_free_frame_group_struct(fgs); } } else if(!obj->in_id_mapping) { if(!strncasecomp(line, WINDOW_SIZE_TOKEN, sizeof(WINDOW_SIZE_TOKEN)-1)) { /* get window size */ char *comma=0; char *window_size = net_get_html_help_token(line+ sizeof(WINDOW_SIZE_TOKEN)-1, NULL); if(window_size) comma = XP_STRCHR(window_size, ','); if(comma) { *comma = '\0'; obj->window_width = XP_ATOI(window_size); obj->window_height = XP_ATOI(comma+1); } } else if(!strncasecomp(line, WINDOW_NAME_TOKEN, sizeof(WINDOW_NAME_TOKEN)-1)) { char *window_name = net_get_html_help_token(line+ sizeof(WINDOW_NAME_TOKEN)-1, NULL); if(window_name) { FREEIF(obj->window_name); obj->window_name = XP_STRDUP(window_name); } } else if(!strncasecomp(line, HELP_VERSION_TOKEN, sizeof(HELP_VERSION_TOKEN)-1)) { /* get window size */ char *help_version = net_get_html_help_token(line+ sizeof(HELP_VERSION_TOKEN)-1, NULL); if(help_version) { obj->helpVersion = XP_ATOI(help_version); } } } else { /* id mapping pair */ if(!strncasecomp(line, obj->id, XP_STRLEN(obj->id))) { char *id_value = net_get_html_help_token(line+XP_STRLEN(obj->id), &next_word); if(id_value) { obj->id_value = XP_STRDUP(id_value); while(next_word) { char *cp = next_word; if(!strncasecomp(cp, TARGET_TOKEN, sizeof(TARGET_TOKEN)-1)) { char *target = net_get_html_help_token( cp+sizeof(TARGET_TOKEN)-1, &next_word); cp = next_word; obj->content_target = XP_STRDUP(target); } else { /* unknown attribute. Skip to next whitespace */ while(*cp && !isspace(*cp)) cp++; if(*cp) { while(isspace(*cp)) cp++; next_word = cp; } else { next_word = NULL; } } } } return(HTML_HELP_ID_FOUND); } if(!strncasecomp(line, DEFAULT_HELP_ID, sizeof(DEFAULT_HELP_ID)-1)) { char *default_id_value = net_get_html_help_token( line+sizeof(DEFAULT_HELP_ID)-1, NULL); if(default_id_value) obj->default_id_value = XP_STRDUP(default_id_value); } } return(0); }