#include #include #include #include #include #include #include #ifdef __cplusplus atlStatus::atlStatus(void){ status=0; strcpy(currlink,"currlink_nDef"); strcpy(lastlink,"lastlink_nDef"); strcpy(email,"email_nDef"); } atlStatus::~atlStatus(void){ } inline void atlStatus::reset(void){ atlStatus(); } inline int atlStatus::isDefined(void){ return(status==3?1:0); } int atlStatus::writeToStream(FILE*f){ return(fprintf(f,"%s %s %s ",currlink,lastlink,email)); } int atlStatus::analyze(const char*orig_buf){ char*buf; buf=discolorcopy(orig_buf); if(buf==NULL){ #if DEBUG fprintf(stderr,"atlStatus::analyze() ERROR: discolorcopy() returns NULL.\n"); #endif return(-1); } switch(status){ case 0: if(strstr(buf,ATL_CURRLINK_STR)!=NULL){ sscanf(strendstr(buf,ATL_CURRLINK_STR)+1,"%s",currlink); currlink[ATL_CURRLINK_STRSIZE]='\0'; status++; } break; case 1: if(strstr(buf,ATL_LASTLINK_STR)!=NULL){ sscanf(strendstr(buf,ATL_LASTLINK_STR)+1,"%s",lastlink); lastlink[ATL_LASTLINK_STRSIZE]='\0'; status++; } break; case 2: if(strstr(buf,ATL_EMAIL_STR)!=NULL){ sscanf(strendstr(buf,ATL_EMAIL_STR)+1,"%s",email); email[ATL_EMAIL_STRSIZE]='\0'; status++; } break; case 3: break; default: #if DEBUG fprintf(stderr,"atlStatus::analyze() WARNING: Bad status value (%d) changed to initial.\n",status); #endif status=0; break; } if(buf!=NULL)free(buf); return(isDefined()); } #endif /* #ifdef __cplusplus */