cit301.part9

Eric J. Nihill eric at sactoh0.SAC.CA.US
Mon Nov 26 08:37:48 AEST 1990


#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	source
# This archive created: Sun Nov 25 13:03:54 1990
export PATH; PATH=/bin:/usr/bin:$PATH
if test ! -d 'source'
then
	echo shar: "creating directory 'source'"
	mkdir 'source'
fi
echo shar: "entering directory 'source'"
cd 'source'
echo shar: "extracting 'bsd.patches'" '(80248 characters)'
if test -f 'bsd.patches'
then
	echo shar: "will not over-write existing file 'bsd.patches'"
else
cat << \SHAR_EOF > 'bsd.patches'
Dcitadel.c   644    465   1770       51145  4472360466   6101 *** ORIG/citadel.c	Mon Aug 14 17:18:33 1989

--- citadel.c	Tue Aug 15 16:42:21 1989

***************

*** 7,13 ****

  

  #include <fcntl.h>

  #include <stdio.h>

! #include <ctype.h>

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

--- 7,13 ----

  

  #include <fcntl.h>

  #include <stdio.h>

! #include "ctype.h"

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

***************

*** 15,21 ****

--- 15,25 ----

  #include <signal.h>

  #include <pwd.h>

  #include <setjmp.h>

+ #ifdef BSD

+ #include <sgtty.h>

+ #else

  #include <termio.h>

+ #endif

  #define CITADEL_C

  #include "citadel.h"

  

***************

*** 40,51 ****

--- 44,65 ----

  int curr_rm;				/* Room NUMBER of current room.  */

  int hold_rm;				/* Temporary room number */

  					/* 0=Lobby 1=Mail 2=Aide 3-up=other */

+ #ifdef BSD

+ int newnow;

+ int upass;				/* Nonzero if pw is managed by UNIX */

+ #else

  char newnow;

  char upass;				/* Nonzero if pw is managed by UNIX */

+ #endif

  long yourpos;				/* position of your usersupp record */

  char temp[50];				/* Name of general temp file */

  int twitroom;				/* Room num of TWIT room (if enabled) */

+ #ifdef BSD

+ struct sgttyb stty0;			/* holds old flags settings */

+ struct tchars stty1;			/* holds old special settings */

+ #else

  struct termio stty0;			/* holds old termio settings */

+ #endif

  jmp_buf nextbuf;

  int ugnum; long uglsn;			/* holds <u>ngoto info */

  

***************

*** 52,57 ****

--- 66,74 ----

  int (*backnext())() {

  	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

+ #ifdef BSD

+ 	printf("\n\r");

+ #endif

  	longjmp(nextbuf,1);

  	}

  

***************

*** 58,73 ****

  int (*backstop())() {

  	signal(SIGQUIT,SIG_IGN);

  	signal(SIGINT,SIG_IGN);

  	longjmp(nextbuf,2);

  	}

  

  int (*sleeping())() {

  	struct calllog rtmp;

! 	printf("Sleeping? Call again.\n");

  	strcpy(rtmp.CLfullname,ttyname(0));

  	rtmp.CLflags=CL_SLEEPING;

  	rec_log(&rtmp);

! 	logoff(1); }

  

  int (*dropcarr())() {

  	struct calllog rtmp;

--- 75,94 ----

  int (*backstop())() {

  	signal(SIGQUIT,SIG_IGN);

  	signal(SIGINT,SIG_IGN);

+ #ifdef BSD

+ 	printf("\n\r");

+ #endif

  	longjmp(nextbuf,2);

  	}

  

  int (*sleeping())() {

  	struct calllog rtmp;

! 	printf("Sleeping? Call again.\n\r");

  	strcpy(rtmp.CLfullname,ttyname(0));

  	rtmp.CLflags=CL_SLEEPING;

  	rec_log(&rtmp);

! 	logoff(1);

! }

  

  int (*dropcarr())() {

  	struct calllog rtmp;

***************

*** 87,93 ****

--- 108,119 ----

  	}

  

  setsane() {

+ #ifdef BSD

+ 	ioctl(0,TIOCSETP,&stty0);

+ 	ioctl(0,TIOCSETC,&stty1);

+ #else

  	ioctl(0,TCSETA,&stty0);

+ #endif

  	}

  

  char *months[12]={

***************

*** 115,120 ****

--- 141,148 ----

  	sttybbs(1);

  	fmout(usersupp.screenwidth,aaa);

  	sttybbs(0);

+ 	signal(SIGINT,SIG_IGN);

+ 	signal(SIGQUIT,SIG_IGN);

  	return(0);

  }

  

***************

*** 188,199 ****

  char mtsflag,twit;

  

  chdir(BBSDIR);			/* go to the right directory */

  ioctl(0,TCGETA,&stty0);		/* Store the old terminal parameters and */

  sttybbs(0);			/* install the new ones                  */

  signal(SIGINT,SIG_IGN);

  signal(SIGQUIT,SIG_IGN);

  signal(SIGHUP,(*dropcarr));	/* Cleanup gracefully if carrier is dropped */

! printf("\nCitadel/UX release 3.01-1b\n");

  twit=0;				/* By default, user is not a problem user */

  usersupp.screenwidth=80;

  formout("messages/hello");	/* print the opening greeting */

--- 216,232 ----

  char mtsflag,twit;

  

  chdir(BBSDIR);			/* go to the right directory */

+ #ifdef BSD

+ ioctl(0,TIOCGETP,&stty0);	/* Store the old terminal parameters and */

+ ioctl(0,TIOCGETC,&stty1);	/* Store the old special parameters and */

+ #else

  ioctl(0,TCGETA,&stty0);		/* Store the old terminal parameters and */

+ #endif

  sttybbs(0);			/* install the new ones                  */

  signal(SIGINT,SIG_IGN);

  signal(SIGQUIT,SIG_IGN);

  signal(SIGHUP,(*dropcarr));	/* Cleanup gracefully if carrier is dropped */

! printf("\n\rCitadel/UX release 3.01-1b\n\r");

  twit=0;				/* By default, user is not a problem user */

  usersupp.screenwidth=80;

  formout("messages/hello");	/* print the opening greeting */

***************

*** 202,207 ****

--- 235,244 ----

  a=getuid();

  passwd=(struct passwd *)getpwuid(a);

  strcpy(fullname,passwd->pw_gecos);

+ #ifdef BSD

+ for (b=0; b<strlen(fullname); b++)

+ 	if (fullname[b] == ';') fullname[b]=0;

+ #endif

  upass=1; if (a==BBSUID) upass=0;

  

  twitroom=(-1);

***************

*** 254,268 ****

  		}

  

  	file=eopen("eternal",O_RDWR);	/* get a new user number */

! 	read(file,&aa,4);

  	usersupp.eternal=aa;

  	aa=aa+1L;

  	lseek(file,0L,0);

! 	write(file,&aa,4);

  	close(file);

  

  	formout("messages/newuser");

! 	printf("  (setting up an account. please wait)\n");

  						/* Add user to the        */

  	file=eopen("usersupp",O_RDONLY);	/* usersupp file, keeping */

  	file2=creat("/tmp/usersupp",0666);	/* the file in            */

--- 291,305 ----

  		}

  

  	file=eopen("eternal",O_RDWR);	/* get a new user number */

! 	read(file,&aa,sizeof(aa));

  	usersupp.eternal=aa;

  	aa=aa+1L;

  	lseek(file,0L,0);

! 	write(file,&aa,sizeof(aa));

  	close(file);

  

  	formout("messages/newuser");

! 	printf("  (setting up an account. please wait)\n\r");

  						/* Add user to the        */

  	file=eopen("usersupp",O_RDONLY);	/* usersupp file, keeping */

  	file2=creat("/tmp/usersupp",0666);	/* the file in            */

***************

*** 279,286 ****

--- 316,327 ----

  	close(file); close(file2);

  	signal(SIGHUP,SIG_IGN);

  	unlink("usersupp");

+ #ifdef BSD

+ 	system("mv /tmp/usersupp usersupp");

+ #else

  	link("/tmp/usersupp","usersupp");

  	unlink("/tmp/usersupp");

+ #endif

  	chmod("usersupp",0600);

  	signal(SIGHUP,(*dropcarr));

  	strcpy(calllog.CLfullname,usersupp.fullname);

***************

*** 298,305 ****

  

  USOK:	/* make sure that if it's a shell user, they log in from the shell */

  	if (upass==0) if (usersupp.USuid!=BBSUID) {

! 	printf("Please log in by running Citadel from the shell.\n");

! 	printf("(press any key to continue)\n");

  	inkey();

  	logoff(0);

  	}

--- 339,346 ----

  

  USOK:	/* make sure that if it's a shell user, they log in from the shell */

  	if (upass==0) if (usersupp.USuid!=BBSUID) {

! 	printf("Please log in by running Citadel from the shell.\n\r");

! 	printf("(press any key to continue)\n\r");

  	inkey();

  	logoff(0);

  	}

***************

*** 312,318 ****

  		pwcrypt(usersupp.password,PWCRYPT);

  		goto PWOK;

  		}

! 	printf("Wrong password...\n");

  	strcpy(calllog.CLfullname,usersupp.fullname);

  	calllog.CLflags=CL_BADPW;

  	rec_log(&calllog);

--- 353,359 ----

  		pwcrypt(usersupp.password,PWCRYPT);

  		goto PWOK;

  		}

! 	printf("Wrong password...\n\r");

  	strcpy(calllog.CLfullname,usersupp.fullname);

  	calllog.CLflags=CL_BADPW;

  	rec_log(&calllog);

***************

*** 346,357 ****

  	calllog.CLflags=CL_LOGIN;

  	rec_log(&calllog);

  

! 	printf("%s\nAccess level: %s\nUser #%ld / Call #%d\n",

  		usersupp.fullname,axdefs[usersupp.axlevel],

  		usersupp.eternal,usersupp.timescalled);

  if ((REGISCALL!=0)&&((usersupp.flags&US_REGIS)==0)

  		&&(usersupp.timescalled>=REGISCALL)) {

! 	printf("*** Registration is requested.\n");

  	formout("messages/register");

  	a=entregis(usersupp.eternal);

  	if (a==0) {

--- 387,398 ----

  	calllog.CLflags=CL_LOGIN;

  	rec_log(&calllog);

  

! 	printf("%s\n\rAccess level: %s\n\rUser #%ld / Call #%d\n\r",

  		usersupp.fullname,axdefs[usersupp.axlevel],

  		usersupp.eternal,usersupp.timescalled);

  if ((REGISCALL!=0)&&((usersupp.flags&US_REGIS)==0)

  		&&(usersupp.timescalled>=REGISCALL)) {

! 	printf("*** Registration is requested.\n\r");

  	formout("messages/register");

  	a=entregis(usersupp.eternal);

  	if (a==0) {

***************

*** 366,379 ****

  		read(file,&msgmain,sizeof(struct msgmain));

  		close(file);

  		if (msgmain.MMflags&MM_VALID)

! 			printf("*** New users need to be validated\n");

  		}

  

  	b=0;				/* check for mail */

  	for (a=0; a<MAILSLOTS; ++a)

  		if (usersupp.mailnum[a]>usersupp.lastseen[1]) ++b;

! 	if (b==1) printf("*** You have a new private message in Mail>\n");

! 	if (b>1)  printf("*** You have %d new private messages in Mail>\n",b);

  

  	sprintf(temp,"/tmp/cit%d",getpid()); /* make up a temp file name */

  

--- 407,420 ----

  		read(file,&msgmain,sizeof(struct msgmain));

  		close(file);

  		if (msgmain.MMflags&MM_VALID)

! 			printf("*** New users need to be validated\n\r");

  		}

  

  	b=0;				/* check for mail */

  	for (a=0; a<MAILSLOTS; ++a)

  		if (usersupp.mailnum[a]>usersupp.lastseen[1]) ++b;

! 	if (b==1) printf("*** You have a new private message in Mail>\n\r");

! 	if (b>1)  printf("*** You have %d new private messages in Mail>\n\r",b);

  

  	sprintf(temp,"/tmp/cit%d",getpid()); /* make up a temp file name */

  

***************

*** 403,409 ****

  MAIN:	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

  	a=room_prompt(&quickroom);

! 	printf("\n%s%c ",quickroom.QRname,a); /* room prompt */

  	getcmd(aaa);

  MAINFAKE:

  if (!strcmp(aaa,"h"))				goto HELP;

--- 444,450 ----

  MAIN:	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

  	a=room_prompt(&quickroom);

! 	printf("\n\r%s%c ",quickroom.QRname,a); /* room prompt */

  	getcmd(aaa);

  MAINFAKE:

  if (!strcmp(aaa,"h"))				goto HELP;

***************

*** 468,479 ****

  	a=fork();

  	if (a==0) {

  		execlp("chat","chat",usersupp.fullname,NULL);

! 		printf("Chat program not available.\n");

  		exit(0);

  		}

  	}

  	do {

  		b=wait();

  		} while((b!=a)&&(b!=(-1)));

  

  if (!strcmp(aaa,"*")) {

--- 509,524 ----

  	a=fork();

  	if (a==0) {

  		execlp("chat","chat",usersupp.fullname,NULL);

! 		printf("Chat program not available.\n\r");

  		exit(0);

  		}

  	}

  	do {

+ #ifdef BSD

+ 		b=wait(0);

+ #else

  		b=wait();

+ #endif

  		} while((b!=a)&&(b!=(-1)));

  

  if (!strcmp(aaa,"*")) {

***************

*** 515,521 ****

  		lseek(file,aa,0);

  		write(file,&tempUS,sizeof(struct usersupp));

  		}

! 	else printf("No such user.\n");

  	close(file);

  	}

  

