16 #include <sys/socket.h>
17 #include <netinet/in.h>
18 #include <arpa/inet.h>
21 #include "sysdep_decls.h"
22 #include "citserver.h"
25 #include "housekeeping.h"
30 #include "locate_host.h"
33 #include "dynloader.h"
38 struct CitContext *ContextList = NULL;
39 char *unique_session_numbers;
40 int ScheduledShutdown = 0;
44 * Various things that need to be initialized at startup
46 void master_startup(void) {
47 lprintf(7, "Opening databases\n");
53 lprintf(7, "Checking floor reference counts\n");
56 lprintf(7, "Creating base rooms (if necessary)\n");
57 create_room(BASEROOM, 0, "", 0);
58 create_room(AIDEROOM, 4, "", 0);
59 create_room(config.c_twitroom, 0, "", 0);
63 * Cleanup routine to be called when the server is shutting down.
65 void master_cleanup(void) {
66 struct CleanupFunctionHook *fcn;
68 /* Cancel all running sessions */
69 lprintf(7, "Cancelling running sessions...\n");
71 /* FIX do something here
72 while (ContextList != NULL) {
76 /* Run any cleanup routines registered by loadable modules */
77 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
78 (*fcn->h_function_pointer)();
82 lprintf(7, "Closing databases\n");
85 /* Do system-dependent stuff */
86 sysdep_master_cleanup();
89 lprintf(3, "citserver: exiting.\n");
90 fflush(stdout); fflush(stderr);
96 * Free any per-session data allocated by modules or whatever
98 void deallocate_user_data(struct CitContext *con)
100 struct CtdlSessData *ptr;
102 begin_critical_section(S_SESSION_TABLE);
103 while (con->FirstSessData != NULL) {
104 lprintf(9, "Deallocating user data symbol %ld\n",
105 con->FirstSessData->sym_id);
106 if (con->FirstSessData->sym_data != NULL)
107 phree(con->FirstSessData->sym_data);
108 ptr = con->FirstSessData->next;
109 phree(con->FirstSessData);
110 con->FirstSessData = ptr;
112 end_critical_section(S_SESSION_TABLE);
119 * Terminate a session and remove its context data structure.
121 void RemoveContext (struct CitContext *con)
123 struct CitContext *ptr = NULL;
124 struct CitContext *ToFree = NULL;
126 lprintf(9, "RemoveContext() called\n");
128 lprintf(5, "WARNING: RemoveContext() called with NULL!\n");
132 lprintf(7, "Calling logout(%d)\n", con->cs_pid);
135 rec_log(CL_TERMINATE, con->curr_user);
137 lprintf(3, "citserver[%3d]: ended.\n", con->cs_pid);
139 /* Run any cleanup routines registered by loadable modules */
140 PerformSessionHooks(EVT_STOP);
142 syslog(LOG_NOTICE,"session %d ended", con->cs_pid);
144 /* Deallocate any user-data attached to this session */
145 deallocate_user_data(con);
149 lprintf(7, "Removing context\n");
151 begin_critical_section(S_SESSION_TABLE);
152 if (ContextList == con) {
153 ToFree = ContextList;
154 ContextList = ContextList->next;
157 for (ptr = ContextList; ptr != NULL; ptr = ptr->next) {
158 if (ptr->next == con) {
160 ptr->next = ptr->next->next;
164 end_critical_section(S_SESSION_TABLE);
166 lprintf(7, "Closing socket %d\n", ToFree->client_socket);
167 close(ToFree->client_socket);
169 /* Tell the housekeeping thread to check to see if this is the time
170 * to initiate a scheduled shutdown event.
172 enter_housekeeping_cmd("SCHED_SHUTDOWN");
174 /* Free up the memory used by this context */
177 lprintf(7, "Done with RemoveContext()\n");
183 * Get a dynamic symbol number for per-session user data.
184 * This API call should be made only ONCE per symbol per citserver run.
186 int CtdlGetDynamicSymbol()
188 static unsigned int next_symbol = SYM_MAX;
189 return ++next_symbol;
195 * Return a pointer to some generic per-session user data.
196 * (This function returns NULL if the requested symbol is not allocated.)
198 * NOTE: we use critical sections for allocating and de-allocating these,
199 * but not for locating one.
201 void *CtdlGetUserData(unsigned long requested_sym)
203 struct CtdlSessData *ptr;
205 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
206 if (ptr->sym_id == requested_sym)
207 return(ptr->sym_data);
209 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
216 * Allocate some generic per-session user data.
218 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
220 struct CtdlSessData *ptr;
222 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
224 /* Fail silently if the symbol is already registered. */
225 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
226 if (ptr->sym_id == requested_sym) {
231 /* Grab us some memory! Dem's good eatin' !! */
232 ptr = mallok(sizeof(struct CtdlSessData));
233 ptr->sym_id = requested_sym;
234 ptr->sym_data = mallok(num_bytes);
236 begin_critical_section(S_SESSION_TABLE);
237 ptr->next = CC->FirstSessData;
238 CC->FirstSessData = ptr;
239 end_critical_section(S_SESSION_TABLE);
241 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
250 * cmd_info() - tell the client about this server
252 void cmd_info(void) {
253 cprintf("%d Server info:\n",LISTING_FOLLOWS);
254 cprintf("%d\n",CC->cs_pid);
255 cprintf("%s\n",config.c_nodename);
256 cprintf("%s\n",config.c_humannode);
257 cprintf("%s\n",config.c_fqdn);
258 cprintf("%s\n",CITADEL);
259 cprintf("%d\n",REV_LEVEL);
260 cprintf("%s\n",config.c_bbs_city);
261 cprintf("%s\n",config.c_sysadm);
262 cprintf("%d\n",SERVER_TYPE);
263 cprintf("%s\n",config.c_moreprompt);
264 cprintf("1\n"); /* 1 = yes, this system supports floors */
265 cprintf("1\n"); /* 1 = we support the extended paging options */
269 void cmd_rchg(char *argbuf)
271 char newroomname[ROOMNAMELEN];
273 extract(newroomname, argbuf, 0);
274 newroomname[ROOMNAMELEN-1] = 0;
275 if (strlen(newroomname) > 0) {
276 safestrncpy(CC->fake_roomname, newroomname,
277 sizeof(CC->fake_roomname) );
280 strcpy(CC->fake_roomname, "");
282 cprintf("%d OK\n", OK);
285 void cmd_hchg(char *argbuf)
287 char newhostname[25];
289 extract(newhostname, argbuf, 0);
291 if (strlen(newhostname) > 0) {
292 safestrncpy(CC->fake_hostname, newhostname,
293 sizeof(CC->fake_hostname) );
296 strcpy(CC->fake_hostname, "");
298 cprintf("%d OK\n", OK);
301 void cmd_uchg(char *newusername)
303 if (CC->usersupp.axlevel < 6)
305 cprintf("%d You must be an Aide to use UCHG.\n",
306 ERROR+HIGHER_ACCESS_REQUIRED);
309 if ((newusername) && (newusername[0]))
311 CC->cs_flags &= ~CS_STEALTH;
312 memset(CC->fake_username, 0, 32);
313 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
314 safestrncpy(CC->fake_username, newusername, sizeof(CC->fake_username));
318 CC->fake_username[0] = '\0';
319 CC->cs_flags |= CS_STEALTH;
325 * returns an asterisk if there are any express messages waiting,
328 char check_express(void) {
329 if (CC->FirstExpressMessage == NULL) {
343 cprintf("%d %ld\n", OK, tv);
347 * Check whether two hostnames match.
348 * "Realname" should be an actual name of a client that is trying to connect;
349 * "testname" should be the value we are comparing it with. The idea is that we
350 * want to compare with both the abbreviated and fully-qualified versions of
351 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
353 static int hostnames_match(const char *realname, const char *testname) {
357 if (!strcasecmp(realname, testname))
360 #ifdef HAVE_NONREENTRANT_NETDB
361 begin_critical_section(S_NETDB);
364 if ((he = gethostbyname(testname)) != NULL)
365 if (!strcasecmp(realname, he->h_name))
368 #ifdef HAVE_NONREENTRANT_NETDB
369 end_critical_section(S_NETDB);
376 * check a hostname against the public_clients file
378 int is_public_client(char *where)
383 if (hostnames_match(where,"localhost")) return(1);
384 if (hostnames_match(where,config.c_fqdn)) return(1);
386 fp = fopen("public_clients","r");
387 if (fp == NULL) return(0);
389 while (fgets(buf,256,fp)!=NULL) {
390 while (isspace((buf[strlen(buf)-1])))
391 buf[strlen(buf)-1] = 0;
392 if (hostnames_match(where,buf)) {
404 * the client is identifying itself to the server
406 void cmd_iden(char *argbuf)
415 if (num_parms(argbuf)<4) {
416 cprintf("%d usage error\n",ERROR);
420 dev_code = extract_int(argbuf,0);
421 cli_code = extract_int(argbuf,1);
422 rev_level = extract_int(argbuf,2);
423 extract(desc,argbuf,3);
425 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
426 from_host[sizeof from_host - 1] = 0;
427 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
429 CC->cs_clientdev = dev_code;
430 CC->cs_clienttyp = cli_code;
431 CC->cs_clientver = rev_level;
432 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
433 CC->cs_clientname[31] = 0;
435 lprintf(9, "Looking up hostname\n");
436 if ((strlen(from_host)>0) &&
437 (is_public_client(CC->cs_host))) {
438 if (inet_aton(from_host, &addr))
439 locate_host(CC->cs_host, &addr);
441 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
446 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
452 cprintf("%d Ok\n",OK);
457 * enter or exit "stealth mode"
459 void cmd_stel(char *cmdbuf)
463 requested_mode = extract_int(cmdbuf,0);
464 if (requested_mode !=0) requested_mode = 1;
466 if (!CC->logged_in) {
467 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
471 if (CC->usersupp.axlevel < 6) {
472 cprintf("%d You must be an Aide to use stealth mode.\n",
473 ERROR+HIGHER_ACCESS_REQUIRED);
477 if (CC->cs_flags & CS_STEALTH) {
478 if (requested_mode == 0)
479 CC->cs_flags = CC->cs_flags-CS_STEALTH;
482 if (requested_mode == 1)
483 CC->cs_flags = CC->cs_flags|CS_STEALTH;
486 cprintf("%d Ok\n",OK);
493 * display system messages or help
495 void cmd_mesg(char *mname)
502 extract(buf,mname,0);
507 strcpy(dirs[0],"messages");
508 strcpy(dirs[1],"help");
509 mesg_locate(targ,buf,2,dirs);
514 if (strlen(targ)==0) {
515 cprintf("%d '%s' not found.\n",ERROR,mname);
519 mfp = fopen(targ,"r");
521 cprintf("%d Cannot open '%s': %s\n",
522 ERROR,targ,strerror(errno));
525 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
527 while (fgets(buf,255,mfp)!=NULL) {
528 buf[strlen(buf)-1] = 0;
539 * enter system messages or help
541 void cmd_emsg(char *mname)
549 if (CC->usersupp.axlevel < 6) {
550 cprintf("%d You must be an Aide to edit system messages.\n",
551 ERROR+HIGHER_ACCESS_REQUIRED);
555 extract(buf,mname,0);
556 for (a=0; a<strlen(buf); ++a) { /* security measure */
557 if (buf[a] == '/') buf[a] = '.';
562 strcpy(dirs[0],"messages");
563 strcpy(dirs[1],"help");
564 mesg_locate(targ,buf,2,dirs);
568 if (strlen(targ)==0) {
569 snprintf(targ, sizeof targ, "./help/%s", buf);
572 mfp = fopen(targ,"w");
574 cprintf("%d Cannot open '%s': %s\n",
575 ERROR,targ,strerror(errno));
578 cprintf("%d %s\n", SEND_LISTING, targ);
580 while (client_gets(buf), strcmp(buf, "000")) {
581 fprintf(mfp, "%s\n", buf);
588 /* Don't show the names of private rooms unless the viewing
589 * user also knows the rooms.
591 void GenerateRoomDisplay(char *real_room,
592 struct CitContext *viewed,
593 struct CitContext *viewer) {
595 strcpy(real_room, viewed->quickroom.QRname);
596 if (viewed->quickroom.QRflags & QR_MAILBOX) {
597 strcpy(real_room, &real_room[11]);
599 if (viewed->quickroom.QRflags & QR_PRIVATE) {
600 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
602 strcpy(real_room, "<private room>");
606 if (viewed->cs_flags & CS_CHAT) {
607 while (strlen(real_room) < 14)
608 strcat(real_room, " ");
610 strcpy(&real_room[14], "<chat>");
619 void cmd_rwho(void) {
620 struct CitContext *cptr;
624 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
625 char host[40], flags[5];
627 aide = CC->usersupp.axlevel >= 6;
628 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
630 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
635 if (cptr->cs_flags & CS_POSTING)
640 if (cptr->fake_username[0])
642 strcpy(un, cptr->fake_username);
646 strcpy(un, cptr->curr_user);
648 if (cptr->fake_hostname[0])
650 strcpy(host, cptr->fake_hostname);
654 strcpy(host, cptr->cs_host);
656 GenerateRoomDisplay(real_room, cptr, CC);
658 if (cptr->fake_roomname[0]) {
659 strcpy(room, cptr->fake_roomname);
663 strcpy(room, real_room);
666 if ((aide) && (spoofed))
669 if ((cptr->cs_flags & CS_STEALTH) && (aide))
672 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
674 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
675 cptr->cs_pid, un, room,
676 host, cptr->cs_clientname,
677 (long)(cptr->lastidle),
678 cptr->lastcmdname, flags);
680 if ((spoofed) && (aide))
682 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
683 cptr->cs_pid, cptr->curr_user,
685 cptr->cs_host, cptr->cs_clientname,
686 (long)(cptr->lastidle),
687 cptr->lastcmdname, flags);
692 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
693 * so that external paging modules such as serv_icq can add more
694 * content to the Wholist.
696 PerformSessionHooks(EVT_RWHO);
702 * Terminate another running session
704 void cmd_term(char *cmdbuf)
707 struct CitContext *ccptr;
710 if (!CC->logged_in) {
711 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
715 if (CC->usersupp.axlevel < 6) {
716 cprintf("%d You must be an Aide to terminate sessions.\n",
717 ERROR+HIGHER_ACCESS_REQUIRED);
721 session_num = extract_int(cmdbuf, 0);
722 if (session_num == CC->cs_pid) {
723 cprintf("%d You can't kill your own session.\n", ERROR);
727 lprintf(9, "Locating session to kill\n");
728 begin_critical_section(S_SESSION_TABLE);
729 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
730 if (session_num == ccptr->cs_pid) {
735 end_critical_section(S_SESSION_TABLE);
738 cprintf("%d Session terminated.\n", OK);
741 cprintf("%d No such session.\n", ERROR);
750 * get the paginator prompt
752 void cmd_more(void) {
753 cprintf("%d %s\n",OK,config.c_moreprompt);
759 void cmd_echo(char *etext)
761 cprintf("%d %s\n",OK,etext);
767 * identify as internal program
769 void cmd_ipgm(char *argbuf)
773 secret = extract_int(argbuf, 0);
774 if (secret == config.c_ipgm_secret) {
775 CC->internal_pgm = 1;
776 strcpy(CC->curr_user, "<internal program>");
777 CC->cs_flags = CC->cs_flags|CS_STEALTH;
778 cprintf("%d Authenticated as an internal program.\n",OK);
781 cprintf("%d Authentication failed.\n",ERROR);
782 lprintf(3, "Warning: ipgm authentication failed.\n");
788 * Shut down the server
790 void cmd_down(void) {
791 if (!CC->logged_in) {
792 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
796 if (CC->usersupp.axlevel < 6) {
797 cprintf("%d You must be an Aide to shut down the server.\n",
798 ERROR+HIGHER_ACCESS_REQUIRED);
802 cprintf("%d Shutting down server. Goodbye.\n", OK);
807 * Schedule or cancel a server shutdown
809 void cmd_scdn(char *argbuf)
813 if (!CC->logged_in) {
814 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
818 if (CC->usersupp.axlevel < 6) {
819 cprintf("%d You must be an Aide to schedule a shutdown.\n",
820 ERROR+HIGHER_ACCESS_REQUIRED);
824 new_state = extract_int(argbuf, 0);
825 if ((new_state == 0) || (new_state == 1)) {
826 ScheduledShutdown = new_state;
828 cprintf("%d %d\n", OK, ScheduledShutdown);
835 void begin_session(struct CitContext *con)
837 int num_sessions, len;
838 struct sockaddr_in sin;
841 * Initialize some variables specific to our context.
844 con->internal_pgm = 0;
845 con->download_fp = NULL;
846 con->upload_fp = NULL;
847 con->FirstExpressMessage = NULL;
849 time(&con->lastidle);
850 strcpy(con->lastcmdname, " ");
851 strcpy(con->cs_clientname, "(unknown)");
852 strcpy(con->curr_user,"(not logged in)");
853 strcpy(con->net_node,"");
854 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
855 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
856 con->cs_host[sizeof con->cs_host - 1] = 0;
858 if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len))
859 locate_host(con->cs_host, &sin.sin_addr);
861 con->upload_type = UPL_FILE;
863 con->FirstSessData = NULL;
865 num_sessions = session_count();
867 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
870 if (con->nologin==1) {
871 cprintf("%d %s: Too many users are already online "
873 ERROR+MAX_SESSIONS_EXCEEDED,
874 config.c_nodename, config.c_maxsessions);
877 cprintf("%d %s Citadel/UX server ready.\n",
878 OK, config.c_nodename);
881 lprintf(3, "citserver[%3d]: started.\n", con->cs_pid);
883 /* Run any session startup routines registered by loadable modules */
884 PerformSessionHooks(EVT_START);
886 rec_log(CL_CONNECT, "");
893 * This loop recognizes all server commands.
895 void do_command_loop(void) {
899 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
900 if (client_gets(cmdbuf) < 1) {
901 lprintf(3, "Client socket is broken. Ending session.\n");
905 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
908 * Let other clients see the last command we executed, and
909 * update the idle time, but not NOOP, PEXP, or GEXP.
911 if ( (strncasecmp(cmdbuf, "NOOP", 4))
912 && (strncasecmp(cmdbuf, "PEXP", 4))
913 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
914 strcpy(CC->lastcmdname, " ");
915 safestrncpy(CC->lastcmdname, cmdbuf,
916 sizeof(CC->lastcmdname) );
920 if ((strncasecmp(cmdbuf, "ENT0", 4))
921 && (strncasecmp(cmdbuf, "MESG", 4))
922 && (strncasecmp(cmdbuf, "MSGS", 4)))
924 CC->cs_flags &= ~CS_POSTING;
927 if (!strncasecmp(cmdbuf,"NOOP",4)) {
928 cprintf("%d%cok\n",OK,check_express());
931 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
932 cprintf("%d Goodbye.\n",OK);
936 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
937 if (CC->logged_in) logout(CC);
938 cprintf("%d logged out.\n",OK);
941 else if (!strncasecmp(cmdbuf,"USER",4)) {
942 cmd_user(&cmdbuf[5]);
945 else if (!strncasecmp(cmdbuf,"PASS",4)) {
946 cmd_pass(&cmdbuf[5]);
949 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
950 cmd_newu(&cmdbuf[5]);
953 else if (!strncasecmp(cmdbuf,"SETP",4)) {
954 cmd_setp(&cmdbuf[5]);
957 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
958 cmd_lrms(&cmdbuf[5]);
961 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
962 cmd_lkra(&cmdbuf[5]);
965 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
966 cmd_lkrn(&cmdbuf[5]);
969 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
970 cmd_lkro(&cmdbuf[5]);
973 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
974 cmd_lzrm(&cmdbuf[5]);
977 else if (!strncasecmp(cmdbuf,"GETU",4)) {
981 else if (!strncasecmp(cmdbuf,"SETU",4)) {
982 cmd_setu(&cmdbuf[5]);
985 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
986 cmd_goto(&cmdbuf[5]);
989 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
990 cmd_msgs(&cmdbuf[5]);
993 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
997 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
1001 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
1002 cmd_msg0(&cmdbuf[5]);
1005 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
1006 cmd_msg2(&cmdbuf[5]);
1009 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
1010 cmd_msg3(&cmdbuf[5]);
1013 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
1014 cmd_msg4(&cmdbuf[5]);
1017 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
1018 cmd_opna(&cmdbuf[5]);
1021 else if (!strncasecmp(cmdbuf,"INFO",4)) {
1025 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
1026 cmd_slrp(&cmdbuf[5]);
1029 else if (!strncasecmp(cmdbuf,"INVT",4)) {
1030 cmd_invt_kick(&cmdbuf[5],1);
1033 else if (!strncasecmp(cmdbuf,"KICK",4)) {
1034 cmd_invt_kick(&cmdbuf[5],0);
1037 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1041 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1042 cmd_setr(&cmdbuf[5]);
1045 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1049 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1050 cmd_seta(&cmdbuf[5]);
1053 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1054 cmd_ent0(&cmdbuf[5]);
1057 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1058 cmd_ent3(&cmdbuf[5]);
1061 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1065 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1066 cmd_dele(&cmdbuf[5]);
1069 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1070 cmd_kill(&cmdbuf[5]);
1073 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1074 cmd_cre8(&cmdbuf[5]);
1077 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1078 cmd_move(&cmdbuf[5]);
1081 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1085 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1086 cmd_mesg(&cmdbuf[5]);
1089 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1090 cmd_emsg(&cmdbuf[5]);
1093 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1097 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1098 cmd_vali(&cmdbuf[5]);
1101 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1102 cmd_einf(&cmdbuf[5]);
1105 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1109 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1113 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1114 cmd_delf(&cmdbuf[5]);
1117 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1118 cmd_movf(&cmdbuf[5]);
1121 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1122 cmd_netf(&cmdbuf[5]);
1125 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1129 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1130 cmd_open(&cmdbuf[5]);
1133 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1137 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1138 cmd_uopn(&cmdbuf[5]);
1141 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1142 cmd_ucls(&cmdbuf[5]);
1145 else if (!strncasecmp(cmdbuf,"READ",4)) {
1146 cmd_read(&cmdbuf[5]);
1149 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1150 cmd_writ(&cmdbuf[5]);
1153 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1154 cmd_qusr(&cmdbuf[5]);
1157 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1158 cmd_echo(&cmdbuf[5]);
1161 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1162 cmd_oimg(&cmdbuf[5]);
1165 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1169 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1170 cmd_netp(&cmdbuf[5]);
1173 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1174 cmd_ndop(&cmdbuf[5]);
1177 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1178 cmd_nuop(&cmdbuf[5]);
1181 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1185 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1186 cmd_cflr(&cmdbuf[5]);
1189 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1190 cmd_kflr(&cmdbuf[5]);
1193 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1194 cmd_eflr(&cmdbuf[5]);
1197 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1198 cmd_iden(&cmdbuf[5]);
1201 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1202 cmd_ipgm(&cmdbuf[5]);
1205 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1209 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1210 cmd_rbio(&cmdbuf[5]);
1213 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1217 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1218 cmd_stel(&cmdbuf[5]);
1221 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1222 cmd_term(&cmdbuf[5]);
1225 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1229 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1230 cmd_scdn(&cmdbuf[5]);
1233 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1234 cmd_nset(&cmdbuf[5]);
1237 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1238 cmd_uimg(&cmdbuf[5]);
1241 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1242 cmd_uchg(&cmdbuf[5]);
1245 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1249 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1250 cmd_hchg(&cmdbuf[5]);
1253 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1254 cmd_rchg(&cmdbuf[5]);
1257 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1258 cmd_agup(&cmdbuf[5]);
1261 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1262 cmd_asup(&cmdbuf[5]);
1265 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1266 cmd_gpex(&cmdbuf[5]);
1269 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1270 cmd_spex(&cmdbuf[5]);
1273 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1274 cmd_conf(&cmdbuf[5]);
1277 #ifdef DEBUG_MEMORY_LEAKS
1278 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1283 else if (!DLoader_Exec_Cmd(cmdbuf))
1285 cprintf("%d Unrecognized or unsupported command.\n",
1289 /* Run any after-each-command outines registered by modules */
1290 PerformSessionHooks(EVT_CMD);