4 * Main source module for the client program.
15 #if TIME_WITH_SYS_TIME
16 # include <sys/time.h>
20 # include <sys/time.h>
27 #include <sys/types.h>
30 #include <sys/ioctl.h>
38 #include "serv_info.h"
40 #include "routines2.h"
45 #include "client_chat.h"
46 #include "client_passwords.h"
47 #include "citadel_decls.h"
58 char march_name[ROOMNAMELEN];
63 #define IFEXPERT if (userflags&US_EXPERT)
64 #define IFNEXPERT if ((userflags&US_EXPERT)==0)
65 #define IFAIDE if (axlevel>=6)
66 #define IFNAIDE if (axlevel<6)
68 struct march *march = NULL;
70 /* globals associated with the client program */
71 char temp[PATH_MAX]; /* Name of general temp file */
72 char temp2[PATH_MAX]; /* Name of general temp file */
73 char tempdir[PATH_MAX]; /* Name of general temp dir */
74 char editor_path[SIZ]; /* path to external editor */
75 char printcmd[SIZ]; /* print command */
76 int editor_pid = (-1);
79 struct CtdlServInfo serv_info; /* Info on the server connected */
83 char room_name[ROOMNAMELEN];
84 char ugname[ROOMNAMELEN];
85 long uglsn; /* holds <u>ngoto info */
86 char is_mail = 0; /* nonzero when we're in a mail room */
87 char axlevel = 0; /* access level */
88 char is_room_aide = 0; /* boolean flag, 1 if room aide */
92 long usernum = 0L; /* user number */
94 long highest_msg_read; /* used for <A>bandon room cmd */
95 long maxmsgnum; /* used for <G>oto */
97 char have_xterm = 0; /* are we running on an xterm? */
104 char curr_floor = 0; /* number of current floor */
105 char floorlist[128][SIZ]; /* names of floors */
106 char express_msgs = 0; /* express messages waiting! */
107 int termn8 = 0; /* Set to nonzero to cause a logoff */
109 extern int rc_ansi_color; /* ansi color value from citadel.rc */
112 * here is our 'clean up gracefully and exit' routine
114 void logoff(int code)
116 if (editor_pid > 0) { /* kill the editor if it's running */
117 kill(editor_pid, SIGHUP);
119 /* shut down the server... but not if the logoff code is 3, because
120 * that means we're exiting because we already lost the server
126 * now clean up various things
133 /* Violently kill off any child processes if Citadel is
136 if (getppid() == 1) {
137 kill(0 - getpgrp(), SIGTERM);
139 kill(0 - getpgrp(), SIGKILL);
141 sttybbs(SB_RESTORE); /* return the old terminal settings */
142 exit(code); /* exit with the proper exit code */
148 * signal catching function for hangups...
150 void dropcarr(int signum)
158 * catch SIGCONT to reset terminal modes when were are put back into the
161 void catch_sigcont(int signum)
164 signal(SIGCONT, catch_sigcont);
169 /* general purpose routines */
171 void formout(char *name)
172 { /* 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(char *patn)
197 pprintf("%s\n", &buf[4]);
200 pprintf(" User Name Num L LastCall Calls Posts\n");
201 pprintf("------------------------- ----- - ---------- ----- -----\n");
202 while (serv_gets(buf), strcmp(buf, "000")) {
203 if (sigcaught == 0) {
205 if (pattern(fl, patn) >= 0) {
206 pprintf("%-25s ", fl);
207 pprintf("%5ld %d ", extract_long(buf, 2),
208 extract_int(buf, 1));
209 lc = extract_long(buf, 3);
210 tmbuf = (struct tm *) localtime(&lc);
211 pprintf("%02d/%02d/%04d ",
214 (tmbuf->tm_year + 1900));
215 pprintf("%5ld %5ld\n", extract_long(buf, 4), extract_long(buf, 5));
225 * grab assorted info about the user...
227 void load_user_info(char *params)
229 extract(fullname, params, 0);
230 axlevel = extract_int(params, 1);
231 timescalled = extract_int(params, 2);
232 posted = extract_int(params, 3);
233 userflags = extract_int(params, 4);
234 usernum = extract_long(params, 5);
239 * Remove a room from the march list. 'floornum' is ignored unless
240 * 'roomname' is set to _FLOOR_, in which case all rooms on the requested
241 * floor will be removed from the march list.
243 void remove_march(char *roomname, int floornum)
245 struct march *mptr, *mptr2;
250 if ((!strcasecmp(march->march_name, roomname))
251 || ((!strcasecmp(roomname, "_FLOOR_")) && (march->march_floor == floornum))) {
258 for (mptr = march; mptr != NULL; mptr = mptr->next) {
260 if ((!strcasecmp(mptr->march_name, roomname))
261 || ((!strcasecmp(roomname, "_FLOOR_"))
262 && (mptr->march_floor == floornum))) {
264 mptr2->next = mptr->next;
275 * Locate the room on the march list which we most want to go to. Each room
276 * is measured given a "weight" of preference based on various factors.
278 char *pop_march(int desired_floor)
280 static char TheRoom[ROOMNAMELEN];
282 int TheOrder = 32767;
285 struct march *mptr = NULL;
287 strcpy(TheRoom, "_BASEROOM_");
291 for (mptr = march; mptr != NULL; mptr = mptr->next) {
293 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
294 weight = weight + 10000;
295 if (mptr->march_floor == desired_floor)
296 weight = weight + 5000;
298 weight = weight + ((128 - (mptr->march_floor)) * 128);
299 weight = weight + (128 - (mptr->march_order));
301 if (weight > TheWeight) {
303 strcpy(TheRoom, mptr->march_name);
304 TheFloor = mptr->march_floor;
305 TheOrder = mptr->march_order;
313 * jump directly to a room
315 void dotgoto(char *towhere, int display_name)
317 char aaa[SIZ], bbb[SIZ], psearch[SIZ];
320 static int oldmailcount = (-1);
321 int partial_match, best_match;
324 /* store ungoto information */
325 strcpy(ugname, room_name);
328 /* first try an exact match */
329 snprintf(aaa, sizeof aaa, "GOTO %s", towhere);
334 if (!strncmp(aaa, "54", 2)) {
335 newprompt("Enter room password: ", bbb, 9);
336 snprintf(aaa, sizeof aaa, "GOTO %s|%s", towhere, bbb);
342 if (!strncmp(aaa, "54", 2)) {
343 printf("Wrong password.\n");
347 * If a match is not found, try a partial match.
348 * Partial matches anywhere in the string carry a weight of 1,
349 * left-aligned matches carry a weight of 2. Pick the room that
350 * has the highest-weighted match.
358 while (serv_gets(aaa), strcmp(aaa, "000")) {
359 extract(psearch, aaa, 0);
361 if (pattern(psearch, towhere) >= 0) {
364 if (!strncasecmp(towhere, psearch, strlen(towhere))) {
367 if (partial_match > best_match) {
368 strcpy(bbb, psearch);
369 best_match = partial_match;
372 if (strlen(bbb) == 0) {
373 printf("No room '%s'.\n", towhere);
376 snprintf(aaa, sizeof aaa, "GOTO %s", bbb);
386 extract(room_name, &aaa[4], 0);
387 room_flags = extract_int(&aaa[4], 4);
388 from_floor = curr_floor;
389 curr_floor = extract_int(&aaa[4], 10);
391 remove_march(room_name, 0);
392 if (!strcasecmp(towhere, "_BASEROOM_"))
393 remove_march(towhere, 0);
394 if ((from_floor != curr_floor) && (display_name > 0) && (floor_mode == 1)) {
395 if (floorlist[(int) curr_floor][0] == 0)
397 printf("(Entering floor: %s)\n", &floorlist[(int) curr_floor][0]);
399 if (display_name == 1) {
401 printf("%s ", room_name);
405 if (display_name != 2) {
406 color(BRIGHT_YELLOW);
407 printf("%d ", extract_int(&aaa[4], 1));
410 color(BRIGHT_YELLOW);
411 printf("%d ", extract_int(&aaa[4], 2));
413 printf("messages.\n");
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)
425 /* check for newly arrived mail if we can */
426 if (num_parms(&aaa[4]) >= 10) {
427 newmailcount = extract_int(&aaa[4], 9);
428 if ((oldmailcount >= 0) && (newmailcount > oldmailcount)) {
430 printf("*** You have new mail\n");
433 oldmailcount = newmailcount;
437 /* Goto next room having unread messages.
438 * We want to skip over rooms that the user has already been to, and take the
439 * user back to the lobby when done. The room we end up in is placed in
440 * newroom - which is set to 0 (the lobby) initially.
445 struct march *mptr, *mptr2;
446 char next_room[ROOMNAMELEN];
448 /* Check to see if the march-mode list is already allocated.
449 * If it is, pop the first room off the list and go there.
455 while (serv_gets(buf), strcmp(buf, "000")) {
456 mptr = (struct march *) malloc(sizeof(struct march));
458 extract(mptr->march_name, buf, 0);
459 mptr->march_floor = (char) (extract_int(buf, 2) & 0x7F);
460 mptr->march_order = (char) (extract_int(buf, 3) & 0x7F);
465 while (mptr2->next != NULL)
470 /* add _BASEROOM_ to the end of the march list, so the user will end up
471 * in the system base room (usually the Lobby>) at the end of the loop
473 mptr = (struct march *) malloc(sizeof(struct march));
475 strcpy(mptr->march_name, "_BASEROOM_");
480 while (mptr2->next != NULL)
485 * ...and remove the room we're currently in, so a <G>oto doesn't make us
486 * walk around in circles
488 remove_march(room_name, 0);
491 strcpy(next_room, pop_march(curr_floor));
493 strcpy(next_room, "_BASEROOM_");
495 remove_march(next_room, 0);
496 dotgoto(next_room, 1);
500 * forget all rooms on a given floor
502 void forget_all_rooms_on(int ffloor)
505 struct march *flist, *fptr;
507 printf("Forgetting all rooms on %s...\r", &floorlist[ffloor][0]);
509 snprintf(buf, sizeof buf, "LKRA %d", ffloor);
513 printf("%-72s\n", &buf[4]);
517 while (serv_gets(buf), strcmp(buf, "000")) {
518 fptr = (struct march *) malloc(sizeof(struct march));
521 extract(fptr->march_name, buf, 0);
523 while (flist != NULL) {
524 snprintf(buf, sizeof buf, "GOTO %s", flist->march_name);
535 printf("%-72s\r", "");
540 * routine called by gotofloor() to move to a new room on a new floor
542 void gf_toroom(char *towhere, int mode)
544 int floor_being_left;
546 floor_being_left = curr_floor;
548 if (mode == GF_GOTO) { /* <;G>oto mode */
552 if (mode == GF_SKIP) { /* <;S>kip mode */
554 remove_march("_FLOOR_", floor_being_left);
556 if (mode == GF_ZAP) { /* <;Z>ap mode */
558 remove_march("_FLOOR_", floor_being_left);
559 forget_all_rooms_on(floor_being_left);
567 void gotofloor(char *towhere, int mode)
571 char buf[SIZ], targ[SIZ];
573 if (floorlist[0][0] == 0)
576 for (a = 0; a < 128; ++a)
577 if (!strcasecmp(&floorlist[a][0], towhere))
581 for (a = 0; a < 128; ++a) {
582 if (!strncasecmp(&floorlist[a][0], towhere, strlen(towhere))) {
588 for (a = 0; a < 128; ++a)
589 if (pattern(towhere, &floorlist[a][0]) > 0)
593 printf("No floor '%s'.\n", towhere);
596 for (mptr = march; mptr != NULL; mptr = mptr->next) {
597 if ((mptr->march_floor) == tofloor)
598 gf_toroom(mptr->march_name, mode);
603 snprintf(buf, sizeof buf, "LKRA %d", tofloor);
607 while (serv_gets(buf), strcmp(buf, "000")) {
608 if ((extract_int(buf, 2) == tofloor) && (strlen(targ) == 0))
609 extract(targ, buf, 0);
611 if (strlen(targ) > 0) {
612 gf_toroom(targ, mode);
614 printf("There are no rooms on '%s'.\n", &floorlist[tofloor][0]);
620 * forget all rooms on current floor
622 void forget_this_floor(void)
625 if (curr_floor == 0) {
626 printf("Can't forget this floor.\n");
629 if (floorlist[0][0] == 0)
631 printf("Are you sure you want to forget all rooms on %s? ",
632 &floorlist[(int) curr_floor][0]);
636 gf_toroom("_BASEROOM_", GF_ZAP);
641 * Figure out the physical screen dimensions, if we can
643 void check_screen_dims(void)
647 unsigned short height; /* rows */
648 unsigned short width; /* columns */
649 unsigned short xpixels;
650 unsigned short ypixels; /* pixels */
653 if (have_xterm) { /* dynamically size screen if on an xterm */
654 if (ioctl(0, TIOCGWINSZ, &xwinsz) == 0) {
656 screenheight = (int) xwinsz.height;
658 screenwidth = (int) xwinsz.width;
666 * set floor mode depending on client, server, and user settings
668 void set_floor_mode(void)
670 if (serv_info.serv_ok_floors == 0) {
671 floor_mode = 0; /* Don't use floors if the server */
673 /* doesn't support them! */
675 if (rc_floor_mode == RC_NO) { /* never use floors */
678 if (rc_floor_mode == RC_YES) { /* always use floors */
681 if (rc_floor_mode == RC_DEFAULT) { /* user choice */
682 floor_mode = ((userflags & US_FLOORS) ? 1 : 0);
688 * Set or change the user's password
690 int set_password(void)
696 if (strlen(rc_password) > 0) {
697 strcpy(pass1, rc_password);
698 strcpy(pass2, rc_password);
700 IFNEXPERT formout("changepw");
701 newprompt("Enter a new password: ", pass1, -19);
702 newprompt("Enter it again to confirm: ", pass2, -19);
706 if (!strcasecmp(pass1, pass2)) {
707 snprintf(buf, sizeof buf, "SETP %s", pass1);
710 printf("%s\n", &buf[4]);
711 offer_to_remember_password(hostbuf, portbuf, fullname, pass1);
714 printf("*** They don't match... try again.\n");
722 * get info about the server we've connected to
724 void get_serv_info(char *supplied_hostname)
728 CtdlInternalGetServInfo(&serv_info);
730 /* be nice and identify ourself to the server */
731 snprintf(buf, sizeof buf, "IDEN %d|%d|%d|%s|",
732 SERVER_TYPE, 0, REV_LEVEL,
733 (server_is_local ? "local" : CITADEL));
735 /* Append a hostname */
736 if (supplied_hostname != NULL) {
737 strcat(buf, supplied_hostname);
740 locate_host(&buf[strlen(buf)]); /* append to the end */
744 serv_gets(buf); /* we don't care about the result code */
752 * Display list of users currently logged on to the server
754 void who_is_online(int longlist)
756 char buf[SIZ], username[SIZ], roomname[SIZ], fromhost[SIZ];
758 char actual_user[SIZ], actual_room[SIZ], actual_host[SIZ];
759 char tbuf[SIZ], clientsoft[SIZ];
761 time_t idletime, idlehours, idlemins, idlesecs;
762 int last_session = (-1);
766 if (tbuf[0] == '2') {
767 timenow = extract_long(&tbuf[4], 0);
775 pprintf("FLG ### User Name Room From host\n");
777 pprintf("--- --- ------------------------- -------------------- ------------------------\n");
782 while (serv_gets(buf), strcmp(buf, "000")) {
783 extract(username, buf, 1);
784 extract(roomname, buf, 2);
785 extract(fromhost, buf, 3);
786 extract(clientsoft, buf, 4);
787 extract(flags, buf, 7);
789 idletime = timenow - extract_long(buf, 5);
790 idlehours = idletime / 3600;
791 idlemins = (idletime - (idlehours * 3600)) / 60;
792 idlesecs = (idletime - (idlehours * 3600) - (idlemins * 60));
794 if (idletime > 900) {
795 while (strlen(roomname) < 20) {
796 strcat(roomname, " ");
798 strcpy(&roomname[14], "[idle]");
803 extract(actual_user, buf, 8);
804 extract(actual_room, buf, 9);
805 extract(actual_host, buf, 10);
807 pprintf(" Flags: %s\n", flags);
808 pprintf("Session: %d\n", extract_int(buf, 0));
809 pprintf(" Name: %s\n", username);
810 pprintf("In room: %s\n", roomname);
811 pprintf(" Host: %s\n", fromhost);
812 pprintf(" Client: %s\n", clientsoft);
813 pprintf(" Idle: %ld:%02ld:%02ld\n",
818 if ( (strlen(actual_user)+strlen(actual_room)+strlen(actual_host)) > 0) {
820 if (strlen(actual_user)>0) pprintf("<%s> ", actual_user);
821 if (strlen(actual_room)>0) pprintf("in <%s> ", actual_room);
822 if (strlen(actual_host)>0) pprintf("from <%s> ", actual_host);
828 if (extract_int(buf, 0) == last_session) {
831 color(BRIGHT_MAGENTA);
832 pprintf("%-3s ", flags);
834 pprintf("%-3d ", extract_int(buf, 0));
836 last_session = extract_int(buf, 0);
838 pprintf("%-25s ", username);
839 color(BRIGHT_MAGENTA);
841 pprintf("%-20s ", roomname);
843 pprintf("%-24s\n", fromhost);
850 void enternew(char *desc, char *buf, int maxlen)
853 snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc);
854 newprompt(bbb, buf, maxlen);
859 int shift(int argc, char **argv, int start, int count) {
862 for (i=start; i<(argc-count); ++i) {
863 argv[i] = argv[i+count];
872 int main(int argc, char **argv)
875 char aaa[100], bbb[100];/* general purpose variables */
876 char argbuf[32]; /* command line buf */
877 char nonce[NONCE_SIZE];
878 char *telnet_client_host = NULL;
879 char *sptr, *sptr2; /* USed to extract the nonce */
880 char hexstring[MD5_HEXSTRING_SIZE];
881 int stored_password = 0;
884 sttybbs(SB_SAVE); /* Store the old terminal parameters */
885 load_command_set(); /* parse the citadel.rc file */
886 sttybbs(SB_NO_INTR); /* Install the new ones */
887 signal(SIGHUP, dropcarr); /* Cleanup gracefully if carrier is dropped */
888 signal(SIGTERM, dropcarr); /* Cleanup gracefully if terminated */
889 signal(SIGCONT, catch_sigcont); /* Catch SIGCONT so we can reset terminal */
892 * Handle command line options as if we were called like /bin/login
893 * (i.e. from in.telnetd)
895 for (a=0; a<argc; ++a) {
896 if ((argc > a+1) && (!strcmp(argv[a], "-h")) ) {
897 telnet_client_host = argv[a+1];
898 argc = shift(argc, argv, a, 2);
900 if (!strcmp(argv[a], "-p")) {
901 argc = shift(argc, argv, a, 1);
905 printf("Attaching to server... \r");
907 attach_to_server(argc, argv, hostbuf, portbuf);
913 printf("%s\n", &aaa[4]);
917 /* If there is a [nonce] at the end, put the nonce in <nonce>, else nonce
921 if ((sptr = strchr(aaa, '<')) == NULL)
927 if ((sptr2 = strchr(sptr, '>')) == NULL)
935 strncpy(nonce, sptr, NONCE_SIZE);
939 get_serv_info(telnet_client_host);
945 printf("%-23s\n%s\n%s\n", serv_info.serv_software, serv_info.serv_humannode,
946 serv_info.serv_bbs_city);
947 screenwidth = 80; /* default screen dimensions */
950 printf(" pause next stop\n");
951 printf(" ctrl-s ctrl-o ctrl-c\n\n");
952 formout("hello"); /* print the opening greeting */
955 GSTA: /* See if we have a username and password on disk */
956 if (rc_remember_passwords) {
957 get_stored_password(hostbuf, portbuf, fullname, password);
958 if (strlen(fullname) > 0) {
959 snprintf(aaa, sizeof(aaa)-1, "USER %s", fullname);
964 sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
966 else /* Else no APOP */
968 snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
974 load_user_info(&aaa[4]);
979 set_stored_password(hostbuf, portbuf, "", "");
987 if (strlen(rc_username) > 0) {
988 strcpy(fullname, rc_username);
990 newprompt("Enter your name: ", fullname, 29);
993 if (!strcasecmp(fullname, "new")) { /* just in case */
994 printf("Please enter the name you wish to log in with.\n");
997 (!strcasecmp(fullname, "bbs"))
998 || (!strcasecmp(fullname, "new"))
999 || (strlen(fullname) == 0));
1001 if (!strcasecmp(fullname, "off")) {
1005 /* sign on to the server */
1006 snprintf(aaa, sizeof aaa, "USER %s", fullname);
1012 /* password authentication */
1013 if (strlen(rc_password) > 0) {
1014 strcpy(password, rc_password);
1016 newprompt("\rPlease enter your password: ", password, -19);
1022 sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
1024 else /* Else no APOP */
1026 snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
1031 if (aaa[0] == '2') {
1032 load_user_info(&aaa[4]);
1033 offer_to_remember_password(hostbuf, portbuf,
1034 fullname, password);
1037 printf("<< wrong password >>\n");
1038 if (strlen(rc_password) > 0)
1042 NEWUSR: if (strlen(rc_password) == 0) {
1043 printf("No record. Enter as new user? ");
1047 snprintf(aaa, sizeof aaa, "NEWU %s", fullname);
1050 if (aaa[0] != '2') {
1051 printf("%s\n", aaa);
1054 load_user_info(&aaa[4]);
1056 while (set_password() != 0);;
1062 /* Switch color support on or off if we're in user mode */
1063 if (rc_ansi_color == 3) {
1064 if (userflags & US_COLOR)
1070 printf("%s\nAccess level: %d (%s)\nUser #%ld / Call #%d\n",
1071 fullname, axlevel, axdefs[(int) axlevel],
1072 usernum, timescalled);
1076 if (aaa[0] == '2') {
1077 b = extract_int(&aaa[4], 0);
1081 printf("*** You have a new private message in Mail>\n");
1083 printf("*** You have %d new private messages in Mail>\n", b);
1086 if ((axlevel >= 6) && (extract_int(&aaa[4], 2) > 0)) {
1087 printf("*** Users need validation\n");
1089 if (extract_int(&aaa[4], 1) > 0) {
1090 printf("*** Please register.\n");
1091 formout("register");
1095 /* Make up some temporary filenames for use in various parts of the
1096 * program. Don't mess with these once they've been set, because we
1097 * will be unlinking them later on in the program and we don't
1098 * want to delete something that we didn't create. */
1099 snprintf(temp, sizeof temp, tmpnam(NULL));
1100 snprintf(temp2, sizeof temp2, tmpnam(NULL));
1101 snprintf(tempdir, sizeof tempdir, tmpnam(NULL));
1103 /* Get screen dimensions. First we go to a default of 80x24. Then
1104 * we try to get the user's actual screen dimensions off the server.
1105 * However, if we're running on an xterm, all this stuff is
1106 * irrelevant because we're going to dynamically size the screen
1107 * during the session.
1113 if (aaa[0] == '2') {
1114 screenwidth = extract_int(&aaa[4], 0);
1115 screenheight = extract_int(&aaa[4], 1);
1117 if (getenv("TERM") != NULL)
1118 if (!strcmp(getenv("TERM"), "xterm")) {
1122 check_screen_dims();
1128 /* Enter the lobby */
1129 dotgoto("_BASEROOM_", 1);
1131 /* Main loop for the system... user is logged in. */
1140 /* MAIN COMMAND LOOP */
1142 mcmd = getcmd(argbuf); /* Get keyboard command */
1145 check_screen_dims(); /* if xterm, get screen size */
1163 newprompt("What do you want your username to be? ", aaa, 32);
1164 snprintf(bbb, sizeof bbb, "ENT0 2|0|0|0|%s", aaa);
1167 if (strncmp("200", aaa, 3))
1168 printf("\n%s\n", aaa);
1182 dotgoto("_MAIL_", 1);
1199 readmsgs(0, (-1), 0);
1202 readmsgs(2, (-1), 0);
1205 readmsgs(3, 1, atoi(argbuf));
1292 cli_image_upload("_userpic_");
1295 cli_image_upload("_roompic_");
1299 snprintf(aaa, sizeof aaa, "_floorpic_|%d", curr_floor);
1300 cli_image_upload(aaa);
1304 enternew("roomname", aaa, 20);
1305 snprintf(bbb, sizeof bbb, "RCHG %s", aaa);
1308 if (strncmp("200", aaa, 3))
1309 printf("\n%s\n", aaa);
1312 enternew("hostname", aaa, 25);
1313 snprintf(bbb, sizeof bbb, "HCHG %s", aaa);
1316 if (strncmp("200", aaa, 3))
1317 printf("\n%s\n", aaa);
1320 enternew("username", aaa, 32);
1321 snprintf(bbb, sizeof bbb, "UCHG %s", aaa);
1324 if (strncmp("200", aaa, 3))
1325 printf("\n%s\n", aaa);
1335 display_help(argbuf);
1339 formout("register");
1344 printf("Are you sure (y/n)? ");
1353 printf("All users will be disconnected! "
1354 "Really terminate the server? ");
1358 printf("%s\n", &aaa[4]);
1367 printf("Do you really want to schedule a "
1368 "server shutdown? ");
1370 serv_puts("SCDN 1");
1373 if (atoi(&aaa[4])) {
1375 "The Citadel server will terminate when all users are logged off.\n"
1380 "The Citadel server will not terminate.\n"
1387 mailing_list_management();
1399 if (server_is_local) {
1400 sttybbs(SB_RESTORE);
1401 snprintf(aaa, sizeof aaa, "USERNAME=\042%s\042; export USERNAME;"
1402 "exec ./subsystem %ld %d %d", fullname,
1403 usernum, screenwidth, axlevel);
1405 sttybbs(SB_NO_INTR);
1407 printf("*** Can't run doors when server is not local.\n");
1420 do_system_configuration();
1424 do_internet_configuration();
1428 check_message_base();
1450 gotofloor(argbuf, GF_GOTO);
1454 gotofloor(argbuf, GF_SKIP);
1458 forget_this_floor();
1486 knrooms(floor_mode);
1496 misc_server_cmd(argbuf);
1500 edit_system_message(argbuf);
1525 } while (termn8 == 0);
1527 TERMN8: printf("%s logged out.\n", fullname);
1528 while (march != NULL) {
1529 remove_march(march->march_name, 0);
1532 printf("\n\nType 'off' to hang up, or next user...\n");
1534 snprintf(aaa, sizeof aaa, "LOUT");
1537 if ((mcmd == 29) || (mcmd == 15)) {