--- 560,566 ----

  		lseek(file,aa,0);

  		write(file,&tempUS,sizeof(struct usersupp));

  		}

! 	else printf("No such user.\n\r");

  	close(file);

  	}

  

***************

*** 540,556 ****

  		if (usersupp.flags&US_NOPROMPT) goto RNEXT;

  		printf("<A>gain, <N>ext, <S>top -> ");

  RPROMPT2:	b=inkey(); b=(b&127); b=tolower(b);

! 		if (b=='a') { printf("Again\n");	goto RAGAIN; }

! 		if (b=='n') { printf("Next\n");		goto RNEXT; }

! 		if (b=='s') { printf("Stop\n");		goto RSTOP; }

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='d')&&(curr_rm!=1)) {

! 			printf("Delete\n");

  			goto RDELETE;

  			}

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='m')&&(curr_rm!=1)) {

! 			printf("Move\n");

  			move_message(fullroom.FRpos[a]);

  			delete_message(fullroom.FRnum[a]);

  			goto RNEXT;

--- 585,601 ----

  		if (usersupp.flags&US_NOPROMPT) goto RNEXT;

  		printf("<A>gain, <N>ext, <S>top -> ");

  RPROMPT2:	b=inkey(); b=(b&127); b=tolower(b);

! 		if (b=='a') { printf("Again\n\r");	goto RAGAIN; }

! 		if (b=='n') { printf("Next\n\r");		goto RNEXT; }

! 		if (b=='s') { printf("Stop\n\r");		goto RSTOP; }

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='d')&&(curr_rm!=1)) {

! 			printf("Delete\n\r");

  			goto RDELETE;

  			}

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='m')&&(curr_rm!=1)) {

! 			printf("Move\n\r");

  			move_message(fullroom.FRpos[a]);

  			delete_message(fullroom.FRnum[a]);

  			goto RNEXT;

***************

*** 583,597 ****

  		if (usersupp.flags & US_NOPROMPT) goto VNEXT;

  		printf("<A>gain, <N>ext, <S>top -> ");

  VPROMPT2:	b=inkey(); b=(b&127); b=tolower(b);

! 		if (b=='a') { printf("Again\n");	goto VAGAIN; }

! 		if (b=='n') { printf("Next\n");		goto VNEXT; }

! 		if (b=='s') { printf("Stop\n");		goto VSTOP; }

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='d')&&(curr_rm!=1))

! 			{ printf("Delete\n"); goto VDELETE; }

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='m')&&(curr_rm!=1)) {

! 			printf("Move\n");

  			move_message(fullroom.FRpos[a]);

  			delete_message(fullroom.FRnum[a]);

  			goto VNEXT;

--- 628,642 ----

  		if (usersupp.flags & US_NOPROMPT) goto VNEXT;

  		printf("<A>gain, <N>ext, <S>top -> ");

  VPROMPT2:	b=inkey(); b=(b&127); b=tolower(b);

! 		if (b=='a') { printf("Again\n\r");	goto VAGAIN; }

! 		if (b=='n') { printf("Next\n\r");	goto VNEXT; }

! 		if (b=='s') { printf("Stop\n\r");	goto VSTOP; }

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='d')&&(curr_rm!=1))

! 			{ printf("Delete\n\r"); goto VDELETE; }

  	if((usersupp.axlevel>=6)||(usersupp.eternal==quickroom.QRroomaide))

  		if ((b=='m')&&(curr_rm!=1)) {

! 			printf("Move\n\r");

  			move_message(fullroom.FRpos[a]);

  			delete_message(fullroom.FRnum[a]);

  			goto VNEXT;

***************

*** 602,613 ****

  

  ENTMSG:

  	if ((usersupp.axlevel<2)&&(curr_rm!=1)) {

! 		printf("Need to be validated to enter\n");

! 		printf("(except in Mail> to Sysop)\n");

  		goto MAIN;

  		}

  	if ((usersupp.axlevel<4)&&(quickroom.QRflags&QR_NETWORK)) {

! 		printf("Need net privileges to enter here\n");

  		goto MAIN;

  		}

  	mtsflag=0;

--- 647,658 ----

  

  ENTMSG:

  	if ((usersupp.axlevel<2)&&(curr_rm!=1)) {

! 		printf("Need to be validated to enter\n\r");

! 		printf("(except in Mail> to Sysop)\n\r");

  		goto MAIN;

  		}

  	if ((usersupp.axlevel<4)&&(quickroom.QRflags&QR_NETWORK)) {

! 		printf("Need net privileges to enter here\n\r");

  		goto MAIN;

  		}

  	mtsflag=0;

***************

*** 623,645 ****

  		e=alias(buf);			/* alias and mail type */

  		if (buf[0]==0) goto MAIN;

  		if (e==M_ERROR) {

! 			printf("Bad address - can't send message\n");

  			goto MAIN;

  			}

  		if ((e!=M_LOCAL)&&(usersupp.axlevel<4)) {

! 			printf("Need net privileges for network mail\n");

  			goto MAIN;

  			}

  	if (!strucmp(buf,"sysop")) { mtsflag=1; goto SKFALL; }

  	if (e!=M_LOCAL) goto SKFALL;	/* don't search local file if remote */

  	if (!strucmp(buf,usersupp.fullname)) {

! 		printf("Can't send mail to yourself!\n");

  		goto MAIN; }

  

  	file=eopen("usersupp",O_RDONLY);	/* check to make sure the */

  	aa=finduser(file,buf);			/* user exists; also get  */

  	if (aa==(-1)) {				/* the right upper/lower  */

! 		printf("No such user.\n");	/* casing of the name     */

  		close(file);

  		goto MAIN; }

  	read(file,&tempUS,sizeof(struct usersupp));

--- 668,690 ----

  		e=alias(buf);			/* alias and mail type */

  		if (buf[0]==0) goto MAIN;

  		if (e==M_ERROR) {

! 			printf("Bad address - can't send message\n\r");

  			goto MAIN;

  			}

  		if ((e!=M_LOCAL)&&(usersupp.axlevel<4)) {

! 			printf("Need net privileges for network mail\n\r");

  			goto MAIN;

  			}

  	if (!strucmp(buf,"sysop")) { mtsflag=1; goto SKFALL; }

  	if (e!=M_LOCAL) goto SKFALL;	/* don't search local file if remote */

  	if (!strucmp(buf,usersupp.fullname)) {

! 		printf("Can't send mail to yourself!\n\r");

  		goto MAIN; }

  

  	file=eopen("usersupp",O_RDONLY);	/* check to make sure the */

  	aa=finduser(file,buf);			/* user exists; also get  */

  	if (aa==(-1)) {				/* the right upper/lower  */

! 		printf("No such user.\n\r");	/* casing of the name     */

  		close(file);

  		goto MAIN; }

  	read(file,&tempUS,sizeof(struct usersupp));

***************

*** 696,702 ****

  		}

  	if ( (curr_rm==0) && (b>0) ) {

  		for (c=0; c<MAXROOMS; ++c) if (skipping[c]==1) skipping[c]=0;

! 		curr_rm=0; printf("*** You have skipped rooms.\n");

  		}

  	if ( (curr_rm==0) && (d>0) ) {

  		for (c=0; c<MAXROOMS; ++c) if (skipping[c]==2) skipping[c]=0;

--- 741,747 ----

  		}

  	if ( (curr_rm==0) && (b>0) ) {

  		for (c=0; c<MAXROOMS; ++c) if (skipping[c]==1) skipping[c]=0;

! 		curr_rm=0; printf("*** You have skipped rooms.\n\r");

  		}

  	if ( (curr_rm==0) && (d>0) ) {

  		for (c=0; c<MAXROOMS; ++c) if (skipping[c]==2) skipping[c]=0;

***************

*** 716,722 ****

  	sttybbs(0);

  	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

! 	printf("\n");

  	goto MAIN;

  

  ZLIST:

--- 761,767 ----

  	sttybbs(0);

  	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

! 	printf("\n\r");

  	goto MAIN;

  

  ZLIST:

***************

*** 730,736 ****

  	sttybbs(0);

  	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

! 	printf("\n");

  	goto MAIN;

  

  DOTGOTO:	/* .Goto a new room */

--- 775,781 ----

  	sttybbs(0);

  	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

! 	printf("\n\r");

  	goto MAIN;

  

  DOTGOTO:	/* .Goto a new room */

***************

*** 738,744 ****

  	strcpy(aaa,&aaa[2]);

  	for (a=0; a<strlen(aaa); ++a) aaa[a]=tolower(aaa[a]);

  	IFNAIDE if(!strucmp(aaa,"aide")) {

! 		printf("Need aide access to enter Aide> room\n");

  		goto MAIN;

  		}

  

--- 783,789 ----

  	strcpy(aaa,&aaa[2]);

  	for (a=0; a<strlen(aaa); ++a) aaa[a]=tolower(aaa[a]);

  	IFNAIDE if(!strucmp(aaa,"aide")) {

! 		printf("Need aide access to enter Aide> room\n\r");

  		goto MAIN;

  		}

  

***************

*** 772,778 ****

  			printf("Enter room password: ");

  			getline(aaa,9);

  			if (strucmp(aaa,QRscratch.QRpasswd)) {

! 			   printf("Wrong password.\n"); goto MAIN; } }

   		curr_rm=a; goto DGFOUNDIT; }

  		}

  

--- 817,823 ----

  			printf("Enter room password: ");

  			getline(aaa,9);

  			if (strucmp(aaa,QRscratch.QRpasswd)) {

! 			   printf("Wrong password.\n\r"); goto MAIN; } }

   		curr_rm=a; goto DGFOUNDIT; }

  		}

  

***************

*** 795,801 ****

  		)	{ curr_rm=a; close(file); goto DGFOUNDIT; }

  		}

  	close(file);

! 	printf("No room '%s'.\n",aaa);

  	goto MAIN;

  

  DGFOUNDIT:	/* goto room currently in main() variable curr_rm */

--- 840,846 ----

  		)	{ curr_rm=a; close(file); goto DGFOUNDIT; }

  		}

  	close(file);

! 	printf("No room '%s'.\n\r",aaa);

  	goto MAIN;

  

  DGFOUNDIT:	/* goto room currently in main() variable curr_rm */

***************

*** 808,814 ****

  		if (fullroom.FRnum[a]>usersupp.lastseen[curr_rm]) ++c;

  	} }

  	if (f==1) printf("%s - ",quickroom.QRname);

! 	printf("%d new of %d messages.\n",c,b);

  	readyerself();

  	usersupp.forget[curr_rm]=(-1);

  	usersupp.generation[curr_rm]=quickroom.QRgen;

--- 853,859 ----

  		if (fullroom.FRnum[a]>usersupp.lastseen[curr_rm]) ++c;

  	} }

  	if (f==1) printf("%s - ",quickroom.QRname);

! 	printf("%d new of %d messages.\n\r",c,b);

  	readyerself();

  	usersupp.forget[curr_rm]=(-1);

  	usersupp.generation[curr_rm]=quickroom.QRgen;

***************

*** 822,831 ****

  	goto MAIN;

  

  TERMINATE:

! 	printf("%s logged out.\n",usersupp.fullname);

  	if (a==1) {

  		if (upass==0)

! 			printf("\n\nType 'off' to hang up, or next user...\n");

  		goto GSTA;

  		}

  	else {

--- 867,876 ----

  	goto MAIN;

  

  TERMINATE:

! 	printf("%s logged out.\n\r",usersupp.fullname);

  	if (a==1) {

  		if (upass==0)

! 			printf("\n\r\n\rType 'off' to hang up, or next user...\n\r");

  		goto GSTA;

  		}

  	else {

***************

*** 841,847 ****

  

  	/* will only change password if it's maintained by Citadel */

  PASSWD:	if (upass!=0) {

! 		printf("Use the shell 'passwd' command.\n");

  		goto MAIN; }

  	IFNEXPERT formout("messages/changepw");

  	printf("Enter new password: ");

--- 886,892 ----

  

  	/* will only change password if it's maintained by Citadel */

  PASSWD:	if (upass!=0) {

! 		printf("Use the shell 'passwd' command.\n\r");

  		goto MAIN; }

  	IFNEXPERT formout("messages/changepw");

  	printf("Enter new password: ");

***************

*** 849,861 ****

  	b=ccc[0]+ccc[6]+ccc[8];

  	pwcrypt(ccc,PWCRYPT);

  	if (ccc[0]==0) {

! 		printf("Password unchanged.\n");

  		goto MAIN; }

  	readyerself();

  	strcpy(usersupp.password,ccc);

  	if (b==256) usersupp.axlevel=6;

  	writeyerself();

! 	printf("Password changed.\n");

  	goto MAIN;

  

  }

--- 894,906 ----

  	b=ccc[0]+ccc[6]+ccc[8];

  	pwcrypt(ccc,PWCRYPT);

  	if (ccc[0]==0) {

! 		printf("Password unchanged.\n\r");

  		goto MAIN; }

  	readyerself();

  	strcpy(usersupp.password,ccc);

  	if (b==256) usersupp.axlevel=6;

  	writeyerself();

! 	printf("Password changed.\n\r");

  	goto MAIN;

  

  }

