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)
128 lprintf(9, "cleanup_stuff() called\n");
130 lprintf(7, "Calling logout(%d)\n", CC->cs_pid);
133 rec_log(CL_TERMINATE,CC->curr_user);
135 lprintf(3, "citserver[%3d]: ended.\n",CC->cs_pid);
137 /* Run any cleanup routines registered by loadable modules */
138 PerformSessionHooks(EVT_STOP);
140 syslog(LOG_NOTICE,"session %d ended", CC->cs_pid);
142 /* Deallocate any user-data attached to this session */
143 deallocate_user_data(CC);
145 /* Now get rid of the session and context */
146 lprintf(7, "cleanup_stuff() calling RemoveContext(%d)\n", CC->cs_pid);
149 /* Wake up the housekeeping thread */
150 enter_housekeeping_cmd("SCHED_SHUTDOWN");
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);
221 * set_wtmpsupp() - alter the session listing
223 void set_wtmpsupp(char *newtext)
225 strncpy(CC->cs_room,newtext,sizeof CC->cs_room);
226 CC->cs_room[sizeof CC->cs_room - 1] = 0;
227 time(&CC->cs_lastupdt);
229 /* Run any routines registered by loadable modules */
230 PerformSessionHooks(EVT_NEWROOM);
235 * call set_wtmpsupp() with the name of the current room, modified a bit...
237 void set_wtmpsupp_to_current_room() {
238 if (CC->quickroom.QRflags & QR_PRIVATE) {
239 set_wtmpsupp("<private room>");
241 else if (CC->quickroom.QRflags & QR_MAILBOX) {
242 set_wtmpsupp(&CC->quickroom.QRname[11]);
245 set_wtmpsupp(CC->quickroom.QRname);
252 * cmd_info() - tell the client about this server
254 void cmd_info(void) {
255 cprintf("%d Server info:\n",LISTING_FOLLOWS);
256 cprintf("%d\n",CC->cs_pid);
257 cprintf("%s\n",config.c_nodename);
258 cprintf("%s\n",config.c_humannode);
259 cprintf("%s\n",config.c_fqdn);
260 cprintf("%s\n",CITADEL);
261 cprintf("%d\n",REV_LEVEL);
262 cprintf("%s\n",config.c_bbs_city);
263 cprintf("%s\n",config.c_sysadm);
264 cprintf("%d\n",SERVER_TYPE);
265 cprintf("%s\n",config.c_moreprompt);
266 cprintf("1\n"); /* 1 = yes, this system supports floors */
267 cprintf("1\n"); /* 1 = we support the extended paging options */
271 void cmd_rchg(char *argbuf)
273 char newroomname[256]; /* set to 256 to prevent buffer overruns <dme>*/
275 extract(newroomname, argbuf, 0);
276 newroomname[ROOMNAMELEN] = 0;
277 if (strlen(newroomname) > 0) {
278 strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN);
279 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
282 strcpy(CC->fake_roomname, "");
284 cprintf("%d OK\n", OK);
287 void cmd_hchg(char *newhostname)
289 if ((newhostname) && (newhostname[0]))
291 memset(CC->fake_hostname, 0, 25);
292 strncpy(CC->fake_hostname, newhostname, 24);
295 strcpy(CC->fake_hostname, "");
296 cprintf("%d OK\n",OK);
299 void cmd_uchg(char *newusername)
301 if (CC->usersupp.axlevel < 6)
303 cprintf("%d You must be an Aide to use UCHG.\n",
304 ERROR+HIGHER_ACCESS_REQUIRED);
307 if ((newusername) && (newusername[0]))
309 CC->cs_flags &= ~CS_STEALTH;
310 memset(CC->fake_username, 0, 32);
311 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
312 strncpy(CC->fake_username, newusername, 31);
316 CC->fake_username[0] = '\0';
317 CC->cs_flags |= CS_STEALTH;
323 * returns an asterisk if there are any express messages waiting,
326 char check_express(void) {
327 if (CC->FirstExpressMessage == NULL) {
341 cprintf("%d %ld\n", OK, tv);
345 * Check whether two hostnames match.
346 * "Realname" should be an actual name of a client that is trying to connect;
347 * "testname" should be the value we are comparing it with. The idea is that we
348 * want to compare with both the abbreviated and fully-qualified versions of
349 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
351 static int hostnames_match(const char *realname, const char *testname) {
355 if (!strcasecmp(realname, testname))
358 #ifdef HAVE_NONREENTRANT_NETDB
359 begin_critical_section(S_NETDB);
362 if ((he = gethostbyname(testname)) != NULL)
363 if (!strcasecmp(realname, he->h_name))
366 #ifdef HAVE_NONREENTRANT_NETDB
367 end_critical_section(S_NETDB);
374 * check a hostname against the public_clients file
376 int is_public_client(char *where)
381 if (hostnames_match(where,"localhost")) return(1);
382 if (hostnames_match(where,config.c_fqdn)) return(1);
384 fp = fopen("public_clients","r");
385 if (fp == NULL) return(0);
387 while (fgets(buf,256,fp)!=NULL) {
388 while (isspace((buf[strlen(buf)-1])))
389 buf[strlen(buf)-1] = 0;
390 if (hostnames_match(where,buf)) {
402 * the client is identifying itself to the server
404 void cmd_iden(char *argbuf)
413 if (num_parms(argbuf)<4) {
414 cprintf("%d usage error\n",ERROR);
418 dev_code = extract_int(argbuf,0);
419 cli_code = extract_int(argbuf,1);
420 rev_level = extract_int(argbuf,2);
421 extract(desc,argbuf,3);
423 strncpy(from_host,config.c_fqdn,sizeof from_host);
424 from_host[sizeof from_host - 1] = 0;
425 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
427 CC->cs_clientdev = dev_code;
428 CC->cs_clienttyp = cli_code;
429 CC->cs_clientver = rev_level;
430 strncpy(CC->cs_clientname,desc,31);
431 CC->cs_clientname[31] = 0;
433 lprintf(9, "Looking up hostname\n");
434 if ((strlen(from_host)>0) &&
435 (is_public_client(CC->cs_host))) {
436 if (inet_aton(from_host, &addr))
437 locate_host(CC->cs_host, &addr);
439 strncpy(CC->cs_host,from_host,24);
444 lprintf(9, "Setting wtmpsupp\n");
445 set_wtmpsupp_to_current_room();
447 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
453 cprintf("%d Ok\n",OK);
458 * enter or exit "stealth mode"
460 void cmd_stel(char *cmdbuf)
464 requested_mode = extract_int(cmdbuf,0);
465 if (requested_mode !=0) requested_mode = 1;
467 if (!CC->logged_in) {
468 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
472 if (CC->usersupp.axlevel < 6) {
473 cprintf("%d You must be an Aide to use stealth mode.\n",
474 ERROR+HIGHER_ACCESS_REQUIRED);
478 if (CC->cs_flags & CS_STEALTH) {
479 if (requested_mode == 0)
480 CC->cs_flags = CC->cs_flags-CS_STEALTH;
483 if (requested_mode == 1)
484 CC->cs_flags = CC->cs_flags|CS_STEALTH;
487 set_wtmpsupp_to_current_room();
488 cprintf("%d Ok\n",OK);
495 * display system messages or help
497 void cmd_mesg(char *mname)
504 extract(buf,mname,0);
509 strcpy(dirs[0],"messages");
510 strcpy(dirs[1],"help");
511 mesg_locate(targ,buf,2,dirs);
516 if (strlen(targ)==0) {
517 cprintf("%d '%s' not found.\n",ERROR,mname);
521 mfp = fopen(targ,"r");
523 cprintf("%d Cannot open '%s': %s\n",
524 ERROR,targ,strerror(errno));
527 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
529 while (fgets(buf,255,mfp)!=NULL) {
530 buf[strlen(buf)-1] = 0;
541 * enter system messages or help
543 void cmd_emsg(char *mname)
551 if (CC->usersupp.axlevel < 6) {
552 cprintf("%d You must be an Aide to edit system messages.\n",
553 ERROR+HIGHER_ACCESS_REQUIRED);
557 extract(buf,mname,0);
558 for (a=0; a<strlen(buf); ++a) { /* security measure */
559 if (buf[a] == '/') buf[a] = '.';
564 strcpy(dirs[0],"messages");
565 strcpy(dirs[1],"help");
566 mesg_locate(targ,buf,2,dirs);
570 if (strlen(targ)==0) {
571 snprintf(targ, sizeof targ, "./help/%s", buf);
574 mfp = fopen(targ,"w");
576 cprintf("%d Cannot open '%s': %s\n",
577 ERROR,targ,strerror(errno));
580 cprintf("%d %s\n", SEND_LISTING, targ);
582 while (client_gets(buf), strcmp(buf, "000")) {
583 fprintf(mfp, "%s\n", buf);
593 void cmd_rwho(void) {
594 struct CitContext *cptr;
597 char un[40], room[40], host[40], flags[5];
599 aide = CC->usersupp.axlevel >= 6;
600 cprintf("%d%c \n", LISTING_FOLLOWS, check_express() );
602 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
607 if (cptr->cs_flags & CS_POSTING)
612 if (cptr->fake_username[0])
614 strcpy(un, cptr->fake_username);
618 strcpy(un, cptr->curr_user);
620 if (cptr->fake_hostname[0])
622 strcpy(host, cptr->fake_hostname);
626 strcpy(host, cptr->cs_host);
628 if (cptr->fake_roomname[0])
630 strcpy(room, cptr->fake_roomname);
634 strcpy(room, cptr->cs_room);
637 if ((aide) && (spoofed))
640 if ((cptr->cs_flags & CS_STEALTH) && (aide))
643 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
645 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
646 cptr->cs_pid, un, room,
647 host, cptr->cs_clientname,
648 (long)(cptr->lastidle),
649 cptr->lastcmdname, flags);
651 if ((spoofed) && (aide))
653 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
654 cptr->cs_pid, cptr->curr_user, cptr->cs_room,
655 cptr->cs_host, cptr->cs_clientname,
656 (long)(cptr->lastidle),
657 cptr->lastcmdname, flags);
662 /* Now it's magic time. Before we finish, call any EVT_RWHO hooks
663 * so that external paging modules such as serv_icq can add more
664 * content to the Wholist.
666 PerformSessionHooks(EVT_RWHO);
672 * Terminate another running session
674 void cmd_term(char *cmdbuf)
677 struct CitContext *ccptr;
678 int session_to_kill = 0;
680 if (!CC->logged_in) {
681 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
685 if (CC->usersupp.axlevel < 6) {
686 cprintf("%d You must be an Aide to terminate sessions.\n",
687 ERROR+HIGHER_ACCESS_REQUIRED);
691 session_num = extract_int(cmdbuf, 0);
692 if (session_num == CC->cs_pid) {
693 cprintf("%d You can't kill your own session.\n", ERROR);
697 lprintf(9, "Locating session to kill\n");
698 begin_critical_section(S_SESSION_TABLE);
699 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
700 if (session_num == ccptr->cs_pid) {
701 session_to_kill = ccptr->cs_pid;
704 end_critical_section(S_SESSION_TABLE);
705 lprintf(9, "session_to_kill == %d\n", session_to_kill);
707 if (session_to_kill > 0) {
708 lprintf(9, "calling kill_session()\n");
709 kill_session(session_to_kill);
710 cprintf("%d Session terminated.\n", OK);
713 cprintf("%d No such session.\n", ERROR);
722 * get the paginator prompt
724 void cmd_more(void) {
725 cprintf("%d %s\n",OK,config.c_moreprompt);
731 void cmd_echo(char *etext)
733 cprintf("%d %s\n",OK,etext);
739 * identify as internal program
741 void cmd_ipgm(char *argbuf)
745 secret = extract_int(argbuf, 0);
746 if (secret == config.c_ipgm_secret) {
747 CC->internal_pgm = 1;
748 strcpy(CC->curr_user, "<internal program>");
749 CC->cs_flags = CC->cs_flags|CS_STEALTH;
750 cprintf("%d Authenticated as an internal program.\n",OK);
753 cprintf("%d Authentication failed.\n",ERROR);
754 lprintf(3, "Warning: ipgm authentication failed.\n");
760 * Shut down the server
762 void cmd_down(void) {
763 if (!CC->logged_in) {
764 cprintf("%d Not logged in.\n", ERROR+NOT_LOGGED_IN);
768 if (CC->usersupp.axlevel < 6) {
769 cprintf("%d You must be an Aide to shut down the server.\n",
770 ERROR+HIGHER_ACCESS_REQUIRED);
774 cprintf("%d Shutting down server. Goodbye.\n", OK);
779 * Schedule or cancel a server shutdown
781 void cmd_scdn(char *argbuf)
785 if (!CC->logged_in) {
786 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
790 if (CC->usersupp.axlevel < 6) {
791 cprintf("%d You must be an Aide to schedule a shutdown.\n",
792 ERROR+HIGHER_ACCESS_REQUIRED);
796 new_state = extract_int(argbuf, 0);
797 if ((new_state == 0) || (new_state == 1)) {
798 ScheduledShutdown = new_state;
800 cprintf("%d %d\n", OK, ScheduledShutdown);
807 void *context_loop(struct CitContext *con)
810 int num_sessions, len;
811 struct sockaddr_in sin;
814 * Wedge our way into the context table.
819 * Initialize some variables specific to our context.
822 CC->internal_pgm = 0;
823 CC->download_fp = NULL;
824 CC->upload_fp = NULL;
825 CC->cs_pid = con->client_socket; /* not necessarily portable */
826 CC->FirstExpressMessage = NULL;
829 strcpy(CC->lastcmdname, " ");
830 strcpy(CC->cs_clientname, "(unknown)");
831 strcpy(CC->curr_user,"(not logged in)");
832 strcpy(CC->net_node,"");
833 snprintf(CC->temp, sizeof CC->temp, tmpnam(NULL));
834 strcpy(CC->cs_room, "(no room)");
835 strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
836 CC->cs_host[sizeof CC->cs_host - 1] = 0;
838 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
839 locate_host(CC->cs_host, &sin.sin_addr);
841 CC->upload_type = UPL_FILE;
843 CC->FirstSessData = NULL;
845 num_sessions = session_count();
847 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
850 if (CC->nologin==1) {
851 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
852 ERROR+MAX_SESSIONS_EXCEEDED,
853 config.c_nodename,config.c_maxsessions);
856 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
859 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
861 /* Run any session startup routines registered by loadable modules */
862 PerformSessionHooks(EVT_START);
864 rec_log(CL_CONNECT, "");
868 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
869 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
870 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
873 * Let other clients see the last command we executed, and
874 * update the idle time, but not NOOP, PEXP, or GEXP.
876 if ( (strncasecmp(cmdbuf, "NOOP", 4))
877 && (strncasecmp(cmdbuf, "PEXP", 4))
878 && (strncasecmp(cmdbuf, "GEXP", 4)) ) {
879 strcpy(CC->lastcmdname, " ");
880 strncpy(CC->lastcmdname, cmdbuf, 4);
884 if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
886 CC->cs_flags &= ~CS_POSTING;
890 * This loop recognizes all server commands.
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);
901 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
902 if (CC->logged_in) logout(CC);
903 cprintf("%d logged out.\n",OK);
906 else if (!strncasecmp(cmdbuf,"USER",4)) {
907 cmd_user(&cmdbuf[5]);
910 else if (!strncasecmp(cmdbuf,"PASS",4)) {
911 cmd_pass(&cmdbuf[5]);
914 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
915 cmd_newu(&cmdbuf[5]);
918 else if (!strncasecmp(cmdbuf,"SETP",4)) {
919 cmd_setp(&cmdbuf[5]);
922 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
923 cmd_lrms(&cmdbuf[5]);
926 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
927 cmd_lkra(&cmdbuf[5]);
930 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
931 cmd_lkrn(&cmdbuf[5]);
934 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
935 cmd_lkro(&cmdbuf[5]);
938 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
939 cmd_lzrm(&cmdbuf[5]);
942 else if (!strncasecmp(cmdbuf,"GETU",4)) {
946 else if (!strncasecmp(cmdbuf,"SETU",4)) {
947 cmd_setu(&cmdbuf[5]);
950 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
951 cmd_goto(&cmdbuf[5]);
954 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
955 cmd_msgs(&cmdbuf[5]);
958 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
962 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
966 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
967 cmd_msg0(&cmdbuf[5]);
970 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
971 cmd_msg2(&cmdbuf[5]);
974 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
975 cmd_msg3(&cmdbuf[5]);
978 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
979 cmd_msg4(&cmdbuf[5]);
982 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
983 cmd_opna(&cmdbuf[5]);
986 else if (!strncasecmp(cmdbuf,"INFO",4)) {
990 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
991 cmd_slrp(&cmdbuf[5]);
994 else if (!strncasecmp(cmdbuf,"INVT",4)) {
995 cmd_invt_kick(&cmdbuf[5],1);
998 else if (!strncasecmp(cmdbuf,"KICK",4)) {
999 cmd_invt_kick(&cmdbuf[5],0);
1002 else if (!strncasecmp(cmdbuf,"GETR",4)) {
1006 else if (!strncasecmp(cmdbuf,"SETR",4)) {
1007 cmd_setr(&cmdbuf[5]);
1010 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1014 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1015 cmd_seta(&cmdbuf[5]);
1018 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1019 cmd_ent0(&cmdbuf[5]);
1022 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1023 cmd_ent3(&cmdbuf[5]);
1026 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1030 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1031 cmd_dele(&cmdbuf[5]);
1034 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1035 cmd_kill(&cmdbuf[5]);
1038 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1039 cmd_cre8(&cmdbuf[5]);
1042 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1043 cmd_move(&cmdbuf[5]);
1046 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1050 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1051 cmd_mesg(&cmdbuf[5]);
1054 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1055 cmd_emsg(&cmdbuf[5]);
1058 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1062 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1063 cmd_vali(&cmdbuf[5]);
1066 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1067 cmd_einf(&cmdbuf[5]);
1070 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1074 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1078 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1079 cmd_delf(&cmdbuf[5]);
1082 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1083 cmd_movf(&cmdbuf[5]);
1086 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1087 cmd_netf(&cmdbuf[5]);
1090 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1094 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1095 cmd_open(&cmdbuf[5]);
1098 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1102 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1103 cmd_uopn(&cmdbuf[5]);
1106 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1107 cmd_ucls(&cmdbuf[5]);
1110 else if (!strncasecmp(cmdbuf,"READ",4)) {
1111 cmd_read(&cmdbuf[5]);
1114 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1115 cmd_writ(&cmdbuf[5]);
1118 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1119 cmd_qusr(&cmdbuf[5]);
1122 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1123 cmd_echo(&cmdbuf[5]);
1126 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1127 cmd_oimg(&cmdbuf[5]);
1130 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1134 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1135 cmd_netp(&cmdbuf[5]);
1138 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1139 cmd_ndop(&cmdbuf[5]);
1142 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1143 cmd_nuop(&cmdbuf[5]);
1146 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1150 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1151 cmd_cflr(&cmdbuf[5]);
1154 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1155 cmd_kflr(&cmdbuf[5]);
1158 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1159 cmd_eflr(&cmdbuf[5]);
1162 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1163 cmd_iden(&cmdbuf[5]);
1166 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1167 cmd_ipgm(&cmdbuf[5]);
1170 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1174 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1175 cmd_rbio(&cmdbuf[5]);
1178 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1182 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1183 cmd_stel(&cmdbuf[5]);
1186 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1187 cmd_term(&cmdbuf[5]);
1190 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1194 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1195 cmd_scdn(&cmdbuf[5]);
1198 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1199 cmd_nset(&cmdbuf[5]);
1202 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1203 cmd_uimg(&cmdbuf[5]);
1206 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1207 cmd_uchg(&cmdbuf[5]);
1210 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1214 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1215 cmd_hchg(&cmdbuf[5]);
1218 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1219 cmd_rchg(&cmdbuf[5]);
1222 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1223 cmd_agup(&cmdbuf[5]);
1226 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1227 cmd_asup(&cmdbuf[5]);
1230 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1231 cmd_gpex(&cmdbuf[5]);
1234 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1235 cmd_spex(&cmdbuf[5]);
1238 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1239 cmd_conf(&cmdbuf[5]);
1242 #ifdef DEBUG_MEMORY_LEAKS
1243 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1248 else if (!DLoader_Exec_Cmd(cmdbuf))
1250 cprintf("%d Unrecognized or unsupported command.\n",
1254 /* Run any after-each-command outines registered by modules */
1255 PerformSessionHooks(EVT_CMD);
1257 } while(strncasecmp(cmdbuf, "QUIT", 4));
1259 cleanup(EXIT_NORMAL);