19 #include <sys/socket.h>
20 #include <netinet/in.h>
21 #include <arpa/inet.h>
24 #include "sysdep_decls.h"
25 #include "citserver.h"
28 #include "housekeeping.h"
33 #include "locate_host.h"
36 #include "dynloader.h"
41 struct CitContext *ContextList = NULL;
42 int ScheduledShutdown = 0;
44 int (*CtdlSendExpressMessageFunc) (char *, char *, char *) = NULL;
47 * Various things that need to be initialized at startup
49 void master_startup(void) {
50 lprintf(7, "Opening databases\n");
56 lprintf(7, "Checking floor reference counts\n");
59 lprintf(7, "Creating base rooms (if necessary)\n");
60 create_room(BASEROOM, 0, "", 0);
61 create_room(AIDEROOM, 4, "", 0);
62 create_room(config.c_twitroom, 0, "", 0);
66 * Cleanup routine to be called when the server is shutting down.
68 void master_cleanup(void) {
69 struct CleanupFunctionHook *fcn;
71 /* Cancel all running sessions */
72 lprintf(7, "Cancelling running sessions...\n");
73 while (ContextList != NULL) {
74 kill_session(ContextList->cs_pid);
77 /* Run any cleanup routines registered by loadable modules */
78 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
79 (*fcn->h_function_pointer)();
83 lprintf(7, "Closing databases\n");
86 /* Do system-dependent stuff */
87 sysdep_master_cleanup();
90 lprintf(3, "citserver: exiting.\n");
91 fflush(stdout); fflush(stderr);
97 * Free any per-session data allocated by modules or whatever
99 void deallocate_user_data(struct CitContext *con)
101 struct CtdlSessData *ptr;
103 begin_critical_section(S_SESSION_TABLE);
104 while (con->FirstSessData != NULL) {
105 lprintf(9, "Deallocating user data symbol %ld\n",
106 con->FirstSessData->sym_id);
107 if (con->FirstSessData->sym_data != NULL)
108 phree(con->FirstSessData->sym_data);
109 ptr = con->FirstSessData->next;
110 phree(con->FirstSessData);
111 con->FirstSessData = ptr;
113 end_critical_section(S_SESSION_TABLE);
120 * Gracefully terminate the session and thread.
121 * (This is called as a cleanup handler by the thread library.)
123 * All NON-system-dependent stuff is done in this function.
124 * System-dependent session/thread cleanup is in cleanup() in sysdep.c
126 void cleanup_stuff(void *arg)
129 lprintf(9, "cleanup_stuff() called\n");
131 lprintf(7, "Calling logout(%d)\n", CC->cs_pid);
134 rec_log(CL_TERMINATE,CC->curr_user);
136 lprintf(3, "citserver[%3d]: ended.\n",CC->cs_pid);
138 /* Run any cleanup routines registered by loadable modules */
139 PerformSessionHooks(EVT_STOP);
141 syslog(LOG_NOTICE,"session %d ended", CC->cs_pid);
143 /* Deallocate any user-data attached to this session */
144 deallocate_user_data(CC);
146 /* Now get rid of the session and context */
147 lprintf(7, "cleanup_stuff() calling RemoveContext(%d)\n", CC->cs_pid);
150 /* While we still have an extra thread with no user attached to it,
151 * take the opportunity to do some housekeeping before exiting.
158 * Get a dynamic symbol number for per-session user data.
159 * This API call should be made only ONCE per symbol per citserver run.
161 int CtdlGetDynamicSymbol()
163 static unsigned int next_symbol = SYM_MAX;
164 return ++next_symbol;
170 * Return a pointer to some generic per-session user data.
171 * (This function returns NULL if the requested symbol is not allocated.)
173 * NOTE: we use critical sections for allocating and de-allocating these,
174 * but not for locating one.
176 void *CtdlGetUserData(unsigned long requested_sym)
178 struct CtdlSessData *ptr;
180 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
181 if (ptr->sym_id == requested_sym)
182 return(ptr->sym_data);
184 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
191 * Allocate some generic per-session user data.
193 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
195 struct CtdlSessData *ptr;
197 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
199 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
200 if (ptr->sym_id == requested_sym) {
201 lprintf(2, "ERROR: CtdlAllocUserData() requested for"
202 " symbol id %ld already registered\n",
208 ptr = mallok(sizeof(struct CtdlSessData));
209 ptr->sym_id = requested_sym;
210 ptr->sym_data = mallok(num_bytes);
212 begin_critical_section(S_SESSION_TABLE);
213 ptr->next = CC->FirstSessData;
214 CC->FirstSessData = ptr;
215 end_critical_section(S_SESSION_TABLE);
217 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
225 * set_wtmpsupp() - alter the session listing
227 void set_wtmpsupp(char *newtext)
229 strncpy(CC->cs_room,newtext,sizeof CC->cs_room);
230 CC->cs_room[sizeof CC->cs_room - 1] = 0;
231 time(&CC->cs_lastupdt);
233 /* Run any routines registered by loadable modules */
234 PerformSessionHooks(EVT_NEWROOM);
239 * call set_wtmpsupp() with the name of the current room, modified a bit...
241 void set_wtmpsupp_to_current_room() {
242 if (CC->quickroom.QRflags & QR_PRIVATE) {
243 set_wtmpsupp("<private room>");
245 else if (CC->quickroom.QRflags & QR_MAILBOX) {
246 set_wtmpsupp(&CC->quickroom.QRname[11]);
249 set_wtmpsupp(CC->quickroom.QRname);
256 * cmd_info() - tell the client about this server
258 void cmd_info(void) {
259 cprintf("%d Server info:\n",LISTING_FOLLOWS);
260 cprintf("%d\n",CC->cs_pid);
261 cprintf("%s\n",config.c_nodename);
262 cprintf("%s\n",config.c_humannode);
263 cprintf("%s\n",config.c_fqdn);
264 cprintf("%s\n",CITADEL);
265 cprintf("%d\n",REV_LEVEL);
266 cprintf("%s\n",config.c_bbs_city);
267 cprintf("%s\n",config.c_sysadm);
268 cprintf("%d\n",SERVER_TYPE);
269 cprintf("%s\n",config.c_moreprompt);
270 cprintf("1\n"); /* 1 = yes, this system supports floors */
271 cprintf("1\n"); /* 1 = we support the extended paging options */
275 void cmd_rchg(char *argbuf)
277 char newroomname[256]; /* set to 256 to prevent buffer overruns <dme>*/
279 extract(newroomname, argbuf, 0);
280 newroomname[ROOMNAMELEN] = 0;
281 if (strlen(newroomname) > 0) {
282 strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN);
283 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
286 strcpy(CC->fake_roomname, "");
288 cprintf("%d OK\n", OK);
291 void cmd_hchg(char *newhostname)
293 if ((newhostname) && (newhostname[0]))
295 memset(CC->fake_hostname, 0, 25);
296 strncpy(CC->fake_hostname, newhostname, 24);
299 strcpy(CC->fake_hostname, "");
300 cprintf("%d OK\n",OK);
303 void cmd_uchg(char *newusername)
305 if (CC->usersupp.axlevel < 6)
307 cprintf("%d You must be an Aide to use UCHG.\n",
308 ERROR+HIGHER_ACCESS_REQUIRED);
311 if ((newusername) && (newusername[0]))
313 CC->cs_flags &= ~CS_STEALTH;
314 memset(CC->fake_username, 0, 32);
315 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
316 strncpy(CC->fake_username, newusername, 31);
320 CC->fake_username[0] = '\0';
321 CC->cs_flags |= CS_STEALTH;
327 * returns an asterisk if there are any express messages waiting,
330 char check_express(void) {
331 if (CC->FirstExpressMessage == NULL) {
345 cprintf("%d %ld\n", OK, tv);
349 * Check whether two hostnames match.
350 * "Realname" should be an actual name of a client that is trying to connect;
351 * "testname" should be the value we are comparing it with. The idea is that we
352 * want to compare with both the abbreviated and fully-qualified versions of
353 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
355 static int hostnames_match(const char *realname, const char *testname) {
359 if (!strcasecmp(realname, testname))
362 #ifdef HAVE_NONREENTRANT_NETDB
363 begin_critical_section(S_NETDB);
366 if ((he = gethostbyname(testname)) != NULL)
367 if (!strcasecmp(realname, he->h_name))
370 #ifdef HAVE_NONREENTRANT_NETDB
371 end_critical_section(S_NETDB);
378 * check a hostname against the public_clients file
380 int is_public_client(char *where)
385 if (hostnames_match(where,"localhost")) return(1);
386 if (hostnames_match(where,config.c_fqdn)) return(1);
388 fp = fopen("public_clients","r");
389 if (fp == NULL) return(0);
391 while (fgets(buf,256,fp)!=NULL) {
392 while (isspace((buf[strlen(buf)-1])))
393 buf[strlen(buf)-1] = 0;
394 if (hostnames_match(where,buf)) {
406 * the client is identifying itself to the server
408 void cmd_iden(char *argbuf)
417 if (num_parms(argbuf)<4) {
418 cprintf("%d usage error\n",ERROR);
422 dev_code = extract_int(argbuf,0);
423 cli_code = extract_int(argbuf,1);
424 rev_level = extract_int(argbuf,2);
425 extract(desc,argbuf,3);
427 strncpy(from_host,config.c_fqdn,sizeof from_host);
428 from_host[sizeof from_host - 1] = 0;
429 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
431 CC->cs_clientdev = dev_code;
432 CC->cs_clienttyp = cli_code;
433 CC->cs_clientver = rev_level;
434 strncpy(CC->cs_clientname,desc,31);
435 CC->cs_clientname[31] = 0;
437 if ((strlen(from_host)>0) &&
438 (is_public_client(CC->cs_host))) {
439 if (inet_aton(from_host, &addr))
440 locate_host(CC->cs_host, &addr);
442 strncpy(CC->cs_host,from_host,24);
446 set_wtmpsupp_to_current_room();
448 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
454 cprintf("%d Ok\n",OK);
459 * enter or exit "stealth mode"
461 void cmd_stel(char *cmdbuf)
465 requested_mode = extract_int(cmdbuf,0);
466 if (requested_mode !=0) requested_mode = 1;
468 if (!CC->logged_in) {
469 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
473 if (CC->usersupp.axlevel < 6) {
474 cprintf("%d You must be an Aide to use stealth mode.\n",
475 ERROR+HIGHER_ACCESS_REQUIRED);
479 if (CC->cs_flags & CS_STEALTH) {
480 if (requested_mode == 0)
481 CC->cs_flags = CC->cs_flags-CS_STEALTH;
484 if (requested_mode == 1)
485 CC->cs_flags = CC->cs_flags|CS_STEALTH;
488 set_wtmpsupp_to_current_room();
489 cprintf("%d Ok\n",OK);
496 * display system messages or help
498 void cmd_mesg(char *mname)
505 extract(buf,mname,0);
510 strcpy(dirs[0],"messages");
511 strcpy(dirs[1],"help");
512 mesg_locate(targ,buf,2,dirs);
517 if (strlen(targ)==0) {
518 cprintf("%d '%s' not found.\n",ERROR,mname);
522 mfp = fopen(targ,"r");
524 cprintf("%d Cannot open '%s': %s\n",
525 ERROR,targ,strerror(errno));
528 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
530 while (fgets(buf,255,mfp)!=NULL) {
531 buf[strlen(buf)-1] = 0;
542 * enter system messages or help
544 void cmd_emsg(char *mname)
552 if (CC->usersupp.axlevel < 6) {
553 cprintf("%d You must be an Aide to edit system messages.\n",
554 ERROR+HIGHER_ACCESS_REQUIRED);
558 extract(buf,mname,0);
559 for (a=0; a<strlen(buf); ++a) { /* security measure */
560 if (buf[a] == '/') buf[a] = '.';
565 strcpy(dirs[0],"messages");
566 strcpy(dirs[1],"help");
567 mesg_locate(targ,buf,2,dirs);
571 if (strlen(targ)==0) {
572 snprintf(targ, sizeof targ, "./help/%s", buf);
575 mfp = fopen(targ,"w");
577 cprintf("%d Cannot open '%s': %s\n",
578 ERROR,targ,strerror(errno));
581 cprintf("%d %s\n", SEND_LISTING, targ);
583 while (client_gets(buf), strcmp(buf, "000")) {
584 fprintf(mfp, "%s\n", buf);
594 void cmd_rwho(void) {
595 struct CitContext *cptr;
598 char un[40], room[40], host[40], flags[5];
600 aide = CC->usersupp.axlevel >= 6;
601 cprintf("%d\n",LISTING_FOLLOWS);
603 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
608 if (cptr->cs_flags & CS_POSTING)
613 if (cptr->fake_username[0])
615 strcpy(un, cptr->fake_username);
619 strcpy(un, cptr->curr_user);
621 if (cptr->fake_hostname[0])
623 strcpy(host, cptr->fake_hostname);
627 strcpy(host, cptr->cs_host);
629 if (cptr->fake_roomname[0])
631 strcpy(room, cptr->fake_roomname);
635 strcpy(room, cptr->cs_room);
638 if ((aide) && (spoofed))
641 if ((cptr->cs_flags & CS_STEALTH) && (aide))
644 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
646 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
647 cptr->cs_pid, un, room,
648 host, cptr->cs_clientname,
649 (long)(cptr->lastidle),
650 cptr->lastcmdname, flags);
652 if ((spoofed) && (aide))
654 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
655 cptr->cs_pid, cptr->curr_user, cptr->cs_room,
656 cptr->cs_host, cptr->cs_clientname,
657 (long)(cptr->lastidle),
658 cptr->lastcmdname, flags);
667 * Terminate another running session
669 void cmd_term(char *cmdbuf)
672 struct CitContext *ccptr;
673 int session_to_kill = 0;
675 if (!CC->logged_in) {
676 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
680 if (CC->usersupp.axlevel < 6) {
681 cprintf("%d You must be an Aide to terminate sessions.\n",
682 ERROR+HIGHER_ACCESS_REQUIRED);
686 session_num = extract_int(cmdbuf, 0);
687 if (session_num == CC->cs_pid) {
688 cprintf("%d You can't kill your own session.\n", ERROR);
692 lprintf(9, "Locating session to kill\n");
693 begin_critical_section(S_SESSION_TABLE);
694 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
695 if (session_num == ccptr->cs_pid) {
696 session_to_kill = ccptr->cs_pid;
699 end_critical_section(S_SESSION_TABLE);
700 lprintf(9, "session_to_kill == %d\n", session_to_kill);
702 if (session_to_kill > 0) {
703 lprintf(9, "calling kill_session()\n");
704 kill_session(session_to_kill);
705 cprintf("%d Session terminated.\n", OK);
708 cprintf("%d No such session.\n", ERROR);
717 * get the paginator prompt
719 void cmd_more(void) {
720 cprintf("%d %s\n",OK,config.c_moreprompt);
726 void cmd_echo(char *etext)
728 cprintf("%d %s\n",OK,etext);
734 * identify as internal program
736 void cmd_ipgm(char *argbuf)
740 secret = extract_int(argbuf, 0);
741 if (secret == config.c_ipgm_secret) {
742 CC->internal_pgm = 1;
743 strcpy(CC->curr_user, "<internal program>");
744 CC->cs_flags = CC->cs_flags|CS_STEALTH;
745 cprintf("%d Authenticated as an internal program.\n",OK);
748 cprintf("%d Authentication failed.\n",ERROR);
754 * Shut down the server
756 void cmd_down(void) {
757 if (!CC->logged_in) {
758 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
762 if (CC->usersupp.axlevel < 6) {
763 cprintf("%d You must be an Aide to shut down the server.\n",
764 ERROR+HIGHER_ACCESS_REQUIRED);
768 cprintf("%d Shutting down server. Goodbye.\n", OK);
773 * Schedule or cancel a server shutdown
775 void cmd_scdn(char *argbuf)
779 if (!CC->logged_in) {
780 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
784 if (CC->usersupp.axlevel < 6) {
785 cprintf("%d You must be an Aide to schedule a shutdown.\n",
786 ERROR+HIGHER_ACCESS_REQUIRED);
790 new_state = extract_int(argbuf, 0);
791 if ((new_state == 0) || (new_state == 1)) {
792 ScheduledShutdown = new_state;
794 cprintf("%d %d\n", OK, ScheduledShutdown);
801 void *context_loop(struct CitContext *con)
804 int num_sessions, len;
805 struct sockaddr_in sin;
808 * Wedge our way into the context table.
813 * Initialize some variables specific to our context.
816 CC->internal_pgm = 0;
817 CC->download_fp = NULL;
818 CC->upload_fp = NULL;
819 CC->cs_pid = con->client_socket; /* not necessarily portable */
820 CC->FirstExpressMessage = NULL;
823 strcpy(CC->lastcmdname, " ");
824 strcpy(CC->cs_clientname, "(unknown)");
825 strcpy(CC->curr_user,"(not logged in)");
826 strcpy(CC->net_node,"");
827 snprintf(CC->temp, sizeof CC->temp, tmpnam(NULL));
828 strcpy(CC->cs_room, "(no room)");
829 strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
830 CC->cs_host[sizeof CC->cs_host - 1] = 0;
832 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
833 locate_host(CC->cs_host, &sin.sin_addr);
835 CC->upload_type = UPL_FILE;
837 CC->FirstSessData = NULL;
839 num_sessions = session_count();
841 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
844 if (CC->nologin==1) {
845 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
846 ERROR+MAX_SESSIONS_EXCEEDED,
847 config.c_nodename,config.c_maxsessions);
850 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
853 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
855 /* Run any session startup routines registered by loadable modules */
856 PerformSessionHooks(EVT_START);
858 rec_log(CL_CONNECT, "");
862 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
863 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
864 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
867 * Let other clients see the last command we executed, and
868 * update the idle time, but not NOOP, PEXP, or GEXP.
870 if ( (strncasecmp(cmdbuf, "NOOP", 4))
871 && (strncasecmp(cmdbuf, "PEXP", 4))
872 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
873 strcpy(CC->lastcmdname, " ");
874 strncpy(CC->lastcmdname, cmdbuf, 4);
878 if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
880 CC->cs_flags &= ~CS_POSTING;
884 * This loop recognizes all server commands.
887 if (!strncasecmp(cmdbuf,"NOOP",4)) {
888 cprintf("%d%cok\n",OK,check_express());
891 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
892 cprintf("%d Goodbye.\n",OK);
895 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
896 if (CC->logged_in) logout(CC);
897 cprintf("%d logged out.\n",OK);
900 else if (!strncasecmp(cmdbuf,"USER",4)) {
901 cmd_user(&cmdbuf[5]);
904 else if (!strncasecmp(cmdbuf,"PASS",4)) {
905 cmd_pass(&cmdbuf[5]);
908 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
909 cmd_newu(&cmdbuf[5]);
912 else if (!strncasecmp(cmdbuf,"SETP",4)) {
913 cmd_setp(&cmdbuf[5]);
916 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
917 cmd_lrms(&cmdbuf[5]);
920 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
921 cmd_lkra(&cmdbuf[5]);
924 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
925 cmd_lkrn(&cmdbuf[5]);
928 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
929 cmd_lkro(&cmdbuf[5]);
932 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
933 cmd_lzrm(&cmdbuf[5]);
936 else if (!strncasecmp(cmdbuf,"GETU",4)) {
940 else if (!strncasecmp(cmdbuf,"SETU",4)) {
941 cmd_setu(&cmdbuf[5]);
944 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
945 cmd_goto(&cmdbuf[5]);
948 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
949 cmd_msgs(&cmdbuf[5]);
952 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
956 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
960 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
961 cmd_msg0(&cmdbuf[5]);
964 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
965 cmd_msg2(&cmdbuf[5]);
968 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
969 cmd_msg3(&cmdbuf[5]);
972 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
973 cmd_msg4(&cmdbuf[5]);
976 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
977 cmd_opna(&cmdbuf[5]);
980 else if (!strncasecmp(cmdbuf,"INFO",4)) {
984 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
985 cmd_slrp(&cmdbuf[5]);
988 else if (!strncasecmp(cmdbuf,"INVT",4)) {
989 cmd_invt_kick(&cmdbuf[5],1);
992 else if (!strncasecmp(cmdbuf,"KICK",4)) {
993 cmd_invt_kick(&cmdbuf[5],0);
996 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1000 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1001 cmd_setr(&cmdbuf[5]);
1004 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1008 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1009 cmd_seta(&cmdbuf[5]);
1012 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1013 cmd_ent0(&cmdbuf[5]);
1016 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1017 cmd_ent3(&cmdbuf[5]);
1020 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1024 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1025 cmd_dele(&cmdbuf[5]);
1028 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1029 cmd_kill(&cmdbuf[5]);
1032 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1033 cmd_cre8(&cmdbuf[5]);
1036 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1037 cmd_move(&cmdbuf[5]);
1040 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1044 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1045 cmd_mesg(&cmdbuf[5]);
1048 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1049 cmd_emsg(&cmdbuf[5]);
1052 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1056 else if (!strncasecmp(cmdbuf,"GREG",4)) {
1057 cmd_greg(&cmdbuf[5]);
1060 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1061 cmd_vali(&cmdbuf[5]);
1064 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1065 cmd_einf(&cmdbuf[5]);
1068 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1072 else if (!strncasecmp(cmdbuf,"REGI",4)) {
1076 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1080 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1081 cmd_delf(&cmdbuf[5]);
1084 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1085 cmd_movf(&cmdbuf[5]);
1088 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1089 cmd_netf(&cmdbuf[5]);
1092 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1096 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1097 cmd_open(&cmdbuf[5]);
1100 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1104 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1105 cmd_uopn(&cmdbuf[5]);
1108 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1109 cmd_ucls(&cmdbuf[5]);
1112 else if (!strncasecmp(cmdbuf,"READ",4)) {
1113 cmd_read(&cmdbuf[5]);
1116 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1117 cmd_writ(&cmdbuf[5]);
1120 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1121 cmd_qusr(&cmdbuf[5]);
1124 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1125 cmd_echo(&cmdbuf[5]);
1128 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1129 cmd_oimg(&cmdbuf[5]);
1132 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1136 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1137 cmd_netp(&cmdbuf[5]);
1140 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1141 cmd_ndop(&cmdbuf[5]);
1144 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1145 cmd_nuop(&cmdbuf[5]);
1148 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1152 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1153 cmd_cflr(&cmdbuf[5]);
1156 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1157 cmd_kflr(&cmdbuf[5]);
1160 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1161 cmd_eflr(&cmdbuf[5]);
1164 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1165 cmd_iden(&cmdbuf[5]);
1168 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1169 cmd_ipgm(&cmdbuf[5]);
1172 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1176 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1177 cmd_rbio(&cmdbuf[5]);
1180 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1184 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1185 cmd_stel(&cmdbuf[5]);
1188 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1189 cmd_term(&cmdbuf[5]);
1192 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1196 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1197 cmd_scdn(&cmdbuf[5]);
1200 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1201 cmd_nset(&cmdbuf[5]);
1204 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1205 cmd_uimg(&cmdbuf[5]);
1208 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1209 cmd_uchg(&cmdbuf[5]);
1212 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1216 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1217 cmd_hchg(&cmdbuf[5]);
1220 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1221 cmd_rchg(&cmdbuf[5]);
1224 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1225 cmd_agup(&cmdbuf[5]);
1228 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1229 cmd_asup(&cmdbuf[5]);
1232 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1233 cmd_gpex(&cmdbuf[5]);
1236 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1237 cmd_spex(&cmdbuf[5]);
1240 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1241 cmd_conf(&cmdbuf[5]);
1244 #ifdef DEBUG_MEMORY_LEAKS
1245 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1250 else if (!DLoader_Exec_Cmd(cmdbuf))
1252 cprintf("%d Unrecognized or unsupported command.\n",
1256 /* Run any after-each-command outines registered by modules */
1257 PerformSessionHooks(EVT_CMD);
1259 } while(strncasecmp(cmdbuf, "QUIT", 4));
1261 cleanup(EXIT_NORMAL);