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;
46 * Various things that need to be initialized at startup
48 void master_startup(void) {
49 lprintf(7, "Opening databases\n");
55 lprintf(7, "Checking floor reference counts\n");
58 lprintf(7, "Creating base rooms (if necessary)\n");
59 create_room(BASEROOM, 0, "", 0);
60 create_room(AIDEROOM, 4, "", 0);
61 create_room(config.c_twitroom, 0, "", 0);
65 * Cleanup routine to be called when the server is shutting down.
67 void master_cleanup(void) {
68 struct CleanupFunctionHook *fcn;
70 /* Cancel all running sessions */
71 lprintf(7, "Cancelling running sessions...\n");
72 while (ContextList != NULL) {
73 kill_session(ContextList->cs_pid);
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 * Gracefully terminate the session and thread.
120 * (This is called as a cleanup handler by the thread library.)
122 * All NON-system-dependent stuff is done in this function.
123 * System-dependent session/thread cleanup is in cleanup() in sysdep.c
125 void cleanup_stuff(void *arg)
127 lprintf(9, "cleanup_stuff() called\n");
129 lprintf(7, "Calling logout(%d)\n", CC->cs_pid);
132 rec_log(CL_TERMINATE,CC->curr_user);
134 lprintf(3, "citserver[%3d]: ended.\n",CC->cs_pid);
136 /* Run any cleanup routines registered by loadable modules */
137 PerformSessionHooks(EVT_STOP);
139 syslog(LOG_NOTICE,"session %d ended", CC->cs_pid);
141 /* Deallocate any user-data attached to this session */
142 deallocate_user_data(CC);
144 /* Tell the housekeeping thread to remove the session and context.
145 * This can't be done inline because the context data gets destroyed
146 * halfway through, and the context being destroyed can't be the one
149 lprintf(7, "Calling RemoveContext(%d)\n", CC->cs_pid);
150 RemoveContext(CC->cs_pid);
155 * Get a dynamic symbol number for per-session user data.
156 * This API call should be made only ONCE per symbol per citserver run.
158 int CtdlGetDynamicSymbol()
160 static unsigned int next_symbol = SYM_MAX;
161 return ++next_symbol;
167 * Return a pointer to some generic per-session user data.
168 * (This function returns NULL if the requested symbol is not allocated.)
170 * NOTE: we use critical sections for allocating and de-allocating these,
171 * but not for locating one.
173 void *CtdlGetUserData(unsigned long requested_sym)
175 struct CtdlSessData *ptr;
177 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
178 if (ptr->sym_id == requested_sym)
179 return(ptr->sym_data);
181 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
188 * Allocate some generic per-session user data.
190 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
192 struct CtdlSessData *ptr;
194 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
196 /* Fail silently if the symbol is already registered. */
197 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
198 if (ptr->sym_id == requested_sym) {
203 /* Grab us some memory! Dem's good eatin' !! */
204 ptr = mallok(sizeof(struct CtdlSessData));
205 ptr->sym_id = requested_sym;
206 ptr->sym_data = mallok(num_bytes);
208 begin_critical_section(S_SESSION_TABLE);
209 ptr->next = CC->FirstSessData;
210 CC->FirstSessData = ptr;
211 end_critical_section(S_SESSION_TABLE);
213 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
222 * cmd_info() - tell the client about this server
224 void cmd_info(void) {
225 cprintf("%d Server info:\n",LISTING_FOLLOWS);
226 cprintf("%d\n",CC->cs_pid);
227 cprintf("%s\n",config.c_nodename);
228 cprintf("%s\n",config.c_humannode);
229 cprintf("%s\n",config.c_fqdn);
230 cprintf("%s\n",CITADEL);
231 cprintf("%d\n",REV_LEVEL);
232 cprintf("%s\n",config.c_bbs_city);
233 cprintf("%s\n",config.c_sysadm);
234 cprintf("%d\n",SERVER_TYPE);
235 cprintf("%s\n",config.c_moreprompt);
236 cprintf("1\n"); /* 1 = yes, this system supports floors */
237 cprintf("1\n"); /* 1 = we support the extended paging options */
241 void cmd_rchg(char *argbuf)
243 char newroomname[ROOMNAMELEN];
245 extract(newroomname, argbuf, 0);
246 newroomname[ROOMNAMELEN] = 0;
247 if (strlen(newroomname) > 0) {
248 safestrncpy(CC->fake_roomname, newroomname,
249 sizeof(CC->fake_roomname) );
250 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
253 strcpy(CC->fake_roomname, "");
255 cprintf("%d OK\n", OK);
258 void cmd_hchg(char *newhostname)
260 if ((newhostname) && (newhostname[0]))
262 memset(CC->fake_hostname, 0, 25);
263 safestrncpy(CC->fake_hostname, newhostname, sizeof(CC->fake_hostname));
266 strcpy(CC->fake_hostname, "");
267 cprintf("%d OK\n",OK);
270 void cmd_uchg(char *newusername)
272 if (CC->usersupp.axlevel < 6)
274 cprintf("%d You must be an Aide to use UCHG.\n",
275 ERROR+HIGHER_ACCESS_REQUIRED);
278 if ((newusername) && (newusername[0]))
280 CC->cs_flags &= ~CS_STEALTH;
281 memset(CC->fake_username, 0, 32);
282 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
283 safestrncpy(CC->fake_username, newusername, sizeof(CC->fake_username));
287 CC->fake_username[0] = '\0';
288 CC->cs_flags |= CS_STEALTH;
294 * returns an asterisk if there are any express messages waiting,
297 char check_express(void) {
298 if (CC->FirstExpressMessage == NULL) {
312 cprintf("%d %ld\n", OK, tv);
316 * Check whether two hostnames match.
317 * "Realname" should be an actual name of a client that is trying to connect;
318 * "testname" should be the value we are comparing it with. The idea is that we
319 * want to compare with both the abbreviated and fully-qualified versions of
320 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
322 static int hostnames_match(const char *realname, const char *testname) {
326 if (!strcasecmp(realname, testname))
329 #ifdef HAVE_NONREENTRANT_NETDB
330 begin_critical_section(S_NETDB);
333 if ((he = gethostbyname(testname)) != NULL)
334 if (!strcasecmp(realname, he->h_name))
337 #ifdef HAVE_NONREENTRANT_NETDB
338 end_critical_section(S_NETDB);
345 * check a hostname against the public_clients file
347 int is_public_client(char *where)
352 if (hostnames_match(where,"localhost")) return(1);
353 if (hostnames_match(where,config.c_fqdn)) return(1);
355 fp = fopen("public_clients","r");
356 if (fp == NULL) return(0);
358 while (fgets(buf,256,fp)!=NULL) {
359 while (isspace((buf[strlen(buf)-1])))
360 buf[strlen(buf)-1] = 0;
361 if (hostnames_match(where,buf)) {
373 * the client is identifying itself to the server
375 void cmd_iden(char *argbuf)
384 if (num_parms(argbuf)<4) {
385 cprintf("%d usage error\n",ERROR);
389 dev_code = extract_int(argbuf,0);
390 cli_code = extract_int(argbuf,1);
391 rev_level = extract_int(argbuf,2);
392 extract(desc,argbuf,3);
394 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
395 from_host[sizeof from_host - 1] = 0;
396 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
398 CC->cs_clientdev = dev_code;
399 CC->cs_clienttyp = cli_code;
400 CC->cs_clientver = rev_level;
401 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
402 CC->cs_clientname[31] = 0;
404 lprintf(9, "Looking up hostname\n");
405 if ((strlen(from_host)>0) &&
406 (is_public_client(CC->cs_host))) {
407 if (inet_aton(from_host, &addr))
408 locate_host(CC->cs_host, &addr);
410 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
415 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
421 cprintf("%d Ok\n",OK);
426 * enter or exit "stealth mode"
428 void cmd_stel(char *cmdbuf)
432 requested_mode = extract_int(cmdbuf,0);
433 if (requested_mode !=0) requested_mode = 1;
435 if (!CC->logged_in) {
436 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
440 if (CC->usersupp.axlevel < 6) {
441 cprintf("%d You must be an Aide to use stealth mode.\n",
442 ERROR+HIGHER_ACCESS_REQUIRED);
446 if (CC->cs_flags & CS_STEALTH) {
447 if (requested_mode == 0)
448 CC->cs_flags = CC->cs_flags-CS_STEALTH;
451 if (requested_mode == 1)
452 CC->cs_flags = CC->cs_flags|CS_STEALTH;
455 cprintf("%d Ok\n",OK);
462 * display system messages or help
464 void cmd_mesg(char *mname)
471 extract(buf,mname,0);
476 strcpy(dirs[0],"messages");
477 strcpy(dirs[1],"help");
478 mesg_locate(targ,buf,2,dirs);
483 if (strlen(targ)==0) {
484 cprintf("%d '%s' not found.\n",ERROR,mname);
488 mfp = fopen(targ,"r");
490 cprintf("%d Cannot open '%s': %s\n",
491 ERROR,targ,strerror(errno));
494 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
496 while (fgets(buf,255,mfp)!=NULL) {
497 buf[strlen(buf)-1] = 0;
508 * enter system messages or help
510 void cmd_emsg(char *mname)
518 if (CC->usersupp.axlevel < 6) {
519 cprintf("%d You must be an Aide to edit system messages.\n",
520 ERROR+HIGHER_ACCESS_REQUIRED);
524 extract(buf,mname,0);
525 for (a=0; a<strlen(buf); ++a) { /* security measure */
526 if (buf[a] == '/') buf[a] = '.';
531 strcpy(dirs[0],"messages");
532 strcpy(dirs[1],"help");
533 mesg_locate(targ,buf,2,dirs);
537 if (strlen(targ)==0) {
538 snprintf(targ, sizeof targ, "./help/%s", buf);
541 mfp = fopen(targ,"w");
543 cprintf("%d Cannot open '%s': %s\n",
544 ERROR,targ,strerror(errno));
547 cprintf("%d %s\n", SEND_LISTING, targ);
549 while (client_gets(buf), strcmp(buf, "000")) {
550 fprintf(mfp, "%s\n", buf);
557 /* Don't show the names of private rooms unless the viewing
558 * user also knows the rooms.
560 void GenerateRoomDisplay(char *real_room,
561 struct CitContext *viewed,
562 struct CitContext *viewer) {
564 strcpy(real_room, viewed->quickroom.QRname);
565 if (viewed->quickroom.QRflags & QR_MAILBOX) {
566 strcpy(real_room, &real_room[11]);
568 if (viewed->quickroom.QRflags & QR_PRIVATE) {
569 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
571 strcpy(real_room, "<private room>");
575 if (viewed->cs_flags & CS_CHAT) {
576 while (strlen(real_room) < 14)
577 strcat(real_room, " ");
579 strcpy(&real_room[14], "<chat>");
588 void cmd_rwho(void) {
589 struct CitContext *cptr;
593 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
594 char host[40], flags[5];
596 aide = CC->usersupp.axlevel >= 6;
597 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
599 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
604 if (cptr->cs_flags & CS_POSTING)
609 if (cptr->fake_username[0])
611 strcpy(un, cptr->fake_username);
615 strcpy(un, cptr->curr_user);
617 if (cptr->fake_hostname[0])
619 strcpy(host, cptr->fake_hostname);
623 strcpy(host, cptr->cs_host);
625 GenerateRoomDisplay(real_room, cptr, CC);
627 if (cptr->fake_roomname[0]) {
628 strcpy(room, cptr->fake_roomname);
632 strcpy(room, real_room);
635 if ((aide) && (spoofed))
638 if ((cptr->cs_flags & CS_STEALTH) && (aide))
641 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
643 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
644 cptr->cs_pid, un, room,
645 host, cptr->cs_clientname,
646 (long)(cptr->lastidle),
647 cptr->lastcmdname, flags);
649 if ((spoofed) && (aide))
651 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
652 cptr->cs_pid, cptr->curr_user,
654 cptr->cs_host, cptr->cs_clientname,
655 (long)(cptr->lastidle),
656 cptr->lastcmdname, flags);
661 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
662 * so that external paging modules such as serv_icq can add more
663 * content to the Wholist.
665 PerformSessionHooks(EVT_RWHO);
671 * Terminate another running session
673 void cmd_term(char *cmdbuf)
676 struct CitContext *ccptr;
677 int session_to_kill = 0;
679 if (!CC->logged_in) {
680 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
684 if (CC->usersupp.axlevel < 6) {
685 cprintf("%d You must be an Aide to terminate sessions.\n",
686 ERROR+HIGHER_ACCESS_REQUIRED);
690 session_num = extract_int(cmdbuf, 0);
691 if (session_num == CC->cs_pid) {
692 cprintf("%d You can't kill your own session.\n", ERROR);
696 lprintf(9, "Locating session to kill\n");
697 begin_critical_section(S_SESSION_TABLE);
698 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
699 if (session_num == ccptr->cs_pid) {
700 session_to_kill = ccptr->cs_pid;
703 end_critical_section(S_SESSION_TABLE);
704 lprintf(9, "session_to_kill == %d\n", session_to_kill);
706 if (session_to_kill > 0) {
707 lprintf(9, "calling kill_session()\n");
708 kill_session(session_to_kill);
709 cprintf("%d Session terminated.\n", OK);
712 cprintf("%d No such session.\n", ERROR);
721 * get the paginator prompt
723 void cmd_more(void) {
724 cprintf("%d %s\n",OK,config.c_moreprompt);
730 void cmd_echo(char *etext)
732 cprintf("%d %s\n",OK,etext);
738 * identify as internal program
740 void cmd_ipgm(char *argbuf)
744 secret = extract_int(argbuf, 0);
745 if (secret == config.c_ipgm_secret) {
746 CC->internal_pgm = 1;
747 strcpy(CC->curr_user, "<internal program>");
748 CC->cs_flags = CC->cs_flags|CS_STEALTH;
749 cprintf("%d Authenticated as an internal program.\n",OK);
752 cprintf("%d Authentication failed.\n",ERROR);
753 lprintf(3, "Warning: ipgm authentication failed.\n");
759 * Shut down the server
761 void cmd_down(void) {
762 if (!CC->logged_in) {
763 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
767 if (CC->usersupp.axlevel < 6) {
768 cprintf("%d You must be an Aide to shut down the server.\n",
769 ERROR+HIGHER_ACCESS_REQUIRED);
773 cprintf("%d Shutting down server. Goodbye.\n", OK);
778 * Schedule or cancel a server shutdown
780 void cmd_scdn(char *argbuf)
784 if (!CC->logged_in) {
785 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
789 if (CC->usersupp.axlevel < 6) {
790 cprintf("%d You must be an Aide to schedule a shutdown.\n",
791 ERROR+HIGHER_ACCESS_REQUIRED);
795 new_state = extract_int(argbuf, 0);
796 if ((new_state == 0) || (new_state == 1)) {
797 ScheduledShutdown = new_state;
799 cprintf("%d %d\n", OK, ScheduledShutdown);
806 void *context_loop(struct CitContext *con)
809 int num_sessions, len;
810 struct sockaddr_in sin;
813 * Wedge our way into the context table.
818 * Initialize some variables specific to our context.
821 CC->internal_pgm = 0;
822 CC->download_fp = NULL;
823 CC->upload_fp = NULL;
824 CC->cs_pid = con->client_socket; /* not necessarily portable */
825 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 safestrncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
834 CC->cs_host[sizeof CC->cs_host - 1] = 0;
836 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
837 locate_host(CC->cs_host, &sin.sin_addr);
839 CC->upload_type = UPL_FILE;
841 CC->FirstSessData = NULL;
843 num_sessions = session_count();
845 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
848 if (CC->nologin==1) {
849 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
850 ERROR+MAX_SESSIONS_EXCEEDED,
851 config.c_nodename,config.c_maxsessions);
854 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
857 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
859 /* Run any session startup routines registered by loadable modules */
860 PerformSessionHooks(EVT_START);
862 rec_log(CL_CONNECT, "");
866 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
867 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
868 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
871 * Let other clients see the last command we executed, and
872 * update the idle time, but not NOOP, PEXP, or GEXP.
874 if ( (strncasecmp(cmdbuf, "NOOP", 4))
875 && (strncasecmp(cmdbuf, "PEXP", 4))
876 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
877 strcpy(CC->lastcmdname, " ");
878 safestrncpy(CC->lastcmdname, cmdbuf,
879 sizeof(CC->lastcmdname) );
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,"VALI",4)) {
1062 cmd_vali(&cmdbuf[5]);
1065 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1066 cmd_einf(&cmdbuf[5]);
1069 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1073 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1077 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1078 cmd_delf(&cmdbuf[5]);
1081 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1082 cmd_movf(&cmdbuf[5]);
1085 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1086 cmd_netf(&cmdbuf[5]);
1089 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1093 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1094 cmd_open(&cmdbuf[5]);
1097 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1101 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1102 cmd_uopn(&cmdbuf[5]);
1105 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1106 cmd_ucls(&cmdbuf[5]);
1109 else if (!strncasecmp(cmdbuf,"READ",4)) {
1110 cmd_read(&cmdbuf[5]);
1113 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1114 cmd_writ(&cmdbuf[5]);
1117 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1118 cmd_qusr(&cmdbuf[5]);
1121 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1122 cmd_echo(&cmdbuf[5]);
1125 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1126 cmd_oimg(&cmdbuf[5]);
1129 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1133 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1134 cmd_netp(&cmdbuf[5]);
1137 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1138 cmd_ndop(&cmdbuf[5]);
1141 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1142 cmd_nuop(&cmdbuf[5]);
1145 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1149 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1150 cmd_cflr(&cmdbuf[5]);
1153 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1154 cmd_kflr(&cmdbuf[5]);
1157 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1158 cmd_eflr(&cmdbuf[5]);
1161 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1162 cmd_iden(&cmdbuf[5]);
1165 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1166 cmd_ipgm(&cmdbuf[5]);
1169 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1173 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1174 cmd_rbio(&cmdbuf[5]);
1177 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1181 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1182 cmd_stel(&cmdbuf[5]);
1185 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1186 cmd_term(&cmdbuf[5]);
1189 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1193 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1194 cmd_scdn(&cmdbuf[5]);
1197 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1198 cmd_nset(&cmdbuf[5]);
1201 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1202 cmd_uimg(&cmdbuf[5]);
1205 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1206 cmd_uchg(&cmdbuf[5]);
1209 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1213 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1214 cmd_hchg(&cmdbuf[5]);
1217 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1218 cmd_rchg(&cmdbuf[5]);
1221 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1222 cmd_agup(&cmdbuf[5]);
1225 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1226 cmd_asup(&cmdbuf[5]);
1229 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1230 cmd_gpex(&cmdbuf[5]);
1233 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1234 cmd_spex(&cmdbuf[5]);
1237 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1238 cmd_conf(&cmdbuf[5]);
1241 #ifdef DEBUG_MEMORY_LEAKS
1242 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1247 else if (!DLoader_Exec_Cmd(cmdbuf))
1249 cprintf("%d Unrecognized or unsupported command.\n",
1253 /* Run any after-each-command outines registered by modules */
1254 PerformSessionHooks(EVT_CMD);
1256 } while(strncasecmp(cmdbuf, "QUIT", 4));
1258 cleanup(EXIT_NORMAL);