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(int exit_code)
127 lprintf(9, "cleanup(%d) called\n", exit_code);
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 /* And flag the context as in need of being killed */
145 CC->state = CON_DYING;
150 * Get a dynamic symbol number for per-session user data.
151 * This API call should be made only ONCE per symbol per citserver run.
153 int CtdlGetDynamicSymbol()
155 static unsigned int next_symbol = SYM_MAX;
156 return ++next_symbol;
162 * Return a pointer to some generic per-session user data.
163 * (This function returns NULL if the requested symbol is not allocated.)
165 * NOTE: we use critical sections for allocating and de-allocating these,
166 * but not for locating one.
168 void *CtdlGetUserData(unsigned long requested_sym)
170 struct CtdlSessData *ptr;
172 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
173 if (ptr->sym_id == requested_sym)
174 return(ptr->sym_data);
176 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
183 * Allocate some generic per-session user data.
185 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
187 struct CtdlSessData *ptr;
189 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
191 /* Fail silently if the symbol is already registered. */
192 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
193 if (ptr->sym_id == requested_sym) {
198 /* Grab us some memory! Dem's good eatin' !! */
199 ptr = mallok(sizeof(struct CtdlSessData));
200 ptr->sym_id = requested_sym;
201 ptr->sym_data = mallok(num_bytes);
203 begin_critical_section(S_SESSION_TABLE);
204 ptr->next = CC->FirstSessData;
205 CC->FirstSessData = ptr;
206 end_critical_section(S_SESSION_TABLE);
208 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
217 * cmd_info() - tell the client about this server
219 void cmd_info(void) {
220 cprintf("%d Server info:\n",LISTING_FOLLOWS);
221 cprintf("%d\n",CC->cs_pid);
222 cprintf("%s\n",config.c_nodename);
223 cprintf("%s\n",config.c_humannode);
224 cprintf("%s\n",config.c_fqdn);
225 cprintf("%s\n",CITADEL);
226 cprintf("%d\n",REV_LEVEL);
227 cprintf("%s\n",config.c_bbs_city);
228 cprintf("%s\n",config.c_sysadm);
229 cprintf("%d\n",SERVER_TYPE);
230 cprintf("%s\n",config.c_moreprompt);
231 cprintf("1\n"); /* 1 = yes, this system supports floors */
232 cprintf("1\n"); /* 1 = we support the extended paging options */
236 void cmd_rchg(char *argbuf)
238 char newroomname[ROOMNAMELEN];
240 extract(newroomname, argbuf, 0);
241 newroomname[ROOMNAMELEN] = 0;
242 if (strlen(newroomname) > 0) {
243 safestrncpy(CC->fake_roomname, newroomname,
244 sizeof(CC->fake_roomname) );
245 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
248 strcpy(CC->fake_roomname, "");
250 cprintf("%d OK\n", OK);
253 void cmd_hchg(char *newhostname)
255 if ((newhostname) && (newhostname[0]))
257 memset(CC->fake_hostname, 0, 25);
258 safestrncpy(CC->fake_hostname, newhostname, sizeof(CC->fake_hostname));
261 strcpy(CC->fake_hostname, "");
262 cprintf("%d OK\n",OK);
265 void cmd_uchg(char *newusername)
267 if (CC->usersupp.axlevel < 6)
269 cprintf("%d You must be an Aide to use UCHG.\n",
270 ERROR+HIGHER_ACCESS_REQUIRED);
273 if ((newusername) && (newusername[0]))
275 CC->cs_flags &= ~CS_STEALTH;
276 memset(CC->fake_username, 0, 32);
277 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
278 safestrncpy(CC->fake_username, newusername, sizeof(CC->fake_username));
282 CC->fake_username[0] = '\0';
283 CC->cs_flags |= CS_STEALTH;
289 * returns an asterisk if there are any express messages waiting,
292 char check_express(void) {
293 if (CC->FirstExpressMessage == NULL) {
307 cprintf("%d %ld\n", OK, tv);
311 * Check whether two hostnames match.
312 * "Realname" should be an actual name of a client that is trying to connect;
313 * "testname" should be the value we are comparing it with. The idea is that we
314 * want to compare with both the abbreviated and fully-qualified versions of
315 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
317 static int hostnames_match(const char *realname, const char *testname) {
321 if (!strcasecmp(realname, testname))
324 #ifdef HAVE_NONREENTRANT_NETDB
325 begin_critical_section(S_NETDB);
328 if ((he = gethostbyname(testname)) != NULL)
329 if (!strcasecmp(realname, he->h_name))
332 #ifdef HAVE_NONREENTRANT_NETDB
333 end_critical_section(S_NETDB);
340 * check a hostname against the public_clients file
342 int is_public_client(char *where)
347 if (hostnames_match(where,"localhost")) return(1);
348 if (hostnames_match(where,config.c_fqdn)) return(1);
350 fp = fopen("public_clients","r");
351 if (fp == NULL) return(0);
353 while (fgets(buf,256,fp)!=NULL) {
354 while (isspace((buf[strlen(buf)-1])))
355 buf[strlen(buf)-1] = 0;
356 if (hostnames_match(where,buf)) {
368 * the client is identifying itself to the server
370 void cmd_iden(char *argbuf)
379 if (num_parms(argbuf)<4) {
380 cprintf("%d usage error\n",ERROR);
384 dev_code = extract_int(argbuf,0);
385 cli_code = extract_int(argbuf,1);
386 rev_level = extract_int(argbuf,2);
387 extract(desc,argbuf,3);
389 safestrncpy(from_host, config.c_fqdn, sizeof from_host);
390 from_host[sizeof from_host - 1] = 0;
391 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
393 CC->cs_clientdev = dev_code;
394 CC->cs_clienttyp = cli_code;
395 CC->cs_clientver = rev_level;
396 safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
397 CC->cs_clientname[31] = 0;
399 lprintf(9, "Looking up hostname\n");
400 if ((strlen(from_host)>0) &&
401 (is_public_client(CC->cs_host))) {
402 if (inet_aton(from_host, &addr))
403 locate_host(CC->cs_host, &addr);
405 safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
410 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
416 cprintf("%d Ok\n",OK);
421 * enter or exit "stealth mode"
423 void cmd_stel(char *cmdbuf)
427 requested_mode = extract_int(cmdbuf,0);
428 if (requested_mode !=0) requested_mode = 1;
430 if (!CC->logged_in) {
431 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
435 if (CC->usersupp.axlevel < 6) {
436 cprintf("%d You must be an Aide to use stealth mode.\n",
437 ERROR+HIGHER_ACCESS_REQUIRED);
441 if (CC->cs_flags & CS_STEALTH) {
442 if (requested_mode == 0)
443 CC->cs_flags = CC->cs_flags-CS_STEALTH;
446 if (requested_mode == 1)
447 CC->cs_flags = CC->cs_flags|CS_STEALTH;
450 cprintf("%d Ok\n",OK);
457 * display system messages or help
459 void cmd_mesg(char *mname)
466 extract(buf,mname,0);
471 strcpy(dirs[0],"messages");
472 strcpy(dirs[1],"help");
473 mesg_locate(targ,buf,2,dirs);
478 if (strlen(targ)==0) {
479 cprintf("%d '%s' not found.\n",ERROR,mname);
483 mfp = fopen(targ,"r");
485 cprintf("%d Cannot open '%s': %s\n",
486 ERROR,targ,strerror(errno));
489 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
491 while (fgets(buf,255,mfp)!=NULL) {
492 buf[strlen(buf)-1] = 0;
503 * enter system messages or help
505 void cmd_emsg(char *mname)
513 if (CC->usersupp.axlevel < 6) {
514 cprintf("%d You must be an Aide to edit system messages.\n",
515 ERROR+HIGHER_ACCESS_REQUIRED);
519 extract(buf,mname,0);
520 for (a=0; a<strlen(buf); ++a) { /* security measure */
521 if (buf[a] == '/') buf[a] = '.';
526 strcpy(dirs[0],"messages");
527 strcpy(dirs[1],"help");
528 mesg_locate(targ,buf,2,dirs);
532 if (strlen(targ)==0) {
533 snprintf(targ, sizeof targ, "./help/%s", buf);
536 mfp = fopen(targ,"w");
538 cprintf("%d Cannot open '%s': %s\n",
539 ERROR,targ,strerror(errno));
542 cprintf("%d %s\n", SEND_LISTING, targ);
544 while (client_gets(buf), strcmp(buf, "000")) {
545 fprintf(mfp, "%s\n", buf);
552 /* Don't show the names of private rooms unless the viewing
553 * user also knows the rooms.
555 void GenerateRoomDisplay(char *real_room,
556 struct CitContext *viewed,
557 struct CitContext *viewer) {
559 strcpy(real_room, viewed->quickroom.QRname);
560 if (viewed->quickroom.QRflags & QR_MAILBOX) {
561 strcpy(real_room, &real_room[11]);
563 if (viewed->quickroom.QRflags & QR_PRIVATE) {
564 if ( (CtdlRoomAccess(&viewed->quickroom, &viewer->usersupp)
566 strcpy(real_room, "<private room>");
570 if (viewed->cs_flags & CS_CHAT) {
571 while (strlen(real_room) < 14)
572 strcat(real_room, " ");
574 strcpy(&real_room[14], "<chat>");
583 void cmd_rwho(void) {
584 struct CitContext *cptr;
588 char real_room[ROOMNAMELEN], room[ROOMNAMELEN];
589 char host[40], flags[5];
591 aide = CC->usersupp.axlevel >= 6;
592 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
594 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
599 if (cptr->cs_flags & CS_POSTING)
604 if (cptr->fake_username[0])
606 strcpy(un, cptr->fake_username);
610 strcpy(un, cptr->curr_user);
612 if (cptr->fake_hostname[0])
614 strcpy(host, cptr->fake_hostname);
618 strcpy(host, cptr->cs_host);
620 GenerateRoomDisplay(real_room, cptr, CC);
622 if (cptr->fake_roomname[0]) {
623 strcpy(room, cptr->fake_roomname);
627 strcpy(room, real_room);
630 if ((aide) && (spoofed))
633 if ((cptr->cs_flags & CS_STEALTH) && (aide))
636 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
638 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
639 cptr->cs_pid, un, room,
640 host, cptr->cs_clientname,
641 (long)(cptr->lastidle),
642 cptr->lastcmdname, flags);
644 if ((spoofed) && (aide))
646 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
647 cptr->cs_pid, cptr->curr_user,
649 cptr->cs_host, cptr->cs_clientname,
650 (long)(cptr->lastidle),
651 cptr->lastcmdname, flags);
656 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
657 * so that external paging modules such as serv_icq can add more
658 * content to the Wholist.
660 PerformSessionHooks(EVT_RWHO);
666 * Terminate another running session
668 void cmd_term(char *cmdbuf)
671 struct CitContext *ccptr;
672 int session_to_kill = 0;
674 if (!CC->logged_in) {
675 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
679 if (CC->usersupp.axlevel < 6) {
680 cprintf("%d You must be an Aide to terminate sessions.\n",
681 ERROR+HIGHER_ACCESS_REQUIRED);
685 session_num = extract_int(cmdbuf, 0);
686 if (session_num == CC->cs_pid) {
687 cprintf("%d You can't kill your own session.\n", ERROR);
691 lprintf(9, "Locating session to kill\n");
692 begin_critical_section(S_SESSION_TABLE);
693 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
694 if (session_num == ccptr->cs_pid) {
695 session_to_kill = ccptr->cs_pid;
698 end_critical_section(S_SESSION_TABLE);
699 lprintf(9, "session_to_kill == %d\n", session_to_kill);
701 if (session_to_kill > 0) {
702 lprintf(9, "calling kill_session()\n");
703 kill_session(session_to_kill);
704 cprintf("%d Session terminated.\n", OK);
707 cprintf("%d No such session.\n", ERROR);
716 * get the paginator prompt
718 void cmd_more(void) {
719 cprintf("%d %s\n",OK,config.c_moreprompt);
725 void cmd_echo(char *etext)
727 cprintf("%d %s\n",OK,etext);
733 * identify as internal program
735 void cmd_ipgm(char *argbuf)
739 secret = extract_int(argbuf, 0);
740 if (secret == config.c_ipgm_secret) {
741 CC->internal_pgm = 1;
742 strcpy(CC->curr_user, "<internal program>");
743 CC->cs_flags = CC->cs_flags|CS_STEALTH;
744 cprintf("%d Authenticated as an internal program.\n",OK);
747 cprintf("%d Authentication failed.\n",ERROR);
748 lprintf(3, "Warning: ipgm authentication failed.\n");
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 begin_session(struct CitContext *con)
803 int num_sessions, len;
804 struct sockaddr_in sin;
807 * Initialize some variables specific to our context.
810 con->internal_pgm = 0;
811 con->download_fp = NULL;
812 con->upload_fp = NULL;
813 con->cs_pid = con->client_socket; /* not necessarily portable */
814 con->FirstExpressMessage = NULL;
816 time(&con->lastidle);
817 strcpy(con->lastcmdname, " ");
818 strcpy(con->cs_clientname, "(unknown)");
819 strcpy(con->curr_user,"(not logged in)");
820 strcpy(con->net_node,"");
821 snprintf(con->temp, sizeof con->temp, tmpnam(NULL));
822 safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
823 con->cs_host[sizeof con->cs_host - 1] = 0;
825 if (!getpeername(con->client_socket, (struct sockaddr *) &sin, &len))
826 locate_host(con->cs_host, &sin.sin_addr);
828 con->upload_type = UPL_FILE;
830 con->FirstSessData = NULL;
832 num_sessions = session_count();
834 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
837 if (con->nologin==1) {
838 cprintf("%d %s: Too many users are already online "
840 ERROR+MAX_SESSIONS_EXCEEDED,
841 config.c_nodename, config.c_maxsessions);
844 cprintf("%d %s Citadel/UX server ready.\n",
845 OK, config.c_nodename);
848 lprintf(3, "citserver[%3d]: started.\n", con->cs_pid);
850 /* Run any session startup routines registered by loadable modules */
851 PerformSessionHooks(EVT_START);
853 rec_log(CL_CONNECT, "");
860 * This loop recognizes all server commands.
862 void do_command_loop(void) {
866 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
867 if (client_gets(cmdbuf) < 1) {
868 lprintf(3, "Client socket is broken. Ending session.\n");
871 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
874 * Let other clients see the last command we executed, and
875 * update the idle time, but not NOOP, PEXP, or GEXP.
877 if ( (strncasecmp(cmdbuf, "NOOP", 4))
878 && (strncasecmp(cmdbuf, "PEXP", 4))
879 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
880 strcpy(CC->lastcmdname, " ");
881 safestrncpy(CC->lastcmdname, cmdbuf,
882 sizeof(CC->lastcmdname) );
886 if ((strncasecmp(cmdbuf, "ENT0", 4))
887 && (strncasecmp(cmdbuf, "MESG", 4))
888 && (strncasecmp(cmdbuf, "MSGS", 4)))
890 CC->cs_flags &= ~CS_POSTING;
893 if (!strncasecmp(cmdbuf,"NOOP",4)) {
894 cprintf("%d%cok\n",OK,check_express());
897 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
898 cprintf("%d Goodbye.\n",OK);
902 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
903 if (CC->logged_in) logout(CC);
904 cprintf("%d logged out.\n",OK);
907 else if (!strncasecmp(cmdbuf,"USER",4)) {
908 cmd_user(&cmdbuf[5]);
911 else if (!strncasecmp(cmdbuf,"PASS",4)) {
912 cmd_pass(&cmdbuf[5]);
915 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
916 cmd_newu(&cmdbuf[5]);
919 else if (!strncasecmp(cmdbuf,"SETP",4)) {
920 cmd_setp(&cmdbuf[5]);
923 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
924 cmd_lrms(&cmdbuf[5]);
927 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
928 cmd_lkra(&cmdbuf[5]);
931 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
932 cmd_lkrn(&cmdbuf[5]);
935 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
936 cmd_lkro(&cmdbuf[5]);
939 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
940 cmd_lzrm(&cmdbuf[5]);
943 else if (!strncasecmp(cmdbuf,"GETU",4)) {
947 else if (!strncasecmp(cmdbuf,"SETU",4)) {
948 cmd_setu(&cmdbuf[5]);
951 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
952 cmd_goto(&cmdbuf[5]);
955 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
956 cmd_msgs(&cmdbuf[5]);
959 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
963 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
967 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
968 cmd_msg0(&cmdbuf[5]);
971 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
972 cmd_msg2(&cmdbuf[5]);
975 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
976 cmd_msg3(&cmdbuf[5]);
979 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
980 cmd_msg4(&cmdbuf[5]);
983 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
984 cmd_opna(&cmdbuf[5]);
987 else if (!strncasecmp(cmdbuf,"INFO",4)) {
991 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
992 cmd_slrp(&cmdbuf[5]);
995 else if (!strncasecmp(cmdbuf,"INVT",4)) {
996 cmd_invt_kick(&cmdbuf[5],1);
999 else if (!strncasecmp(cmdbuf,"KICK",4)) {
1000 cmd_invt_kick(&cmdbuf[5],0);
1003 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1007 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1008 cmd_setr(&cmdbuf[5]);
1011 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1015 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1016 cmd_seta(&cmdbuf[5]);
1019 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1020 cmd_ent0(&cmdbuf[5]);
1023 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1024 cmd_ent3(&cmdbuf[5]);
1027 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1031 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1032 cmd_dele(&cmdbuf[5]);
1035 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1036 cmd_kill(&cmdbuf[5]);
1039 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1040 cmd_cre8(&cmdbuf[5]);
1043 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1044 cmd_move(&cmdbuf[5]);
1047 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1051 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1052 cmd_mesg(&cmdbuf[5]);
1055 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1056 cmd_emsg(&cmdbuf[5]);
1059 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1063 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1064 cmd_vali(&cmdbuf[5]);
1067 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1068 cmd_einf(&cmdbuf[5]);
1071 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1075 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1079 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1080 cmd_delf(&cmdbuf[5]);
1083 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1084 cmd_movf(&cmdbuf[5]);
1087 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1088 cmd_netf(&cmdbuf[5]);
1091 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1095 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1096 cmd_open(&cmdbuf[5]);
1099 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1103 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1104 cmd_uopn(&cmdbuf[5]);
1107 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1108 cmd_ucls(&cmdbuf[5]);
1111 else if (!strncasecmp(cmdbuf,"READ",4)) {
1112 cmd_read(&cmdbuf[5]);
1115 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1116 cmd_writ(&cmdbuf[5]);
1119 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1120 cmd_qusr(&cmdbuf[5]);
1123 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1124 cmd_echo(&cmdbuf[5]);
1127 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1128 cmd_oimg(&cmdbuf[5]);
1131 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1135 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1136 cmd_netp(&cmdbuf[5]);
1139 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1140 cmd_ndop(&cmdbuf[5]);
1143 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1144 cmd_nuop(&cmdbuf[5]);
1147 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1151 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1152 cmd_cflr(&cmdbuf[5]);
1155 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1156 cmd_kflr(&cmdbuf[5]);
1159 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1160 cmd_eflr(&cmdbuf[5]);
1163 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1164 cmd_iden(&cmdbuf[5]);
1167 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1168 cmd_ipgm(&cmdbuf[5]);
1171 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1175 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1176 cmd_rbio(&cmdbuf[5]);
1179 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1183 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1184 cmd_stel(&cmdbuf[5]);
1187 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1188 cmd_term(&cmdbuf[5]);
1191 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1195 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1196 cmd_scdn(&cmdbuf[5]);
1199 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1200 cmd_nset(&cmdbuf[5]);
1203 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1204 cmd_uimg(&cmdbuf[5]);
1207 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1208 cmd_uchg(&cmdbuf[5]);
1211 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1215 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1216 cmd_hchg(&cmdbuf[5]);
1219 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1220 cmd_rchg(&cmdbuf[5]);
1223 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1224 cmd_agup(&cmdbuf[5]);
1227 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1228 cmd_asup(&cmdbuf[5]);
1231 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1232 cmd_gpex(&cmdbuf[5]);
1235 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1236 cmd_spex(&cmdbuf[5]);
1239 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1240 cmd_conf(&cmdbuf[5]);
1243 #ifdef DEBUG_MEMORY_LEAKS
1244 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1249 else if (!DLoader_Exec_Cmd(cmdbuf))
1251 cprintf("%d Unrecognized or unsupported command.\n",
1255 /* Run any after-each-command outines registered by modules */
1256 PerformSessionHooks(EVT_CMD);