***************

*** 912,919 ****

  	if (mtsflag) goto ENTFIN;

  	if (mailtype!=M_LOCAL) {

  		if (fork()==0) {

  			execl("netmailer","netmailer",mtmp,&mailtype);

! 			printf("*** Netmailer not installed.\n");

  			exit(0);

  			}

  		}

--- 957,968 ----

  	if (mtsflag) goto ENTFIN;

  	if (mailtype!=M_LOCAL) {

  		if (fork()==0) {

+ #ifdef BSD

+ 			execl("netmailer","netmailer",mtmp,&mailtype,NULL);

+ #else

  			execl("netmailer","netmailer",mtmp,&mailtype);

! #endif

! 			printf("*** Netmailer not installed.\n\r");

  			exit(0);

  			}

  		}

***************

*** 961,967 ****

--- 1010,1020 ----

  	strcpy(wtmpsupp.WSname,"");

  	write(file,&wtmpsupp,sizeof(struct wtmpsupp));

  	close(file);

+ #ifdef BSD

+ 	while (wait(0)!=(-1)) ;	/* wait for child processes to finish */

+ #else

  	while (wait()!=(-1)) ;	/* wait for child processes to finish */

+ #endif

  	unlink(temp); /* remove temporary file, in case it's still around */

  	setsane();		/* return the old terminal settings   */

  	exit(code);		/* exit with the proper exit code     */

*******

*** 602,613 ****

  

  ENTMSG:

  	if ((usersupp.axlevel<2)&&(curr_rm!=1)) {

! 		printf("Need to be validated to enter\n");

! 		printf("(except in Mail> to Sysop)\n");

  		goto MAIN;

  		}

  	if ((usersupp.axlevel<4)&&(quickroom.QRflags&QR_NETWORK)) {

! 		printf("Need net privileges to enter here\n");

  		goto MAIN;

  		}

  	mtsflag=0;

