void INFwfile::putKey(char *str) { putEnd(); putStr(str); putChar('='); }
void INFwfile::putComment(char *str) { putEnd(); putChar(';'); putStr(str); }
void INFwfile::putSection(char *str) { putEnd(); putChar('['); putStr(str); putChar(']'); }
int main() { char *query,*pptr; char ftphost[MAX],email[MAX],dnsname[MAX],ipstring[20],genbuf[MAX]; unsigned char addr[4]; int ret=0,ipclass=0,inlib=0; alarm(CGIALARM); query=getenv(QUERYSTRING); putHead(); strcpy(ftphost,""); if(query && *query ){ while(query && *query){ if(!strncmp(query,"ftp=",4)) { query+=4; if((pptr=strchr(query,'&'))!=NULL) *pptr='\0'; /* set the NULL at end of string */ strncpy(ftphost,query,MAX-1); *(ftphost+MAX-1)='\0'; } else if(!strncmp(query,"email=",6)) { query+=6; if((pptr=strchr(query,'&'))!=NULL) *pptr='\0'; /* set the NULL at end of string */ strncpy(email,query,MAX-1); *(email+MAX-1)='\0'; } query=strchr(query,'&'); if(query) query++; } if(strlen(ftphost)){ ret=getftpname(ftphost,dnsname,addr); if(ret>-2){ sprintf(ipstring,"%d.%d.%d.%d",addr[0],addr[1],addr[2],addr[3]); ipclass=getclass(addr); if(ipclass<=2){ /* free IP, can search */ inlib=addftp(ipstring); } if(ret<3)/* fail on getting DNS name */ strcpy(dnsname,ftphost); }else{ ipclass=4; /* out of CERNET */ strcpy(dnsname,ftphost); } showthank(dnsname,ipstring,ipclass,inlib); } } putPage(); putEnd(); /* log submit */ sprintf(genbuf,"E-Mail:%s, Submit:'%s',dns:%s,ip:%s,class:%d",email,ftphost,dnsname,ipstring,ipclass); Log(SUBMITLOGFILE,genbuf); return(0); }
static void convertPage(FILE * const ifP, int const turnflag, int const turnokflag, bool const psfilter, bool const rle, bool const flate, bool const ascii85, bool const setpage, bool const showpage, bool const center, float const scale, int const dpiX, int const dpiY, int const pagewid, int const pagehgt, int const imagewidth, int const imageheight, bool const equalpixels, char const name[], bool const dict, bool const vmreclaim, bool const levelIsGiven, bool const levelGiven) { struct pam inpam; tuple* tuplerow; unsigned int padright; /* Number of bits we must add to the right end of each Postscript output line in order to have an integral number of bytes of output. E.g. at 2 bits per sample with 10 columns, this would be 4. */ int row; unsigned int ps_maxval; /* The maxval of the Postscript program */ float scols, srows; float llx, lly; bool turned; bool color; unsigned int postscriptLevel; struct bmepsoe * bmepsoeP; pnm_readpaminit(ifP, &inpam, PAM_STRUCT_SIZE(tuple_type)); if (!STRSEQ(inpam.tuple_type, PAM_PBM_TUPLETYPE) && !STRSEQ(inpam.tuple_type, PAM_PGM_TUPLETYPE) && !STRSEQ(inpam.tuple_type, PAM_PPM_TUPLETYPE)) pm_error("Unrecognized tuple type %s. This program accepts only " "PBM, PGM, PPM, and equivalent PAM input images", inpam.tuple_type); color = STRSEQ(inpam.tuple_type, PAM_PPM_TUPLETYPE); selectPostscriptLevel(levelIsGiven, levelGiven, color, dict, flate, ascii85, &postscriptLevel); if (color) pm_message("generating color Postscript program."); computeDepth(inpam.maxval, &bitspersample, &ps_maxval); { unsigned int const realBitsPerLine = inpam.width * bitspersample; unsigned int const paddedBitsPerLine = ((realBitsPerLine + 7) / 8) * 8; padright = (paddedBitsPerLine - realBitsPerLine) / bitspersample; } /* In positioning/scaling the image, we treat the input image as if it has a density of 72 pixels per inch. */ computeImagePosition(dpiX, dpiY, inpam.width, inpam.height, turnflag, turnokflag, center, pagewid, pagehgt, scale, imagewidth, imageheight, equalpixels, &scols, &srows, &llx, &lly, &turned); putinit(postscriptLevel, name, inpam.width, inpam.height, scols, srows, llx, lly, padright, bitspersample, pagewid, pagehgt, color, turned, rle, flate, ascii85, setpage, psfilter, dict); createBmepsOutputEncoder(&bmepsoeP, stdout, rle, flate, ascii85); initNativeOutputEncoder(rle, bitspersample); tuplerow = pnm_allocpamrow(&inpam); for (row = 0; row < inpam.height; ++row) { pnm_readpamrow(&inpam, tuplerow); if (psfilter) convertRowPsFilter(&inpam, tuplerow, bmepsoeP); else convertRowNative(&inpam, tuplerow, ps_maxval, rle, padright); } pnm_freepamrow(tuplerow); if (psfilter) flushBmepsOutput(bmepsoeP); else flushNativeOutput(rle); destroyBmepsOutputEncoder(bmepsoeP); putEnd(showpage, psfilter, ascii85, dict, vmreclaim); }
void INFwfile::CloseFile() { putEnd(); DCwfile::CloseFile(); }