4 * citadel.c - Main source file.
16 #include <sys/types.h>
19 #include <sys/ioctl.h>
27 #include "serv_info.h"
29 #include "routines2.h"
34 #include "client_chat.h"
35 #include "citadel_decls.h"
48 #define IFEXPERT if (userflags&US_EXPERT)
49 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
50 #define IFAIDE if (axlevel>=6)
51 #define IFNAIDE if (axlevel<6)
53 struct march *march = NULL;
55 /* globals associated with the client program */
56 char temp[16]; /* Name of general temp file */
57 char temp2[16]; /* Name of general temp file */
58 char tempdir[16]; /* Name of general temp dir */
59 char editor_path[256]; /* path to external editor */
60 char printcmd[256]; /* print command */
61 int editor_pid = (-1);
64 struct CtdlServInfo serv_info; /* Info on the server connected */
68 char room_name[ROOMNAMELEN];
69 char ugname[ROOMNAMELEN];
70 long uglsn; /* holds <u>ngoto info */
71 char is_mail = 0; /* nonzero when we're in a mail room */
72 char axlevel = 0; /* access level */
73 char is_room_aide = 0; /* boolean flag, 1 if room aide */
77 long usernum = 0L; /* user number */
79 long highest_msg_read; /* used for <A>bandon room cmd */
80 long maxmsgnum; /* used for <G>oto */
82 char have_xterm = 0; /* are we running on an xterm? */
87 char curr_floor = 0; /* number of current floor */
88 char floorlist[128][256]; /* names of floors */
89 char express_msgs = 0; /* express messages waiting! */
91 jmp_buf jmp_reconnect; /* for server reconnects */
95 void sigpipehandler(int nothing) {
96 longjmp(jmp_reconnect, nothing);
100 * here is our 'clean up gracefully and exit' routine
102 void logoff(int code)
104 if (editor_pid>0) { /* kill the editor if it's running */
105 kill(editor_pid,SIGHUP);
108 /* shut down the server... but not if the logoff code is 3, because
109 * that means we're exiting because we already lost the server
111 if (code!=3) serv_puts("QUIT");
114 * now clean up various things
121 /* Violently kill off any child processes if Citadel is
125 kill(0-getpgrp(),SIGTERM);
127 kill(0-getpgrp(),SIGKILL);
130 sttybbs(SB_RESTORE); /* return the old terminal settings */
131 exit(code); /* exit with the proper exit code */
137 * We handle "next" and "stop" much differently than in earlier versions.
138 * The signal catching routine simply sets a flag and returns.
140 void sighandler(int which_sig)
142 signal(SIGINT,SIG_IGN);
143 signal(SIGQUIT,SIG_IGN);
144 sigcaught = which_sig;
150 * signal catching function for hangups...
152 void dropcarr(int signum) {
159 * catch SIGCONT to reset terminal modes when were are put back into the
162 void catch_sigcont(int signum) {
168 /* general purpose routines */
170 void formout(char *name) /* display a file */
174 snprintf(cmd,sizeof cmd,"MESG %s",name);
178 printf("%s\n",&cmd[4]);
181 fmout(screenwidth,NULL,
182 ((userflags & US_PAGINATOR) ? 1 : 0),
187 void userlist(void) {
197 printf("%s\n",&buf[4]);
201 sttybbs(SB_YES_INTR);
202 printf(" User Name Num L LastCall Calls Posts\n");
203 printf("------------------------- ----- - ---------- ----- -----\n");
204 while (serv_gets(buf), strcmp(buf,"000")) {
205 if (sigcaught == 0) {
208 printf("%5ld %d ",extract_long(buf,2),
210 lc = extract_long(buf,3);
211 tmbuf = (struct tm *)localtime(&lc);
212 printf("%02d/%02d/%04d ",
215 (tmbuf->tm_year + 1900));
216 printf("%5ld %5ld\n",extract_long(buf,4),extract_long(buf,5));
219 linecount = checkpagin(linecount,
220 ((userflags & US_PAGINATOR) ? 1 : 0),
231 * grab assorted info about the user...
233 void load_user_info(char *params)
235 extract(fullname,params,0);
236 axlevel = extract_int(params,1);
237 timescalled = extract_int(params,2);
238 posted = extract_int(params,3);
239 userflags = extract_int(params,4);
240 usernum = extract_long(params,5);
245 * Remove a room from the march list. 'floornum' is ignored unless
246 * 'roomname' is set to _FLOOR_, in which case all rooms on the requested
247 * floor will be removed from the march list.
249 void remove_march(char *roomname, int floornum)
251 struct march *mptr,*mptr2;
253 if (march==NULL) return;
255 if ( (!strucmp(march->march_name,roomname))
256 || ((!strucmp(roomname,"_FLOOR_"))&&(march->march_floor==floornum))) {
264 for (mptr=march; mptr!=NULL; mptr=mptr->next) {
266 if ( (!strucmp(mptr->march_name,roomname))
267 || ((!strucmp(roomname,"_FLOOR_"))
268 &&(mptr->march_floor==floornum))) {
270 mptr2->next = mptr->next;
282 * Locate the room on the march list which we most want to go to. Each room
283 * is measured given a "weight" of preference based on various factors.
285 char *pop_march(int desired_floor) {
286 static char TheRoom[ROOMNAMELEN];
288 int TheOrder = 32767;
291 struct march *mptr = NULL;
293 strcpy(TheRoom, "_BASEROOM_");
294 if (march == NULL) return(TheRoom);
296 for (mptr = march; mptr != NULL; mptr = mptr->next) {
298 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
299 weight = weight + 10000;
300 if (mptr->march_floor == desired_floor)
301 weight = weight + 5000;
303 weight = weight + ((128-(mptr->march_floor))*128);
304 weight = weight + (128-(mptr->march_order));
306 if (weight > TheWeight) {
308 strcpy(TheRoom, mptr->march_name);
309 TheFloor = mptr->march_floor;
310 TheOrder = mptr->march_order;
318 * jump directly to a room
320 void dotgoto(char *towhere, int display_name)
322 char aaa[256],bbb[256],psearch[256];
325 static int oldmailcount = (-1);
326 int partial_match,best_match;
329 /* store ungoto information */
330 strcpy(ugname,room_name);
333 /* first try an exact match */
334 snprintf(aaa,sizeof aaa,"GOTO %s",towhere);
337 if (aaa[3]=='*') express_msgs = 1;
338 if (!strncmp(aaa,"54",2)) {
339 newprompt("Enter room password: ",bbb,9);
340 snprintf(aaa,sizeof aaa,"GOTO %s|%s",towhere,bbb);
343 if (aaa[3]=='*') express_msgs = 1;
345 if (!strncmp(aaa,"54",2)) {
346 printf("Wrong password.\n");
352 * If a match is not found, try a partial match.
353 * Partial matches anywhere in the string carry a weight of 1,
354 * left-aligned matches carry a weight of 2. Pick the room that
355 * has the highest-weighted match.
362 if (aaa[0]=='1') while (serv_gets(aaa), strcmp(aaa,"000")) {
363 extract(psearch,aaa,0);
365 if (pattern(psearch,towhere)>=0) {
368 if (!struncmp(towhere,psearch,strlen(towhere))) {
371 if (partial_match > best_match) {
373 best_match = partial_match;
376 if (strlen(bbb)==0) {
377 printf("No room '%s'.\n",towhere);
380 snprintf(aaa,sizeof aaa,"GOTO %s",bbb);
383 if (aaa[3]=='*') express_msgs = 1;
391 extract(room_name,&aaa[4],0);
392 room_flags = extract_int(&aaa[4],4);
393 from_floor = curr_floor;
394 curr_floor = extract_int(&aaa[4],10);
396 remove_march(room_name,0);
397 if (!strucmp(towhere,"_BASEROOM_")) remove_march(towhere,0);
398 if ((from_floor!=curr_floor) && (display_name>0) && (floor_mode==1)) {
399 if (floorlist[(int)curr_floor][0]==0) load_floorlist();
400 printf("(Entering floor: %s)\n",&floorlist[(int)curr_floor][0]);
402 if (display_name == 1) printf("%s - ",room_name);
403 if (display_name != 2) printf("%d new of %d messages.\n",
404 extract_int(&aaa[4],1),
405 extract_int(&aaa[4],2));
406 highest_msg_read = extract_int(&aaa[4],6);
407 maxmsgnum = extract_int(&aaa[4],5);
408 is_mail = (char) extract_int(&aaa[4],7);
409 is_room_aide = (char) extract_int(&aaa[4],8);
410 ls = extract_long(&aaa[4],6);
412 /* read info file if necessary */
413 if (extract_int(&aaa[4],3) > 0) readinfo();
415 /* check for newly arrived mail if we can */
416 if (num_parms(&aaa[4])>=10) {
417 newmailcount = extract_int(&aaa[4],9);
418 if ( (oldmailcount >= 0) && (newmailcount > oldmailcount) )
419 printf("*** You have new mail\n");
420 oldmailcount = newmailcount;
424 /* Goto next room having unread messages.
425 * We want to skip over rooms that the user has already been to, and take the
426 * user back to the lobby when done. The room we end up in is placed in
427 * newroom - which is set to 0 (the lobby) initially.
429 void gotonext(void) {
431 struct march *mptr,*mptr2;
434 /* Check to see if the march-mode list is already allocated.
435 * If it is, pop the first room off the list and go there.
441 while (serv_gets(buf), strcmp(buf,"000")) {
442 mptr = (struct march *) malloc(sizeof(struct march));
444 extract(mptr->march_name,buf,0);
445 mptr->march_floor = (char) (extract_int(buf,2) & 0x7F);
446 mptr->march_order = (char) (extract_int(buf,3) & 0x7F);
452 while (mptr2->next != NULL)
458 /* add _BASEROOM_ to the end of the march list, so the user will end up
459 * in the system base room (usually the Lobby>) at the end of the loop
461 mptr = (struct march *) malloc(sizeof(struct march));
463 strcpy(mptr->march_name,"_BASEROOM_");
469 while (mptr2->next != NULL)
474 * ...and remove the room we're currently in, so a <G>oto doesn't make us
475 * walk around in circles
477 remove_march(room_name,0);
481 strcpy(next_room, pop_march(curr_floor));
484 strcpy(next_room,"_BASEROOM_");
486 remove_march(next_room,0);
487 dotgoto(next_room,1);
491 * forget all rooms on a given floor
493 void forget_all_rooms_on(int ffloor)
496 struct march *flist,*fptr;
498 printf("Forgetting all rooms on %s...\r",&floorlist[ffloor][0]);
500 snprintf(buf,sizeof buf,"LKRA %d",ffloor);
504 printf("%-72s\n",&buf[4]);
508 while (serv_gets(buf), strcmp(buf,"000")) {
509 fptr = (struct march *) malloc(sizeof(struct march));
512 extract(fptr->march_name,buf,0);
514 while (flist != NULL) {
515 snprintf(buf,sizeof buf,"GOTO %s",flist->march_name);
526 printf("%-72s\r","");
531 * routine called by gotofloor() to move to a new room on a new floor
533 void gf_toroom(char *towhere, int mode)
535 int floor_being_left;
537 floor_being_left = curr_floor;
539 if (mode == GF_GOTO) { /* <;G>oto mode */
544 if (mode == GF_SKIP) { /* <;S>kip mode */
546 remove_march("_FLOOR_",floor_being_left);
549 if (mode == GF_ZAP) { /* <;Z>ap mode */
551 remove_march("_FLOOR_",floor_being_left);
552 forget_all_rooms_on(floor_being_left);
560 void gotofloor(char *towhere, int mode)
564 char buf[256],targ[256];
566 if (floorlist[0][0]==0) load_floorlist();
568 for (a=0; a<128; ++a) if (!strucmp(&floorlist[a][0],towhere))
572 for (a=0; a<128; ++a) {
573 if (!struncmp(&floorlist[a][0],towhere,strlen(towhere))) {
580 for (a=0; a<128; ++a)
581 if (pattern(towhere,&floorlist[a][0])>0)
586 printf("No floor '%s'.\n",towhere);
590 for (mptr = march; mptr != NULL; mptr = mptr->next) {
591 if ((mptr->march_floor) == tofloor)
592 gf_toroom(mptr->march_name,mode);
597 snprintf(buf,sizeof buf,"LKRA %d",tofloor);
600 if (buf[0]=='1') while (serv_gets(buf), strcmp(buf,"000")) {
601 if ((extract_int(buf,2)==tofloor)&&(strlen(targ)==0))
604 if (strlen(targ)>0) {
605 gf_toroom(targ,mode);
608 printf("There are no rooms on '%s'.\n",&floorlist[tofloor][0]);
614 * forget all rooms on current floor
616 void forget_this_floor(void) {
618 if (curr_floor == 0) {
619 printf("Can't forget this floor.\n");
623 if (floorlist[0][0]==0) load_floorlist();
624 printf("Are you sure you want to forget all rooms on %s? ",
625 &floorlist[(int)curr_floor][0]);
626 if (yesno()==0) return;
628 gf_toroom("_BASEROOM_",GF_ZAP);
633 * Figure out the physical screen dimensions, if we can
635 void check_screen_dims(void) {
638 unsigned short height; /* rows */
639 unsigned short width; /* columns */
640 unsigned short xpixels;
641 unsigned short ypixels; /* pixels */
644 if (have_xterm) { /* dynamically size screen if on an xterm */
645 if ( ioctl(0, TIOCGWINSZ, &xwinsz) == 0 ) {
646 if (xwinsz.height) screenheight = (int) xwinsz.height;
647 if (xwinsz.width) screenwidth = (int) xwinsz.width;
655 * set floor mode depending on client, server, and user settings
657 void set_floor_mode(void) {
658 if (serv_info.serv_ok_floors == 0) {
659 floor_mode = 0; /* Don't use floors if the server */
660 } /* doesn't support them! */
662 if (rc_floor_mode == RC_NO) { /* never use floors */
665 if (rc_floor_mode == RC_YES) { /* always use floors */
668 if (rc_floor_mode == RC_DEFAULT) { /* user choice */
669 floor_mode = ((userflags & US_FLOORS) ? 1 : 0);
675 * Set or change the user's password
677 int set_password(void) {
682 if (strlen(rc_password) > 0) {
683 strcpy(pass1,rc_password);
684 strcpy(pass2,rc_password);
687 IFNEXPERT formout("changepw");
688 newprompt("Enter a new password: ", pass1, -19);
689 newprompt("Enter it again to confirm: ", pass2, -19);
691 if (!strucmp(pass1,pass2)) {
692 snprintf(buf,sizeof buf,"SETP %s",pass1);
695 printf("%s\n",&buf[4]);
696 strcpy(re_password, pass1);
700 printf("*** They don't match... try again.\n");
708 * get info about the server we've connected to
710 void get_serv_info(void) {
713 CtdlInternalGetServInfo(&serv_info);
715 /* be nice and identify ourself to the server */
716 snprintf(buf,sizeof buf,"IDEN %d|%d|%d|%s|",
717 SERVER_TYPE,0,REV_LEVEL,
718 (server_is_local ? "local" : CITADEL));
719 locate_host(&buf[strlen(buf)]); /* append to the end */
721 serv_gets(buf); /* we don't care about the result code */
729 * Display list of users currently logged on to the server
731 void who_is_online(int longlist)
733 char buf[128], username[128], roomname[128], fromhost[128], flags[128];
734 char tbuf[128], clientsoft[128];
736 time_t idletime, idlehours, idlemins, idlesecs;
737 int last_session = (-1);
743 if (tbuf[0] == '2') {
744 timenow = extract_long(&tbuf[4], 0);
752 printf("FLG ### User Name Room From host\n");
754 printf("--- --- ------------------------- -------------------- ------------------------\n");
760 while(serv_gets(buf), strcmp(buf,"000"))
762 extract(username,buf,1);
763 extract(roomname,buf,2);
764 extract(fromhost,buf,3);
765 extract(clientsoft, buf, 4);
766 extract(flags,buf,7);
769 idletime = timenow - extract_long(buf, 5);
770 idlehours = idletime / 3600;
771 idlemins = (idletime - (idlehours*3600)) / 60;
772 idlesecs = (idletime - (idlehours*3600) - (idlemins*60) );
773 printf("\nFlags: %-3s Sess# %-3d Name: %-25s Room: %s\n",
774 flags, extract_int(buf,0), username, roomname);
775 printf("from <%s> using <%s>, idle %ld:%02ld:%02ld\n",
776 fromhost, clientsoft,
777 (long)idlehours, (long)idlemins, (long)idlesecs);
781 if (extract_int(buf,0)==last_session) {
785 color(1); printf("%-3s ", flags);
786 color(2); printf("%-3d ", extract_int(buf,0));
788 last_session=extract_int(buf,0);
789 color(3); printf("%-25s ", username);
790 color(4); printf("%-20s ", roomname);
791 color(5); printf("%-24s\n", fromhost);
798 void enternew(char *desc, char *buf, int maxlen)
801 snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc);
802 newprompt(bbb, buf, maxlen);
808 int main(int argc, char **argv)
811 char aaa[100],bbb[100],eee[100]; /* general purpose variables */
812 char argbuf[32]; /* command line buf */
813 volatile int termn8 = 0;
816 sttybbs(SB_SAVE); /* Store the old terminal parameters */
817 load_command_set(); /* parse the citadel.rc file */
818 sttybbs(SB_NO_INTR); /* Install the new ones */
819 signal(SIGINT,SIG_IGN);
820 signal(SIGQUIT,SIG_IGN);
821 signal(SIGHUP,dropcarr); /* Cleanup gracefully if carrier is dropped */
822 signal(SIGTERM,dropcarr); /* Cleanup gracefully if terminated */
823 signal(SIGCONT,catch_sigcont); /* Catch SIGCONT so we can reset terminal */
825 printf("Attaching to server...\r");
827 attach_to_server(argc,argv);
833 printf("%s\n",&aaa[4]);
842 printf("%-22s\n%s\n%s\n",serv_info.serv_software,serv_info.serv_humannode,
843 serv_info.serv_bbs_city);
844 screenwidth = 80; /* default screen dimensions */
847 printf(" pause next stop\n");
848 printf(" ctrl-s ctrl-o ctrl-c\n\n");
849 formout("hello"); /* print the opening greeting */
852 GSTA: termn8=0; newnow=0;
854 if (strlen(rc_username) > 0) {
855 strcpy(fullname,rc_username);
858 newprompt("Enter your name: ",fullname,29);
861 if (!strucmp(fullname,"new")) { /* just in case */
862 printf("Please enter the name you wish to log in with.\n");
865 (!strucmp(fullname,"bbs"))
866 || (!strucmp(fullname,"new"))
867 || (strlen(fullname)==0) );
869 if (!strucmp(fullname,"off")) {
874 /* sign on to the server */
875 strcpy(re_username, fullname);
876 snprintf(aaa,sizeof aaa,"USER %s",fullname);
879 if (aaa[0]!='3') goto NEWUSR;
881 /* password authentication */
882 if (strlen(rc_password)>0) {
883 strcpy(eee,rc_password);
886 newprompt("\rPlease enter your password: ",eee,-19);
889 snprintf(aaa,sizeof aaa,"PASS %s",eee);
893 strcpy(re_password, eee);
894 load_user_info(&aaa[4]);
898 printf("<< wrong password >>\n");
899 if (strlen(rc_password)>0) logoff(0);
902 NEWUSR: if (strlen(rc_password)==0) {
903 printf("No record. Enter as new user? ");
904 if (yesno()==0) goto GSTA;
907 snprintf(aaa,sizeof aaa,"NEWU %s",fullname);
914 load_user_info(&aaa[4]);
916 while (set_password() != 0) ;;
922 PWOK: printf("%s\nAccess level: %d (%s)\nUser #%ld / Call #%d\n",
923 fullname,axlevel,axdefs[(int)axlevel],
924 usernum,timescalled);
929 b = extract_int(&aaa[4],0);
930 if (b==1) printf("*** You have a new private message in Mail>\n");
931 if (b>1) printf("*** You have %d new private messages in Mail>\n",b);
933 if ((axlevel>=6) && (extract_int(&aaa[4],2)>0)) {
934 printf("*** Users need validation\n");
937 if (extract_int(&aaa[4],1)>0) {
938 printf("*** Please register.\n");
944 /* Make up some temporary filenames for use in various parts of the
945 * program. Don't mess with these once they've been set, because we
946 * will be unlinking them later on in the program and we don't
947 * want to delete something that we didn't create. */
948 snprintf(temp,sizeof temp,"/tmp/citA%d",getpid());
949 snprintf(temp2,sizeof temp2,"/tmp/citB%d",getpid());
950 snprintf(tempdir,sizeof tempdir,"/tmp/citC%d",getpid());
952 /* Get screen dimensions. First we go to a default of 80x24. Then
953 * we try to get the user's actual screen dimensions off the server.
954 * However, if we're running on an xterm, all this stuff is
955 * irrelevant because we're going to dynamically size the screen
956 * during the session.
963 screenwidth = extract_int(&aaa[4],0);
964 screenheight = extract_int(&aaa[4],1);
966 if (getenv("TERM")!=NULL) if (!strcmp(getenv("TERM"),"xterm")) {
976 /* Enter the lobby */
977 dotgoto("_BASEROOM_",1);
979 /* Main loop for the system... user is logged in. */
983 if (newnow==1) readmsgs(3,1,5);
984 else readmsgs(1,1,0);
986 do { /* MAIN LOOP OF PROGRAM */
988 /* Reconnect to the server if the connection was broken */
989 if (setjmp(jmp_reconnect)) {
990 printf("\rServer connection broken; reconnecting...\r");
992 attach_to_server(argc,argv);
996 if (aaa[0]!='2') { printf("%s\n", &aaa[4]); exit(0); }
998 sprintf(aaa, "USER %s", re_username);
1001 if (aaa[0]!='3') { printf("%s\n", &aaa[4]); exit(0); }
1002 sprintf(aaa, "PASS %s", re_password);
1005 if (aaa[0]!='2') { printf("%s\n", &aaa[4]); exit(0); }
1006 load_user_info(&aaa[4]);
1007 sprintf(aaa, "GOTO %s", room_name);
1011 signal(SIGPIPE, sigpipehandler);
1013 signal(SIGINT,SIG_IGN);
1014 signal(SIGQUIT,SIG_IGN);
1015 mcmd=getcmd(argbuf);
1018 check_screen_dims();
1021 if (termn8==0) switch(mcmd) {
1022 case 1: formout("help");
1024 case 4: entmsg(0,0);
1026 case 36: entmsg(0,1);
1028 case 46: entmsg(0,2);
1030 case 78: newprompt("What do you want your username to be? ", aaa, 32);
1031 snprintf(bbb, sizeof bbb, "ENT0 2|0|0|0|%s", aaa);
1034 if (strncmp("200", aaa, 3))
1035 printf("\n%s\n", aaa);
1042 case 47: updatelsa();
1045 case 58: updatelsa();
1046 dotgoto("_MAIL_",1);
1048 case 20: updatels();
1049 case 52: dotgoto(argbuf,0);
1051 case 10: readmsgs(0,1,0);
1053 case 9: readmsgs(3,1,5);
1055 case 13: readmsgs(1,1,0);
1057 case 11: readmsgs(0,(-1),0);
1059 case 12: readmsgs(2,(-1),0);
1061 case 71: readmsgs(3, 1, atoi(argbuf));
1063 case 7: forget(); break;
1064 case 18: subshell(); break;
1065 case 38: updatels();
1067 case 22: killroom(); break;
1068 case 32: userlist(); break;
1069 case 27: invite(); break;
1070 case 28: kickout(); break;
1071 case 23: editthisroom(); break;
1072 case 14: roomdir(); break;
1073 case 33: download(0); break;
1074 case 34: download(1); break;
1075 case 31: download(2); break;
1076 case 43: download(3); break;
1077 case 45: download(4); break;
1078 case 55: download(5); break;
1079 case 39: upload(0); break;
1080 case 40: upload(1); break;
1081 case 42: upload(2); break;
1082 case 44: upload(3); break;
1083 case 57: cli_upload(); break;
1084 case 16: ungoto(); break;
1085 case 24: whoknows(); break;
1086 case 26: validate(); break;
1087 case 29: updatels();
1090 case 30: updatels();
1093 case 48: enterinfo();
1095 case 49: readinfo();
1097 case 72: cli_image_upload("_userpic_");
1099 case 73: cli_image_upload("_roompic_");
1103 snprintf(aaa, sizeof aaa, "_floorpic_|%d", curr_floor);
1104 cli_image_upload(aaa);
1108 enternew("roomname", aaa, 20);
1109 snprintf(bbb, sizeof bbb, "RCHG %s", aaa);
1112 if (strncmp("200",aaa, 3))
1113 printf("\n%s\n", aaa);
1116 enternew("hostname", aaa, 25);
1117 snprintf(bbb, sizeof bbb, "HCHG %s", aaa);
1120 if (strncmp("200",aaa, 3))
1121 printf("\n%s\n", aaa);
1124 enternew("username", aaa, 32);
1125 snprintf(bbb, sizeof bbb, "UCHG %s", aaa);
1128 if (strncmp("200",aaa, 3))
1129 printf("\n%s\n", aaa);
1137 if (argbuf[0]==0) strcpy(aaa,"?");
1138 display_help(argbuf);
1142 formout("register");
1147 printf("Are you sure (y/n)? ");
1162 case 2: if (server_is_local) {
1163 sttybbs(SB_RESTORE);
1164 snprintf(aaa,sizeof aaa,"USERNAME=\042%s\042; export USERNAME;"
1165 "exec ./subsystem %ld %d %d", fullname,
1166 usernum,screenwidth,axlevel);
1168 sttybbs(SB_NO_INTR);
1171 printf("*** Can't run doors when server is not local.\n");
1184 do_system_configuration();
1202 gotofloor(argbuf,GF_GOTO);
1206 gotofloor(argbuf,GF_SKIP);
1210 forget_this_floor();
1238 knrooms(floor_mode);
1248 misc_server_cmd(argbuf);
1252 edit_system_message(argbuf);
1279 TERMN8: printf("%s logged out.\n",fullname);
1280 while (march!=NULL) remove_march(march->march_name,0);
1282 printf("\n\nType 'off' to hang up, or next user...\n");
1283 snprintf(aaa,sizeof aaa,"LOUT");
1286 if ((mcmd==29)||(mcmd==15)) {