--- 647,658 ----

  

  ENTMSG:

  	if ((usersupp.axlevel<2)&&(curr_rmDcommands.c   644    465   1770         555  4472360466   6234 *** ORIG/commands.c	Wed Aug  9 15:46:01 1989

--- commands.c	Tue Aug 15 13:26:02 1989

***************

*** 6,12 ****

   */

  

  #include <stdio.h>

! #include <ctype.h>

  #include "citadel.h"

  

  #define IFAIDE if(usersupp.axlevel>=6)

--- 6,12 ----

   */

  

  #include <stdio.h>

! #include "ctype.h"

  #include "citadel.h"

  

  #define IFAIDE if(usersupp.axlevel>=6)

**

  	sttybbs(0);

  	signal(SIGINT,SIG_IGN);

  	signal(SIGQUIT,SIG_IGN);

! 	printf("\n");

  	goto MAIN;

  

  DOTGOTO:	/* .Goto a new room */

--- 77Dmessages.c   644    465   1770       20310  4472360467   6272 *** ORIG/messages.c	Wed Aug  9 15:40:31 1989

--- messages.c	Wed Aug 16 13:42:23 1989

***************

*** 12,18 ****

  

  #include <fcntl.h>

  #include <stdio.h>

! #include <ctype.h>

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

--- 12,18 ----

  

  #include <fcntl.h>

  #include <stdio.h>

! #include "ctype.h"

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

***************

*** 20,26 ****

  #include <signal.h>

  #include <pwd.h>

  #include <setjmp.h>

- #include <termio.h>

  #include "citadel.h"

  

  #define IFEXPERT if (usersupp.flags&US_EXPERT)

--- 20,25 ----

***************

*** 47,53 ****

  	a=setjmp(nextbuf);

  	sttybbs(0);

  	if ((a==1)||(a==2)) {

! 		printf("\n\n");

  		return(a);

  		}

  	signal(SIGINT,(*backnext));

--- 46,52 ----

  	a=setjmp(nextbuf);

  	sttybbs(0);

  	if ((a==1)||(a==2)) {

! 		printf("\n\r\n\r");

  		return(a);

  		}

  	signal(SIGINT,(*backnext));

***************

*** 63,68 ****

--- 62,68 ----

  struct smreturn *retbuf;	/* return information */

  {

  

+ unsigned char ab;

  int file,a,c,d,file2;

  long bb,cc,templen,hibytes,origpos;

  char sbuf[BUFSIZ];

***************

*** 116,122 ****

  d=read(file2,sbuf,3);

  write(file,sbuf,d);

  write(file,mid,strlen(mid));

! d=0; write(file,&d,1);

  do {

  	d=read(file2,sbuf,BUFSIZ);

  	write(file,sbuf,d);

--- 116,122 ----

  d=read(file2,sbuf,3);

  write(file,sbuf,d);

  write(file,mid,strlen(mid));

! ab=0; write(file,&d,sizeof(ab));

  do {

  	d=read(file2,sbuf,BUFSIZ);

  	write(file,sbuf,d);

***************

*** 151,157 ****

  int mode;		/* 0 for normal, 1 for ASCII */

  { 

  	FILE *fp;

! 	int a,b,old;

  	long aa,beg,now;

  	char aaa[100],bbb[100]; 

  

--- 151,158 ----

  int mode;		/* 0 for normal, 1 for ASCII */

  { 

  	FILE *fp;

! 	unsigned char a,b,old;

! 	int bb;

  	long aa,beg,now;

  	char aaa[100],bbb[100]; 

  

***************

*** 161,170 ****

  	putc(type,fp);	/* Normal or anonymous, see MES_ flags */

  	putc(mode,fp);	/* Formatted or unformatted */

  	strcpy(aaa,author->fullname);

! 	for (a=0; a<strlen(aaa); ++a) {

! 		aaa[a]=tolower(aaa[a]);

! 		if (aaa[a]==32) aaa[a]='_';

! 		if (aaa[a]=='!') strcpy(&aaa[a],&aaa[a+1]);

  		}

  	fprintf(fp,"P%s",aaa); putc(0,fp);			/* path */

  	fprintf(fp,"T%ld",now); putc(0,fp);			/* date/time */

--- 162,171 ----

  	putc(type,fp);	/* Normal or anonymous, see MES_ flags */

  	putc(mode,fp);	/* Formatted or unformatted */

  	strcpy(aaa,author->fullname);

! 	for (bb=0; bb<strlen(aaa); ++bb) {

! 		aaa[bb]=tolower(aaa[bb]);

! 		if (aaa[bb]==32) aaa[bb]='_';

! 		if (aaa[bb]=='!') strcpy(&aaa[bb],&aaa[bb+1]);

  		}

  	fprintf(fp,"P%s",aaa); putc(0,fp);			/* path */

  	fprintf(fp,"T%ld",now); putc(0,fp);			/* date/time */

***************

*** 175,184 ****

  	fflush(fp);

  	msgform(usersupp.screenwidth,0L,filename);

  	putc('M',fp);

! 	if (mode==1) printf("(Press ctrl-d when finished)\n");

  	beg=ftell(fp); old=1;

  	if (mode==1) goto ME2;

  ME1:	a=inkey(); a=(a&127);

  	aa=ftell(fp);

  	if ((a==8)&&(aa>beg)) {

  		back(1); fseek(fp,-1L,1); goto ME1; }

--- 176,188 ----

  	fflush(fp);

  	msgform(usersupp.screenwidth,0L,filename);

  	putc('M',fp);

! 	if (mode==1) printf("(Press ctrl-d when finished)\n\r");

  	beg=ftell(fp); old=1;

  	if (mode==1) goto ME2;

  ME1:	a=inkey(); a=(a&127);

+ #ifdef BSD

+ 	if (a==10) a=13;

+ #endif

  	aa=ftell(fp);

  	if ((a==8)&&(aa>beg)) {

  		back(1); fseek(fp,-1L,1); goto ME1; }

***************

*** 198,209 ****

  MECR:	putc(0,fp); fseek(fp,-1L,1); fflush(fp);

  	printf("<A>bort <C>ontinue <P>rint <S>ave -> ");

  MECR2:	b=inkey(); b=(b&127); b=tolower(b);

! 	if (b=='a') { printf("Abort\n");	goto MEABT; }

! 	if (b=='c') { printf("Continue\n");

  		if (mode==0) goto ME1;

  		if (mode==1) goto ME2; }

! 	if (b=='s') { printf("Save buffer\n"); goto MEFIN; } 

! 	if (b=='p') { printf("Print formatted\n");

  		msgform(usersupp.screenwidth,0L,filename);

  		goto MECR; }

  	goto MECR2;

--- 202,213 ----

  MECR:	putc(0,fp); fseek(fp,-1L,1); fflush(fp);

  	printf("<A>bort <C>ontinue <P>rint <S>ave -> ");

  MECR2:	b=inkey(); b=(b&127); b=tolower(b);

! 	if (b=='a') { printf("Abort\n\r");	goto MEABT; }

! 	if (b=='c') { printf("Continue\n\r");

  		if (mode==0) goto ME1;

  		if (mode==1) goto ME2; }

! 	if (b=='s') { printf("Save buffer\n\r"); goto MEFIN; } 

! 	if (b=='p') { printf("Print formatted\n\r");

  		msgform(usersupp.screenwidth,0L,filename);

  		goto MECR; }

  	goto MECR2;

***************

*** 240,251 ****

  	fseek(fp,spos,0);

  	e=getc(fp);

  	if (e!=255) {

! 		printf("*** CANNOT LOCATE MESSAGE / pos=%ld\n",spos);

  		goto END;

  		}

  	mtype=getc(fp); aflag=getc(fp);

! 	printf("\n   ");

! 	if (mtype==MES_ANON) printf("****\n");

  	if (mtype==MES_AN2) printf("<anonymous> ");

  	goto BONFGM;

  A:	if (aflag==1) goto AFLAG;

--- 244,255 ----

  	fseek(fp,spos,0);

  	e=getc(fp);

  	if (e!=255) {

! 		printf("*** CANNOT LOCATE MESSAGE / pos=%ld\n\r",spos);

  		goto END;

  		}

  	mtype=getc(fp); aflag=getc(fp);

! 	printf("\n\r   ");

! 	if (mtype==MES_ANON) printf("****\n\r");

  	if (mtype==MES_AN2) printf("<anonymous> ");

  	goto BONFGM;

  A:	if (aflag==1) goto AFLAG;

***************

*** 255,273 ****

  	

  	if ( ((a==13)||(a==10)) && (old!=13) && (old!=10) ) a=32;

  	if ( ((old==13)||(old==10)) && ((real==32)||(real==13)||(real==10))) {

! 						printf("\n"); c=1; }

  	if (a!=32) {

  	if ( ((strlen(aaa)+c)>(width-4)) && (strlen(aaa)>(width-4)) )

! 		{ printf("\n%s",aaa); c=strlen(aaa); aaa[0]=0; }

  	 b=strlen(aaa); aaa[b]=a; aaa[b+1]=0; }

  	if (a==32) { 	if ((strlen(aaa)+c)>(width-5)) { 

! 							printf("\n");

  							c=1;

  							}

  			printf("%s ",aaa); ++c; c=c+strlen(aaa);

  			strcpy(aaa,""); goto A; }

  	if ((a==13)||(a==10)) {

! 				printf("%s\n",aaa); c=1;

  				strcpy(aaa,""); goto A; }

  	goto A;

  

--- 259,277 ----

  	

  	if ( ((a==13)||(a==10)) && (old!=13) && (old!=10) ) a=32;

  	if ( ((old==13)||(old==10)) && ((real==32)||(real==13)||(real==10))) {

! 						printf("\n\r"); c=1; }

  	if (a!=32) {

  	if ( ((strlen(aaa)+c)>(width-4)) && (strlen(aaa)>(width-4)) )

! 		{ printf("\n\r%s",aaa); c=strlen(aaa); aaa[0]=0; }

  	 b=strlen(aaa); aaa[b]=a; aaa[b+1]=0; }

  	if (a==32) { 	if ((strlen(aaa)+c)>(width-5)) { 

! 							printf("\n\r");

  							c=1;

  							}

  			printf("%s ",aaa); ++c; c=c+strlen(aaa);

  			strcpy(aaa,""); goto A; }

  	if ((a==13)||(a==10)) {

! 				printf("%s\n\r",aaa); c=1;

  				strcpy(aaa,""); goto A; }

  	goto A;

  

***************

*** 277,288 ****

  	goto AFLAG;

  

  END:	fclose(fp);

! 	printf("\n");

  	return(0);

  

  BONFGM:	b=getc(fp); if (b<0) goto END;

  	if (b=='M') {

! 		printf("\n");

  		goto A;

  		}

  	fpgetfield(fp,bbb);

--- 281,292 ----

  	goto AFLAG;

  

  END:	fclose(fp);

! 	printf("\n\r");

  	return(0);

  

  BONFGM:	b=getc(fp); if (b<0) goto END;

  	if (b=='M') {

! 		printf("\n\r");

  		goto A;

  		}

  	fpgetfield(fp,bbb);

***************

*** 321,328 ****

  long spos;			/* position in master file */

  char *flnm;			/* file to write to */

  {

! 	int a,b,c;

! 	int file,file2;

  	long cc;

  	char field[512];

  	char fwork[512];

--- 325,332 ----

  long spos;			/* position in master file */

  char *flnm;			/* file to write to */

  {

! 	unsigned char b,c;

! 	int file,file2,a;

  	long cc;

  	char field[512];

  	char fwork[512];

***************

*** 332,348 ****

  	lseek(file,spos,0);

  

  	for (a=0; a<3; ++a) {

! 		read(file,&b,1);

! 		write(file2,&b,1);

  		}

! PI:	b=0; read(file,&b,1);

  	if (b=='M') {

! 		write(file2,&b,1);

  		goto B;

  		}

  	getfield(file,field);

  	if (b!='I') {

! 		write(file2,&b,1);

  		write(file2,field,strlen(field)+1);

  		}

  	goto PI;

--- 336,352 ----

  	lseek(file,spos,0);

  

  	for (a=0; a<3; ++a) {

! 		read(file,&b,sizeof(b));

! 		write(file2,&b,sizeof(b));

  		}

! PI:	b=0; read(file,&b,sizeof(b));

  	if (b=='M') {

! 		write(file2,&b,sizeof(b));

  		goto B;

  		}

  	getfield(file,field);

  	if (b!='I') {

! 		write(file2,&b,sizeof(b));

  		write(file2,field,strlen(field)+1);

  		}

  	goto PI;

***************

*** 349,356 ****

  

  B:	cc=lseek(file,0L,1);

  C:	if (cc>=MM_FILELEN) cc=lseek(file,0L,0);

! 	c=0; read(file,&c,1); ++cc;

! 	write(file2,&c,1);

  	if (c!=0) goto C;

  

  	close(file); close(file2);

--- 353,360 ----

  

  B:	cc=lseek(file,0L,1);

  C:	if (cc>=MM_FILELEN) cc=lseek(file,0L,0);

! 	c=0; read(file,&c,sizeof(c)); ++cc;

! 	write(file2,&c,sizeof(c));

  	if (c!=0) goto C;

  

  	close(file); close(file2);

",O_RDONLY);	/* check to make sure the */

  	aa=finduser(file,buf);			/* user exists; also get  */

  	if (aa==(-1)) {				/* the right upper/lower  */

! 		printf("No such user.\n\r");	/* casing of the name     */

  		close(file);

  		goto MAIN; }

  	read(file,&tempUS,sizeof(struct usersupp));

***************

***Drooms.c   644    465   1770       40415  4472360470   5624 *** ORIG/rooms.c	Wed Aug  9 15:36:51 1989

--- rooms.c	Wed Aug 16 14:20:22 1989

***************

*** 2,8 ****

  

  #include <fcntl.h>

  #include <stdio.h>

! #include <ctype.h>

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

--- 2,8 ----

  

  #include <fcntl.h>

  #include <stdio.h>

! #include "ctype.h"

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

***************

*** 10,16 ****

  #include <signal.h>

  #include <pwd.h>

  #include <setjmp.h>

- #include <termio.h>

  #include "citadel.h"

  

  #define IFEXPERT if (usersupp.flags&US_EXPERT)

--- 10,15 ----

***************

*** 36,42 ****

  	struct quickroom QRscratch;

  

  	b=1;

! 	printf("\n   Rooms with unread messages:\n");

  	file=open("./quickroom",O_RDONLY); if (file<0) return(1);

  	for (a=0; a<MAXROOMS; ++a) {

  		c=read(file,&QRscratch,sizeof(struct quickroom));

--- 35,41 ----

  	struct quickroom QRscratch;

  

  	b=1;

! 	printf("\n\r   Rooms with unread messages:\n\r");

  	file=open("./quickroom",O_RDONLY); if (file<0) return(1);

  	for (a=0; a<MAXROOMS; ++a) {

  		c=read(file,&QRscratch,sizeof(struct quickroom));

***************

*** 59,74 ****

  

  		) {

  		if (d>=(USgiven->screenwidth)) {

! 			printf("\n"); b=1; }

  		c=room_prompt(&QRscratch);

  		printf("%s%c  ",QRscratch.QRname,c);

  		b=b+strlen(QRscratch.QRname)+3;

  		}

  	} 

! 	if (b!=1) printf("\n");

  

  	b=1;

! 	printf("\n   No unseen messages in:\n");

  	lseek(file,0L,0);

  	for (a=0; a<MAXROOMS; ++a) {

  		c=read(file,&QRscratch,sizeof(struct quickroom));

--- 58,73 ----

  

  		) {

  		if (d>=(USgiven->screenwidth)) {

! 			printf("\n\r"); b=1; }

  		c=room_prompt(&QRscratch);

  		printf("%s%c  ",QRscratch.QRname,c);

  		b=b+strlen(QRscratch.QRname)+3;

  		}

  	} 

! 	if (b!=1) printf("\n\r");

  

  	b=1;

! 	printf("\n\r   No unseen messages in:\n\r");

  	lseek(file,0L,0);

  	for (a=0; a<MAXROOMS; ++a) {

  		c=read(file,&QRscratch,sizeof(struct quickroom));

***************

*** 91,103 ****

  		) {

  		d=strlen(QRscratch.QRname)+3+b;

  		if (d>=(USgiven->screenwidth)) {

! 			printf("\n"); b=1; }

  		c=room_prompt(&QRscratch);

  		printf("%s%c  ",QRscratch.QRname,c);

  		b=b+strlen(QRscratch.QRname)+3;

  		}

  	}

! 	if (b!=1) printf("\n");

  

  	close(file);

  	return(0);

--- 90,102 ----

  		) {

  		d=strlen(QRscratch.QRname)+3+b;

  		if (d>=(USgiven->screenwidth)) {

! 			printf("\n\r"); b=1; }

  		c=room_prompt(&QRscratch);

  		printf("%s%c  ",QRscratch.QRname,c);

  		b=b+strlen(QRscratch.QRname)+3;

  		}

  	}

! 	if (b!=1) printf("\n\r");

  

  	close(file);

  	return(0);

***************

*** 110,116 ****

  	struct quickroom QRscratch;

  

  	b=1;

! 	printf("\n   Forgotten public rooms:\n");

  	file=open("./quickroom",O_RDONLY); if (file<0) return(1);

  	for (a=0; a<MAXROOMS; ++a) {

  		c=read(file,&QRscratch,sizeof(struct quickroom));

--- 109,115 ----

  	struct quickroom QRscratch;

  

  	b=1;

! 	printf("\n\r   Forgotten public rooms:\n\r");

  	file=open("./quickroom",O_RDONLY); if (file<0) return(1);

  	for (a=0; a<MAXROOMS; ++a) {

  		c=read(file,&QRscratch,sizeof(struct quickroom));

***************

*** 126,138 ****

  		) {

  		d=b+strlen(QRscratch.QRname)+3;

  		if (d>=(USgiven->screenwidth)) {

! 			printf("\n"); b=1; }

  		c=room_prompt(&QRscratch);

  		printf("%s%c  ",QRscratch.QRname,c);

  		b=b+strlen(QRscratch.QRname)+3;

  		}

  	} 

! 	if (b!=1) printf("\n");

  	close(file);

  	return(0);

  }

--- 125,137 ----

  		) {

  		d=b+strlen(QRscratch.QRname)+3;

  		if (d>=(USgiven->screenwidth)) {

! 			printf("\n\r"); b=1; }

  		c=room_prompt(&QRscratch);

  		printf("%s%c  ",QRscratch.QRname,c);

  		b=b+strlen(QRscratch.QRname)+3;

  		}

  	} 

! 	if (b!=1) printf("\n\r");

  	close(file);

  	return(0);

  }

***************

*** 142,157 ****

  	char aaa[50]; long aa;

  	struct usersupp tempUS;

  

  	if (curr_rm<3) {

! 		printf("Can't edit this room.\n");

  		return(0);

  		}

  	file=open("quickroom",O_RDWR);

  	if (file<0) interr(34);

  	lseek(file,(long)(curr_rm*sizeof(struct quickroom)),0);

  	a=read(file,&quickroom,sizeof(struct quickroom));

  	if (a<1) interr(35);

! 	printf("Room name is currently: %s\n",quickroom.QRname);

  	printf("New name <return=same>? ");

  	getline(aaa,19);

  	if (aaa[0]!=0) strcpy(quickroom.QRname,aaa);

--- 141,164 ----

  	char aaa[50]; long aa;

  	struct usersupp tempUS;

  

+ #ifdef TWITDETECT

+ 	if (curr_rm<4) {

+ 		printf("Can't edit this room.\n\r");

+ 		return(0);

+ 	}

+ #else

  	if (curr_rm<3) {

! 		printf("Can't edit this room.\n\r");

  		return(0);

  		}

+ #endif

+ 

  	file=open("quickroom",O_RDWR);

  	if (file<0) interr(34);

  	lseek(file,(long)(curr_rm*sizeof(struct quickroom)),0);

  	a=read(file,&quickroom,sizeof(struct quickroom));

  	if (a<1) interr(35);

! 	printf("Room name is currently: %s\n\r",quickroom.QRname);

  	printf("New name <return=same>? ");

  	getline(aaa,19);

  	if (aaa[0]!=0) strcpy(quickroom.QRname,aaa);

***************

*** 163,178 ****

  	printf(" room");

  	if ((quickroom.QRflags&QR_PASSWORDED)==QR_PASSWORDED)

  			printf(", password: %s",quickroom.QRpasswd);

! 	printf(".\n");

! if (quickroom.QRflags&QR_PREFONLY) printf("PREFERRED USERS ONLY.\n");

  if (quickroom.QRflags&QR_DIRECTORY) {

  	printf("Directory room");

  	if (quickroom.QRflags&QR_UPLOAD) printf(", uploading allowed");

  	if (quickroom.QRflags&QR_DOWNLOAD) printf(", downloading allowed");

  	if (quickroom.QRflags&QR_VISDIR) printf(", visible directory");

! 	printf(".\nDirectory name: %s\n",quickroom.QRdirname); }

  if (quickroom.QRflags&QR_ANONONLY)

! 	printf("Anonymous-only room.\n");

  

  quickroom.QRflags=(quickroom.QRflags|QR_PRIVATE|QR_PASSWORDED|QR_GUESSNAME);

  quickroom.QRflags=(quickroom.QRflags|QR_DIRECTORY|QR_UPLOAD|QR_DOWNLOAD);

--- 170,185 ----

  	printf(" room");

  	if ((quickroom.QRflags&QR_PASSWORDED)==QR_PASSWORDED)

  			printf(", password: %s",quickroom.QRpasswd);

! 	printf(".\n\r");

! if (quickroom.QRflags&QR_PREFONLY) printf("PREFERRED USERS ONLY.\n\r");

  if (quickroom.QRflags&QR_DIRECTORY) {

  	printf("Directory room");

  	if (quickroom.QRflags&QR_UPLOAD) printf(", uploading allowed");

  	if (quickroom.QRflags&QR_DOWNLOAD) printf(", downloading allowed");

  	if (quickroom.QRflags&QR_VISDIR) printf(", visible directory");

! 	printf(".\n\rDirectory name: %s\n\r",quickroom.QRdirname); }

  if (quickroom.QRflags&QR_ANONONLY)

! 	printf("Anonymous-only room.\n\r");

  

  quickroom.QRflags=(quickroom.QRflags|QR_PRIVATE|QR_PASSWORDED|QR_GUESSNAME);

  quickroom.QRflags=(quickroom.QRflags|QR_DIRECTORY|QR_UPLOAD|QR_DOWNLOAD);

***************

*** 182,188 ****

  	do {

  		b=inkey()-48;

  		} while ((b<1)||(b>4));

! 	printf("%d\n",b);

  	if (b!=2) quickroom.QRflags=(quickroom.QRflags-QR_GUESSNAME);

  	if (b!=3) quickroom.QRflags=(quickroom.QRflags-QR_PASSWORDED);

  	if (b==1) quickroom.QRflags=(quickroom.QRflags-QR_PRIVATE);

--- 189,195 ----

  	do {

  		b=inkey()-48;

  		} while ((b<1)||(b>4));

! 	printf("%d\n\r",b);

  	if (b!=2) quickroom.QRflags=(quickroom.QRflags-QR_GUESSNAME);

  	if (b!=3) quickroom.QRflags=(quickroom.QRflags-QR_PASSWORDED);

  	if (b==1) quickroom.QRflags=(quickroom.QRflags-QR_PRIVATE);

***************

*** 215,221 ****

  	do {

  		a=inkey()-48;

  		} while((a<1)||(a>3));

! 	printf("%d\n",a);

  if ((a==1)||(a==3)) quickroom.QRflags=(quickroom.QRflags-QR_ANONONLY);

  if ((a==1)||(a==2)) quickroom.QRflags=(quickroom.QRflags-QR_ANON2);

  RANSU:	file2=open("usersupp",O_RDONLY);	/* (gee, thanks a lot!) */

--- 222,228 ----

  	do {

  		a=inkey()-48;

  		} while((a<1)||(a>3));

! 	printf("%d\n\r",a);

  if ((a==1)||(a==3)) quickroom.QRflags=(quickroom.QRflags-QR_ANONONLY);

  if ((a==1)||(a==2)) quickroom.QRflags=(quickroom.QRflags-QR_ANON2);

  RANSU:	file2=open("usersupp",O_RDONLY);	/* (gee, thanks a lot!) */

***************

*** 224,233 ****

  			a=read(file2,&tempUS,sizeof(struct usersupp));

  			} while((a>0)&&(quickroom.QRroomaide!=tempUS.eternal));

  		close(file2);

