4 * Main source module for the client program.
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 "client_passwords.h"
36 #include "citadel_decls.h"
47 char march_name[ROOMNAMELEN];
52 #define IFEXPERT if (userflags&US_EXPERT)
53 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
54 #define IFAIDE if (axlevel>=6)
55 #define IFNAIDE if (axlevel<6)
57 struct march *march = NULL;
59 /* globals associated with the client program */
60 char temp[PATH_MAX]; /* Name of general temp file */
61 char temp2[PATH_MAX]; /* Name of general temp file */
62 char tempdir[PATH_MAX]; /* Name of general temp dir */
63 char editor_path[256]; /* path to external editor */
64 char printcmd[256]; /* print command */
65 int editor_pid = (-1);
68 struct CtdlServInfo serv_info; /* Info on the server connected */
72 char room_name[ROOMNAMELEN];
73 char ugname[ROOMNAMELEN];
74 long uglsn; /* holds <u>ngoto info */
75 char is_mail = 0; /* nonzero when we're in a mail room */
76 char axlevel = 0; /* access level */
77 char is_room_aide = 0; /* boolean flag, 1 if room aide */
81 long usernum = 0L; /* user number */
83 long highest_msg_read; /* used for <A>bandon room cmd */
84 long maxmsgnum; /* used for <G>oto */
86 char have_xterm = 0; /* are we running on an xterm? */
93 char curr_floor = 0; /* number of current floor */
94 char floorlist[128][256]; /* names of floors */
95 char express_msgs = 0; /* express messages waiting! */
98 * here is our 'clean up gracefully and exit' routine
100 void logoff(int code)
102 if (editor_pid > 0) { /* kill the editor if it's running */
103 kill(editor_pid, SIGHUP);
105 /* shut down the server... but not if the logoff code is 3, because
106 * that means we're exiting because we already lost the server
112 * now clean up various things
119 /* Violently kill off any child processes if Citadel is
122 if (getppid() == 1) {
123 kill(0 - getpgrp(), SIGTERM);
125 kill(0 - getpgrp(), SIGKILL);
127 sttybbs(SB_RESTORE); /* return the old terminal settings */
128 exit(code); /* exit with the proper exit code */
134 * signal catching function for hangups...
136 void dropcarr(int signum)
144 * catch SIGCONT to reset terminal modes when were are put back into the
147 void catch_sigcont(int signum)
150 signal(SIGCONT, catch_sigcont);
155 /* general purpose routines */
157 void formout(char *name)
158 { /* display a file */
160 snprintf(cmd, sizeof cmd, "MESG %s", name);
164 printf("%s\n", &cmd[4]);
167 fmout(screenwidth, NULL,
168 ((userflags & US_PAGINATOR) ? 1 : 0),
173 void userlist(char *patn)
183 pprintf("%s\n", &buf[4]);
186 pprintf(" User Name Num L LastCall Calls Posts\n");
187 pprintf("------------------------- ----- - ---------- ----- -----\n");
188 while (serv_gets(buf), strcmp(buf, "000")) {
189 if (sigcaught == 0) {
191 if (pattern(fl, patn) >= 0) {
192 pprintf("%-25s ", fl);
193 pprintf("%5ld %d ", extract_long(buf, 2),
194 extract_int(buf, 1));
195 lc = extract_long(buf, 3);
196 tmbuf = (struct tm *) localtime(&lc);
197 pprintf("%02d/%02d/%04d ",
200 (tmbuf->tm_year + 1900));
201 pprintf("%5ld %5ld\n", extract_long(buf, 4), extract_long(buf, 5));
211 * grab assorted info about the user...
213 void load_user_info(char *params)
215 extract(fullname, params, 0);
216 axlevel = extract_int(params, 1);
217 timescalled = extract_int(params, 2);
218 posted = extract_int(params, 3);
219 userflags = extract_int(params, 4);
220 usernum = extract_long(params, 5);
225 * Remove a room from the march list. 'floornum' is ignored unless
226 * 'roomname' is set to _FLOOR_, in which case all rooms on the requested
227 * floor will be removed from the march list.
229 void remove_march(char *roomname, int floornum)
231 struct march *mptr, *mptr2;
236 if ((!strcasecmp(march->march_name, roomname))
237 || ((!strcasecmp(roomname, "_FLOOR_")) && (march->march_floor == floornum))) {
244 for (mptr = march; mptr != NULL; mptr = mptr->next) {
246 if ((!strcasecmp(mptr->march_name, roomname))
247 || ((!strcasecmp(roomname, "_FLOOR_"))
248 && (mptr->march_floor == floornum))) {
250 mptr2->next = mptr->next;
261 * Locate the room on the march list which we most want to go to. Each room
262 * is measured given a "weight" of preference based on various factors.
264 char *pop_march(int desired_floor)
266 static char TheRoom[ROOMNAMELEN];
268 int TheOrder = 32767;
271 struct march *mptr = NULL;
273 strcpy(TheRoom, "_BASEROOM_");
277 for (mptr = march; mptr != NULL; mptr = mptr->next) {
279 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
280 weight = weight + 10000;
281 if (mptr->march_floor == desired_floor)
282 weight = weight + 5000;
284 weight = weight + ((128 - (mptr->march_floor)) * 128);
285 weight = weight + (128 - (mptr->march_order));
287 if (weight > TheWeight) {
289 strcpy(TheRoom, mptr->march_name);
290 TheFloor = mptr->march_floor;
291 TheOrder = mptr->march_order;
299 * jump directly to a room
301 void dotgoto(char *towhere, int display_name)
303 char aaa[256], bbb[256], psearch[256];
306 static int oldmailcount = (-1);
307 int partial_match, best_match;
310 /* store ungoto information */
311 strcpy(ugname, room_name);
314 /* first try an exact match */
315 snprintf(aaa, sizeof aaa, "GOTO %s", towhere);
320 if (!strncmp(aaa, "54", 2)) {
321 newprompt("Enter room password: ", bbb, 9);
322 snprintf(aaa, sizeof aaa, "GOTO %s|%s", towhere, bbb);
328 if (!strncmp(aaa, "54", 2)) {
329 printf("Wrong password.\n");
333 * If a match is not found, try a partial match.
334 * Partial matches anywhere in the string carry a weight of 1,
335 * left-aligned matches carry a weight of 2. Pick the room that
336 * has the highest-weighted match.
344 while (serv_gets(aaa), strcmp(aaa, "000")) {
345 extract(psearch, aaa, 0);
347 if (pattern(psearch, towhere) >= 0) {
350 if (!strncasecmp(towhere, psearch, strlen(towhere))) {
353 if (partial_match > best_match) {
354 strcpy(bbb, psearch);
355 best_match = partial_match;
358 if (strlen(bbb) == 0) {
359 printf("No room '%s'.\n", towhere);
362 snprintf(aaa, sizeof aaa, "GOTO %s", bbb);
372 extract(room_name, &aaa[4], 0);
373 room_flags = extract_int(&aaa[4], 4);
374 from_floor = curr_floor;
375 curr_floor = extract_int(&aaa[4], 10);
377 remove_march(room_name, 0);
378 if (!strcasecmp(towhere, "_BASEROOM_"))
379 remove_march(towhere, 0);
380 if ((from_floor != curr_floor) && (display_name > 0) && (floor_mode == 1)) {
381 if (floorlist[(int) curr_floor][0] == 0)
383 printf("(Entering floor: %s)\n", &floorlist[(int) curr_floor][0]);
385 if (display_name == 1) {
387 printf("%s ", room_name);
391 if (display_name != 2) {
392 color(BRIGHT_YELLOW);
393 printf("%d ", extract_int(&aaa[4], 1));
396 color(BRIGHT_YELLOW);
397 printf("%d ", extract_int(&aaa[4], 2));
399 printf("messages.\n");
401 highest_msg_read = extract_int(&aaa[4], 6);
402 maxmsgnum = extract_int(&aaa[4], 5);
403 is_mail = (char) extract_int(&aaa[4], 7);
404 is_room_aide = (char) extract_int(&aaa[4], 8);
405 ls = extract_long(&aaa[4], 6);
407 /* read info file if necessary */
408 if (extract_int(&aaa[4], 3) > 0)
411 /* check for newly arrived mail if we can */
412 if (num_parms(&aaa[4]) >= 10) {
413 newmailcount = extract_int(&aaa[4], 9);
414 if ((oldmailcount >= 0) && (newmailcount > oldmailcount)) {
416 printf("*** You have new mail\n");
419 oldmailcount = newmailcount;
423 /* Goto next room having unread messages.
424 * We want to skip over rooms that the user has already been to, and take the
425 * user back to the lobby when done. The room we end up in is placed in
426 * newroom - which is set to 0 (the lobby) initially.
431 struct march *mptr, *mptr2;
432 char next_room[ROOMNAMELEN];
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);
451 while (mptr2->next != NULL)
456 /* add _BASEROOM_ to the end of the march list, so the user will end up
457 * in the system base room (usually the Lobby>) at the end of the loop
459 mptr = (struct march *) malloc(sizeof(struct march));
461 strcpy(mptr->march_name, "_BASEROOM_");
466 while (mptr2->next != NULL)
471 * ...and remove the room we're currently in, so a <G>oto doesn't make us
472 * walk around in circles
474 remove_march(room_name, 0);
477 strcpy(next_room, pop_march(curr_floor));
479 strcpy(next_room, "_BASEROOM_");
481 remove_march(next_room, 0);
482 dotgoto(next_room, 1);
486 * forget all rooms on a given floor
488 void forget_all_rooms_on(int ffloor)
491 struct march *flist, *fptr;
493 printf("Forgetting all rooms on %s...\r", &floorlist[ffloor][0]);
495 snprintf(buf, sizeof buf, "LKRA %d", ffloor);
499 printf("%-72s\n", &buf[4]);
503 while (serv_gets(buf), strcmp(buf, "000")) {
504 fptr = (struct march *) malloc(sizeof(struct march));
507 extract(fptr->march_name, buf, 0);
509 while (flist != NULL) {
510 snprintf(buf, sizeof buf, "GOTO %s", flist->march_name);
521 printf("%-72s\r", "");
526 * routine called by gotofloor() to move to a new room on a new floor
528 void gf_toroom(char *towhere, int mode)
530 int floor_being_left;
532 floor_being_left = curr_floor;
534 if (mode == GF_GOTO) { /* <;G>oto mode */
538 if (mode == GF_SKIP) { /* <;S>kip mode */
540 remove_march("_FLOOR_", floor_being_left);
542 if (mode == GF_ZAP) { /* <;Z>ap mode */
544 remove_march("_FLOOR_", floor_being_left);
545 forget_all_rooms_on(floor_being_left);
553 void gotofloor(char *towhere, int mode)
557 char buf[256], targ[256];
559 if (floorlist[0][0] == 0)
562 for (a = 0; a < 128; ++a)
563 if (!strcasecmp(&floorlist[a][0], towhere))
567 for (a = 0; a < 128; ++a) {
568 if (!strncasecmp(&floorlist[a][0], towhere, strlen(towhere))) {
574 for (a = 0; a < 128; ++a)
575 if (pattern(towhere, &floorlist[a][0]) > 0)
579 printf("No floor '%s'.\n", towhere);
582 for (mptr = march; mptr != NULL; mptr = mptr->next) {
583 if ((mptr->march_floor) == tofloor)
584 gf_toroom(mptr->march_name, mode);
589 snprintf(buf, sizeof buf, "LKRA %d", tofloor);
593 while (serv_gets(buf), strcmp(buf, "000")) {
594 if ((extract_int(buf, 2) == tofloor) && (strlen(targ) == 0))
595 extract(targ, buf, 0);
597 if (strlen(targ) > 0) {
598 gf_toroom(targ, mode);
600 printf("There are no rooms on '%s'.\n", &floorlist[tofloor][0]);
606 * forget all rooms on current floor
608 void forget_this_floor(void)
611 if (curr_floor == 0) {
612 printf("Can't forget this floor.\n");
615 if (floorlist[0][0] == 0)
617 printf("Are you sure you want to forget all rooms on %s? ",
618 &floorlist[(int) curr_floor][0]);
622 gf_toroom("_BASEROOM_", GF_ZAP);
627 * Figure out the physical screen dimensions, if we can
629 void check_screen_dims(void)
633 unsigned short height; /* rows */
634 unsigned short width; /* columns */
635 unsigned short xpixels;
636 unsigned short ypixels; /* pixels */
639 if (have_xterm) { /* dynamically size screen if on an xterm */
640 if (ioctl(0, TIOCGWINSZ, &xwinsz) == 0) {
642 screenheight = (int) xwinsz.height;
644 screenwidth = (int) xwinsz.width;
652 * set floor mode depending on client, server, and user settings
654 void set_floor_mode(void)
656 if (serv_info.serv_ok_floors == 0) {
657 floor_mode = 0; /* Don't use floors if the server */
659 /* doesn't support them! */
661 if (rc_floor_mode == RC_NO) { /* never use floors */
664 if (rc_floor_mode == RC_YES) { /* always use floors */
667 if (rc_floor_mode == RC_DEFAULT) { /* user choice */
668 floor_mode = ((userflags & US_FLOORS) ? 1 : 0);
674 * Set or change the user's password
676 int set_password(void)
682 if (strlen(rc_password) > 0) {
683 strcpy(pass1, rc_password);
684 strcpy(pass2, rc_password);
686 IFNEXPERT formout("changepw");
687 newprompt("Enter a new password: ", pass1, -19);
688 newprompt("Enter it again to confirm: ", pass2, -19);
692 if (!strcasecmp(pass1, pass2)) {
693 snprintf(buf, sizeof buf, "SETP %s", pass1);
696 printf("%s\n", &buf[4]);
697 offer_to_remember_password(hostbuf, portbuf, fullname, 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)
714 CtdlInternalGetServInfo(&serv_info);
716 /* be nice and identify ourself to the server */
717 snprintf(buf, sizeof buf, "IDEN %d|%d|%d|%s|",
718 SERVER_TYPE, 0, REV_LEVEL,
719 (server_is_local ? "local" : CITADEL));
720 locate_host(&buf[strlen(buf)]); /* append to the end */
722 serv_gets(buf); /* we don't care about the result code */
730 * Display list of users currently logged on to the server
732 void who_is_online(int longlist)
734 char buf[256], username[256], roomname[256], fromhost[256];
736 char actual_user[256], actual_room[256], actual_host[256];
737 char tbuf[256], clientsoft[256];
739 time_t idletime, idlehours, idlemins, idlesecs;
740 int last_session = (-1);
744 if (tbuf[0] == '2') {
745 timenow = extract_long(&tbuf[4], 0);
753 pprintf("FLG ### User Name Room From host\n");
755 pprintf("--- --- ------------------------- -------------------- ------------------------\n");
760 while (serv_gets(buf), strcmp(buf, "000")) {
761 extract(username, buf, 1);
762 extract(roomname, buf, 2);
763 extract(fromhost, buf, 3);
764 extract(clientsoft, buf, 4);
765 extract(flags, buf, 7);
767 idletime = timenow - extract_long(buf, 5);
768 idlehours = idletime / 3600;
769 idlemins = (idletime - (idlehours * 3600)) / 60;
770 idlesecs = (idletime - (idlehours * 3600) - (idlemins * 60));
772 if (idletime > 900) {
773 while (strlen(roomname) < 20) {
774 strcat(roomname, " ");
776 strcpy(&roomname[14], "[idle]");
781 extract(actual_user, buf, 8);
782 extract(actual_room, buf, 9);
783 extract(actual_host, buf, 10);
785 pprintf("\nFlags: %-3s Sess# %-3d Name: %-25s Room: %s\n",
786 flags, extract_int(buf, 0), username, roomname);
787 pprintf("from <%s> using <%s>, idle %ld:%02ld:%02ld\n",
788 fromhost, clientsoft,
789 (long) idlehours, (long) idlemins, (long) idlesecs);
791 if ( (strlen(actual_user)+strlen(actual_room)+strlen(actual_host)) > 0) {
793 if (strlen(actual_user)>0) pprintf("<%s> ", actual_user);
794 if (strlen(actual_room)>0) pprintf("in <%s> ", actual_room);
795 if (strlen(actual_host)>0) pprintf("from <%s> ", actual_host);
800 if (extract_int(buf, 0) == last_session) {
803 color(BRIGHT_MAGENTA);
804 pprintf("%-3s ", flags);
806 pprintf("%-3d ", extract_int(buf, 0));
808 last_session = extract_int(buf, 0);
810 pprintf("%-25s ", username);
811 color(BRIGHT_MAGENTA);
813 pprintf("%-20s ", roomname);
815 pprintf("%-24s\n", fromhost);
822 void enternew(char *desc, char *buf, int maxlen)
825 snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc);
826 newprompt(bbb, buf, maxlen);
835 int main(int argc, char **argv)
838 char aaa[100], bbb[100];/* general purpose variables */
839 char argbuf[32]; /* command line buf */
840 char nonce[NONCE_SIZE];
841 char *sptr, *sptr2; /* USed to extract the nonce */
842 char hexstring[MD5_HEXSTRING_SIZE];
843 volatile int termn8 = 0;
844 int stored_password = 0;
847 sttybbs(SB_SAVE); /* Store the old terminal parameters */
848 load_command_set(); /* parse the citadel.rc file */
849 sttybbs(SB_NO_INTR); /* Install the new ones */
850 signal(SIGHUP, dropcarr); /* Cleanup gracefully if carrier is dropped */
851 signal(SIGTERM, dropcarr); /* Cleanup gracefully if terminated */
852 signal(SIGCONT, catch_sigcont); /* Catch SIGCONT so we can reset terminal */
854 printf("Attaching to server... \r");
856 attach_to_server(argc, argv, hostbuf, portbuf);
862 printf("%s\n", &aaa[4]);
866 /* If there is a [nonce] at the end, put the nonce in <nonce>, else nonce
870 if ((sptr = strchr(aaa, '<')) == NULL)
876 if ((sptr2 = strchr(sptr, '>')) == NULL)
884 strncpy(nonce, sptr, NONCE_SIZE);
894 printf("%-23s\n%s\n%s\n", serv_info.serv_software, serv_info.serv_humannode,
895 serv_info.serv_bbs_city);
896 screenwidth = 80; /* default screen dimensions */
899 printf(" pause next stop\n");
900 printf(" ctrl-s ctrl-o ctrl-c\n\n");
901 formout("hello"); /* print the opening greeting */
904 GSTA: /* See if we have a username and password on disk */
905 if (rc_remember_passwords) {
906 get_stored_password(hostbuf, portbuf, fullname, password);
907 if (strlen(fullname) > 0) {
908 snprintf(aaa, sizeof(aaa)-1, "USER %s", fullname);
913 sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
915 else /* Else no APOP */
917 snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
923 load_user_info(&aaa[4]);
928 set_stored_password(hostbuf, portbuf, "", "");
936 if (strlen(rc_username) > 0) {
937 strcpy(fullname, rc_username);
939 newprompt("Enter your name: ", fullname, 29);
942 if (!strcasecmp(fullname, "new")) { /* just in case */
943 printf("Please enter the name you wish to log in with.\n");
946 (!strcasecmp(fullname, "bbs"))
947 || (!strcasecmp(fullname, "new"))
948 || (strlen(fullname) == 0));
950 if (!strcasecmp(fullname, "off")) {
954 /* sign on to the server */
955 snprintf(aaa, sizeof aaa, "USER %s", fullname);
961 /* password authentication */
962 if (strlen(rc_password) > 0) {
963 strcpy(password, rc_password);
965 newprompt("\rPlease enter your password: ", password, -19);
971 sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
973 else /* Else no APOP */
975 snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
981 load_user_info(&aaa[4]);
982 offer_to_remember_password(hostbuf, portbuf,
986 printf("<< wrong password >>\n");
987 if (strlen(rc_password) > 0)
991 NEWUSR: if (strlen(rc_password) == 0) {
992 printf("No record. Enter as new user? ");
996 snprintf(aaa, sizeof aaa, "NEWU %s", fullname);
1000 printf("%s\n", aaa);
1003 load_user_info(&aaa[4]);
1005 while (set_password() != 0);;
1011 PWOK: printf("%s\nAccess level: %d (%s)\nUser #%ld / Call #%d\n",
1012 fullname, axlevel, axdefs[(int) axlevel],
1013 usernum, timescalled);
1017 if (aaa[0] == '2') {
1018 b = extract_int(&aaa[4], 0);
1022 printf("*** You have a new private message in Mail>\n");
1024 printf("*** You have %d new private messages in Mail>\n", b);
1027 if ((axlevel >= 6) && (extract_int(&aaa[4], 2) > 0)) {
1028 printf("*** Users need validation\n");
1030 if (extract_int(&aaa[4], 1) > 0) {
1031 printf("*** Please register.\n");
1032 formout("register");
1036 /* Make up some temporary filenames for use in various parts of the
1037 * program. Don't mess with these once they've been set, because we
1038 * will be unlinking them later on in the program and we don't
1039 * want to delete something that we didn't create. */
1040 snprintf(temp, sizeof temp, tmpnam(NULL));
1041 snprintf(temp2, sizeof temp2, tmpnam(NULL));
1042 snprintf(tempdir, sizeof tempdir, tmpnam(NULL));
1044 /* Get screen dimensions. First we go to a default of 80x24. Then
1045 * we try to get the user's actual screen dimensions off the server.
1046 * However, if we're running on an xterm, all this stuff is
1047 * irrelevant because we're going to dynamically size the screen
1048 * during the session.
1054 if (aaa[0] == '2') {
1055 screenwidth = extract_int(&aaa[4], 0);
1056 screenheight = extract_int(&aaa[4], 1);
1058 if (getenv("TERM") != NULL)
1059 if (!strcmp(getenv("TERM"), "xterm")) {
1063 check_screen_dims();
1069 /* Enter the lobby */
1070 dotgoto("_BASEROOM_", 1);
1072 /* Main loop for the system... user is logged in. */
1081 /* MAIN COMMAND LOOP */
1083 mcmd = getcmd(argbuf); /* Get keyboard command */
1086 check_screen_dims(); /* if xterm, get screen size */
1104 newprompt("What do you want your username to be? ", aaa, 32);
1105 snprintf(bbb, sizeof bbb, "ENT0 2|0|0|0|%s", aaa);
1108 if (strncmp("200", aaa, 3))
1109 printf("\n%s\n", aaa);
1123 dotgoto("_MAIL_", 1);
1140 readmsgs(0, (-1), 0);
1143 readmsgs(2, (-1), 0);
1146 readmsgs(3, 1, atoi(argbuf));
1233 cli_image_upload("_userpic_");
1236 cli_image_upload("_roompic_");
1240 snprintf(aaa, sizeof aaa, "_floorpic_|%d", curr_floor);
1241 cli_image_upload(aaa);
1245 enternew("roomname", aaa, 20);
1246 snprintf(bbb, sizeof bbb, "RCHG %s", aaa);
1249 if (strncmp("200", aaa, 3))
1250 printf("\n%s\n", aaa);
1253 enternew("hostname", aaa, 25);
1254 snprintf(bbb, sizeof bbb, "HCHG %s", aaa);
1257 if (strncmp("200", aaa, 3))
1258 printf("\n%s\n", aaa);
1261 enternew("username", aaa, 32);
1262 snprintf(bbb, sizeof bbb, "UCHG %s", aaa);
1265 if (strncmp("200", aaa, 3))
1266 printf("\n%s\n", aaa);
1276 display_help(argbuf);
1280 formout("register");
1285 printf("Are you sure (y/n)? ");
1294 printf("All users will be disconnected! "
1295 "Really terminate the server? ");
1299 printf("%s\n", &aaa[4]);
1308 printf("Do you really want to schedule a "
1309 "server shutdown? ");
1311 serv_puts("SCDN 1");
1314 if (atoi(&aaa[4])) {
1316 "The Citadel server will terminate when all users are logged off.\n"
1321 "The Citadel server will not terminate.\n"
1336 if (server_is_local) {
1337 sttybbs(SB_RESTORE);
1338 snprintf(aaa, sizeof aaa, "USERNAME=\042%s\042; export USERNAME;"
1339 "exec ./subsystem %ld %d %d", fullname,
1340 usernum, screenwidth, axlevel);
1342 sttybbs(SB_NO_INTR);
1344 printf("*** Can't run doors when server is not local.\n");
1357 do_system_configuration();
1361 do_internet_configuration();
1365 check_message_base();
1387 gotofloor(argbuf, GF_GOTO);
1391 gotofloor(argbuf, GF_SKIP);
1395 forget_this_floor();
1423 knrooms(floor_mode);
1433 misc_server_cmd(argbuf);
1437 edit_system_message(argbuf);
1462 } while (termn8 == 0);
1464 TERMN8:printf("%s logged out.\n", fullname);
1465 while (march != NULL)
1466 remove_march(march->march_name, 0);
1468 printf("\n\nType 'off' to hang up, or next user...\n");
1469 snprintf(aaa, sizeof aaa, "LOUT");
1472 if ((mcmd == 29) || (mcmd == 15)) {