int shift; int save_shift; };int read_dict_file ( char *buff, FILE *f ){int b, i;*buff = 0;do {while ((b = fgetc(f)) != EOF && (b == ' '||b == '\t'||b =='\n' ||b == '\r')); if ( b == EOF ) return(0); for ( i = 0; b != EOF && b != '\n' && b != '\r'; i++ ) { buff[i] = (b == '\t') ? ' ': b; b = fgetc(f); } buff[i] = 0; } while (*buff == '#'); return(1);}void (*r_signal(sig, func, fd_socket, fd_accept)) (int)int sig;void (*func) ();int fd_socket;int fd_accept;{ struct sigaction act, oact; act.sa_handler = func; sigemptyset(&act.sa_mask); act.sa_flags = 0;#ifdef SA_RESTART act.sa_flags |= SA_RESTART;#endif if (sigaction(sig, &act, &oact) < 0) return (SIG_ERR); return (oact.sa_handler);}/* Read 'n' bytes from a descriptor */int readn(fd, ptr, nbytes)register int fd;register char *ptr;register int nbytes;{ int nleft, nread; nleft=nbytes; while(nleft > 0) { nread=read(fd,ptr,nleft); if (nread<0) return(nread); else if (nread==0) break; nleft -=nread; ptr +=nread; } return(nbytes-nleft);}/* Write 'n' bytes to a descriptor */int writen(fd, ptr, nbytes)register int fd;register char *ptr;register int nbytes;{ int nleft, nwritten; nleft=nbytes; while(nleft > 0) { nwritten=write(fd, ptr, nleft); if(nwritten <= 0) return(nwritten); nleft -= nwritten; ptr += nwritten; } return(nbytes-nleft);}char * dateTime(){ time_t t; char * s; time(&t); s = (char *)ctime((const time_t *)&t); s[24] = '\0'; return s;}void handle_SIGSEGV (void){ fprintf(stderr, "\nSegmentation Violation! [%s]\n", dateTime()); exit(1);}void handle_SIGINT (void){ fprintf(stderr, "\nSignal Interrupt! [%s]\n", dateTime()); exit(1);}void sendln(int s, char buf[1024]) { writen(s, buf, strlen(buf), 0);}int readln(int s){ int i,done=0,w, result; char tmp[1]; struct timeval timeout; fd_set inputs; sprintf(line,""); i = 0; while (!done) { FD_ZERO(&inputs); FD_SET(s, &inputs); timeout.tv_sec = socket_timeout; timeout.tv_usec = 0; result = select(FD_SETSIZE, &inputs,(fd_set *)0, (fd_set *)0,&timeout); switch(result) { case 0: printf("\n\nSocket Timeout\n"); exit(1); break; case -1: perror("select"); exit(1); break; default: w=readn(s ,tmp, 1); break; } if (w==0) return 0; if (tmp[0] != 0) { line[i] = tmp[0]; } if (line[i] == '\n') { done = 1; } i++; } line[i] = 0; return (i);}/* Code to call out on a socket */int call_socket(hostname, portnum)char *hostname;u_short portnum;{ struct sockaddr_in sa; struct hostent *hp; int a, s, foo=1; if ((hp= gethostbyname(hostname)) == NULL) { /* do we know the host's */ errno= ECONNREFUSED; /* address? */ return(-1); /* no */ } bzero(&sa,sizeof(sa)); bcopy(hp->h_addr,(char *)&sa.sin_addr,hp->h_length); /* set address */ sa.sin_family= hp->h_addrtype; sa.sin_port= htons((u_short)portnum); if ((s= socket(hp->h_addrtype,SOCK_STREAM,0)) < 0) /* get socket */ return(-1);#ifdef SOCKET_OPTS /* set socket options so we can try multiple connects */if(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&foo,sizeof(foo))==-1) {fprintf(stderr, "Error setting SO_REUSEADDR socket option in call_socket!\n"); fflush((FILE *)stderr); exit(1); }#endif if (connect(s,(struct sockaddr *)&sa,sizeof sa) < 0) { /* connect */ perror("connect failed"); exit(1); } return(s);}int base64_encode(int quit, struct BASE64_PARAMS *e_p,char *string_to_encode){ int index; unsigned long int value; unsigned char blivit; int z=0; index = 0; while ( ( *(string_to_encode+z) ) || (e_p->shift != 0) ) { if ( ( *(string_to_encode+z) ) && ( quit == 0 ) ) { blivit = *(string_to_encode +z); z++; if ( *(string_to_encode+z)==0 ) { quit = 1; e_p->save_shift = e_p->shift; blivit = 0; } } else { quit = 1; e_p->save_shift = e_p->shift; blivit = 0; } if ( (quit == 0) || (e_p->shift !=