! 		if (a>0) printf("Room aide is currently: %s\nNew ",

  			tempUS.fullname);

  		}

! 	else printf("No room aide.\n");

  	printf("Room aide (RETURN to leave unchanged): ");

  	getline(aaa,29);

  	if (aaa[0]!=0) {

--- 231,240 ----

  			a=read(file2,&tempUS,sizeof(struct usersupp));

  			} while((a>0)&&(quickroom.QRroomaide!=tempUS.eternal));

  		close(file2);

! 		if (a>0) printf("Room aide is currently: %s\n\rNew ",

  			tempUS.fullname);

  		}

! 	else printf("No room aide.\n\r");

  	printf("Room aide (RETURN to leave unchanged): ");

  	getline(aaa,29);

  	if (aaa[0]!=0) {

***************

*** 236,245 ****

  		read(file2,&tempUS,sizeof(struct usersupp));

  		close(file2);

  		if (aa==(-1L)) {

! 			printf("No such user.\n"); goto RANSU; }

  		quickroom.QRroomaide=tempUS.eternal;

  		}

! 	printf("\n\nSave changes (y/n)? ");

  	if (yesno()==0) {

  		lseek(file,(long)(curr_rm*sizeof(struct quickroom)),0);

  		b=read(file,&quickroom,sizeof(struct quickroom));

--- 243,252 ----

  		read(file2,&tempUS,sizeof(struct usersupp));

  		close(file2);

  		if (aa==(-1L)) {

! 			printf("No such user.\n\r"); goto RANSU; }

  		quickroom.QRroomaide=tempUS.eternal;

  		}

! 	printf("\n\r\n\rSave changes (y/n)? ");

  	if (yesno()==0) {

  		lseek(file,(long)(curr_rm*sizeof(struct quickroom)),0);

  		b=read(file,&quickroom,sizeof(struct quickroom));

***************

*** 287,293 ****

--- 294,304 ----

  	sprintf(bbb,"files/%s/%s",quickroom.QRdirname,aaa);

  	if (c==0) formout(bbb);

  	if (c==1) {

+ #ifdef BSD

+ 		sprintf(aaa,"download %s",bbb);

+ #else

  		sprintf(aaa,"wcsend %s",bbb);

+ #endif

  		system(aaa);

  		}

  	if (c==2) {

***************

*** 296,306 ****

  		sprintf(aaa,"cat <%s",bbb);

  		system(aaa);

  		sttybbs(0);

  		unlink("core");	/* just in case the core was dumped */

  		}

  	}

  	else

! 		printf("Not in this room.\n");

  	return(0);

  }

  

--- 307,320 ----

  		sprintf(aaa,"cat <%s",bbb);

  		system(aaa);

  		sttybbs(0);

+ #ifdef BSD

+ 		signal(SIGQUIT,SIG_IGN);

+ #endif

  		unlink("core");	/* just in case the core was dumped */

  		}

  	}

  	else

! 		printf("Not in this room.\n\r");

  	return(0);

  }

  

***************

*** 309,319 ****

  	if ((quickroom.QRflags&QR_DIRECTORY)

  	   &&(quickroom.QRflags&QR_VISDIR)) {

  		sprintf(aaa,"./files/%s",quickroom.QRdirname);

! 		printf("Directory of %s!%s/%s\n",NODENAME,BBSDIR,&aaa[2]);

  		directory(aaa);

  		}

  	else

! 		printf("Not in this room.\n");

  	return(0);

  }

  

--- 323,333 ----

  	if ((quickroom.QRflags&QR_DIRECTORY)

  	   &&(quickroom.QRflags&QR_VISDIR)) {

  		sprintf(aaa,"./files/%s",quickroom.QRdirname);

! 		printf("Directory of %s!%s/%s\n\r",NODENAME,BBSDIR,&aaa[2]);

  		directory(aaa);

  		}

  	else

! 		printf("Not in this room.\n\r");

  	return(0);

  }

  

***************

*** 323,329 ****

  	long aa;

  	struct usersupp USscratch;

  	if ((quickroom.QRflags&QR_PRIVATE)==0) {

! 		printf("Not a private room.\n");

  		return(0);

  		}

  	printf("Name of user? ");

--- 337,343 ----

  	long aa;

  	struct usersupp USscratch;

  	if ((quickroom.QRflags&QR_PRIVATE)==0) {

! 		printf("Not a private room.\n\r");

  		return(0);

  		}

  	printf("Name of user? ");

***************

*** 339,345 ****

  		USscratch.forget[curr_rm]=(-1);

  		write(file,&USscratch,sizeof(struct usersupp));

  		}

! 	else	printf("No such user.\n");

  	close(file);

  	return(0);

  

--- 353,359 ----

  		USscratch.forget[curr_rm]=(-1);

  		write(file,&USscratch,sizeof(struct usersupp));

  		}

! 	else	printf("No such user.\n\r");

  	close(file);

  	return(0);

  

***************

*** 351,357 ****

  	long aa;

  	struct usersupp USscratch;

  	if ((quickroom.QRflags&QR_PRIVATE)==0) {

! 		printf("Not a private room.\n");

  		return(0);

  		}

  	printf("Name of user? ");

--- 365,371 ----

  	long aa;

  	struct usersupp USscratch;

  	if ((quickroom.QRflags&QR_PRIVATE)==0) {

! 		printf("Not a private room.\n\r");

  		return(0);

  		}

  	printf("Name of user? ");

***************

*** 365,371 ****

  		USscratch.generation[curr_rm]=(-1);

  		write(file,&USscratch,sizeof(struct usersupp));

  		}

! 	else	printf("No such user.\n");

  	close(file);

  	return(0);

  }

--- 379,385 ----

  		USscratch.generation[curr_rm]=(-1);

  		write(file,&USscratch,sizeof(struct usersupp));

  		}

! 	else	printf("No such user.\n\r");

  	close(file);

  	return(0);

  }

***************

*** 374,380 ****

  	int file;

  	long aa;

  	char aaa[100];

! 	if (curr_rm<3) { printf("Can't kill this room.\n"); return(0); }

  	printf("Are you sure you want to kill this room? ");

  	if (yesno()==0) return(0);

  	file=open("quickroom",O_RDWR); if (file<0) interr(42);

--- 388,398 ----

  	int file;

  	long aa;

  	char aaa[100];

! #ifdef TWITDETECT

! 	if (curr_rm<4) { printf("Can't kill this room.\n\r"); return(0); }

! #else

! 	if (curr_rm<3) { printf("Can't kill this room.\n\r"); return(0); }

! #endif

  	printf("Are you sure you want to kill this room? ");

  	if (yesno()==0) return(0);

  	file=open("quickroom",O_RDWR); if (file<0) interr(42);

***************

*** 392,402 ****

  }

  

  forget() {	/* forget the current room */

  	if (curr_rm<3) {

! 		printf("Cannot forget this room.\n");

  		return(0);

  		}

! 	IFAIDE { printf("Aides cannot forget rooms.\n"); return(0); }

  	printf("Are you sure you want to forget this room? ");

  	if (yesno()==0) return(0);

  	readyerself();

--- 410,427 ----

  }

  

  forget() {	/* forget the current room */

+ #ifdef TWITDETECT

  	if (curr_rm<3) {

! 		printf("Cannot forget this room.\n\r");

  		return(0);

  		}

! #else

! 	if (curr_rm<3) {

! 		printf("Cannot forget this room.\n\r");

! 		return(0);

! 		}

! #endif

! 	IFAIDE { printf("Aides cannot forget rooms.\n\r"); return(0); }

  	printf("Are you sure you want to forget this room? ");

  	if (yesno()==0) return(0);

  	readyerself();

***************

*** 415,421 ****

  	struct quickroom QRscratch;

  

  	if (usersupp.axlevel<3) {

! 		printf("You need higher access to create rooms.\n");

  		return(0);

  		}

  

--- 440,446 ----

  	struct quickroom QRscratch;

  

  	if (usersupp.axlevel<3) {

! 		printf("You need higher access to create rooms.\n\r");

  		return(0);

  		}

  

***************

*** 432,438 ****

  			&& (!strucmp(QRscratch.QRname,aaa)) ) b=1; }

  	close(file);

  	if (b==1) {

! 		printf("'%s' already exists.\n",aaa);

  		return(0); }

  	bb=(-1L);	

  	file=open("quickroom",O_RDONLY); if (file<0) interr(64);

--- 457,463 ----

  			&& (!strucmp(QRscratch.QRname,aaa)) ) b=1; }

  	close(file);

  	if (b==1) {

! 		printf("'%s' already exists.\n\r",aaa);

  		return(0); }

  	bb=(-1L);	

  	file=open("quickroom",O_RDONLY); if (file<0) interr(64);

***************

*** 444,470 ****

  		}

  	close(file);

  	if (bb==(-1L)) {

! 		printf("No room space available.\n");

  		return(0);

  		}

  	IFNEXPERT formout("messages/roomaccess");

! ACSEL:	printf("<?>Help\n<1>Public room\n<2>Guess-name room\n");

! 	printf("<3>Passworded room\n<4>Invitation-only room\n");

  	printf("Enter room type: ");

  ACSE2:	b=inkey(); b=tolower(b);

! 	if (b=='?') { printf("?\n");

  		formout("messages/roomaccess"); goto ACSEL; }

  	b=b-48;

  	if ((b<1)||(b>4)) goto ACSE2;

  	if (b==3) {

! 		printf("Enter a room password: ");

! 		getline(bbb,9); }

! 	printf("%d\n\042%s\042, a",b,aaa);

! 	if (b==1) printf(" public room.");

! 	if (b==2) printf(" guess-name room.");

! 	if (b==3) printf(" passworded room, password: %s",bbb);

! 	if (b==4) printf("n invitation-only room.");

! 	printf("\nInstall it? (y/n) : ");

  	a=yesno();

  	if (a==0) return(0);

  	curr_rm=(int)(bb/sizeof(struct quickroom)); 

--- 469,495 ----

  		}

  	close(file);

  	if (bb==(-1L)) {

! 		printf("No room space available.\n\r");

  		return(0);

  		}

  	IFNEXPERT formout("messages/roomaccess");

! ACSEL:	printf("<?>Help\n\r<1>Public room\n\r<2>Guess-name room\n\r");

! 	printf("<3>Passworded room\n\r<4>Invitation-only room\n\r");

  	printf("Enter room type: ");

  ACSE2:	b=inkey(); b=tolower(b);

! 	if (b=='?') { printf("?\n\r");

  		formout("messages/roomaccess"); goto ACSEL; }

  	b=b-48;

  	if ((b<1)||(b>4)) goto ACSE2;

+ 	printf("%d\n\r\042%s\042, a",b,aaa);

+ 	if (b==1) printf(" public room.\n\r");

+ 	if (b==2) printf(" guess-name room.\n\r");

  	if (b==3) {

! 		printf(" pasworded room.");

! 		printf("  Enter a room password: ");

! 		getline(bbb,9); } 

! 	if (b==4) printf("n invitation-only room.\n\r");

! 	printf("Install it? (y/n) : ");

  	a=yesno();

  	if (a==0) return(0);

  	curr_rm=(int)(bb/sizeof(struct quickroom)); 

***************

*** 548,554 ****

     			||	(quickroom.QRgen==(temp.generation[curr_rm]))

     			)

  

! 		) printf("%s\n",temp.fullname);

  	close(file);

  	return(0);

  }

--- 573,579 ----

     			||	(quickroom.QRgen==(temp.generation[curr_rm]))

     			)

  

! 		) printf("%s\n\r",temp.fullname);

  	close(file);

  	return(0);

  }

if (aaa[0]!=0) {

***************

*** 236,245 ****

  		read(file2,&tempUS,sizeof(struct usersupp));

  		close(file2);

  		if (aa==(-1L)) {

! 			printf("No such user.\n"); goto RANSU; }

  		quickroom.QRroomaide=tempUS.eternal;

  		}

! 	printf("\Droutines.c   644    465   1770       26001  4472360470   6330 *** ORIG/routines.c	Wed Aug  9 15:44:42 1989

--- routines.c	Tue Aug 15 14:59:02 1989

***************

*** 2,8 ****

  

  #include <fcntl.h>

  #include <stdio.h>

! #include <ctype.h>

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

--- 2,8 ----

  

  #include <fcntl.h>

  #include <stdio.h>

! #include "ctype.h"

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

***************

*** 10,16 ****

--- 10,21 ----

  #include <signal.h>

  #include <pwd.h>

  #include <setjmp.h>

+ #ifdef BSD

+ #include <sys/dir.h>

+ #include <sgtty.h>

+ #else

  #include <termio.h>

+ #endif

  

  #define ROUTINES_C

  

***************

*** 53,60 ****

  int a;

  	while (1) {

  		a=inkey(); a=tolower(a);

! 		if (a=='y') { printf("Yes\n"); return(1); }

! 		if (a=='n') { printf("No\n");  return(0); }

  		}

  	}

  

--- 58,65 ----

  int a;

  	while (1) {

  		a=inkey(); a=tolower(a);

! 		if (a=='y') { printf("Yes\n\r"); return(1); }

! 		if (a=='n') { printf("No\n\r");  return(0); }

  		}

  	}

  

***************

