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 message list we might have in memory */
144 if (CC->msglist != NULL) phree(CC->msglist);
146 /* Deallocate any user-data attached to this session */
147 deallocate_user_data(CC);
149 /* Now get rid of the session and context */
150 lprintf(7, "cleanup_stuff() calling RemoveContext(%d)\n", CC->cs_pid);
153 /* While we still have an extra thread with no user attached to it,
154 * take the opportunity to do some housekeeping before exiting.
161 * Get a dynamic symbol number for per-session user data.
162 * This API call should be made only ONCE per symbol per citserver run.
164 int CtdlGetDynamicSymbol()
166 static unsigned int next_symbol = SYM_MAX;
167 return ++next_symbol;
173 * Return a pointer to some generic per-session user data.
174 * (This function returns NULL if the requested symbol is not allocated.)
176 * NOTE: we use critical sections for allocating and de-allocating these,
177 * but not for locating one.
179 void *CtdlGetUserData(unsigned long requested_sym)
181 struct CtdlSessData *ptr;
183 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
184 if (ptr->sym_id == requested_sym)
185 return(ptr->sym_data);
187 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
194 * Allocate some generic per-session user data.
196 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
198 struct CtdlSessData *ptr;
200 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
202 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
203 if (ptr->sym_id == requested_sym) {
204 lprintf(2, "ERROR: CtdlAllocUserData() requested for"
205 " symbol id %ld already registered\n",
211 ptr = mallok(sizeof(struct CtdlSessData));
212 ptr->sym_id = requested_sym;
213 ptr->sym_data = mallok(num_bytes);
215 begin_critical_section(S_SESSION_TABLE);
216 ptr->next = CC->FirstSessData;
217 CC->FirstSessData = ptr;
218 end_critical_section(S_SESSION_TABLE);
220 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
228 * set_wtmpsupp() - alter the session listing
230 void set_wtmpsupp(char *newtext)
232 strncpy(CC->cs_room,newtext,sizeof CC->cs_room);
233 CC->cs_room[sizeof CC->cs_room - 1] = 0;
234 time(&CC->cs_lastupdt);
236 /* Run any routines registered by loadable modules */
237 PerformSessionHooks(EVT_NEWROOM);
242 * call set_wtmpsupp() with the name of the current room, modified a bit...
244 void set_wtmpsupp_to_current_room() {
245 if (CC->quickroom.QRflags & QR_PRIVATE) {
246 set_wtmpsupp("<private room>");
248 else if (CC->quickroom.QRflags & QR_MAILBOX) {
249 set_wtmpsupp(&CC->quickroom.QRname[11]);
252 set_wtmpsupp(CC->quickroom.QRname);
259 * cmd_info() - tell the client about this server
261 void cmd_info(void) {
262 cprintf("%d Server info:\n",LISTING_FOLLOWS);
263 cprintf("%d\n",CC->cs_pid);
264 cprintf("%s\n",config.c_nodename);
265 cprintf("%s\n",config.c_humannode);
266 cprintf("%s\n",config.c_fqdn);
267 cprintf("%s\n",CITADEL);
268 cprintf("%d\n",REV_LEVEL);
269 cprintf("%s\n",config.c_bbs_city);
270 cprintf("%s\n",config.c_sysadm);
271 cprintf("%d\n",SERVER_TYPE);
272 cprintf("%s\n",config.c_moreprompt);
273 cprintf("1\n"); /* 1 = yes, this system supports floors */
274 cprintf("1\n"); /* 1 = we support the extended paging options */
278 void cmd_rchg(char *argbuf)
280 char newroomname[256]; /* set to 256 to prevent buffer overruns <dme>*/
282 extract(newroomname, argbuf, 0);
283 newroomname[ROOMNAMELEN] = 0;
284 if (strlen(newroomname) > 0) {
285 strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN);
286 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
289 strcpy(CC->fake_roomname, "");
291 cprintf("%d OK\n", OK);
294 void cmd_hchg(char *newhostname)
296 if ((newhostname) && (newhostname[0]))
298 memset(CC->fake_hostname, 0, 25);
299 strncpy(CC->fake_hostname, newhostname, 24);
302 strcpy(CC->fake_hostname, "");
303 cprintf("%d OK\n",OK);
306 void cmd_uchg(char *newusername)
308 if (CC->usersupp.axlevel < 6)
310 cprintf("%d You must be an Aide to use UCHG.\n",
311 ERROR+HIGHER_ACCESS_REQUIRED);
314 if ((newusername) && (newusername[0]))
316 CC->cs_flags &= ~CS_STEALTH;
317 memset(CC->fake_username, 0, 32);
318 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
319 strncpy(CC->fake_username, newusername, 31);
323 CC->fake_username[0] = '\0';
324 CC->cs_flags |= CS_STEALTH;
330 * returns an asterisk if there are any express messages waiting,
333 char check_express(void) {
334 if (CC->FirstExpressMessage == NULL) {
348 cprintf("%d %ld\n", OK, tv);
352 * Check whether two hostnames match.
353 * "Realname" should be an actual name of a client that is trying to connect;
354 * "testname" should be the value we are comparing it with. The idea is that we
355 * want to compare with both the abbreviated and fully-qualified versions of
356 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
358 static int hostnames_match(const char *realname, const char *testname) {
362 if (!strcasecmp(realname, testname))
365 #ifdef HAVE_NONREENTRANT_NETDB
366 begin_critical_section(S_NETDB);
369 if ((he = gethostbyname(testname)) != NULL)
370 if (!strcasecmp(realname, he->h_name))
373 #ifdef HAVE_NONREENTRANT_NETDB
374 end_critical_section(S_NETDB);
381 * check a hostname against the public_clients file
383 int is_public_client(char *where)
388 if (hostnames_match(where,"localhost")) return(1);
389 if (hostnames_match(where,config.c_fqdn)) return(1);
391 fp = fopen("public_clients","r");
392 if (fp == NULL) return(0);
394 while (fgets(buf,256,fp)!=NULL) {
395 while (isspace((buf[strlen(buf)-1])))
396 buf[strlen(buf)-1] = 0;
397 if (hostnames_match(where,buf)) {
409 * the client is identifying itself to the server
411 void cmd_iden(char *argbuf)
420 if (num_parms(argbuf)<4) {
421 cprintf("%d usage error\n",ERROR);
425 dev_code = extract_int(argbuf,0);
426 cli_code = extract_int(argbuf,1);
427 rev_level = extract_int(argbuf,2);
428 extract(desc,argbuf,3);
430 strncpy(from_host,config.c_fqdn,sizeof from_host);
431 from_host[sizeof from_host - 1] = 0;
432 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
434 CC->cs_clientdev = dev_code;
435 CC->cs_clienttyp = cli_code;
436 CC->cs_clientver = rev_level;
437 strncpy(CC->cs_clientname,desc,31);
438 CC->cs_clientname[31] = 0;
440 if ((strlen(from_host)>0) &&
441 (is_public_client(CC->cs_host))) {
442 if (inet_aton(from_host, &addr))
443 locate_host(CC->cs_host, &addr);
445 strncpy(CC->cs_host,from_host,24);
449 set_wtmpsupp_to_current_room();
451 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
457 cprintf("%d Ok\n",OK);
462 * enter or exit "stealth mode"
464 void cmd_stel(char *cmdbuf)
468 requested_mode = extract_int(cmdbuf,0);
469 if (requested_mode !=0) requested_mode = 1;
471 if (!CC->logged_in) {
472 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
476 if (CC->usersupp.axlevel < 6) {
477 cprintf("%d You must be an Aide to use stealth mode.\n",
478 ERROR+HIGHER_ACCESS_REQUIRED);
482 if (CC->cs_flags & CS_STEALTH) {
483 if (requested_mode == 0)
484 CC->cs_flags = CC->cs_flags-CS_STEALTH;
487 if (requested_mode == 1)
488 CC->cs_flags = CC->cs_flags|CS_STEALTH;
491 set_wtmpsupp_to_current_room();
492 cprintf("%d Ok\n",OK);
499 * display system messages or help
501 void cmd_mesg(char *mname)
508 extract(buf,mname,0);
513 strcpy(dirs[0],"messages");
514 strcpy(dirs[1],"help");
515 mesg_locate(targ,buf,2,dirs);
520 if (strlen(targ)==0) {
521 cprintf("%d '%s' not found.\n",ERROR,mname);
525 mfp = fopen(targ,"r");
527 cprintf("%d Cannot open '%s': %s\n",
528 ERROR,targ,strerror(errno));
531 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
533 while (fgets(buf,255,mfp)!=NULL) {
534 buf[strlen(buf)-1] = 0;
545 * enter system messages or help
547 void cmd_emsg(char *mname)
555 if (CC->usersupp.axlevel < 6) {
556 cprintf("%d You must be an Aide to edit system messages.\n",
557 ERROR+HIGHER_ACCESS_REQUIRED);
561 extract(buf,mname,0);
562 for (a=0; a<strlen(buf); ++a) { /* security measure */
563 if (buf[a] == '/') buf[a] = '.';
568 strcpy(dirs[0],"messages");
569 strcpy(dirs[1],"help");
570 mesg_locate(targ,buf,2,dirs);
574 if (strlen(targ)==0) {
575 snprintf(targ, sizeof targ, "./help/%s", buf);
578 mfp = fopen(targ,"w");
580 cprintf("%d Cannot open '%s': %s\n",
581 ERROR,targ,strerror(errno));
584 cprintf("%d %s\n", SEND_LISTING, targ);
586 while (client_gets(buf), strcmp(buf, "000")) {
587 fprintf(mfp, "%s\n", buf);
597 void cmd_rwho(void) {
598 struct CitContext *cptr;
601 char un[40], room[40], host[40], flags[5];
603 aide = CC->usersupp.axlevel >= 6;
604 cprintf("%d\n",LISTING_FOLLOWS);
606 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
611 if (cptr->cs_flags & CS_POSTING)
616 if (cptr->fake_username[0])
618 strcpy(un, cptr->fake_username);
622 strcpy(un, cptr->curr_user);
624 if (cptr->fake_hostname[0])
626 strcpy(host, cptr->fake_hostname);
630 strcpy(host, cptr->cs_host);
632 if (cptr->fake_roomname[0])
634 strcpy(room, cptr->fake_roomname);
638 strcpy(room, cptr->cs_room);
641 if ((aide) && (spoofed))
644 if ((cptr->cs_flags & CS_STEALTH) && (aide))
647 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
649 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
650 cptr->cs_pid, un, room,
651 host, cptr->cs_clientname,
652 (long)(cptr->lastidle),
653 cptr->lastcmdname, flags);
655 if ((spoofed) && (aide))
657 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
658 cptr->cs_pid, cptr->curr_user, cptr->cs_room,
659 cptr->cs_host, cptr->cs_clientname,
660 (long)(cptr->lastidle),
661 cptr->lastcmdname, flags);
670 * Terminate another running session
672 void cmd_term(char *cmdbuf)
675 struct CitContext *ccptr;
676 int session_to_kill = 0;
678 if (!CC->logged_in) {
679 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
683 if (CC->usersupp.axlevel < 6) {
684 cprintf("%d You must be an Aide to terminate sessions.\n",
685 ERROR+HIGHER_ACCESS_REQUIRED);
689 session_num = extract_int(cmdbuf, 0);
690 if (session_num == CC->cs_pid) {
691 cprintf("%d You can't kill your own session.\n", ERROR);
695 lprintf(9, "Locating session to kill\n");
696 begin_critical_section(S_SESSION_TABLE);
697 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
698 if (session_num == ccptr->cs_pid) {
699 session_to_kill = ccptr->cs_pid;
702 end_critical_section(S_SESSION_TABLE);
703 lprintf(9, "session_to_kill == %d\n", session_to_kill);
705 if (session_to_kill > 0) {
706 lprintf(9, "calling kill_session()\n");
707 kill_session(session_to_kill);
708 cprintf("%d Session terminated.\n", OK);
711 cprintf("%d No such session.\n", ERROR);
720 * get the paginator prompt
722 void cmd_more(void) {
723 cprintf("%d %s\n",OK,config.c_moreprompt);
729 void cmd_echo(char *etext)
731 cprintf("%d %s\n",OK,etext);
737 * identify as internal program
739 void cmd_ipgm(char *argbuf)
743 secret = extract_int(argbuf, 0);
744 if (secret == config.c_ipgm_secret) {
745 CC->internal_pgm = 1;
746 strcpy(CC->curr_user, "<internal program>");
747 CC->cs_flags = CC->cs_flags|CS_STEALTH;
748 cprintf("%d Authenticated as an internal program.\n",OK);
751 cprintf("%d Authentication failed.\n",ERROR);
757 * Shut down the server
759 void cmd_down(void) {
760 if (!CC->logged_in) {
761 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
765 if (CC->usersupp.axlevel < 6) {
766 cprintf("%d You must be an Aide to shut down the server.\n",
767 ERROR+HIGHER_ACCESS_REQUIRED);
771 cprintf("%d Shutting down server. Goodbye.\n", OK);
776 * Schedule or cancel a server shutdown
778 void cmd_scdn(char *argbuf)
782 if (!CC->logged_in) {
783 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
787 if (CC->usersupp.axlevel < 6) {
788 cprintf("%d You must be an Aide to schedule a shutdown.\n",
789 ERROR+HIGHER_ACCESS_REQUIRED);
793 new_state = extract_int(argbuf, 0);
794 if ((new_state == 0) || (new_state == 1)) {
795 ScheduledShutdown = new_state;
797 cprintf("%d %d\n", OK, ScheduledShutdown);
804 void *context_loop(struct CitContext *con)
807 int num_sessions, len;
808 struct sockaddr_in sin;
811 * Wedge our way into the context table.
816 * Initialize some variables specific to our context.
819 CC->internal_pgm = 0;
820 CC->download_fp = NULL;
821 CC->upload_fp = NULL;
822 CC->cs_pid = con->client_socket; /* not necessarily portable */
823 CC->FirstExpressMessage = NULL;
828 strcpy(CC->lastcmdname, " ");
829 strcpy(CC->cs_clientname, "(unknown)");
830 strcpy(CC->curr_user,"(not logged in)");
831 strcpy(CC->net_node,"");
832 snprintf(CC->temp, sizeof CC->temp, tmpnam(NULL));
833 strcpy(CC->cs_room, "(no room)");
834 strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
835 CC->cs_host[sizeof CC->cs_host - 1] = 0;
837 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
838 locate_host(CC->cs_host, &sin.sin_addr);
840 CC->upload_type = UPL_FILE;
842 CC->FirstSessData = NULL;
844 num_sessions = session_count();
846 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
849 if (CC->nologin==1) {
850 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
851 ERROR+MAX_SESSIONS_EXCEEDED,
852 config.c_nodename,config.c_maxsessions);
855 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
858 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
860 /* Run any session startup routines registered by loadable modules */
861 PerformSessionHooks(EVT_START);
863 rec_log(CL_CONNECT, "");
867 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
868 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
869 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
872 * Let other clients see the last command we executed, and
873 * update the idle time, but not NOOP, PEXP, or GEXP.
875 if ( (strncasecmp(cmdbuf, "NOOP", 4))
876 && (strncasecmp(cmdbuf, "PEXP", 4))
877 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
878 strcpy(CC->lastcmdname, " ");
879 strncpy(CC->lastcmdname, cmdbuf, 4);
883 if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
885 CC->cs_flags &= ~CS_POSTING;
889 * This loop recognizes all server commands.
892 if (!strncasecmp(cmdbuf,"NOOP",4)) {
893 cprintf("%d%cok\n",OK,check_express());
896 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
897 cprintf("%d Goodbye.\n",OK);
900 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
901 if (CC->logged_in) logout(CC);
902 cprintf("%d logged out.\n",OK);
905 else if (!strncasecmp(cmdbuf,"USER",4)) {
906 cmd_user(&cmdbuf[5]);
909 else if (!strncasecmp(cmdbuf,"PASS",4)) {
910 cmd_pass(&cmdbuf[5]);
913 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
914 cmd_newu(&cmdbuf[5]);
917 else if (!strncasecmp(cmdbuf,"SETP",4)) {
918 cmd_setp(&cmdbuf[5]);
921 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
922 cmd_lrms(&cmdbuf[5]);
925 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
926 cmd_lkra(&cmdbuf[5]);
929 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
930 cmd_lkrn(&cmdbuf[5]);
933 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
934 cmd_lkro(&cmdbuf[5]);
937 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
938 cmd_lzrm(&cmdbuf[5]);
941 else if (!strncasecmp(cmdbuf,"GETU",4)) {
945 else if (!strncasecmp(cmdbuf,"SETU",4)) {
946 cmd_setu(&cmdbuf[5]);
949 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
950 cmd_goto(&cmdbuf[5]);
953 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
954 cmd_msgs(&cmdbuf[5]);
957 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
961 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
965 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
966 cmd_msg0(&cmdbuf[5]);
969 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
970 cmd_msg2(&cmdbuf[5]);
973 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
974 cmd_msg3(&cmdbuf[5]);
977 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
978 cmd_msg4(&cmdbuf[5]);
981 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
982 cmd_opna(&cmdbuf[5]);
985 else if (!strncasecmp(cmdbuf,"INFO",4)) {
989 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
990 cmd_slrp(&cmdbuf[5]);
993 else if (!strncasecmp(cmdbuf,"INVT",4)) {
994 cmd_invt_kick(&cmdbuf[5],1);
997 else if (!strncasecmp(cmdbuf,"KICK",4)) {
998 cmd_invt_kick(&cmdbuf[5],0);
1001 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1005 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1006 cmd_setr(&cmdbuf[5]);
1009 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1013 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1014 cmd_seta(&cmdbuf[5]);
1017 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1018 cmd_ent0(&cmdbuf[5]);
1021 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1022 cmd_ent3(&cmdbuf[5]);
1025 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1029 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1030 cmd_dele(&cmdbuf[5]);
1033 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1034 cmd_kill(&cmdbuf[5]);
1037 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1038 cmd_cre8(&cmdbuf[5]);
1041 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1042 cmd_move(&cmdbuf[5]);
1045 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1049 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1050 cmd_mesg(&cmdbuf[5]);
1053 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1054 cmd_emsg(&cmdbuf[5]);
1057 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1061 else if (!strncasecmp(cmdbuf,"GREG",4)) {
1062 cmd_greg(&cmdbuf[5]);
1065 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1066 cmd_vali(&cmdbuf[5]);
1069 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1070 cmd_einf(&cmdbuf[5]);
1073 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1077 else if (!strncasecmp(cmdbuf,"REGI",4)) {
1081 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1085 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1086 cmd_delf(&cmdbuf[5]);
1089 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1090 cmd_movf(&cmdbuf[5]);
1093 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1094 cmd_netf(&cmdbuf[5]);
1097 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1101 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1102 cmd_open(&cmdbuf[5]);
1105 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1109 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1110 cmd_uopn(&cmdbuf[5]);
1113 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1114 cmd_ucls(&cmdbuf[5]);
1117 else if (!strncasecmp(cmdbuf,"READ",4)) {
1118 cmd_read(&cmdbuf[5]);
1121 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1122 cmd_writ(&cmdbuf[5]);
1125 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1126 cmd_qusr(&cmdbuf[5]);
1129 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1130 cmd_echo(&cmdbuf[5]);
1133 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1134 cmd_oimg(&cmdbuf[5]);
1137 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1141 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1142 cmd_netp(&cmdbuf[5]);
1145 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1146 cmd_ndop(&cmdbuf[5]);
1149 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1150 cmd_nuop(&cmdbuf[5]);
1153 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1157 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1158 cmd_cflr(&cmdbuf[5]);
1161 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1162 cmd_kflr(&cmdbuf[5]);
1165 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1166 cmd_eflr(&cmdbuf[5]);
1169 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1170 cmd_iden(&cmdbuf[5]);
1173 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1174 cmd_ipgm(&cmdbuf[5]);
1177 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1181 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1182 cmd_rbio(&cmdbuf[5]);
1185 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1189 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1190 cmd_stel(&cmdbuf[5]);
1193 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1194 cmd_term(&cmdbuf[5]);
1197 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1201 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1202 cmd_scdn(&cmdbuf[5]);
1205 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1206 cmd_nset(&cmdbuf[5]);
1209 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1210 cmd_uimg(&cmdbuf[5]);
1213 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1214 cmd_uchg(&cmdbuf[5]);
1217 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1221 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1222 cmd_hchg(&cmdbuf[5]);
1225 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1226 cmd_rchg(&cmdbuf[5]);
1229 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1230 cmd_agup(&cmdbuf[5]);
1233 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1234 cmd_asup(&cmdbuf[5]);
1237 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1238 cmd_gpex(&cmdbuf[5]);
1241 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1242 cmd_spex(&cmdbuf[5]);
1245 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1246 cmd_conf(&cmdbuf[5]);
1249 #ifdef DEBUG_MEMORY_LEAKS
1250 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1255 else if (!DLoader_Exec_Cmd(cmdbuf))
1257 cprintf("%d Unrecognized or unsupported command.\n",
1261 /* Run any after-each-command outines registered by modules */
1262 PerformSessionHooks(EVT_CMD);
1264 } while(strncasecmp(cmdbuf, "QUIT", 4));
1266 cleanup(EXIT_NORMAL);