4 * citadel.c - Main source file.
16 #include <sys/types.h>
19 #include <sys/ioctl.h>
26 #include "serv_info.h"
28 #include "routines2.h"
33 #include "client_chat.h"
34 #include "citadel_decls.h"
43 #define IFEXPERT if (userflags&US_EXPERT)
44 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
45 #define IFAIDE if (axlevel>=6)
46 #define IFNAIDE if (axlevel<6)
48 struct march *march = NULL;
50 /* globals associated with the client program */
51 char temp[16]; /* Name of general temp file */
52 char temp2[16]; /* Name of general temp file */
53 char tempdir[16]; /* Name of general temp dir */
54 char editor_path[256]; /* path to external editor */
55 char printcmd[256]; /* print command */
56 int editor_pid = (-1);
59 struct CtdlServInfo serv_info; /* Info on the server connected */
64 char ugname[ROOMNAMELEN];
65 long uglsn; /* holds <u>ngoto info */
66 char is_mail = 0; /* nonzero when we're in a mail room */
67 char axlevel = 0; /* access level */
68 char is_room_aide = 0; /* boolean flag, 1 if room aide */
72 long usernum = 0L; /* user number */
74 long highest_msg_read; /* used for <A>bandon room cmd */
75 long maxmsgnum; /* used for <G>oto */
77 char have_xterm = 0; /* are we running on an xterm? */
82 char curr_floor = 0; /* number of current floor */
83 char floorlist[128][256]; /* names of floors */
84 char express_msgs = 0; /* express messages waiting! */
86 jmp_buf jmp_reconnect; /* for server reconnects */
90 void sigpipehandler(int nothing) {
91 longjmp(jmp_reconnect, nothing);
95 * here is our 'clean up gracefully and exit' routine
99 if (editor_pid>0) { /* kill the editor if it's running */
100 kill(editor_pid,SIGHUP);
103 /* shut down the server... but not if the logoff code is 3, because
104 * that means we're exiting because we already lost the server
106 if (code!=3) serv_puts("QUIT");
109 * now clean up various things
116 /* Violently kill off any child processes if Citadel is
120 kill(0-getpgrp(),SIGTERM);
122 kill(0-getpgrp(),SIGKILL);
125 sttybbs(SB_RESTORE); /* return the old terminal settings */
126 exit(code); /* exit with the proper exit code */
132 * We handle "next" and "stop" much differently than in earlier versions.
133 * The signal catching routine simply sets a flag and returns.
135 void sighandler(int which_sig)
137 signal(SIGINT,SIG_IGN);
138 signal(SIGQUIT,SIG_IGN);
139 sigcaught = which_sig;
145 * signal catching function for hangups...
147 void dropcarr(int signum) {
154 * catch SIGCONT to reset terminal modes when were are put back into the
157 void catch_sigcont(int signum) {
163 /* general purpose routines */
165 void formout(char *name) /* display a file */
169 snprintf(cmd,sizeof cmd,"MESG %s",name);
173 printf("%s\n",&cmd[4]);
176 fmout(screenwidth,NULL,
177 ((userflags & US_PAGINATOR) ? 1 : 0),
182 void userlist(void) {
192 printf("%s\n",&buf[4]);
196 sttybbs(SB_YES_INTR);
197 printf(" User Name Num L LastCall Calls Posts\n");
198 printf("------------------------- ----- - ---------- ----- -----\n");
199 while (serv_gets(buf), strcmp(buf,"000")) {
200 if (sigcaught == 0) {
203 printf("%5ld %d ",extract_long(buf,2),
205 lc = extract_long(buf,3);
206 tmbuf = (struct tm *)localtime(&lc);
207 printf("%02d/%02d/%04d ",
210 (tmbuf->tm_year + 1900));
211 printf("%5ld %5ld\n",extract_long(buf,4),extract_long(buf,5));
214 linecount = checkpagin(linecount,
215 ((userflags & US_PAGINATOR) ? 1 : 0),
226 * grab assorted info about the user...
228 void load_user_info(char *params)
230 extract(fullname,params,0);
231 axlevel = extract_int(params,1);
232 timescalled = extract_int(params,2);
233 posted = extract_int(params,3);
234 userflags = extract_int(params,4);
235 usernum = extract_long(params,5);
240 * Remove a room from the march list. 'floornum' is ignored unless
241 * 'roomname' is set to _FLOOR_, in which case all rooms on the requested
242 * floor will be removed from the march list.
244 void remove_march(char *roomname, int floornum)
246 struct march *mptr,*mptr2;
248 if (march==NULL) return;
250 if ( (!strucmp(march->march_name,roomname))
251 || ((!strucmp(roomname,"_FLOOR_"))&&(march->march_floor==floornum))) {
259 for (mptr=march; mptr!=NULL; mptr=mptr->next) {
261 if ( (!strucmp(mptr->march_name,roomname))
262 || ((!strucmp(roomname,"_FLOOR_"))
263 &&(mptr->march_floor==floornum))) {
265 mptr2->next = mptr->next;
276 * sort the march list by floor
278 void sort_march_list(void) {
279 struct march *mlist[129];
280 struct march *mptr = NULL;
283 if (march == NULL) return;
285 for (a=0; a<129; ++a) mlist[a] = NULL;
287 /* first, create 128 separate lists for each floor. */
288 while (march != NULL) {
290 a = (int)(march->march_floor);
292 /* assign an illegal floor number of 128 to _BASEROOM_
293 * in order to force it to show up last */
294 if (!strucmp(march->march_name,"_BASEROOM_")) a = 128;
298 mptr->next = mlist[a];
302 /* now merge the lists, in order, into one big list,
303 * except the current floor
305 for (a=128; a>=0; --a) if (a != curr_floor) {
306 while (mlist[a] != NULL) {
308 mlist[a] = mlist[a]->next;
314 /* now merge in rooms from the current floor */
315 while (mlist[(int)curr_floor] != NULL) {
316 mptr = mlist[(int)curr_floor];
317 mlist[(int)curr_floor] = mlist[(int)curr_floor]->next;
327 * jump directly to a room
329 void dotgoto(char *towhere, int display_name)
331 char aaa[256],bbb[256],psearch[256];
334 static int oldmailcount = (-1);
335 int partial_match,best_match;
338 /* store ungoto information */
339 strcpy(ugname,room_name);
342 /* first try an exact match */
343 snprintf(aaa,sizeof aaa,"GOTO %s",towhere);
346 if (aaa[3]=='*') express_msgs = 1;
347 if (!strncmp(aaa,"54",2)) {
348 newprompt("Enter room password: ",bbb,9);
349 snprintf(aaa,sizeof aaa,"GOTO %s|%s",towhere,bbb);
352 if (aaa[3]=='*') express_msgs = 1;
354 if (!strncmp(aaa,"54",2)) {
355 printf("Wrong password.\n");
361 * If a match is not found, try a partial match.
362 * Partial matches anywhere in the string carry a weight of 1,
363 * left-aligned matches carry a weight of 2. Pick the room that
364 * has the highest-weighted match.
371 if (aaa[0]=='1') while (serv_gets(aaa), strcmp(aaa,"000")) {
372 extract(psearch,aaa,0);
374 if (pattern(psearch,towhere)>=0) {
377 if (!struncmp(towhere,psearch,strlen(towhere))) {
380 if (partial_match > best_match) {
382 best_match = partial_match;
385 if (strlen(bbb)==0) {
386 printf("No room '%s'.\n",towhere);
389 snprintf(aaa,sizeof aaa,"GOTO %s",bbb);
392 if (aaa[3]=='*') express_msgs = 1;
400 extract(room_name,&aaa[4],0);
401 room_flags = extract_int(&aaa[4],4);
402 from_floor = curr_floor;
403 curr_floor = extract_int(&aaa[4],10);
405 remove_march(room_name,0);
406 if (!strucmp(towhere,"_BASEROOM_")) remove_march(towhere,0);
407 if ((from_floor!=curr_floor) && (display_name>0) && (floor_mode==1)) {
408 if (floorlist[(int)curr_floor][0]==0) load_floorlist();
409 printf("(Entering floor: %s)\n",&floorlist[(int)curr_floor][0]);
411 if (display_name == 1) printf("%s - ",room_name);
412 if (display_name != 2) printf("%d new of %d messages.\n",
413 extract_int(&aaa[4],1),
414 extract_int(&aaa[4],2));
415 highest_msg_read = extract_int(&aaa[4],6);
416 maxmsgnum = extract_int(&aaa[4],5);
417 is_mail = (char) extract_int(&aaa[4],7);
418 is_room_aide = (char) extract_int(&aaa[4],8);
419 ls = extract_long(&aaa[4],6);
421 /* read info file if necessary */
422 if (extract_int(&aaa[4],3) > 0) readinfo();
424 /* check for newly arrived mail if we can */
425 if (num_parms(&aaa[4])>=10) {
426 newmailcount = extract_int(&aaa[4],9);
427 if ( (oldmailcount >= 0) && (newmailcount > oldmailcount) )
428 printf("*** You have new mail\n");
429 oldmailcount = newmailcount;
433 /* Goto next room having unread messages.
434 * We want to skip over rooms that the user has already been to, and take the
435 * user back to the lobby when done. The room we end up in is placed in
436 * newroom - which is set to 0 (the lobby) initially.
438 void gotonext(void) {
440 struct march *mptr,*mptr2;
443 /* Check to see if the march-mode list is already allocated.
444 * If it is, pop the first room off the list and go there.
450 while (serv_gets(buf), strcmp(buf,"000")) {
451 mptr = (struct march *) malloc(sizeof(struct march));
453 extract(mptr->march_name,buf,0);
454 mptr->march_floor = (char) (extract_int(buf,2) & 0x7F);
460 while (mptr2->next != NULL)
466 /* add _BASEROOM_ to the end of the march list, so the user will end up
467 * in the system base room (usually the Lobby>) at the end of the loop
469 mptr = (struct march *) malloc(sizeof(struct march));
471 strcpy(mptr->march_name,"_BASEROOM_");
477 while (mptr2->next != NULL)
482 * ...and remove the room we're currently in, so a <G>oto doesn't make us
483 * walk around in circles
485 remove_march(room_name,0);
491 strcpy(next_room,march->march_name);
494 strcpy(next_room,"_BASEROOM_");
496 remove_march(next_room,0);
497 dotgoto(next_room,1);
501 * forget all rooms on a given floor
503 void forget_all_rooms_on(int ffloor)
506 struct march *flist,*fptr;
508 printf("Forgetting all rooms on %s...\r",&floorlist[ffloor][0]);
510 snprintf(buf,sizeof buf,"LKRA %d",ffloor);
514 printf("%-72s\n",&buf[4]);
518 while (serv_gets(buf), strcmp(buf,"000")) {
519 fptr = (struct march *) malloc(sizeof(struct march));
522 extract(fptr->march_name,buf,0);
524 while (flist != NULL) {
525 snprintf(buf,sizeof buf,"GOTO %s",flist->march_name);
536 printf("%-72s\r","");
541 * routine called by gotofloor() to move to a new room on a new floor
543 void gf_toroom(char *towhere, int mode)
545 int floor_being_left;
547 floor_being_left = curr_floor;
549 if (mode == GF_GOTO) { /* <;G>oto mode */
554 if (mode == GF_SKIP) { /* <;S>kip mode */
556 remove_march("_FLOOR_",floor_being_left);
559 if (mode == GF_ZAP) { /* <;Z>ap mode */
561 remove_march("_FLOOR_",floor_being_left);
562 forget_all_rooms_on(floor_being_left);
570 void gotofloor(char *towhere, int mode)
574 char buf[256],targ[256];
576 if (floorlist[0][0]==0) load_floorlist();
578 for (a=0; a<128; ++a) if (!strucmp(&floorlist[a][0],towhere))
582 for (a=0; a<128; ++a) {
583 if (!struncmp(&floorlist[a][0],towhere,strlen(towhere))) {
590 for (a=0; a<128; ++a)
591 if (pattern(towhere,&floorlist[a][0])>0)
596 printf("No floor '%s'.\n",towhere);
600 for (mptr = march; mptr != NULL; mptr = mptr->next) {
601 if ((mptr->march_floor) == tofloor)
602 gf_toroom(mptr->march_name,mode);
607 snprintf(buf,sizeof buf,"LKRA %d",tofloor);
610 if (buf[0]=='1') while (serv_gets(buf), strcmp(buf,"000")) {
611 if ((extract_int(buf,2)==tofloor)&&(strlen(targ)==0))
614 if (strlen(targ)>0) {
615 gf_toroom(targ,mode);
618 printf("There are no rooms on '%s'.\n",&floorlist[tofloor][0]);
624 * forget all rooms on current floor
626 void forget_this_floor(void) {
628 if (curr_floor == 0) {
629 printf("Can't forget this floor.\n");
633 if (floorlist[0][0]==0) load_floorlist();
634 printf("Are you sure you want to forget all rooms on %s? ",
635 &floorlist[(int)curr_floor][0]);
636 if (yesno()==0) return;
638 gf_toroom("_BASEROOM_",GF_ZAP);
643 * Figure out the physical screen dimensions, if we can
645 void check_screen_dims(void) {
648 unsigned short height; /* rows */
649 unsigned short width; /* columns */
650 unsigned short xpixels;
651 unsigned short ypixels; /* pixels */
654 if (have_xterm) { /* dynamically size screen if on an xterm */
655 if ( ioctl(0, TIOCGWINSZ, &xwinsz) == 0 ) {
656 if (xwinsz.height) screenheight = (int) xwinsz.height;
657 if (xwinsz.width) screenwidth = (int) xwinsz.width;
665 * set floor mode depending on client, server, and user settings
667 void set_floor_mode(void) {
668 if (serv_info.serv_ok_floors == 0) {
669 floor_mode = 0; /* Don't use floors if the server */
670 } /* doesn't support them! */
672 if (rc_floor_mode == RC_NO) { /* never use floors */
675 if (rc_floor_mode == RC_YES) { /* always use floors */
678 if (rc_floor_mode == RC_DEFAULT) { /* user choice */
679 floor_mode = ((userflags & US_FLOORS) ? 1 : 0);
685 * Set or change the user's password
687 int set_password(void) {
692 if (strlen(rc_password) > 0) {
693 strcpy(pass1,rc_password);
694 strcpy(pass2,rc_password);
697 IFNEXPERT formout("changepw");
698 newprompt("Enter a new password: ", pass1, -19);
699 newprompt("Enter it again to confirm: ", pass2, -19);
701 if (!strucmp(pass1,pass2)) {
702 snprintf(buf,sizeof buf,"SETP %s",pass1);
705 printf("%s\n",&buf[4]);
706 strcpy(re_password, pass1);
710 printf("*** They don't match... try again.\n");
718 * get info about the server we've connected to
720 void get_serv_info(void) {
723 CtdlInternalGetServInfo(&serv_info);
725 /* be nice and identify ourself to the server */
726 snprintf(buf,sizeof buf,"IDEN %d|%d|%d|%s|",
727 SERVER_TYPE,0,REV_LEVEL,
728 (server_is_local ? "local" : CITADEL));
729 locate_host(&buf[strlen(buf)]); /* append to the end */
731 serv_gets(buf); /* we don't care about the result code */
739 * Display list of users currently logged on to the server
741 void who_is_online(int longlist)
743 char buf[128], username[128], roomname[128], fromhost[128], flags[128];
744 char tbuf[128], clientsoft[128];
746 time_t idletime, idlehours, idlemins, idlesecs;
747 int last_session = (-1);
753 if (tbuf[0] == '2') {
754 timenow = extract_long(&tbuf[4], 0);
762 printf("FLG ### User Name Room From host\n");
764 printf("--- --- ------------------------- -------------------- ------------------------\n");
770 while(serv_gets(buf), strcmp(buf,"000"))
772 extract(username,buf,1);
773 extract(roomname,buf,2);
774 extract(fromhost,buf,3);
775 extract(clientsoft, buf, 4);
776 extract(flags,buf,7);
779 idletime = timenow - extract_long(buf, 5);
780 idlehours = idletime / 3600;
781 idlemins = (idletime - (idlehours*3600)) / 60;
782 idlesecs = (idletime - (idlehours*3600) - (idlemins*60) );
783 printf("\nFlags: %-3s Sess# %-3d Name: %-25s Room: %s\n",
784 flags, extract_int(buf,0), username, roomname);
785 printf("from <%s> using <%s>, idle %ld:%02ld:%02ld\n",
786 fromhost, clientsoft,
787 (long)idlehours, (long)idlemins, (long)idlesecs);
791 if (extract_int(buf,0)==last_session) {
795 color(1); printf("%-3s ", flags);
796 color(2); printf("%-3d ", extract_int(buf,0));
798 last_session=extract_int(buf,0);
799 color(3); printf("%-25s ", username);
800 color(4); printf("%-20s ", roomname);
801 color(5); printf("%-24s\n", fromhost);
808 void enternew(char *desc, char *buf, int maxlen)
811 snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc);
812 newprompt(bbb, buf, maxlen);
818 int main(int argc, char **argv)
821 char aaa[100],bbb[100],eee[100]; /* general purpose variables */
822 char argbuf[32]; /* command line buf */
826 sttybbs(SB_SAVE); /* Store the old terminal parameters */
827 load_command_set(); /* parse the citadel.rc file */
828 sttybbs(SB_NO_INTR); /* Install the new ones */
829 signal(SIGINT,SIG_IGN);
830 signal(SIGQUIT,SIG_IGN);
831 signal(SIGHUP,dropcarr); /* Cleanup gracefully if carrier is dropped */
832 signal(SIGTERM,dropcarr); /* Cleanup gracefully if terminated */
833 signal(SIGCONT,catch_sigcont); /* Catch SIGCONT so we can reset terminal */
835 printf("Attaching to server...\r");
837 attach_to_server(argc,argv);
843 printf("%s\n",&aaa[4]);
852 printf("%-22s\n%s\n%s\n",serv_info.serv_software,serv_info.serv_humannode,
853 serv_info.serv_bbs_city);
854 screenwidth = 80; /* default screen dimensions */
857 printf(" pause next stop\n");
858 printf(" ctrl-s ctrl-o ctrl-c\n\n");
859 formout("hello"); /* print the opening greeting */
862 GSTA: termn8=0; newnow=0;
864 if (strlen(rc_username) > 0) {
865 strcpy(fullname,rc_username);
868 newprompt("Enter your name: ",fullname,29);
871 if (!strucmp(fullname,"new")) { /* just in case */
872 printf("Please enter the name you wish to log in with.\n");
875 (!strucmp(fullname,"bbs"))
876 || (!strucmp(fullname,"new"))
877 || (strlen(fullname)==0) );
879 if (!strucmp(fullname,"off")) {
884 /* sign on to the server */
885 strcpy(re_username, fullname);
886 snprintf(aaa,sizeof aaa,"USER %s",fullname);
889 if (aaa[0]!='3') goto NEWUSR;
891 /* password authentication */
892 if (strlen(rc_password)>0) {
893 strcpy(eee,rc_password);
896 newprompt("\rPlease enter your password: ",eee,-19);
899 snprintf(aaa,sizeof aaa,"PASS %s",eee);
903 strcpy(re_password, eee);
904 load_user_info(&aaa[4]);
908 printf("<< wrong password >>\n");
909 if (strlen(rc_password)>0) logoff(0);
912 NEWUSR: if (strlen(rc_password)==0) {
913 printf("No record. Enter as new user? ");
914 if (yesno()==0) goto GSTA;
917 snprintf(aaa,sizeof aaa,"NEWU %s",fullname);
924 load_user_info(&aaa[4]);
926 while (set_password() != 0) ;;
932 PWOK: printf("%s\nAccess level: %d (%s)\nUser #%ld / Call #%d\n",
933 fullname,axlevel,axdefs[(int)axlevel],
934 usernum,timescalled);
939 b = extract_int(&aaa[4],0);
940 if (b==1) printf("*** You have a new private message in Mail>\n");
941 if (b>1) printf("*** You have %d new private messages in Mail>\n",b);
943 if ((axlevel>=6) && (extract_int(&aaa[4],2)>0)) {
944 printf("*** Users need validation\n");
947 if (extract_int(&aaa[4],1)>0) {
948 printf("*** Please register.\n");
954 /* Make up some temporary filenames for use in various parts of the
955 * program. Don't mess with these once they've been set, because we
956 * will be unlinking them later on in the program and we don't
957 * want to delete something that we didn't create. */
958 snprintf(temp,sizeof temp,"/tmp/citA%d",getpid());
959 snprintf(temp2,sizeof temp2,"/tmp/citB%d",getpid());
960 snprintf(tempdir,sizeof tempdir,"/tmp/citC%d",getpid());
962 /* Get screen dimensions. First we go to a default of 80x24. Then
963 * we try to get the user's actual screen dimensions off the server.
964 * However, if we're running on an xterm, all this stuff is
965 * irrelevant because we're going to dynamically size the screen
966 * during the session.
973 screenwidth = extract_int(&aaa[4],0);
974 screenheight = extract_int(&aaa[4],1);
976 if (getenv("TERM")!=NULL) if (!strcmp(getenv("TERM"),"xterm")) {
986 /* Enter the lobby */
987 dotgoto("_BASEROOM_",1);
989 /* Main loop for the system... user is logged in. */
993 if (newnow==1) readmsgs(3,1,5);
994 else readmsgs(1,1,0);
996 do { /* MAIN LOOP OF PROGRAM */
998 /* Reconnect to the server if the connection was broken */
999 if (setjmp(jmp_reconnect)) {
1000 printf("\rServer connection broken; reconnecting...\r");
1002 attach_to_server(argc,argv);
1006 if (aaa[0]!='2') { printf("%s\n", &aaa[4]); exit(0); }
1007 sprintf(aaa, "USER %s", re_username);
1010 if (aaa[0]!='3') { printf("%s\n", &aaa[4]); exit(0); }
1011 sprintf(aaa, "PASS %s", re_password);
1014 if (aaa[0]!='2') { printf("%s\n", &aaa[4]); exit(0); }
1015 load_user_info(&aaa[4]);
1017 signal(SIGPIPE, sigpipehandler);
1019 signal(SIGINT,SIG_IGN);
1020 signal(SIGQUIT,SIG_IGN);
1021 mcmd=getcmd(argbuf);
1024 check_screen_dims();
1027 if (termn8==0) switch(mcmd) {
1028 case 1: formout("help");
1030 case 4: entmsg(0,0);
1032 case 36: entmsg(0,1);
1034 case 46: entmsg(0,2);
1036 case 78: newprompt("What do you want your username to be? ", aaa, 32);
1037 snprintf(bbb, sizeof bbb, "ENT0 2|0|0|0|%s", aaa);
1040 if (strncmp("200", aaa, 3))
1041 printf("\n%s\n", aaa);
1048 case 47: updatelsa();
1051 case 58: updatelsa();
1052 dotgoto("_MAIL_",1);
1054 case 20: updatels();
1055 case 52: dotgoto(argbuf,0);
1057 case 10: readmsgs(0,1,0);
1059 case 9: readmsgs(3,1,5);
1061 case 13: readmsgs(1,1,0);
1063 case 11: readmsgs(0,(-1),0);
1065 case 12: readmsgs(2,(-1),0);
1067 case 71: readmsgs(3, 1, atoi(argbuf));
1069 case 7: forget(); break;
1070 case 18: subshell(); break;
1071 case 38: updatels();
1073 case 22: killroom(); break;
1074 case 32: userlist(); break;
1075 case 27: invite(); break;
1076 case 28: kickout(); break;
1077 case 23: editthisroom(); break;
1078 case 14: roomdir(); break;
1079 case 33: download(0); break;
1080 case 34: download(1); break;
1081 case 31: download(2); break;
1082 case 43: download(3); break;
1083 case 45: download(4); break;
1084 case 55: download(5); break;
1085 case 39: upload(0); break;
1086 case 40: upload(1); break;
1087 case 42: upload(2); break;
1088 case 44: upload(3); break;
1089 case 57: cli_upload(); break;
1090 case 16: ungoto(); break;
1091 case 24: whoknows(); break;
1092 case 26: validate(); break;
1093 case 29: updatels();
1096 case 30: updatels();
1099 case 48: enterinfo();
1101 case 49: readinfo();
1103 case 72: cli_image_upload("_userpic_");
1105 case 73: cli_image_upload("_roompic_");
1109 snprintf(aaa, sizeof aaa, "_floorpic_|%d", curr_floor);
1110 cli_image_upload(aaa);
1114 enternew("roomname", aaa, 20);
1115 snprintf(bbb, sizeof bbb, "RCHG %s", aaa);
1118 if (strncmp("200",aaa, 3))
1119 printf("\n%s\n", aaa);
1122 enternew("hostname", aaa, 25);
1123 snprintf(bbb, sizeof bbb, "HCHG %s", aaa);
1126 if (strncmp("200",aaa, 3))
1127 printf("\n%s\n", aaa);
1130 enternew("username", aaa, 32);
1131 snprintf(bbb, sizeof bbb, "UCHG %s", aaa);
1134 if (strncmp("200",aaa, 3))
1135 printf("\n%s\n", aaa);
1143 if (argbuf[0]==0) strcpy(aaa,"?");
1144 display_help(argbuf);
1148 formout("register");
1153 printf("Are you sure (y/n)? ");
1168 case 2: if (server_is_local) {
1169 sttybbs(SB_RESTORE);
1170 snprintf(aaa,sizeof aaa,"USERNAME=\042%s\042; export USERNAME;"
1171 "exec ./subsystem %ld %d %d", fullname,
1172 usernum,screenwidth,axlevel);
1174 sttybbs(SB_NO_INTR);
1177 printf("*** Can't run doors when server is not local.\n");
1190 do_system_configuration();
1208 gotofloor(argbuf,GF_GOTO);
1212 gotofloor(argbuf,GF_SKIP);
1216 forget_this_floor();
1244 knrooms(floor_mode);
1254 misc_server_cmd(argbuf);
1258 edit_system_message(argbuf);
1285 TERMN8: printf("%s logged out.\n",fullname);
1286 while (march!=NULL) remove_march(march->march_name,0);
1288 printf("\n\nType 'off' to hang up, or next user...\n");
1289 snprintf(aaa,sizeof aaa,"LOUT");
1292 if ((mcmd==29)||(mcmd==15)) {