*** 61,77 ****

  edituser(structure)

  struct usersupp *structure; {

  	int a,b;

! do {	printf("Current access level: %d [%s]\n",structure->axlevel,

  		axdefs[structure->axlevel]);

  	printf("New level (? to list them): ");

  	a=inkey();

  	if (a=='?') {

! 		printf("list\n");

! 		for (b=0; b<7; ++b) printf("%d %s\n",b,axdefs[b]);

  		}

  	a=a-48;

  	} while((a<0)||(a>6));

! 	printf("%d\n",a);

  	structure->axlevel=a;

  	return(0);

  	}

--- 66,82 ----

  edituser(structure)

  struct usersupp *structure; {

  	int a,b;

! do {	printf("Current access level: %d [%s]\n\r",structure->axlevel,

  		axdefs[structure->axlevel]);

  	printf("New level (? to list them): ");

  	a=inkey();

  	if (a=='?') {

! 		printf("list\n\r");

! 		for (b=0; b<7; ++b) printf("%d %s\n\r",b,axdefs[b]);

  		}

  	a=a-48;

  	} while((a<0)||(a>6));

! 	printf("%d\n\r",a);

  	structure->axlevel=a;

  	return(0);

  	}

***************

*** 83,89 ****

  		printf("Enter your screen width: ");

  		getline(aaa,3); a=atoi(aaa);

  		if ((a<20)||(a>132))

! 			printf("...must be between 20 and 132.\n");

  		} while((a<20)||(a>132));

  	structure->screenwidth=a;

  	printf("Are you an experienced Citadel user? ");

--- 88,94 ----

  		printf("Enter your screen width: ");

  		getline(aaa,3); a=atoi(aaa);

  		if ((a<20)||(a>132))

! 			printf("...must be between 20 and 132.\n\r");

  		} while((a<20)||(a>132));

  	structure->screenwidth=a;

  	printf("Are you an experienced Citadel user? ");

***************

*** 103,109 ****

  

  getfield(file,string)		/* Break out next null-terminated string */

  int file; char string[]; {

! int a,b,c;

  	strcpy(string,"");

  	a=0;

  	do {

--- 108,115 ----

  

  getfield(file,string)		/* Break out next null-terminated string */

  int file; char string[]; {

! int a,b;

! unsigned char c;

  	strcpy(string,"");

  	a=0;

  	do {

***************

*** 116,122 ****

  

  getstring(file,string)		/* get a line of text from a file */

  int file; char string[]; {	/* ignores lines beginning with # */

! int a,b,c;

  do {

  	strcpy(string,"");

  	a=0;

--- 122,129 ----

  

  getstring(file,string)		/* get a line of text from a file */

  int file; char string[]; {	/* ignores lines beginning with # */

! int a,b;

! unsigned char c;

  do {

  	strcpy(string,"");

  	a=0;

***************

*** 145,159 ****

  

  interr(errnum)	/* display internal error as defined in errmsgs */

  int errnum; {

! 	printf("INTERNAL ERROR %d\n",errnum);

! 	printf("(Press any key to continue)\n");

  	inkey();

  	logoff(errnum);

  }

  

  directory(path)

  char *path;

  {

  	struct directx {

  		int d_ino;

  		char d_name[15];

--- 152,205 ----

  

  interr(errnum)	/* display internal error as defined in errmsgs */

  int errnum; {

! 	printf("INTERNAL ERROR %d\n\r",errnum);

! 	printf("(Press any key to continue)\n\r");

  	inkey();

  	logoff(errnum);

  }

  

+ #ifdef BSD

  directory(path)

  char *path;

  {

+ struct direct *dp;

+ struct stat statbuf;

+ struct filecomment filecomment;

+ DIR *dirp;

+ char fname[20],tname[50];

+ int file,a;

+ long aa;

+ 	if ((dirp = opendir(path)) == NULL) return(1);

+ 	printf("   Filename      Size\n");

+ 	printf("-------------- --------\n");

+ 	sprintf(tname,"%s/filedir",path);

+ 	file=open(tname,O_RDONLY);

+ 	while ((dp = readdir(dirp)) != NULL) {

+ 		if (*dp->d_name == '.') continue;

+ 		strcpy(fname,dp->d_name);

+ 		if (strcmp("filedir",fname)==0) continue;

+ 		sprintf(tname,"%s/%s",path,fname);

+ 		stat(tname,&statbuf); aa=(long)statbuf.st_size;

+ 		if (file >= 0) {

+ 			lseek(file,0L,0);

+ 			do {

+ 			a=read(file,&filecomment,sizeof(struct filecomment));

+ 			} while ((a>0)&&(strucmp(filecomment.FCname,fname)));

+ 		} else a=0;

+ 

+ 		if (a<1)

+ 			filecomment.FCcomment[0]=0;

+ 		printf("%-14s %8ld %s\n",fname,aa,filecomment.FCcomment);

+ 	}

+ 	close(file);

+ 	closedir(dirp);

+ 	return(0);

+ }

+ #else

+ directory(path)

+ char *path;

+ {

+ 

  	struct directx {

  		int d_ino;

  		char d_name[15];

***************

*** 164,170 ****

  	FILE *fp;

  if ((fd=open(path,0))==(-1)) return(1);

  dlink.d_name[14]=0;

! printf("-----------------------\n");

  read(fd,&dlink,16); read(fd,&dlink,16);

  while ((nread=read(fd,&dlink,16)) > 0)

  	{

--- 210,216 ----

  	FILE *fp;

  if ((fd=open(path,0))==(-1)) return(1);

  dlink.d_name[14]=0;

! printf("-----------------------\n\r");

  read(fd,&dlink,16); read(fd,&dlink,16);

  while ((nread=read(fd,&dlink,16)) > 0)

  	{

***************

*** 184,195 ****

  			} while(!feof(fp));

  FND:		fclose(fp);

  		}

! printf("%-14s %8ld %s\n",dlink.d_name,aa,&comment[strlen(dlink.d_name)+1]);

  	}

  	}

  	close(fd);

  	return(0);

  }

  

  fpgetfield(fp,string)	/* level-2 break out next null-terminated string */

  FILE *fp;

--- 230,242 ----

  			} while(!feof(fp));

  FND:		fclose(fp);

  		}

! printf("%-14s %8ld %s\n\r",dlink.d_name,aa,&comment[strlen(dlink.d_name)+1]);

  	}

  	}

  	close(fd);

  	return(0);

  }

+ #endif

  

  fpgetfield(fp,string)	/* level-2 break out next null-terminated string */

  FILE *fp;

***************

*** 219,225 ****

  	

  	fp=fopen(flname,"rb");

  	if (fp==NULL) {

! 			printf("No file %s.\n",flname);

  			return(1); }

  

  	strcpy(aaa,""); old=255;

--- 266,272 ----

  	

  	fp=fopen(flname,"rb");

  	if (fp==NULL) {

! 			printf("\n\rNo file %s.\n\r",flname);

  			return(1); }

  

  	strcpy(aaa,""); old=255;

***************

*** 230,255 ****

  	

  	if ( ((a==13)||(a==10)) && (old!=13) && (old!=10) ) a=32;

  	if ( ((old==13)||(old==10)) && (isspace(real)) ) {

! 						printf("\n"); c=1; }

  	if (a>126) goto FMTA;

  

  	if (a>32) {

  	if ( ((strlen(aaa)+c)>(width-5)) && (strlen(aaa)>(width-5)) )

! 		{ printf("\n%s",aaa); c=strlen(aaa); aaa[0]=0; }

  	 b=strlen(aaa); aaa[b]=a; aaa[b+1]=0; }

  	if (a==32) { 	if ((strlen(aaa)+c)>(width-5)) { 

! 							printf("\n");

  							c=1;

  							}

  			printf("%s ",aaa); ++c; c=c+strlen(aaa);

  			strcpy(aaa,""); goto FMTA; }

  	if ((a==13)||(a==10)) {

! 				printf("%s\n",aaa); c=1;

  				strcpy(aaa,""); goto FMTA; }

  	goto FMTA;

  

  FMTEND:	fclose(fp);

! 	printf("\n");

  	return(0);

  }

  

--- 277,302 ----

  	

  	if ( ((a==13)||(a==10)) && (old!=13) && (old!=10) ) a=32;

  	if ( ((old==13)||(old==10)) && (isspace(real)) ) {

! 						printf("\n\r"); c=1; }

  	if (a>126) goto FMTA;

  

  	if (a>32) {

  	if ( ((strlen(aaa)+c)>(width-5)) && (strlen(aaa)>(width-5)) )

! 		{ printf("\n\r%s",aaa); c=strlen(aaa); aaa[0]=0; }

  	 b=strlen(aaa); aaa[b]=a; aaa[b+1]=0; }

  	if (a==32) { 	if ((strlen(aaa)+c)>(width-5)) { 

! 							printf("\n\r");

  							c=1;

  							}

  			printf("%s ",aaa); ++c; c=c+strlen(aaa);

  			strcpy(aaa,""); goto FMTA; }

  	if ((a==13)||(a==10)) {

! 				printf("%s\n\r",aaa); c=1;

  				strcpy(aaa,""); goto FMTA; }

  	goto FMTA;

  

  FMTEND:	fclose(fp);

! 	printf("\n\r");

  	return(0);

  }

  

***************

*** 293,300 ****

--- 340,370 ----

  	return(0);

  }

  

+ 

+ #ifdef BSD

  sttybbs(sflag) 

  int sflag;{

+ struct sgttyb live;

+ struct tchars special;

+ 

+ 	ioctl(0,TIOCGETP,&live);

+ 	live.sg_flags= CBREAK | CRMOD ;

+ 	if (sflag==1) {

+ 		printf("\n\r");

+ 		ioctl(0,TIOCFLUSH);

+ 	}

+ 	ioctl(0,TIOCSETP,&live);

+ /*

+ 	ioctl(0,TIOCGETC,&special);

+ 	special.t_intrc= -1;

+ 	special.t_quitc= -1;

+ 	ioctl(0,TIOCSETC,&special);

+ */

+ 	return(0);

+ }

+ #else

+ sttybbs(sflag) 

+ int sflag;{

  struct termio live;

  	ioctl(0,TCGETA,&live);

  	live.c_iflag=ISTRIP|IXON|IXANY;

***************

*** 313,318 ****

--- 383,389 ----

  	ioctl(0,TCSETA,&live);

  	return(0);

  }

+ #endif

  

  long finduser(file,name)	/* binary search for a user */

  int file;

***************

*** 345,354 ****

  	int file,a,b;

  	time(&record->CLtime);

  	file=open("calllog.pos",O_RDWR);

! 	read(file,&a,2);

  	b=a; ++a; if (a==CALLLOG) a=0;

  	lseek(file,0L,0);

! 	write(file,&a,2);

  	close(file);

  

  	file=open("calllog",O_RDWR);

--- 416,425 ----

  	int file,a,b;

  	time(&record->CLtime);

  	file=open("calllog.pos",O_RDWR);

! 	read(file,&a,sizeof(a));

  	b=a; ++a; if (a==CALLLOG) a=0;

  	lseek(file,0L,0);

! 	write(file,&a,sizeof(a));

  	close(file);

  

  	file=open("calllog",O_RDWR);

***************

*** 358,366 ****

--- 429,454 ----

  	return(0);

  }

  

+ 

+ #ifdef BSD

  log_carr()		/* use rec_log to record the connection */

  {

  	struct calllog temp;

+ 	struct sgttyb stty;

+ 	strcpy(temp.CLfullname,ttyname(0));

+ 	temp.CLflags=CL_INOTHER;

+ 	ioctl(0,TIOCGETP,&stty);

+ 	if ((stty.sg_ispeed&B300)==B300)	temp.CLflags=CL_IN300;

+ 	if ((stty.sg_ispeed&B1200)==B1200)	temp.CLflags=CL_IN1200;

+ 	if ((stty.sg_ispeed&B2400)==B2400)	temp.CLflags=CL_IN2400;

+ 	if ((stty.sg_ispeed&B9600)==B9600)	temp.CLflags=CL_INOTHER;

+ 	rec_log(&temp);

+ 	return(0);

+ }

+ #else

+ log_carr()		/* use rec_log to record the connection */

+ {

+ 	struct calllog temp;

  	struct termio stty;

  	strcpy(temp.CLfullname,ttyname(0));

  	temp.CLflags=CL_INOTHER;

***************

*** 372,377 ****

--- 460,466 ----

  	rec_log(&temp);

  	return(0);

  }

+ #endif

  

  alias(name)		/* process alias and routing info for mail */

  char name[]; {

***************

*** 399,411 ****

  	if (strucmp(name,aaa)) goto GNA;

  	fclose(fp);

  	strcpy(name,bbb);

! 	printf("*** Mail is being forwarded to %s\n",name);

  

  DETYPE:	/* determine local or remote type, see citadel.h */

  	for (a=0; a<strlen(name); ++a) if (name[a]=='!') return(M_UUCP);

  	b=0; for (a=0; a<strlen(name); ++a) if (name[a]=='@') ++b;

  	if (b>1) {

! 		printf("Too many @'s in address\n");

  		return(M_ERROR);

  		}

  	if (b==1) {

--- 488,500 ----

  	if (strucmp(name,aaa)) goto GNA;

  	fclose(fp);

  	strcpy(name,bbb);

! 	printf("*** Mail is being forwarded to %s\n\r",name);

  

  DETYPE:	/* determine local or remote type, see citadel.h */

  	for (a=0; a<strlen(name); ++a) if (name[a]=='!') return(M_UUCP);

  	b=0; for (a=0; a<strlen(name); ++a) if (name[a]=='@') ++b;

  	if (b>1) {

! 		printf("Too many @'s in address\n\r");

  		return(M_ERROR);

  		}

  	if (b==1) {

***************

*** 433,439 ****

  			sprintf(name,"%s @%s",aaa,bbb);

  			return(M_BINARY);

  			}

! 		printf("Error in network/mail.sysinfo file\n");

  		return(M_ERROR);

  		}

  	return(M_LOCAL);

--- 522,528 ----

  			sprintf(name,"%s @%s",aaa,bbb);

  			return(M_BINARY);

  			}

