// internet.cpp #include "includes.h" #include "internet.h" internet::internet(void) { allOK=false; read_file=NULL; write_file=NULL; strcpy(templine,""); } int internet::isOK(void) { return (allOK); } void internet::getline(void) { if (fgets(templine,499,read_file)==NULL) strcpy(templine,"**END**"); } void internet::tidyup(int xxx) { int i,j; for (i=0, j=0; templine[i]!=0; i++) { char c=templine[i]; if (xxx==-1) { if (isupper(c)) c=tolower(c); } else if (xxx==1) { if (islower(c)) c=toupper(c); } if (iscntrl(c)) continue; templine[j]=c; j++; } templine[j]=0; } char *internet::readline(void) { if (!allOK) return (NULL); getline(); tidyup(0); return (templine); } char *internet::readlineLC(void) { if (!allOK) return (NULL); getline(); tidyup(-1); return (templine); } char *internet::readlineUC(void) { if (!allOK) return (NULL); getline(); tidyup(1); return (templine); } void internet::writeline(char *s) { if (!allOK) return; fprintf(write_file,"%s\n",s); fflush(write_file); }