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(char *supplied_hostname)
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));
721 /* Append a hostname */
722 if (supplied_hostname != NULL) {
723 strcat(buf, supplied_hostname);
726 locate_host(&buf[strlen(buf)]); /* append to the end */
730 serv_gets(buf); /* we don't care about the result code */
738 * Display list of users currently logged on to the server
740 void who_is_online(int longlist)
742 char buf[256], username[256], roomname[256], fromhost[256];
744 char actual_user[256], actual_room[256], actual_host[256];
745 char tbuf[256], clientsoft[256];
747 time_t idletime, idlehours, idlemins, idlesecs;
748 int last_session = (-1);
752 if (tbuf[0] == '2') {
753 timenow = extract_long(&tbuf[4], 0);
761 pprintf("FLG ### User Name Room From host\n");
763 pprintf("--- --- ------------------------- -------------------- ------------------------\n");
768 while (serv_gets(buf), strcmp(buf, "000")) {
769 extract(username, buf, 1);
770 extract(roomname, buf, 2);
771 extract(fromhost, buf, 3);
772 extract(clientsoft, buf, 4);
773 extract(flags, buf, 7);
775 idletime = timenow - extract_long(buf, 5);
776 idlehours = idletime / 3600;
777 idlemins = (idletime - (idlehours * 3600)) / 60;
778 idlesecs = (idletime - (idlehours * 3600) - (idlemins * 60));
780 if (idletime > 900) {
781 while (strlen(roomname) < 20) {
782 strcat(roomname, " ");
784 strcpy(&roomname[14], "[idle]");
789 extract(actual_user, buf, 8);
790 extract(actual_room, buf, 9);
791 extract(actual_host, buf, 10);
793 pprintf("\nFlags: %-3s Sess# %-3d Name: %-25s Room: %s\n",
794 flags, extract_int(buf, 0), username, roomname);
795 pprintf("from <%s> using <%s>, idle %ld:%02ld:%02ld\n",
796 fromhost, clientsoft,
797 (long) idlehours, (long) idlemins, (long) idlesecs);
799 if ( (strlen(actual_user)+strlen(actual_room)+strlen(actual_host)) > 0) {
801 if (strlen(actual_user)>0) pprintf("<%s> ", actual_user);
802 if (strlen(actual_room)>0) pprintf("in <%s> ", actual_room);
803 if (strlen(actual_host)>0) pprintf("from <%s> ", actual_host);
808 if (extract_int(buf, 0) == last_session) {
811 color(BRIGHT_MAGENTA);
812 pprintf("%-3s ", flags);
814 pprintf("%-3d ", extract_int(buf, 0));
816 last_session = extract_int(buf, 0);
818 pprintf("%-25s ", username);
819 color(BRIGHT_MAGENTA);
821 pprintf("%-20s ", roomname);
823 pprintf("%-24s\n", fromhost);
830 void enternew(char *desc, char *buf, int maxlen)
833 snprintf(bbb, sizeof bbb, "Enter in your new %s: ", desc);
834 newprompt(bbb, buf, maxlen);
839 int shift(int argc, char **argv, int start, int count) {
842 for (i=start; i<(argc-count); ++i) {
843 argv[i] = argv[i+count];
852 int main(int argc, char **argv)
855 char aaa[100], bbb[100];/* general purpose variables */
856 char argbuf[32]; /* command line buf */
857 char nonce[NONCE_SIZE];
858 char *telnet_client_host = NULL;
859 char *sptr, *sptr2; /* USed to extract the nonce */
860 char hexstring[MD5_HEXSTRING_SIZE];
861 volatile int termn8 = 0;
862 int stored_password = 0;
865 sttybbs(SB_SAVE); /* Store the old terminal parameters */
866 load_command_set(); /* parse the citadel.rc file */
867 sttybbs(SB_NO_INTR); /* Install the new ones */
868 signal(SIGHUP, dropcarr); /* Cleanup gracefully if carrier is dropped */
869 signal(SIGTERM, dropcarr); /* Cleanup gracefully if terminated */
870 signal(SIGCONT, catch_sigcont); /* Catch SIGCONT so we can reset terminal */
873 * Handle command line options as if we were called like /bin/login
874 * (i.e. from in.telnetd)
876 for (a=0; a<argc; ++a) {
877 if ((argc > a+1) && (!strcmp(argv[a], "-h")) ) {
878 telnet_client_host = argv[a+1];
879 argc = shift(argc, argv, a, 2);
881 if (!strcmp(argv[a], "-p")) {
882 argc = shift(argc, argv, a, 1);
886 printf("Attaching to server... \r");
888 attach_to_server(argc, argv, hostbuf, portbuf);
894 printf("%s\n", &aaa[4]);
898 /* If there is a [nonce] at the end, put the nonce in <nonce>, else nonce
902 if ((sptr = strchr(aaa, '<')) == NULL)
908 if ((sptr2 = strchr(sptr, '>')) == NULL)
916 strncpy(nonce, sptr, NONCE_SIZE);
920 get_serv_info(telnet_client_host);
926 printf("%-23s\n%s\n%s\n", serv_info.serv_software, serv_info.serv_humannode,
927 serv_info.serv_bbs_city);
928 screenwidth = 80; /* default screen dimensions */
931 printf(" pause next stop\n");
932 printf(" ctrl-s ctrl-o ctrl-c\n\n");
933 formout("hello"); /* print the opening greeting */
936 GSTA: /* See if we have a username and password on disk */
937 if (rc_remember_passwords) {
938 get_stored_password(hostbuf, portbuf, fullname, password);
939 if (strlen(fullname) > 0) {
940 snprintf(aaa, sizeof(aaa)-1, "USER %s", fullname);
945 sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
947 else /* Else no APOP */
949 snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
955 load_user_info(&aaa[4]);
960 set_stored_password(hostbuf, portbuf, "", "");
968 if (strlen(rc_username) > 0) {
969 strcpy(fullname, rc_username);
971 newprompt("Enter your name: ", fullname, 29);
974 if (!strcasecmp(fullname, "new")) { /* just in case */
975 printf("Please enter the name you wish to log in with.\n");
978 (!strcasecmp(fullname, "bbs"))
979 || (!strcasecmp(fullname, "new"))
980 || (strlen(fullname) == 0));
982 if (!strcasecmp(fullname, "off")) {
986 /* sign on to the server */
987 snprintf(aaa, sizeof aaa, "USER %s", fullname);
993 /* password authentication */
994 if (strlen(rc_password) > 0) {
995 strcpy(password, rc_password);
997 newprompt("\rPlease enter your password: ", password, -19);
1003 sprintf(aaa, "PAS2 %s", make_apop_string(password, nonce, hexstring));
1005 else /* Else no APOP */
1007 snprintf(aaa, sizeof(aaa)-1, "PASS %s", password);
1012 if (aaa[0] == '2') {
1013 load_user_info(&aaa[4]);
1014 offer_to_remember_password(hostbuf, portbuf,
1015 fullname, password);
1018 printf("<< wrong password >>\n");
1019 if (strlen(rc_password) > 0)
1023 NEWUSR: if (strlen(rc_password) == 0) {
1024 printf("No record. Enter as new user? ");
1028 snprintf(aaa, sizeof aaa, "NEWU %s", fullname);
1031 if (aaa[0] != '2') {
1032 printf("%s\n", aaa);
1035 load_user_info(&aaa[4]);
1037 while (set_password() != 0);;
1043 PWOK: printf("%s\nAccess level: %d (%s)\nUser #%ld / Call #%d\n",
1044 fullname, axlevel, axdefs[(int) axlevel],
1045 usernum, timescalled);
1049 if (aaa[0] == '2') {
1050 b = extract_int(&aaa[4], 0);
1054 printf("*** You have a new private message in Mail>\n");
1056 printf("*** You have %d new private messages in Mail>\n", b);
1059 if ((axlevel >= 6) && (extract_int(&aaa[4], 2) > 0)) {
1060 printf("*** Users need validation\n");
1062 if (extract_int(&aaa[4], 1) > 0) {
1063 printf("*** Please register.\n");
1064 formout("register");
1068 /* Make up some temporary filenames for use in various parts of the
1069 * program. Don't mess with these once they've been set, because we
1070 * will be unlinking them later on in the program and we don't
1071 * want to delete something that we didn't create. */
1072 snprintf(temp, sizeof temp, tmpnam(NULL));
1073 snprintf(temp2, sizeof temp2, tmpnam(NULL));
1074 snprintf(tempdir, sizeof tempdir, tmpnam(NULL));
1076 /* Get screen dimensions. First we go to a default of 80x24. Then
1077 * we try to get the user's actual screen dimensions off the server.
1078 * However, if we're running on an xterm, all this stuff is
1079 * irrelevant because we're going to dynamically size the screen
1080 * during the session.
1086 if (aaa[0] == '2') {
1087 screenwidth = extract_int(&aaa[4], 0);
1088 screenheight = extract_int(&aaa[4], 1);
1090 if (getenv("TERM") != NULL)
1091 if (!strcmp(getenv("TERM"), "xterm")) {
1095 check_screen_dims();
1101 /* Enter the lobby */
1102 dotgoto("_BASEROOM_", 1);
1104 /* Main loop for the system... user is logged in. */
1113 /* MAIN COMMAND LOOP */
1115 mcmd = getcmd(argbuf); /* Get keyboard command */
1118 check_screen_dims(); /* if xterm, get screen size */
1136 newprompt("What do you want your username to be? ", aaa, 32);
1137 snprintf(bbb, sizeof bbb, "ENT0 2|0|0|0|%s", aaa);
1140 if (strncmp("200", aaa, 3))
1141 printf("\n%s\n", aaa);
1155 dotgoto("_MAIL_", 1);
1172 readmsgs(0, (-1), 0);
1175 readmsgs(2, (-1), 0);
1178 readmsgs(3, 1, atoi(argbuf));
1265 cli_image_upload("_userpic_");
1268 cli_image_upload("_roompic_");
1272 snprintf(aaa, sizeof aaa, "_floorpic_|%d", curr_floor);
1273 cli_image_upload(aaa);
1277 enternew("roomname", aaa, 20);
1278 snprintf(bbb, sizeof bbb, "RCHG %s", aaa);
1281 if (strncmp("200", aaa, 3))
1282 printf("\n%s\n", aaa);
1285 enternew("hostname", aaa, 25);
1286 snprintf(bbb, sizeof bbb, "HCHG %s", aaa);
1289 if (strncmp("200", aaa, 3))
1290 printf("\n%s\n", aaa);
1293 enternew("username", aaa, 32);
1294 snprintf(bbb, sizeof bbb, "UCHG %s", aaa);
1297 if (strncmp("200", aaa, 3))
1298 printf("\n%s\n", aaa);
1308 display_help(argbuf);
1312 formout("register");
1317 printf("Are you sure (y/n)? ");
1326 printf("All users will be disconnected! "
1327 "Really terminate the server? ");
1331 printf("%s\n", &aaa[4]);
1340 printf("Do you really want to schedule a "
1341 "server shutdown? ");
1343 serv_puts("SCDN 1");
1346 if (atoi(&aaa[4])) {
1348 "The Citadel server will terminate when all users are logged off.\n"
1353 "The Citadel server will not terminate.\n"
1368 if (server_is_local) {
1369 sttybbs(SB_RESTORE);
1370 snprintf(aaa, sizeof aaa, "USERNAME=\042%s\042; export USERNAME;"
1371 "exec ./subsystem %ld %d %d", fullname,
1372 usernum, screenwidth, axlevel);
1374 sttybbs(SB_NO_INTR);
1376 printf("*** Can't run doors when server is not local.\n");
1389 do_system_configuration();
1393 do_internet_configuration();
1397 check_message_base();
1419 gotofloor(argbuf, GF_GOTO);
1423 gotofloor(argbuf, GF_SKIP);
1427 forget_this_floor();
1455 knrooms(floor_mode);
1465 misc_server_cmd(argbuf);
1469 edit_system_message(argbuf);
1494 } while (termn8 == 0);
1496 TERMN8:printf("%s logged out.\n", fullname);
1497 while (march != NULL)
1498 remove_march(march->march_name, 0);
1500 printf("\n\nType 'off' to hang up, or next user...\n");
1501 snprintf(aaa, sizeof aaa, "LOUT");
1504 if ((mcmd == 29) || (mcmd == 15)) {