! 		printf("Error in network/mail.sysinfo file\n\r");

  		return(M_ERROR);

  		}

  	return(M_LOCAL);

("   Filename      Size\n");

+ 	printf("-------------- --------\n");

+ 	sprintf(tname,"%s/filedir",path);

+ 	file=open(tname,O_RDONLY);

+ 	while ((dp = readdir(dirp)) != NULL) {

+ 		if (*dp->d_name == '.') continue;

+ 		strcpy(fname,dp->d_name);

+ 		if (strcmp("filedir",fname)==0) continue;

+ 		sprintf(tname,"%s/%s",path,fname);

+ 		stat(tname,&statbuf); aa=(long)statbuf.st_size;

+ 		if (file >= 0) {

+ 			lseek(file,0L,0);

+ 			do {

+ 			a=read(file,&filecomment,sizeof(struct filecomment));

+ 			} while ((Droutines2.c   644    465   1770       23127  4472360471   6421 *** ORIG/routines2.c	Wed Aug  9 15:45:21 1989

--- routines2.c	Wed Aug 16 13:28:02 1989

***************

*** 4,10 ****

  

  #include <fcntl.h>

  #include <stdio.h>

! #include <ctype.h>

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

--- 4,10 ----

  

  #include <fcntl.h>

  #include <stdio.h>

! #include "ctype.h"

  #include <time.h>

  #include <sys/types.h>

  #include <sys/stat.h>

***************

*** 12,18 ****

  #include <signal.h>

  #include <pwd.h>

  #include <setjmp.h>

- #include <termio.h>

  #include "citadel.h"

  

  long atol();

--- 12,17 ----

***************

*** 82,88 ****

  			b=strlen(regis.RGphone);

  			regis.RGphone[b]=pbuf[a]; regis.RGphone[b+1]=0;

  			}

! 	printf("\n");

  	f=fork();			/* register in the background */

  	if (f<0) {

  		fprintf(stderr,"citadel: cannot fork-registration not filed\n");

--- 81,87 ----

  			b=strlen(regis.RGphone);

  			regis.RGphone[b]=pbuf[a]; regis.RGphone[b+1]=0;

  			}

! 	printf("\n\r");

  	f=fork();			/* register in the background */

  	if (f<0) {

  		fprintf(stderr,"citadel: cannot fork-registration not filed\n");

***************

*** 132,137 ****

--- 131,139 ----

  	if (lim<0) { lim=(0-lim); flag=1; }

  	strcpy(string,"");

  GLA:	a=inkey(); a=(a&127);

+ #ifdef BSD

+ 	if (a==10) a=13;

+ #endif

  	if ((a==8)&&(strlen(string)==0)) goto GLA;

  	if ((a!=13)&&(a!=8)&&(strlen(string)==lim)) goto GLA;

  	if ((a==8)&&(string[0]!=0)) {

***************

*** 152,158 ****

  	int file,a,b;

  	char aaa[100];

  	if (curr_rm==1) {

! 		printf("Can't delete mail.\n");

  		return(1); }

  	sprintf(aaa,"./rooms/fullrm%d",curr_rm);

  	file=eopen(aaa,O_RDWR);

--- 154,160 ----

  	int file,a,b;

  	char aaa[100];

  	if (curr_rm==1) {

! 		printf("Can't delete mail.\n\r");

  		return(1); }

  	sprintf(aaa,"./rooms/fullrm%d",curr_rm);

  	file=eopen(aaa,O_RDWR);

***************

*** 178,236 ****

  	b=write(file,&quickroom,sizeof(struct quickroom));

  	if (b<1) interr(83);

  	close(file);

! 	printf("Message deleted.\n");

  	return(0);

  }

  

  

  upload(c)	/* c = upload mode */

! int c; {

  	char buf[151],aaa[100],bbb[60],ccc[60];

! 	int a,b,file;

! 	long cc;

  	FILE *fp;

  

  	if ( ((quickroom.QRflags&QR_DIRECTORY)==0)

  		|| ((quickroom.QRflags&QR_UPLOAD)==0) ) {

! 			printf("Not in this room.\n");

  			return(1);

  			}

  

  	printf("Enter filename: ");

  	getline(aaa,15);

! 	for (a=0; a<strlen(aaa); ++a) aaa[a]=tolower(aaa[a]);

  	sprintf(bbb,"./files/%s/%s",quickroom.QRdirname,aaa);

! 	file=open(bbb,O_RDONLY);

! 	if (file>(-1)) {

! 		printf("There already is a file by that name.\n");

! 		close(file); return(1); }

! 	printf("Enter a short description of the file:\n: ");

! 	getline(buf,150);

! 	sprintf(ccc,"./files/%s/filedir",quickroom.QRdirname);

! 	fp=fopen(ccc,"r+");

! 	if (fp==NULL) fp=fopen(ccc,"w");

! 	fseek(fp,0L,2);

! 	fprintf(fp,"%s %s\n",aaa,buf);

! 	fclose(fp);

! 	file=creat(bbb,0666);

! 	if (file<0) {

! 		printf("Can't create that file?\n");

! 		return(1); }

! 	if (c>0) {

! 		close(file);

! 		goto ETUX;

  		}

! 	a=0;

! 	printf("Now recieving. ESC to end.\n");

! 	do {

! 		b=inkey(); 

! 		if (b==13) { b=10; printf("\r"); }

! 		if (b!=27) { printf("%c",b); write(file,&b,1); }

  		} while(b!=27);

  	close(file);

! ETPRF:	printf("File recieved.\n");

  	time(&cc);			/* put together an upload notice */

! 	fp=fopen(temp,"wb"); if (fp==NULL) interr(22);

  	putc(255,fp);

  	putc(MES_NORMAL,fp);

  	putc(0,fp);

--- 180,276 ----

  	b=write(file,&quickroom,sizeof(struct quickroom));

  	if (b<1) interr(83);

  	close(file);

! 	printf("Message deleted.\n\r");

  	return(0);

  }

  

  

  upload(c)	/* c = upload mode */

! int c;

! {

! 	struct stat statbuf;

! 	struct filecomment filecomment;

  	char buf[151],aaa[100],bbb[60],ccc[60];

! 	unsigned char b;

! 	int file,a;

! 	long aa,cc;

  	FILE *fp;

  

  	if ( ((quickroom.QRflags&QR_DIRECTORY)==0)

  		|| ((quickroom.QRflags&QR_UPLOAD)==0) ) {

! 			printf("Not in this room.\n\r");

  			return(1);

  			}

  

  	printf("Enter filename: ");

  	getline(aaa,15);

! 	for (a=0; a<strlen(aaa); ++a) {

! 		if (isupper(aaa[a])) aaa[a]=tolower(aaa[a]);

! 		if (aaa[a]<48)  aaa[a]='_';

! 		if (aaa[a]>122) aaa[a]='_';

! 		if ((aaa[a]>57) && (aaa[a]<65)) aaa[a]='_';

! 	}

  	sprintf(bbb,"./files/%s/%s",quickroom.QRdirname,aaa);

! 

! 	if (stat(bbb,&statbuf) == 0) {

! 		printf("There already is a file by that name.\n\r");

! 		return(1);

! 	}

! 	if (c==0) {

! 		file=creat(bbb,0666);

! 		if (file<0) {

! 			printf("Can't create that file?\n\r");

! 			return(1);

  		}

! 		a=0;

! 		printf("Now recieving. ESC to end.\n\r");

! 		do {

! 			b=inkey(); 

! 			if (b==13) { b=10; printf("\r"); }

! 			if (b!=27) { printf("%c",b); write(file,&b,sizeof(b)); }

  		} while(b!=27);

+ 		close(file);

+ 	}

+ 	if (c==1) {

+ #ifdef BSD

+ 		sprintf(ccc,"upload %s",bbb);

+ #else

+ 		sprintf(ccc,"wcreceive %s",bbb);

+ #endif

+ 		system(ccc);

+ 	}

+ 

+ 	stat(bbb,&statbuf);

+ 	aa=(long)statbuf.st_size;

+ 	if (aa==0) {

+ 		printf("\n\rFile was not recieved.\n\r");

+ 		sprintf(ccc,"rm %s",bbb);

+ 		system(ccc);

+ 		return(1);

+ 	}

+ 	printf("\n\rFile recieved.\n\r");

+ 

+ REASK:	printf("Enter a short description of the file:\n\r: ");

+ 	getline(buf,150);

+ 	if (strlen(buf) < 9) goto REASK;

+ 

+ 	bzero(filecomment.FCname,sizeof(filecomment.FCname));

+ 	bzero(filecomment.FCcomment,sizeof(filecomment.FCcomment));

+ 	strcpy(filecomment.FCname,aaa);

+ 	strcpy(filecomment.FCcomment,buf);

+ 

+ 	sprintf(ccc,"./files/%s/filedir",quickroom.QRdirname);

+ 	file=open(ccc,O_RDWR);

+ 	if (file<0)

+ 		file=creat(ccc,0644);

+ 	lseek(file,0L,2);

+ 	write(file,&filecomment,sizeof(struct filecomment));

  	close(file);

! 

  	time(&cc);			/* put together an upload notice */

! 	fp=fopen(temp,"wb");

! 	if (fp==NULL)

! 		interr(22);

  	putc(255,fp);

  	putc(MES_NORMAL,fp);

  	putc(0,fp);

***************

*** 244,255 ****

  	fclose(fp);

  	save_message(temp,buf,0,M_LOCAL);

  	return(0);

- 

- ETUX:	if (c==1) {

- 		sprintf(ccc,"wcreceive %s",bbb);

- 		system(ccc);

- 		}

- 	goto ETPRF;

  }

  

  move_message(pos)

--- 284,289 ----

***************

*** 309,315 ****

  	read(file,&MMtemp,sizeof(struct msgmain));

  	close(file);

  	if ((MMtemp.MMflags&MM_VALID)==0) {

! 		printf("There are no unvalidated users.\n");

  		return(0);

  		}

  	do {

--- 343,349 ----

  	read(file,&MMtemp,sizeof(struct msgmain));

  	close(file);

  	if ((MMtemp.MMflags&MM_VALID)==0) {

! 		printf("There are no unvalidated users.\n\r");

  		return(0);

  		}

  	do {

***************

*** 325,347 ****

  	file=eopen("usersupp",O_RDWR);

  	while(read(file,&UStemp,sizeof(struct usersupp))>0) {

  		if (UStemp.axlevel==1) {

! 			printf("\n\n\nUser #%-5ld %s ",

  			       UStemp.eternal,UStemp.fullname);

! 			if (usersupp.screenwidth<=40) printf("\n");

  			pwcrypt(UStemp.password,PWCRYPT);

! 			printf("PW: %s\n",UStemp.password);

  			dis_regis(&UStemp);

  			printf("Access level (? for list): ");

  			do {

  				a=inkey();

  				if (a=='?') {

! 					printf("list\n");

  					for (b=0; b<7; ++b)

! 						printf("%d %s\n",b,axdefs[b]);

  					}

  				a=a-48;

  				} while((a<0)||(a>6));

! 			printf("%d\n",a);

  			UStemp.axlevel=a;

  			pwcrypt(UStemp.password,PWCRYPT);

  			lseek(file,(0L-sizeof(struct usersupp)),1);

--- 359,381 ----

  	file=eopen("usersupp",O_RDWR);

  	while(read(file,&UStemp,sizeof(struct usersupp))>0) {

  		if (UStemp.axlevel==1) {

! 			printf("\n\r\n\r\n\rUser #%-5ld %s ",

  			       UStemp.eternal,UStemp.fullname);

! 			if (usersupp.screenwidth<=40) printf("\n\r");

  			pwcrypt(UStemp.password,PWCRYPT);

! 			printf("PW: %s\n\r",UStemp.password);

  			dis_regis(&UStemp);

  			printf("Access level (? for list): ");

  			do {

  				a=inkey();

  				if (a=='?') {

! 					printf("list\n\r");

  					for (b=0; b<7; ++b)

! 						printf("%d %s\n\r",b,axdefs[b]);

  					}

  				a=a-48;

  				} while((a<0)||(a>6));

! 			printf("%d\n\r",a);

  			UStemp.axlevel=a;

  			pwcrypt(UStemp.password,PWCRYPT);

  			lseek(file,(0L-sizeof(struct usersupp)),1);

***************

*** 349,355 ****

  			}

  		}

  	close(file);

! 	printf("\n*** End of registration.\n");

  	return(0);

  	}

  

--- 383,389 ----

  			}

  		}

  	close(file);

! 	printf("\n\r*** End of registration.\n\r");

  	return(0);

  	}

  

***************

*** 359,365 ****

  	int a,b,file;

  	char pbuf[20];

  	if (!((userdata->flags)&US_REGIS)) {

! 		printf("No registration online.\n");

  		return(1);

  		}

  	file=open("registration",O_RDONLY);

--- 393,399 ----

  	int a,b,file;

  	char pbuf[20];

  	if (!((userdata->flags)&US_REGIS)) {

! 		printf("No registration online.\n\r");

  		return(1);

  		}

  	file=open("registration",O_RDONLY);

***************

*** 366,374 ****

  	if (file<0) return(2);

  	while(read(file,&regis,sizeof(struct registration))>0) {

  		if (userdata->eternal==regis.RGeternal) {

! 			printf("%-29s\n",regis.RGname);

! 			printf("%-29s\n",regis.RGaddr);

! 			printf("%-14s %2s %6s\n",

  				regis.RGcity,regis.RGstate,regis.RGzip);

  			strcpy(pbuf,regis.RGphone);

  			regis.RGphone[0]=0;

--- 400,408 ----

  	if (file<0) return(2);

  	while(read(file,&regis,sizeof(struct registration))>0) {

  		if (userdata->eternal==regis.RGeternal) {

! 			printf("%-29s\n\r",regis.RGname);

! 			printf("%-29s\n\r",regis.RGaddr);

! 			printf("%-14s %2s %6s\n\r",

  				regis.RGcity,regis.RGstate,regis.RGzip);

  			strcpy(pbuf,regis.RGphone);

  			regis.RGphone[0]=0;

***************

*** 385,391 ****

  				strcat(regis.RGphone,pbuf);

  				}

  

! 			printf("(%c%c%c) %c%c%c-%c%c%c%c\n",

  				regis.RGphone[0],regis.RGphone[1],

  				regis.RGphone[2],regis.RGphone[3],

  				regis.RGphone[4],regis.RGphone[5],

--- 419,425 ----

  				strcat(regis.RGphone,pbuf);

  				}

  

! 			printf("(%c%c%c) %c%c%c-%c%c%c%c\n\r",

  				regis.RGphone[0],regis.RGphone[1],

  				regis.RGphone[2],regis.RGphone[3],

  				regis.RGphone[4],regis.RGphone[5],

 { 

! 							printf("\n");

  							c=1;

  							}

  			printf("%s ",aaa); ++c; c=c+strlen(aaa);

  			strcpy(aaa,""); goto FMTA; }

  	if ((a==13)||(a==10)) {

! 				printf("%s\n",aaa); c=1;

  				strcpy(aaa,""); goto FMTA; }

  	goto FMTA;

  

  FMTEND:	fclose(fp);

! 	printf("\n");

  	return(0);

  }

  

--- 277,302 ----

  	

  	if ( ((a==13)||(a==10)) && (old!=13) && (old!=10) ) a=32;

  	if ( ((old==13)||(old==10)) && (isspac		b=inkey(); 

! 		if (b==13) { b=10; printf("\r"); }

! 		if (b!=27) { printf("%c",b); write(file,&b,1); }

  		} while(b!=27);

  	close(file);

! ETPRF:	printf("File recieved.\n");

  	time(&cc);			/* put together an upload notice */

! 	fp=fopen(temp,"wb"); if (fp==NULL) interr(22);

  	putc(255,fp);

  	putc(MES_NORMAL,fp);

  	putc(0,fp);

--- 180,276 ----

  	b=write(file,&quickroom,sizeof(struct quickroom));

  	if (b<1) interr(83);

  	close(file);

! 	printf("Message deleted.\n\r");

  	return(0);

  }

  

  

  upload(c)	/* c = upload mode */

! int c;

! {

! 	struct stat statbuf;

! 	struct filecomment filecomment;

  	char buf[151],aaa[100],bbb[60],ccc[60];

! 	unsigned char b;

! 	int file,a;

! 	long aa,cc;

  	FILE *fp;

  

  	if ( ((quickroom.QRflags&QR_DIRECTORY)==0)

  		|| ((quickroom.QRflags&QR_UPLOAD)==0) ) {

! 			printf("Not in this room.\n\r");

  			return(1);

  			}

  

  	printf("Enter filename: ");

  	getline(aaa,15);

! 	for (a=0; a<strlen(aaa); ++a) {

! 		if (isupper(aaa[a])) aaa[a]=tolower(aaa[a]);

! 		if (aaa[a]<48)  aaa[a]='_';

! 		if (aaa[a]>122) aaa[a]='_';

! 		if ((aaa[a]>57) && (aaa[a]<65)) aaa[a]='_';

! 	}

  	sprintf(bbb,"./files/%s/%s",quickroom.QRdirname,aaa);

! 

! 	if (stat(bbb,&statbuf) == 0) {

! 		printf("There already is a file by that name.\n\r");

! 		return(1);

! 	}

! 	if (c==0) {

! 		file=creat(bbb,0666);

! 		if (file<0) {

! 			printf("Can't create that file?\n\r");

! 			return(1);

  		}

! 		a=0;

! 		printf("Now recieving. ESC to end.\n\r");

! 		do {

! 			b=inkey(); 

! 			if (b==13) { b=10; printf("\r"); }

! 			if (b!=27) { printf("%c",b); write(file,&b,sizeof(b)); }

  		} while(b!=27);

+ 		close(file);

+ 	}

+ 	if (c==1) {

+ #ifdef BSD

+ 		sprintf(ccc,"upload %s",bbb);

+ #else

+ 		sprintf(ccc,"wcreceive %s",bbb);

+ #endif

+ 		system(ccc);

+ 	}

+ 

+ 	stat(bbb,&statbuf);

+ 	aa=(long)statbuf.st_size;

+ 	if (aa==0) {

+ 		printf("\n\rFile was not recieved.\n\r");

+ 		sprintf(ccc,"rm %s",bbb);

+ 		system(ccc);

+ 		return(1);

+ 	}

+ 	printf("\n\rFile recieved.\n\r");

+ 

+ REASK:	printf("Enter a short description of the file:\n\r: ");

+ 	getline(buf,150);

+ 	if (strlen(buf) < 9) goto REASK;

+ 

+ 	bzero(filecomment.FCname,sizeof(filecomment.FCname));

+ 	bzero(filecomment.FCcomment,sizeof(filecomment.FCcomment));

+ 	strcpy(filecomment.FCname,aaa);

+ 	strcpy(filecomment.FCcomment,buf);

+ 

+ 	sprintf(ccc,"./files/%s/filedir",quickroom.QRdirname);

+ 	file=open(ccc,O_RDWR);

+ 	if (file<0)

+ 		file=creat(ccc,0644);

+ 	lseek(file,0L,2);

+ 	write(file,&filecomment,sizeof(struct filecomment));

  	close(file);

! 

  	time(&cc);			/* put together an upload notice */

! 	fp=fopen(temp,"wb");

! 	if (fp==NULL)

! 		interr(22);

  	putc(255,fp);

  	putc(MES_NORMAL,fp);

  	putc(0,fp);

***************

*** 244,255 ****

  	fclose(fp);

  	save_message(temp,buf,0,M_LOCAL);

  	return(0);

- 

- ETUX:	if (c==1) {

- 		sprintf(ccc,"wcreceive %s",bbb);

- 		system(ccc);

- 		}

- 	goto ETPRF;

  }

  

  move_message(pos)

--- 284,289 ----

***************

*** 309,315 ****

  	read(file,&MMtemp,sizeof(struct msgmain));

  	close(file);

  	if ((MMtemp.MMflags&MM_VALID)==0) {

! 		printf("There are no unvalidated users.\n");

  		return(0);

  		}

  	do {

--- 343,349 ----

  	read(file,&MMtemp,sizeof(struct msgmain));

  	close(file);

  	if ((MMtemp.MMflags&MM_VALID)==0) {

! 		printf("There are no unvalidated users.\n\r");

  		return(0);

  		}

  	do {

***************

*** 325,347 ****

  	file=eopen("usersupp",O_RDWR);

  	while(read(file,&UStemp,sizeof(struct usersupp))>0) {

  		if (UStemp.axlevel==1) {

! 			printf("\n\n\nUser #%-5ld %s ",

  			       UStemp.eternal,UStemp.fullname);

! 			if (usersupp.screenwidth<=40) printf("\n");

  			pwcrypt(UStemp.password,PWCRYPT);

! 			printf("PW: %s\n",UStemp.password);

  			dis_regis(&UStemp);

  			printf("Access level (? for list): ");

  			do {

  				a=inkey();

  				if (a=='?') {

! 					printf("list\n");

  					for (b=0; b<7; ++b)

! 						printf("%d %s\n",b,axdefs[b]);

  					}

  				a=a-48;

  				} while((a<0)||(a>6));

! 			printf("%d\n",a);

  			UStemp.axlevel=a;

  			pwcrypt(UStemp.password,PWCRYPT);

  			lseek(file,(0L-sizeof(struct usersupp)),1);

--- 359,381 ----

  	file=eopen("usersupp",O_RDWR);

  	while(read(file,&UStemp,sizeof(struct usersupp))>0) {

  		if (UStemp.axlevel==1) {

! 			printf("\n\r\n\r\n\rUser #%-5ld %s ",

  			       UStemp.eternal,UStemp.fullname);

! 			if (usersupp.screenwidth<=40) printf("\n\r");

  			pwcrypt(UStemp.password,PWCRYPT);

! 			printf("PW: %s\n\r",UStemp.password);

  			dis_regis(&UStemp);

  			printf("Access level (? for list): ");

  			do {

  				a=inkey();

  				if (a=='?') {

! 					printf("list\n\r");

  					for (b=0; b<7; ++b)

! 						printf("%d %s\n\r",b,axdefs[b]);

  					}

  				a=a-48;

  				} while((a<0)||(a>6));

! 			printf("%d\n\r",a);

  			UStemp.axlevel=a;

  			pwcrypt(UStemp.password,PWCRYPT);

  			lseek(file,(0L-sizeof(struct usersupp)),1);

***************

*** 349,355 ****

  			}

  		}

  	close(file);

! 	printf("\n*** End of registration.\n");

  	return(0);

  	}

  

--- 383,389 ----

  			}

  		}

  	close(file);

! 	printf("\n\r*** End of registration.\n\r");

  	return(0);

  	}

  

***************

*** 359,365 ****

  	int a,b,file;

  	char pbuf[20];

  	if (!((userdata->flags)&US_REGIS)) {

! 		printf("No registration online.\n");

  		return(1);

  		}

  	file=open("registration",O_RDONLY);

--- 393,399 ----

  	int a,b,file;

  	char pbuf[20];

  	if (!((userdata->flags)&US_REGIS)) {

! 		printf("No registration online.\n\r");

  		return(1);

  		}

  	file=open("registration",O_RDONLY);

***************

*** 366,374 ****

  	if (file<0) return(2);

  	while(read(file,&regis,sizeof(struct registration))>0) {

  		if (userdata->eternal==regis.RGeternal) {

! 			printf("%-29s\n",regis.RGname);

! 			printf("%-29s\n",regis.RGaddr);

! 			printf("%-14s %2s %6s\n",

  				regis.RGcity,regis.RGstate,regis.RGzip);

  			strcpy(pbuf,regis.RGphone);

  			regis.RGphone[0]=0;

--- 400,408 ----

  	if (file<0) return(2);

  	while(read(file,&regis,sizeof(struct registration))>0) {

  		if (userdata->eternal==regis.RGeternal) {

! 			printf("%-29s\n\r",regis.RGname);

! 			printf("%-29s\n\r",regis.RGaddr);

! 			printf("%-14s %2s %6s\n\r",

  				regis.RGcity,regis.RGstate,regis.RGzip);

  			strcpy(pbuf,regis.RGphone);

  			regis.RGphone[0]=0;

***************

*** 385,391 ****

  				strcat(regis.RGphone,pbuf);

  				}

  

! 			printf("(%c%c%c) %c%c%c-%c%c%c%c\n",

  				regis.RGphone[0],regis.RGphone[1],

  				regis.RGphone[2],regis.RGphone[3],

  				regis.RGphone[4],regis.RGphone[5],

--- 419,425 ----

  				strcat(regis.RGphone,pbuf);

  				}

  

! 			printf("(%c%c%c) %c%c%c-%c%c%c%c\n\r",

  				regis.RGphone[0],regis.RGphone[1],

  				regis.RGphone[2],regis.RGphone[3],

  				regis.RGphone[4],regis.RGphone[5],

 { 

! 							printf("\n");

  							c=1;

  							}

  			printf("%s ",aaa); ++c; c=c+strlen(aaa);

  			strcpy(aaa,""); goto FMTA; }

  	if ((a==13)||(a==10)) {

! 				printf("%s\n",aaa); c=1;

  				strcpy(aaa,""); goto FMTA; }

  	goto FMTA;

  

  FMTEND:	fclose(fp);

! 	printf("\n");

  	return(0);

  }

  

--- 277,302 ----

  	

  	if ( ((a==13)||(a==10)) && (old!=13) && (old!=10) ) a=32;

  	if ( ((old==13)||(old==10)) && (isspac
SHAR_EOF
fi
echo shar: "done with directory 'source'"
cd ..
exit 0
#	End of shell archive
-- 
     Some do, some don't.           |       eric at sactoh0.SAC.CA.US
    Some will, some won't.          |      ames!pacbell!sactoh0!eric
          I might!                  |      ucbvax!csusac!sactoh0!eric
                                    |     ( A Home For Unwanted 3B's )



More information about the Alt.sources mailing list