--- ceptd/config.h.orig Wed Jul 27 10:28:38 1994 +++ ceptd/config.h Sun Sep 1 12:37:09 1996 @@ -49,7 +49,7 @@ #undef NO_STRERROR /* define NO_STRERROR if you don't have strerror func. */ #define HASTERMIOS /* define HASTERMIOS if system has termios.h */ -#undef ASCIIPID /* define if your system writes pid in ascii to +#define ASCIIPID /* define if your system writes pid in ascii to uucp-lock */ #endif /* __bsdi__ */ --- ceptd/Makefile.orig Wed Jun 15 17:10:59 1994 +++ ceptd/Makefile Sun Sep 1 14:17:11 1996 @@ -1,21 +1,30 @@ # directories: OWNER= root -GROUP= sys -EXECMODE= 6750 +GROUP= bin +EXECMODE= 0750 +MANMODE= 0644 -BINDIR= /usr/local/bin# directory for the executable ceptd -MANDIR= /usr/local/man/manl# directory for the ceptds manpage +BINDIR= /usr/local/libexec# directory for the executable ceptd +MANDIR= /usr/local/man/man8# directory for the ceptds manpage ETCDIR= /usr/local/etc# directory for 'init file' and 'users file' # defaults for the ceptd : -DEFAULTINITFILENAME= $(ETCDIR)/init.cept# modems default init file -DEFAULTUSERSFILENAME= $(ETCDIR)/users.cept# file with allowed users -DEFAULTLOGFILENAME= /tmp/log.cept# logfile for user online times +DEFAULTINITFILENAME= $(ETCDIR)/cept.init# modems default init file +DEFAULTUSERSFILENAME= $(ETCDIR)/cept.users# file with allowed users +DEFAULTLOGFILENAME= /var/log/log.cept# logfile for user online times DEFAULTMODEM= /dev/modem# char. special file for modem DEFAULTSPEED= 2400# modem baud rate DEFAULTSOCKETPORT= 20005# socket port for connections -LOCKDIR= /var/spool/locks# lock dir for uucp-locks +LOCKDIR= /var/spool/lock# lock dir for uucp-locks + +.ifdef NOMANCOMPRESS +MANPAGE= ceptd.8 +MANCOMPRESS= cat +.else +MANPAGE= ceptd.8.gz +MANCOMPRESS= gzip -c -9 +.endif # define these flags in $(DEFS): @@ -54,86 +63,49 @@ -DDEFAULTINITFILENAME=\"$(DEFAULTINITFILENAME)\"\ -DDEFAULTUSERSFILENAME=\"$(DEFAULTUSERSFILENAME)\"\ -DDEFAULTLOGFILENAME=\"$(DEFAULTLOGFILENAME)\"\ - -DSVR4 + -DBSD # -DISDN\ # the GNU C-compiler: -CC = gcc -CCOPTS = -O -CCFLAGS = -Wswitch -Wcomment -Wshadow -Wpointer-arith -Wcast-qual\ - -Wtrigraphs# -Wunused +#CC = gcc +#CCOPTS = -O +#CCFLAGS = -Wswitch -Wcomment -Wshadow -Wpointer-arith -Wcast-qual\ +# -Wtrigraphs# -Wunused # ... the lex is ... -LEX = flex +#LEX =flex ############################################################################## -all: ceptd ceptd.8 +all: ceptd ${MANPAGE} OBJS = ceptd.o level2.o modeminit.o socket.o term.o lex.yy.o isdn.o SRC = ceptd.c level2.c modeminit.c socket.c term.c lex.yy.c isdn.c INC = config.h cept.h ../xcept/protocol.h -.c.o: makefile config.h cept.h ../xcept/protocol.h - @echo - @echo '########################## $@ ########################' - $(CC) -c $(CCOPTS) $(CCFLAGS) $(DEFS) $*.c +.c.o: config.h cept.h ../xcept/protocol.h + $(CC) -c $(CFLAGS) $(DEFS) $*.c lex.yy.c: lex_yy - @echo - @echo '########################## $@ ########################' $(LEX) -s -i -p lex_yy ceptd: $(OBJS) - @echo - @echo '########################## $@ ########################' - $(CC) $(OBJS) -L. -o ceptd -lnsl -lsocket - @echo "$@ finished" - -install: ceptd ceptd.8 - @echo - @echo '########################## $@ #################################' - strip ceptd - mv ceptd $(BINDIR) - chown $(OWNER) $(BINDIR)/ceptd - chgrp $(GROUP) $(BINDIR)/ceptd - chmod $(EXECMODE) $(BINDIR)/ceptd - mv ceptd.8 $(MANDIR) - chown $(OWNER) $(MANDIR)/ceptd.8 - chgrp $(GROUP) $(MANDIR)/ceptd.8 - chmod 644 $(MANDIR)/ceptd.8 - @echo - @echo '**************************************************************' - @echo '**************************************************************' - @echo "------>>> Now do the following steps:" - @echo - @echo '1)' add the following line to your /etc/inetd.conf file: - @echo " cept stream tcp nowait $(OWNER)"\ - $(BINDIR)/ceptd ceptd - @echo - @echo '2)' add the following line to your /etc/services file: - @echo " cept $(DEFAULTSOCKETPORT)/tcp ceptd" - @echo - @echo '3)' copy the ../etc/users.cept file to $(DEFAULTUSERSFILENAME)\ - and edit it. - @echo - @echo '4)' copy the ../etc/init.cept file to $(DEFAULTINITFILENAME)\ - and edit it. - @echo - @echo '5)' read the ceptd manual. - @echo '***************************************************************' - @echo '***************************************************************' + $(CC) $(OBJS) -L. -o ceptd + +install: ceptd ${MANPAGE} + ${INSTALL} -c -o ${OWNER} -g ${GROUP} -m ${EXECMODE} ceptd ${BINDIR}/ceptd + ${INSTALL} -c -o ${OWNER} -g ${GROUP} -m ${MANMODE} ${MANPAGE} ${MANDIR}/${MANPAGE} -ceptd.8: ceptd.8.template +${MANPAGE}: ceptd.8.template sed -e 's|--- The permissions file.|$(DEFAULTUSERSFILENAME)|g'\ -e 's|--- The initalization file.|$(DEFAULTINITFILENAME)|g'\ -e 's|--- The log file.|$(DEFAULTLOGFILENAME)|g'\ - ceptd.8.template > ceptd.8 + ceptd.8.template | ${MANCOMPRESS} > ${MANPAGE} clean: - rm -f ceptd.8 *.o TAGS ceptd + rm -f ${MANPAGE} *.o TAGS ceptd veryclean: rm -f ceptd.8 *.o TAGS ceptd lex.yy.c *.zoo --- ceptd/ceptd.8.template.orig Wed May 25 19:36:11 1994 +++ ceptd/ceptd.8.template Sun Sep 1 15:33:16 1996 @@ -17,8 +17,8 @@ .I ceptd can be started from the \fIinetd\fR. If not started from inetd, \fIceptd\fR will deal with connection request forking on connects. -If the standard input of ceptd -is not a tty, ceptd assumes being started from inetd. +If standard input and output of ceptd +are sockets, ceptd assumes being started from inetd. .PP .I Available options: .PP --- ceptd/ceptd.c.orig Wed May 25 19:36:11 1994 +++ ceptd/ceptd.c Mon Sep 1 16:38:21 2003 @@ -67,12 +67,12 @@ static int endtime(); static void exit_btx_server(); /* signal routine for parent */ static pid_t childpid = -1; /* pid of child process */ -static int modem = -1, inetd = 0; +static int modem = -1; int debug =0; static char *userlogfilename = DEFAULTLOGFILENAME; static int connected; static char *caller; -int connectstatus, isdnflag = 0; +int connectstatus, isdnflag = 0, inetd = 0; main(argc,argv) int argc;char *argv[]; @@ -108,7 +108,7 @@ } if(!(initfile = fopen(initfilename,"r"))){ - log(LOG_CRIT,"Unable to open file '%s': %m - exiting !",initfilename); + mylog(LOG_CRIT,"Unable to open file '%s': %m - exiting !",initfilename); if(inetd) info("Unable to open file '%s':\n%m - exiting !",initfilename); usage(argv[0]); } @@ -116,7 +116,7 @@ usersfile=0; } else { if(!(usersfile = fopen(usersfilename,"r"))){ - log(LOG_CRIT,"Unable to open file '%s': %m - exiting !", + mylog(LOG_CRIT,"Unable to open file '%s': %m - exiting !", usersfilename); if(inetd) info("Unable to open file '%s':\n%m - exiting !", usersfilename); @@ -128,7 +128,7 @@ if(userlogfilename){ if(-1 == (userlog = open(userlogfilename,O_WRONLY | O_APPEND | O_CREAT,0666))){ - log(LOG_CRIT,"Unable to open file '%s': %m - exiting !", + mylog(LOG_CRIT,"Unable to open file '%s': %m - exiting !", userlogfilename); if(inetd) info("Unable to open file '%s':\n%m - exiting !",userlogfilename); @@ -149,21 +149,21 @@ char *name; { if(inetd) info("Your server is wrong installed !"); - log(LOG_INFO,"\n*** %s Version %s ***\n",name,XCEPTVERSION); - log(LOG_INFO, + mylog(LOG_INFO,"\n*** %s Version %s ***\n",name,XCEPTVERSION); + mylog(LOG_INFO, "Usage: %s [-p port] [-d] [-f filename] [-s filename] [-u filename]", name); - log(LOG_INFO,"\n-d \t\t\tadditional debug output"); - log(LOG_INFO,"-p port\t\t\tuse port number 'port'"); - log(LOG_INFO,"-f filename\t\tuse init filename 'filename'"); - log(LOG_INFO,"-s filename\t\tuse users filename 'filename'"); - log(LOG_INFO,"-u filename\t\tuse filename 'filename' to log clients"); - log(LOG_INFO,"\nDefaults:\nusers filename:\t %s", + mylog(LOG_INFO,"\n-d \t\t\tadditional debug output"); + mylog(LOG_INFO,"-p port\t\t\tuse port number 'port'"); + mylog(LOG_INFO,"-f filename\t\tuse init filename 'filename'"); + mylog(LOG_INFO,"-s filename\t\tuse users filename 'filename'"); + mylog(LOG_INFO,"-u filename\t\tuse filename 'filename' to log clients"); + mylog(LOG_INFO,"\nDefaults:\nusers filename:\t %s", DEFAULTUSERSFILENAME ? DEFAULTUSERSFILENAME : "-- No permission check ! --"); - log(LOG_INFO,"init filename:\t %s\nport:\t\t %d", + mylog(LOG_INFO,"init filename:\t %s\nport:\t\t %d", DEFAULTINITFILENAME,DEFAULTSOCKETPORT); - log(LOG_INFO,"log filename:\t %s", + mylog(LOG_INFO,"log filename:\t %s", DEFAULTLOGFILENAME ? DEFAULTLOGFILENAME : "-- Not defined ! --"); exit(1); } @@ -171,11 +171,11 @@ static void exit_btx_server() { - log(LOG_DEBUG,"Kill child..."); + mylog(LOG_DEBUG,"Kill child..."); if(childpid != -1) kill(childpid,SIGTERM); - log(LOG_DEBUG,"shutdown socket..."); - if (-1 == socketbye()) log(LOG_ERR,"Shutdown socket: %m"); - log(LOG_INFO,"Exiting"); + mylog(LOG_DEBUG,"shutdown socket..."); + if (-1 == socketbye()) mylog(LOG_ERR,"Shutdown socket: %m"); + mylog(LOG_INFO,"Exiting"); _exit(0); } @@ -210,7 +210,7 @@ extern int sockfd; if(-1 == createsocket(port)) { - log(LOG_ERR,"Create socket: %m"); + mylog(LOG_ERR,"Create socket: %m"); exit(1); } signal(SIGINT, exit_btx_server); @@ -220,12 +220,8 @@ #else { struct sigaction act; + memset(&act, 0, sizeof act); act.sa_handler = hang_childs; - act.sa_mask.sa_sigbits[0] = 0; - act.sa_mask.sa_sigbits[1] = 0; - act.sa_mask.sa_sigbits[2] = 0; - act.sa_mask.sa_sigbits[3] = 0; - act.sa_flags =0; sigaction(SIGCHLD, &act, NULL); /* POSIX */ } #endif @@ -233,10 +229,10 @@ for(;;){ if(-1 == (sockfd = getclient())){ /* wait for new client */ if(errno == EINTR) continue; - log(LOG_ERR,"Accept socket: %m"); + mylog(LOG_ERR,"Accept socket: %m"); exit_btx_server(); } - log(LOG_DEBUG,"Client accepted "); + mylog(LOG_DEBUG,"Client accepted "); childpid = -1; switch (childpid = fork()) { case 0: @@ -244,7 +240,7 @@ signal(SIGTERM, SIG_DFL); dobtx(initfile,usersfile,sockfd); /* never returns (child) */ case -1: - log(LOG_CRIT,"Fork failed: %m"); + mylog(LOG_CRIT,"Fork failed: %m"); break; /* default: waitchild(); @@ -264,9 +260,9 @@ int sig,code; { if(!sig) - log(LOG_DEBUG,"Disconnect pid: %d",getpid()); + mylog(LOG_DEBUG,"Disconnect pid: %d",getpid()); else - log(LOG_DEBUG,"Disconnect pid: %d signal: %d code: %d", + mylog(LOG_DEBUG,"Disconnect pid: %d signal: %d code: %d", getpid(),sig,code); /* ignore 2nd signal when modem gets closed (SIGHUP) */ @@ -298,12 +294,12 @@ FILE *initfile, *usersfile; int sockfd; { if(-1 == checksecurity(usersfile,sockfd,&caller)){ - log(LOG_NOTICE,"%s: - no permission -",caller); + mylog(LOG_NOTICE,"%s: - no permission -",caller); status(NOPERMISSION); /* info("%s:\n- no permission -",caller); */ exit(1); } else { - log(LOG_DEBUG,"%s - accepted",caller); + mylog(LOG_DEBUG,"%s - accepted",caller); } starttime(); signal(SIGPIPE, disconnect); @@ -374,7 +370,7 @@ if(-1 == (userlog = open(userlogfilename,O_WRONLY | O_APPEND | O_CREAT/* | O_EXLOCK */))){ - log(LOG_CRIT,"Unable to open file '%s': %m - exiting !",userlogfilename); + mylog(LOG_CRIT,"Unable to open file '%s': %m - exiting !",userlogfilename); info("Unable to open file '%s':\n%m - exiting !",userlogfilename); return -1; } @@ -432,7 +428,7 @@ } } -log(priority,fmt,a,b,c,d,e,f,g,h,i,j) +mylog(priority,fmt,a,b,c,d,e,f,g,h,i,j) int priority,a,b,c,d,e,f,g,h,i,j; char *fmt; { --- ceptd/modeminit.c.orig Wed May 25 19:36:12 1994 +++ ceptd/modeminit.c Sat Sep 6 22:04:39 2003 @@ -82,6 +82,7 @@ extern int errno; extern int connectstatus, isdnflag; +extern int inetd; #ifdef USE_LOCK #include @@ -112,12 +113,12 @@ modem = -1; isdnflag = 0; if( -1 == dial_btx(initfile) ) { - log(LOG_DEBUG,"Dial failed"); + mylog(LOG_DEBUG,"Dial failed"); return -1; } if(isdnflag) return modem; if(modem == -1) { - log(LOG_NOTICE,"No device !"); + mylog(LOG_NOTICE,"No device !"); info("No device !"); return -1; } @@ -134,14 +135,15 @@ */ modemclose() { - (void) setsid (); /* give up controling terminal modem */ + if (!inetd) + (void) setsid (); /* give up controling terminal modem */ if(modem != -1){ sendmodem(hangupstring); termflush(modem); /* get rid of garbage */ /* ioctl(modem, TIOCCDTR, 0); */ /* clear DTR */ termset(modem,&oldpar); if(-1 == close(modem)) - log(LOG_NOTICE,"Unable to close device %s : %m",devicename); + mylog(LOG_NOTICE,"Unable to close device %s : %m",devicename); modem = -1; } #ifdef USE_LOCK @@ -163,8 +165,8 @@ #endif int s; - if(-1 == setsid()) - log(LOG_ERR,"Can't setsid : %m"); + if(!inetd && -1 == setsid()) + mylog(LOG_ERR,"Can't setsid : %m"); #ifdef USE_LOCK device = strrchr(devname, '/'); device++; @@ -172,7 +174,7 @@ { struct stat dstat; if(stat(devname,&dstat) != 0) { - log(LOG_INFO, "Stat %s failed", device); + mylog(LOG_INFO, "Stat %s failed", device); status(OPENFAIL); goto error; } @@ -186,13 +188,13 @@ strcat(lock,"/LCK.."); strcat(lock,device); # endif /* SVR4 */ - log(LOG_DEBUG,"lock: %s\n",lock); + mylog(LOG_DEBUG,"lock: %s\n",lock); if (checklock(lock) == TRUE) { - log(LOG_INFO, "Open %s failed --- already locked", device); + mylog(LOG_INFO, "Open %s failed --- already locked", device); status(OPENFAIL); goto error; } else if (makelock(lock) == FAIL) { - log(LOG_INFO, "Locking %s failed: %m", device); + mylog(LOG_INFO, "Locking %s failed: %m", device); status(OPENFAIL); goto error; } @@ -200,7 +202,7 @@ if( -1 == (modem = open(devname,/* O_EXCL |*/ O_RDWR | O_NDELAY))){ - log(LOG_INFO,"Open %s failed: %m",devname); + mylog(LOG_INFO,"Open %s failed: %m",devname); goto error; } @@ -223,7 +225,7 @@ /* showlamps(modem); */ return modem; error: - log(LOG_INFO,"Initalize modem (%s) failed : %m",devname); + mylog(LOG_INFO,"Initalize modem (%s) failed : %m",devname); status(OPENFAIL); /* info("Modem: (%s) :\n%m",devname); */ return -1; @@ -239,7 +241,7 @@ if(-1 == termset(fd,&newpar)) goto error; return 1; error: - log(LOG_INFO,"set line (cflags) failed : %m"); + mylog(LOG_INFO,"set line (cflags) failed : %m"); status(OPENFAIL); return -1; } @@ -254,7 +256,7 @@ if(-1 == termset(fd,&newpar)) goto error; return 1; error: - log(LOG_INFO,"set line (cflags) failed : %m"); + mylog(LOG_INFO,"set line (cflags) failed : %m"); status(OPENFAIL); return -1; } @@ -273,7 +275,7 @@ yyin = initfile; rewind(yyin); if(line = dolex()){ - log(LOG_INFO,"Initfile line %d",line); + mylog(LOG_INFO,"Initfile line %d",line); return -1; } } @@ -282,7 +284,7 @@ sethangupstring(str) char *str; { - log(LOG_DEBUG,"hangup: %s",str); + mylog(LOG_DEBUG,"hangup: %s",str); strncpy(hangupstring,str,MIMAXCHARS); changestring(hangupstring); @@ -292,7 +294,7 @@ setnocarrierstring(str) char *str; { - log(LOG_DEBUG,"nocarrier: %s",str); + mylog(LOG_DEBUG,"nocarrier: %s",str); strncpy(nocarrierstring,str,MIMAXCHARS); changestring(nocarrierstring); @@ -301,7 +303,7 @@ setconnectstring(str) char *str; { - log(LOG_DEBUG,"connect: %s",str); + mylog(LOG_DEBUG,"connect: %s",str); strncpy(connectstring,str,MIMAXCHARS); changestring(connectstring); @@ -310,7 +312,7 @@ setbusystring(str) char *str; { - log(LOG_DEBUG,"busy: %s",str); + mylog(LOG_DEBUG,"busy: %s",str); strncpy(busystring,str,MIMAXCHARS); changestring(busystring); @@ -319,7 +321,7 @@ setnodialtonestring(str) char *str; { - log(LOG_DEBUG,"nodialtone: %s",str); + mylog(LOG_DEBUG,"nodialtone: %s",str); strncpy(nodialtonestring,str,MIMAXCHARS); changestring(nodialtonestring); @@ -328,10 +330,10 @@ int setbaud(baud) /* setbaud with real baud rate (as int) */ int baud; { - log(LOG_DEBUG,"Baud: %d",baud); + mylog(LOG_DEBUG,"Baud: %d",baud); speed = baud; if(-1 != setspeed(modem,speed)) return 0; - log(LOG_NOTICE,"Set baud rate (%s) %m",devicename); + mylog(LOG_NOTICE,"Set baud rate (%s) %m",devicename); return -1; } @@ -349,14 +351,14 @@ char *str; { changestring(str); - log(LOG_DEBUG,"Send: %s",str); + mylog(LOG_DEBUG,"Send: %s",str); return sendmodem(str); } wsleep(waittime) int waittime; { - log(LOG_DEBUG,"Sleep: %d.%d sec",waittime/10,waittime%10); + mylog(LOG_DEBUG,"Sleep: %d.%d sec",waittime/10,waittime%10); #if defined(SCO) || defined(SVR4) sleep(waittime/10); #else @@ -369,13 +371,13 @@ { isdnflag=1; # ifdef ISDN - log(LOG_DEBUG,"%s %s",device,port); + mylog(LOG_DEBUG,"%s %s",device,port); changestring(port); changestring(device); modem = openisdn(device,port); return modem; # else - log(LOG_ERR,"ISDN not configured in this server (%s) !\n",port); + mylog(LOG_ERR,"ISDN not configured in this server (%s) !\n",port); return -1; # endif } @@ -392,7 +394,7 @@ int pos =0, len[NSTRINGS], maxlen = 0; register int k,j,i; - log(LOG_DEBUG,"Waitconnect: wait %2ds for connection",tmout); + mylog(LOG_DEBUG,"Waitconnect: wait %2ds for connection",tmout); str[0]=nocarrierstring; str[1]=busystring; @@ -410,7 +412,7 @@ for(pos=0;;){ if(readmodem(s+pos,1) <1){ alarm(0); - log(LOG_ERR,"Wait: Error: %m "); + mylog(LOG_ERR,"Wait: Error: %m "); return -1; } for(j=0; j> 7 ] ]; if( set == SUPP && (c1 & 0x70) == 0x40 ) { /* diacritical ??? */ - log("diacritical mark %d\n", c1 & 0x0f); + mylog("diacritical mark %d\n", c1 & 0x0f); c2 = layer2getc(); if(c2&0x60) c1 = (c1<<8) | c2; t.sshift = 0; } - log("OUTPUT 0x%02x '%c'\n", c1&0xff, isprint(c1&0xff) ? c1&0xff : '.'); + mylog("OUTPUT 0x%02x '%c'\n", c1&0xff, isprint(c1&0xff) ? c1&0xff : '.'); output(c1); t.lastchar = c1; } @@ -161,7 +161,7 @@ reachedEOF = 1; } if(c <= MAXPROTOCOLSEQ) serverstatus(c); - log("\nXCEPTD STATUS CODE: %d\n\n", c); + mylog("\nXCEPTD STATUS CODE: %d\n\n", c); if(!reachedEOF && (status = read1(server_infd, &c, 1)) <= 0) { if(status < 0) xbtxerror(1, "layer2getc()"); @@ -174,7 +174,7 @@ if(reachedEOF) c = US; - log("(%c %03x %2d/%2d %2x/%2x) (0x%02x) ", t.serialmode ? 'S' : 'P', + mylog("(%c %03x %2d/%2d %2x/%2x) (0x%02x) ", t.serialmode ? 'S' : 'P', t.serialmode ? screen[t.cursory-1][t.cursorx-1].attr : t.par_attr, t.cursory, t.cursorx, t.serialmode ? screen[t.cursory-1][t.cursorx-1].fg : t.par_fg, @@ -190,7 +190,7 @@ layer2ungetc() { read1(0, NULL, -1); - log("<-- character pushed back\n"); + mylog("<-- character pushed back\n"); } @@ -301,46 +301,46 @@ switch(c1) { case APB: - log("APB active position back\n"); + mylog("APB active position back\n"); move_cursor(APB); break; case APF: - log("APF active position forward\n"); + mylog("APF active position forward\n"); move_cursor(APF); break; case APD: - log("APD active position down\n"); + mylog("APD active position down\n"); move_cursor(APD); break; case APU: - log("APU active position up\n"); + mylog("APU active position up\n"); move_cursor(APU); break; case CS: - log("CS clear screen\n"); + mylog("CS clear screen\n"); t.leftright[0] = t.save_left; clearscreen(); break; case APR: - log("APR active position return\n"); + mylog("APR active position return\n"); move_cursor(APR); break; case LS1: case LS0: c2 = (c1==LS1) ? 1 : 0; - log("LS%d locking shift G%d left\n", c2, c2); + mylog("LS%d locking shift G%d left\n", c2, c2); t.leftright[0] = c2; /* G0 or G1 !! */ t.save_left = c2; break; case CON: - log("CON cursor on\n"); + mylog("CON cursor on\n"); if(!t.cursor_on) { t.cursor_on = 1; xcursor(t.cursorx-1, t.cursory-1); @@ -348,14 +348,14 @@ break; case RPT: - log("RPT repeat last char\n"); + mylog("RPT repeat last char\n"); c2 = layer2getc() & 0x3f; - log(" %d times\n", c2); + mylog(" %d times\n", c2); while(c2--) output(t.lastchar); break; case COF: - log("COF cursor off\n"); + mylog("COF cursor off\n"); if(t.cursor_on) { t.cursor_on = 0; xcursor(t.cursorx-1, t.cursory-1); @@ -363,7 +363,7 @@ break; case CAN: - log("CAN cancel\n"); + mylog("CAN cancel\n"); y = t.cursory-1; screen[y][t.cursorx-1].chr = ' '; screen[y][t.cursorx-1].set = PRIM; @@ -379,22 +379,22 @@ break; case SS2: - log("SS2 single shift G2 left\n"); + mylog("SS2 single shift G2 left\n"); t.sshift = G2; break; case ESC: - log("ESC escape sequence\n"); + mylog("ESC escape sequence\n"); do_ESC(); break; case SS3: - log("SS3 single shift G3 left\n"); + mylog("SS3 single shift G3 left\n"); t.sshift = G3; break; case APH: - log("APH active position home\n"); + mylog("APH active position home\n"); move_cursor(APA, 1, 1); t.par_attr = 0; t.par_fg = WHITE; @@ -402,12 +402,12 @@ break; case US: - log("US unit separator (or APA)\n"); + mylog("US unit separator (or APA)\n"); do_US(); break; default: - log("??? unprocessed control character 0x%02x - ignored\n", c1); + mylog("??? unprocessed control character 0x%02x - ignored\n", c1); if(c1 == DCT) return 1; } @@ -436,7 +436,7 @@ case 0x85: /* ANM MGF */ case 0x86: /* ANC CNF */ case 0x87: /* ANW WHF */ - log("set foreground to color #%d %s\n", t.clut*8+c1-0x80, + mylog("set foreground to color #%d %s\n", t.clut*8+c1-0x80, (mode==1) ? "(+ unload L set)" : ""); set_attr(ATTR_FOREGROUND, 1, t.clut*8+c1-0x80, mode); if(mode==1) { @@ -445,42 +445,42 @@ break; case FSH: - log("FSH flashing begin\n"); + mylog("FSH flashing begin\n"); /* set_attr(ATTR_FLASH, 1, 0, mode); */ break; case STD: - log("STD flashing steady\n"); + mylog("STD flashing steady\n"); /* set_attr(ATTR_FLASH, 0, 0, mode); */ break; case EBX: - log("EBX end of window\n"); + mylog("EBX end of window\n"); /* set_attr(ATTR_WINDOW, 0, 0, mode); */ break; case SBX: - log("SBX start of window\n"); + mylog("SBX start of window\n"); /* set_attr(ATTR_WINDOW, 1, 0, mode); */ break; case NSZ: - log("NSZ normal size\n"); + mylog("NSZ normal size\n"); set_attr(ATTR_NODOUBLE, 1, 0, mode); break; case DBH: - log("DBH double height\n"); + mylog("DBH double height\n"); set_attr(ATTR_YDOUBLE, 1, 0, mode); break; case DBW: - log("DBW double width\n"); + mylog("DBW double width\n"); set_attr(ATTR_XDOUBLE, 1, 0, mode); break; case DBS: - log("DBS double size\n"); + mylog("DBS double size\n"); set_attr(ATTR_XYDOUBLE, 1, 0, mode); break; @@ -494,7 +494,7 @@ case 0x96: /* MSC CNB */ case 0x97: /* MSW WHB */ /* at fullrow control the parallel set is used ! */ - log("set %s to color #%d\n", (mode==1) ? + mylog("set %s to color #%d\n", (mode==1) ? "mosaic foreground (+ invoke L set)" : "background", t.clut*8+c1-0x90); if(mode==1) { @@ -506,62 +506,62 @@ break; case CDY: - log("CDY conceal display\n"); + mylog("CDY conceal display\n"); set_attr(ATTR_CONCEALED, 1, 0, mode); break; case SPL: - log("SPL stop lining\n"); + mylog("SPL stop lining\n"); set_attr(ATTR_UNDERLINE, 0, 0, mode); break; case STL: - log("STL start lining\n"); + mylog("STL start lining\n"); set_attr(ATTR_UNDERLINE, 1, 0, mode); break; case CSI: - log("CSI control sequence introducer\n"); + mylog("CSI control sequence introducer\n"); adv = do_CSI(); break; case 0x9c: if(mode==1) { - log("BBD black background\n"); + mylog("BBD black background\n"); set_attr(ATTR_BACKGROUND, 1, t.clut*8+BLACK, 1); } else { - log("NPO normal polarity\n"); + mylog("NPO normal polarity\n"); set_attr(ATTR_INVERTED, 0, 0, mode); } break; case 0x9d: if(mode==1) { - log("NBD new background\n"); + mylog("NBD new background\n"); set_attr(ATTR_BACKGROUND, 1, screen[t.cursory-1][t.cursorx-1].fg, 1); } else { - log("IPO inverted polarity\n"); + mylog("IPO inverted polarity\n"); set_attr(ATTR_INVERTED, 1, 0, mode); } break; case 0x9e: if(mode==1) { - log("HMS hold mosaic\n"); + mylog("HMS hold mosaic\n"); t.hold_mosaic = 1; } else { - log("TRB transparent background\n"); + mylog("TRB transparent background\n"); set_attr(ATTR_BACKGROUND, 1, TRANSPARENT, mode); } break; case 0x9f: if(mode==1) { - log("RMS release mosaic\n"); + mylog("RMS release mosaic\n"); t.hold_mosaic = 0; } else { - log("STC stop conceal\n"); + mylog("STC stop conceal\n"); set_attr(ATTR_CONCEALED, 0, 0, mode); } break; @@ -591,55 +591,55 @@ switch(c2) { case 0x20: /* annex 7.3 */ - log(" TFI Terminal Facility Identifier\n"); + mylog(" TFI Terminal Facility Identifier\n"); c3 = layer2getc(); if(c3==0x40) { - log(" TFI request\n"); + mylog(" TFI request\n"); write(server_outfd, TFI_string, 6); } else { - log(" TFI echo 0x%02x\n", c3); + mylog(" TFI echo 0x%02x\n", c3); do { c3 = layer2getc(); - log(" TFI echo 0x%02x\n", c3); + mylog(" TFI echo 0x%02x\n", c3); } while(c3 & 0x20); /* extension bit */ } break; case 0x23: - log(" define DRCS\n"); + mylog(" define DRCS\n"); do_DRCS(); break; case 0x26: - log(" define color\n"); + mylog(" define color\n"); do_DEFCOLOR(); break; case 0x2d: /* page 155 */ - log(" define Format\n"); + mylog(" define Format\n"); do_DEFFORMAT(); break; case 0x2f: /* page 157 */ - log(" Reset sequence\n"); + mylog(" Reset sequence\n"); do_RESET(); alphamosaic = 1; break; case 0x3e: /* annex 7.4 */ - log(" Telesoftware\n"); + mylog(" Telesoftware\n"); do_TSW(); break; default: /* APA active position addressing */ - if(c2<0x40) log(" unknown US sequence\n"); + if(c2<0x40) mylog(" unknown US sequence\n"); else { alphamosaic = 1; - log(" new row %2d\n", c2 & 0x3f); + mylog(" new row %2d\n", c2 & 0x3f); c3 = layer2getc(); - log(" new column %2d\n", c3 & 0x3f); + mylog(" new column %2d\n", c3 & 0x3f); move_cursor(APA, c2 & 0x3f, c3 & 0x3f); t.par_attr = 0; t.par_fg = WHITE; @@ -654,8 +654,8 @@ * other VPDE's has to be skipped (*17420101711a#). */ if(!alphamosaic) { - while( (c2 = layer2getc()) != US ) log("skipping to next US\n"); - log("\n"); + while( (c2 = layer2getc()) != US ) mylog("skipping to next US\n"); + mylog("\n"); layer2ungetc(); } } @@ -670,9 +670,9 @@ switch(c2) { case 0x22: - log(" invoke C1\n"); + mylog(" invoke C1\n"); c3 = layer2getc(); - log(" (%s)\n", c3==0x40 ? "serial" : "parallel"); + mylog(" (%s)\n", c3==0x40 ? "serial" : "parallel"); if(c3==0x40) t.serialmode = 1; else { t.serialmode = 0; @@ -681,22 +681,22 @@ break; case 0x23: - log(" set attributes\n"); + mylog(" set attributes\n"); c3 = layer2getc(); switch(c3) { case 0x20: - log(" full screen background\n"); + mylog(" full screen background\n"); c4 = layer2getc(); - log(" color = %d\n", + mylog(" color = %d\n", c4==0x5e ? TRANSPARENT : t.clut*8+c4-0x50); for(y=0; y<24; y++) define_fullrow_bg(y, c4==0x5e ? TRANSPARENT : t.clut*8+c4-0x50); break; case 0x21: - log(" full row\n"); + mylog(" full row\n"); c4 = layer2getc(); - log(" "); + mylog(" "); supplementary_control_C1(c4+0x40, 1); break; } @@ -706,61 +706,61 @@ case 0x29: case 0x2a: case 0x2b: - log(" load G%d with\n", c2 - 0x28); + mylog(" load G%d with\n", c2 - 0x28); c3 = layer2getc(); switch(c3) { case 0x40: - log(" 'primary graphic'\n"); + mylog(" 'primary graphic'\n"); t.G0123L[c2 - 0x28] = PRIM; t.prim = c2 - 0x28; break; case 0x62: - log(" 'supplementary graphic'\n"); + mylog(" 'supplementary graphic'\n"); t.G0123L[c2 - 0x28] = SUPP; t.supp = c2 - 0x28; break; case 0x63: - log(" '2nd supplementary mosaic'\n"); + mylog(" '2nd supplementary mosaic'\n"); t.G0123L[c2 - 0x28] = SUP2; break; case 0x64: - log(" '3rd supplementary mosaic'\n"); + mylog(" '3rd supplementary mosaic'\n"); t.G0123L[c2 - 0x28] = SUP3; break; case 0x20: - log(" DRCS\n"); + mylog(" DRCS\n"); c4 = layer2getc(); - if(c4 != 0x40) log("HAEH (ESC 0x%02x 0x20 0x%02x)\n", c2, c4); - else log("\n"); + if(c4 != 0x40) mylog("HAEH (ESC 0x%02x 0x20 0x%02x)\n", c2, c4); + else mylog("\n"); t.G0123L[c2 - 0x28] = DRCS; break; } break; case 0x6e: - log(" LS2 locking shift G2 left\n"); + mylog(" LS2 locking shift G2 left\n"); t.leftright[0] = G2; t.save_left = G2; break; case 0x6f: - log(" LS3 locking shift G3 left\n"); + mylog(" LS3 locking shift G3 left\n"); t.leftright[0] = G3; t.save_left = G3; break; case 0x7c: - log(" LS3R locking shift G3 right\n"); + mylog(" LS3R locking shift G3 right\n"); t.leftright[1] = G3; break; case 0x7d: - log(" LS2R locking shift G2 right\n"); + mylog(" LS2R locking shift G2 right\n"); t.leftright[1] = G2; break; case 0x7e: - log(" LS1R locking shift G1 right\n"); + mylog(" LS1R locking shift G1 right\n"); t.leftright[1] = G1; break; } @@ -781,32 +781,32 @@ c2 = layer2getc(); if(c2 == 0x42) { - log(" STC stop conceal\n"); + mylog(" STC stop conceal\n"); set_attr(ATTR_CONCEALED, 0, 0, t.serialmode); return 0; } - log("\n"); + mylog("\n"); c3 = layer2getc(); /* protection only available as fullrow controls ?? (page 135) */ if(c2 == 0x31 && c3 == 0x50) { - log(" PMS protected mode start\n"); + mylog(" PMS protected mode start\n"); set_attr(ATTR_PROTECTED, 1, 0, 2); return 0; } if(c2 == 0x31 && c3 == 0x51) { - log(" PMC protected mode cancel\n"); + mylog(" PMC protected mode cancel\n"); set_attr(ATTR_PROTECTED, 0, 0, 2); return 0; } if(c2 == 0x32 && c3 == 0x53) { - log(" MMS marked mode start\n"); + mylog(" MMS marked mode start\n"); /* set_attr(ATTR_MARKED, 1, 0, t.serialmode); */ return 0; } if(c2 == 0x32 && c3 == 0x54) { - log(" MMT marked mode stop\n"); + mylog(" MMT marked mode stop\n"); /* set_attr(ATTR_MARKED, 0, 0, t.serialmode); */ return 0; } @@ -814,28 +814,28 @@ switch(c3) { case 0x40: - log(" invoke CLUT%d\n", c2 - 0x2f); + mylog(" invoke CLUT%d\n", c2 - 0x2f); t.clut = c2 - 0x30; return 0; case 0x41: switch(c2) { case 0x30: - log(" IVF inverted flash\n"); + mylog(" IVF inverted flash\n"); return 1; case 0x31: - log(" RIF reduced intesity flash\n"); + mylog(" RIF reduced intesity flash\n"); return 1; case 0x32: case 0x33: case 0x34: - log(" FF%c fast flash %c\n", c2-1, c2-1); + mylog(" FF%c fast flash %c\n", c2-1, c2-1); return 1; case 0x35: - log(" ICF increment flash\n"); + mylog(" ICF increment flash\n"); return 1; case 0x36: - log(" DCF decrement flash\n"); + mylog(" DCF decrement flash\n"); return 1; } break; @@ -843,19 +843,19 @@ case 0x60: switch(c2) { case 0x30: - log(" SCU explicit scroll up\n"); + mylog(" SCU explicit scroll up\n"); if(t.scroll_area) scroll(1); return 0; case 0x31: - log(" SCD explicit scroll down\n"); + mylog(" SCD explicit scroll down\n"); if(t.scroll_area) scroll(0); return 0; case 0x32: - log(" AIS activate implicite scrolling\n"); + mylog(" AIS activate implicite scrolling\n"); t.scroll_impl = 1; return 0; case 0x33: - log(" DIS deactivate implicite scrolling\n"); + mylog(" DIS deactivate implicite scrolling\n"); t.scroll_impl = 0; return 0; } @@ -864,20 +864,20 @@ default: /* definition of scrolling area (page 137) */ upper = c2 & 0x0f; if(c3>=0x30 && c3<=0x39) upper = upper*10 + (c3&0x0f); - log(" upper row: %2d\n", upper); - if(c3>=0x30 && c3<=0x39) { c3 = layer2getc(); log("\n"); } + mylog(" upper row: %2d\n", upper); + if(c3>=0x30 && c3<=0x39) { c3 = layer2getc(); mylog("\n"); } /* if(c3!=0x3b) fprintf(stderr, "XCEPT: scrolling area - protocol !\n"); */ lower = layer2getc() & 0x0f; - log("\n"); + mylog("\n"); c3 = layer2getc(); if(c3>=0x30 && c3<=0x39) lower = lower*10 + (c3&0x0f); - log(" lower row: %2d", lower); - if(c3>=0x30 && c3<=0x39) { log("\n"); c3=layer2getc(); log(" "); } + mylog(" lower row: %2d", lower); + if(c3>=0x30 && c3<=0x39) { mylog("\n"); c3=layer2getc(); mylog(" "); } if(c3==0x55) { - log(" CSA create scrolling area\n"); + mylog(" CSA create scrolling area\n"); if(upper>=2 && lower=upper) { t.scroll_upper = upper; t.scroll_lower = lower; @@ -885,7 +885,7 @@ } } if(c3==0x56) { - log(" CSD delete scrolling area\n"); + mylog(" CSD delete scrolling area\n"); t.scroll_area = 0; } return 0; @@ -901,62 +901,62 @@ c3 = layer2getc(); if(c3 == 0x20) { - log(" DRCS header unit\n"); + mylog(" DRCS header unit\n"); c4 = layer2getc(); if(c4==0x20 || c4==0x28) { - log(" %s existing DRCS\n", (c4==0x20) ? "keep" : "delete"); + mylog(" %s existing DRCS\n", (c4==0x20) ? "keep" : "delete"); if(c4==0x28) free_DRCS(); c5 = layer2getc(); } else c5 = c4; if(c5 == 0x20) { - log("\n"); + mylog("\n"); c6 = layer2getc(); } else c6 = c5; if(c6 == 0x40) { - log("\n"); + mylog("\n"); c7 = layer2getc(); } else c7 = c6; switch(c7 & 0xf) { case 6: - log(" 12x12 pixel\n"); + mylog(" 12x12 pixel\n"); t.drcs_w = 12; t.drcs_h = 12; break; case 7: - log(" 12x10 pixel\n"); + mylog(" 12x10 pixel\n"); t.drcs_w = 12; t.drcs_h = 10; break; case 10: - log(" 6x12 pixel\n"); + mylog(" 6x12 pixel\n"); t.drcs_w = 6; t.drcs_h = 12; break; case 11: - log(" 6x10 pixel\n"); + mylog(" 6x10 pixel\n"); t.drcs_w = 6; t.drcs_h = 10; break; case 12: - log(" 6x5 pixel\n"); + mylog(" 6x5 pixel\n"); t.drcs_w = 6; t.drcs_h = 5; break; case 15: - log(" 6x6 pixel\n"); + mylog(" 6x6 pixel\n"); t.drcs_w = 6; t.drcs_h = 6; break; } c8 = layer2getc(); - log(" %d bit/pixel\n", c8 & 0xf); + mylog(" %d bit/pixel\n", c8 & 0xf); t.drcs_bits = c8 & 0xf; t.drcs_step = (t.drcs_h>=10 && t.drcs_w*t.drcs_bits==24) ? 2 : 1; } else { - log(" DRCS pattern transfer unit (char: 0x%02x)\n", c3); + mylog(" DRCS pattern transfer unit (char: 0x%02x)\n", c3); do_DRCS_data(c3); } } @@ -983,7 +983,7 @@ switch(c4) { case 0x20: /* S-bytes */ case 0x2f: - log(" fill rest of char with %d\n", c4 & 1); + mylog(" fill rest of char with %d\n", c4 & 1); for(; byte0x7f) { - log(" end of pattern data\n"); + mylog(" end of pattern data\n"); layer2ungetc(); if(byte) byte = maxbytes; } else { /* D-bytes */ - log(" pattern data\n"); + mylog(" pattern data\n"); if(t.drcs_w==6) { /* low res */ for(n=0; n<4; n++) if(planemask & (1<=0; i--) - if(data[n][j*2+k] & (1< */ - log(" color header unit\n"); + mylog(" color header unit\n"); t.col_modmap = 1; /* by default modify colormap */ c4 = layer2getc(); if((c4 & 0xf0) == 0x20) { if(c4!=0x20 && c4!=0x22) { - log("*** : bad value !\n"); + mylog("*** : bad value !\n"); fprintf(stderr, "XCEPT: do_DEFCOLOR(): ICT1 = 0x%02x\n", c4); } - log(" : load %s\n", c4==0x20 ? "colormap" : "DCLUT"); + mylog(" : load %s\n", c4==0x20 ? "colormap" : "DCLUT"); t.col_modmap = (c4==0x20); c5 = layer2getc(); } else c5 = c4; if((c5 & 0xf0) == 0x20) { - log(" : (unit %d)\n", c5&0xf); + mylog(" : (unit %d)\n", c5&0xf); if(c5!=0x20) { - log("*** : bad value !\n"); + mylog("*** : bad value !\n"); fprintf(stderr, "XCEPT: do_DEFCOLOR(): ICT2 = 0x%02x\n", c5); } c6 = layer2getc(); } else c6 = c5; if((c6 & 0xf0) == 0x30) { - log(" : %d bits\n", c6&0xf); + mylog(" : %d bits\n", c6&0xf); if(c6!=0x34 && c6!=0x35) { - log("*** : bad value !\n"); + mylog("*** : bad value !\n"); fprintf(stderr, "XCEPT: do_DEFCOLOR(): SUR = 0x%02x\n", c6); } c7 = layer2getc(); } else c7 = c6; if((c7 & 0xf0) == 0x40) { - log(" : 0x%02x\n", c7); + mylog(" : 0x%02x\n", c7); if(c7!=0x40 && c7!=0x41) { - log("*** : bad value !\n"); + mylog("*** : bad value !\n"); fprintf(stderr, "XCEPT: do_DEFCOLOR(): SCM = 0x%02x\n", c7); } } else { - log(" default header\n"); + mylog(" default header\n"); layer2ungetc(); } break; case 0x21: - log(" color reset unit\n"); + mylog(" color reset unit\n"); default_colors(); break; default: - log(" color transfer unit (1.Stelle: %d)\n", c3&0xf); + mylog(" color transfer unit (1.Stelle: %d)\n", c3&0xf); index = c3&0xf; c4 = layer2getc(); if((c4 & 0xf0) == 0x30) { /* c3 zehner, c4 einer */ - log(" (2.Stelle: %d)\n", c4&0xf); + mylog(" (2.Stelle: %d)\n", c4&0xf); index = (c3&0xf)*10 + (c4&0xf); c5 = layer2getc(); } else c5 = c4; if(t.col_modmap) { /* load colormap */ while(c5>=0x40 && c5<=0x7f) { - log(" color #%2d: R G B\n", index); + mylog(" color #%2d: R G B\n", index); c6 = layer2getc(); r = (c5&0x20)>>2 | (c5&0x04) | (c6&0x20)>>4 | (c6&0x04)>>2; g = (c5&0x10)>>1 | (c5&0x02)<<1 | (c6&0x10)>>3 | (c6&0x02)>>1; b = (c5&0x08) | (c5&0x01)<<2 | (c6&0x08)>>2 | (c6&0x01); - log(" %1x %1x %1x\n", r, g, b); + mylog(" %1x %1x %1x\n", r, g, b); if(index>=16 && index<=31) define_color(index++, r, g, b); c5 = layer2getc(); } } else { /* load DCLUT */ while(c5>=0x40 && c5<=0x7f) { - log(" DCLUT[%2d] = %2d\n", index, c5&0x1f); + mylog(" DCLUT[%2d] = %2d\n", index, c5&0x1f); if(index>=0 && index<=3) define_DCLUT(index++, c5&0x1f); c5 = layer2getc(); } } - log(" end of color data\n"); + mylog(" end of color data\n"); layer2ungetc(); break; } @@ -1246,15 +1246,15 @@ if((c3&0xf0) == 0x40) { switch(c3) { case 0x41: - log(" 40 columns by 24 rows\n"); + mylog(" 40 columns by 24 rows\n"); break; case 0x42: - log(" 40 columns by 20 rows\n"); + mylog(" 40 columns by 20 rows\n"); rows = 20; fontheight = 12; break; default: - log(" unrecognized format (using default)\n"); + mylog(" unrecognized format (using default)\n"); break; } c4 = layer2getc(); @@ -1262,11 +1262,11 @@ else c4 = c3; if((c4&0xf0) == 0x70) { - log(" wraparound %s\n", (c3&1) ? "inactive" : "active"); + mylog(" wraparound %s\n", (c3&1) ? "inactive" : "active"); t.wrap = (c3 == 0x70) ? 1 : 0; } else { - log(" default format\n"); + mylog(" default format\n"); layer2ungetc(); } } @@ -1281,9 +1281,9 @@ switch(c3) { case 0x40: /* (page 158) */ - log(" service break to row\n"); + mylog(" service break to row\n"); c4 = layer2getc(); - log(" #%d\n", c4 & 0x3f); + mylog(" #%d\n", c4 & 0x3f); backup = t; /* structure copy */ t.leftright[0] = t.prim; /* PFUSCH !!! */ t.leftright[1] = t.supp; @@ -1298,7 +1298,7 @@ case 0x41: case 0x42: - log(" defaults (%s C1)\n", c3&1 ? "serial" : "parallel"); + mylog(" defaults (%s C1)\n", c3&1 ? "serial" : "parallel"); default_sets(); t.serialmode = c3 & 1; t.wrap = 1; @@ -1311,13 +1311,13 @@ case 0x43: case 0x44: - log(" limited defaults (%s C1)\n", c3&1 ? "serial":"parallel"); + mylog(" limited defaults (%s C1)\n", c3&1 ? "serial":"parallel"); default_sets(); t.serialmode = c3 & 1; break; case 0x4f: - log(" reset to previous state\n"); + mylog(" reset to previous state\n"); t = backup; move_cursor(APA, t.cursory, t.cursorx); break; @@ -1776,7 +1776,7 @@ * layer 6 debug log routine. (varargs !?!) */ -log(s, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) +mylog(s, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) char *s; int p1, p2 ,p3, p4, p5, p6, p7, p8, p9, p10, p11, p12; { --- xcept/tsw.c.orig Tue Dec 14 17:04:50 1993 +++ xcept/tsw.c Mon Sep 1 16:46:16 2003 @@ -68,7 +68,7 @@ while( (DDU = layer2getc()) != US ) { switch( DDU ) { /* Dialog Data Unit */ case DDU_D_SET: - log("DDU_D_SET\n"); + mylog("DDU_D_SET\n"); sq = get_sq( tsw_mode ); LI = get_LI( sq, tsw_mode ); @@ -79,34 +79,34 @@ } break; case DDU_D_END: - log("DDU_D_END\n"); + mylog("DDU_D_END\n"); sq = get_sq( tsw_mode ); if( layer2getc() == US ) goto end_do_TSW; - log("PV: 0x%02x\n", sq ); + mylog("PV: 0x%02x\n", sq ); tsw_mode = 0x00; break; default: sq = DDU; - log("DDU_D_DATA, sq: 0x%02x\n", sq ); + mylog("DDU_D_DATA, sq: 0x%02x\n", sq ); while( (TDU = l2getc(tsw_mode,&us)) != US && us == 0 ) { switch( TDU ) { /* Telesoftware Data Unit */ case TDU_T_ASSOCIATE: - log("CI TDU_T_ASSOCIATE\n"); + mylog("CI TDU_T_ASSOCIATE\n"); break; case TDU_T_FILESPEC: - log("CI TDU_T_FILESPEC\n"); + mylog("CI TDU_T_FILESPEC\n"); break; case TDU_T_WR_START: - log("CI TDU_T_WR_START\n"); + mylog("CI TDU_T_WR_START\n"); break; case TDU_T_WRITE: - log("CI TDU_T_WRITE\n"); + mylog("CI TDU_T_WRITE\n"); break; case TDU_T_WR_END: - log("CI TDU_T_WR_END\n"); + mylog("CI TDU_T_WR_END\n"); if( write( dz_tsw, cp_tsw, ll_tsw ) != ll_tsw ) { sprintf( msg, "write(,,%d)", ll_tsw ); perror( msg ); @@ -115,7 +115,7 @@ close( dz_tsw ); break; default: - log("unknown TDU 0x%02x\n", TDU ); + mylog("unknown TDU 0x%02x\n", TDU ); break; } LI = get_LI( sq, tsw_mode ); @@ -130,10 +130,10 @@ do { PV = l2getc( tsw_mode, &us ); if( us ) { - log("\n" ); + mylog("\n" ); goto end_do_TSW; } - log("PV DATA\n"); + mylog("PV DATA\n"); *(cp_tsw+ii_tsw) = PV; } while( ++ii_tsw < ll_tsw ); } @@ -142,7 +142,7 @@ } } end_do_TSW: - log("\n"); + mylog("\n"); layer2ungetc(); } @@ -161,7 +161,7 @@ if( mode == MODE1_3IN4 ) { switch( nr ) { case 0: /*--- Byte 1+2 ---*/ - b1 = layer2getc(); log("\n"); + b1 = layer2getc(); mylog("\n"); if( b1 == US ) { nr = 0; rc = US; *us = 1; break; @@ -197,9 +197,9 @@ else rc = layer2getc(); - log("l2getc(0x%02X) ", rc ); - if( isprint(rc) ) log("'%c' ", rc ); - else log(" "); + mylog("l2getc(0x%02X) ", rc ); + if( isprint(rc) ) mylog("'%c' ", rc ); + else mylog(" "); return( rc ); } @@ -213,7 +213,7 @@ int sq; sq = l2getc( mode, &us ); - log("sequence code: 0x%02x\n", sq ); + mylog("sequence code: 0x%02x\n", sq ); return( sq ); } @@ -229,7 +229,7 @@ LI = l2getc( mode, &us ); LI = LI % sq; - log("LI=%3d\n", LI ); + mylog("LI=%3d\n", LI ); return( LI ); } @@ -249,27 +249,27 @@ goto end_do_PI; switch( PI ) { - case PI_STREAM: log("Str\n"); rc = 1; break; - case PI_CHECK: log("PI Checksum use & mode\n"); + case PI_STREAM: mylog("Str\n"); rc = 1; break; + case PI_CHECK: mylog("PI Checksum use & mode\n"); LI = get_LI( sq, tsw_mode ); for( i=0; i