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;
45 * Various things that need to be initialized at startup
47 void master_startup(void) {
48 lprintf(7, "Opening databases\n");
51 lprintf(7, "Checking floor reference counts\n");
54 lprintf(7, "Creating base rooms (if necessary)\n");
55 create_room(BASEROOM, 0, "", 0);
56 create_room(AIDEROOM, 4, "", 0);
57 create_room(config.c_twitroom, 0, "", 0);
61 * Cleanup routine to be called when the server is shutting down.
63 void master_cleanup(void) {
64 struct CleanupFunctionHook *fcn;
66 /* Cancel all running sessions */
67 lprintf(7, "Cancelling running sessions...\n");
68 while (ContextList != NULL) {
69 kill_session(ContextList->cs_pid);
72 /* Run any cleanup routines registered by loadable modules */
73 for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
74 (*fcn->h_function_pointer)();
78 lprintf(7, "Closing databases\n");
81 /* Do system-dependent stuff */
82 sysdep_master_cleanup();
85 lprintf(3, "citserver: exiting.\n");
86 fflush(stdout); fflush(stderr);
92 * Free any per-session data allocated by modules or whatever
94 void deallocate_user_data(struct CitContext *con)
96 struct CtdlSessData *ptr;
98 begin_critical_section(S_SESSION_TABLE);
99 while (con->FirstSessData != NULL) {
100 lprintf(9, "Deallocating user data symbol %ld\n",
101 con->FirstSessData->sym_id);
102 if (con->FirstSessData->sym_data != NULL)
103 phree(con->FirstSessData->sym_data);
104 ptr = con->FirstSessData->next;
105 phree(con->FirstSessData);
106 con->FirstSessData = ptr;
108 end_critical_section(S_SESSION_TABLE);
115 * Gracefully terminate the session and thread.
116 * (This is called as a cleanup handler by the thread library.)
118 * All NON-system-dependent stuff is done in this function.
119 * System-dependent session/thread cleanup is in cleanup() in sysdep.c
121 void cleanup_stuff(void *arg)
124 lprintf(9, "cleanup_stuff() called\n");
126 lprintf(7, "Calling logout(%d)\n", CC->cs_pid);
129 rec_log(CL_TERMINATE,CC->curr_user);
131 lprintf(3, "citserver[%3d]: ended.\n",CC->cs_pid);
133 /* Run any cleanup routines registered by loadable modules */
134 PerformSessionHooks(EVT_STOP);
136 syslog(LOG_NOTICE,"session %d ended", CC->cs_pid);
138 /* Deallocate any message list we might have in memory */
139 if (CC->msglist != NULL) phree(CC->msglist);
141 /* Deallocate any user-data attached to this session */
142 deallocate_user_data(CC);
144 /* Now get rid of the session and context */
145 lprintf(7, "cleanup_stuff() calling RemoveContext(%d)\n", CC->cs_pid);
148 /* While we still have an extra thread with no user attached to it,
149 * take the opportunity to do some housekeeping before exiting.
156 * Get a dynamic symbol number for per-session user data.
157 * This API call should be made only ONCE per symbol per citserver run.
159 int CtdlGetDynamicSymbol()
161 static unsigned int next_symbol = SYM_MAX;
162 return ++next_symbol;
168 * Return a pointer to some generic per-session user data.
169 * (This function returns NULL if the requested symbol is not allocated.)
171 * NOTE: we use critical sections for allocating and de-allocating these,
172 * but not for locating one.
174 void *CtdlGetUserData(unsigned long requested_sym)
176 struct CtdlSessData *ptr;
178 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
179 if (ptr->sym_id == requested_sym)
180 return(ptr->sym_data);
182 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
189 * Allocate some generic per-session user data.
191 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
193 struct CtdlSessData *ptr;
195 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
197 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
198 if (ptr->sym_id == requested_sym) {
199 lprintf(2, "ERROR: CtdlAllocUserData() requested for"
200 " symbol id %ld already registered\n",
206 ptr = mallok(sizeof(struct CtdlSessData));
207 ptr->sym_id = requested_sym;
208 ptr->sym_data = mallok(num_bytes);
210 begin_critical_section(S_SESSION_TABLE);
211 ptr->next = CC->FirstSessData;
212 CC->FirstSessData = ptr;
213 end_critical_section(S_SESSION_TABLE);
215 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
223 * set_wtmpsupp() - alter the session listing
225 void set_wtmpsupp(char *newtext)
227 strncpy(CC->cs_room,newtext,sizeof CC->cs_room);
228 CC->cs_room[sizeof CC->cs_room - 1] = 0;
229 time(&CC->cs_lastupdt);
231 /* Run any routines registered by loadable modules */
232 PerformSessionHooks(EVT_NEWROOM);
237 * call set_wtmpsupp() with the name of the current room, modified a bit...
239 void set_wtmpsupp_to_current_room() {
240 if (CC->quickroom.QRflags & QR_PRIVATE) {
241 set_wtmpsupp("<private room>");
243 else if (CC->quickroom.QRflags & QR_MAILBOX) {
244 set_wtmpsupp(&CC->quickroom.QRname[11]);
247 set_wtmpsupp(CC->quickroom.QRname);
254 * cmd_info() - tell the client about this server
256 void cmd_info(void) {
257 cprintf("%d Server info:\n",LISTING_FOLLOWS);
258 cprintf("%d\n",CC->cs_pid);
259 cprintf("%s\n",config.c_nodename);
260 cprintf("%s\n",config.c_humannode);
261 cprintf("%s\n",config.c_fqdn);
262 cprintf("%s\n",CITADEL);
263 cprintf("%d\n",REV_LEVEL);
264 cprintf("%s\n",config.c_bbs_city);
265 cprintf("%s\n",config.c_sysadm);
266 cprintf("%d\n",SERVER_TYPE);
267 cprintf("%s\n",config.c_moreprompt);
268 cprintf("1\n"); /* 1 = yes, this system supports floors */
269 cprintf("1\n"); /* 1 = we support the extended paging options */
273 void cmd_rchg(char *argbuf)
275 char newroomname[256]; /* set to 256 to prevent buffer overruns <dme>*/
277 extract(newroomname, argbuf, 0);
278 newroomname[ROOMNAMELEN] = 0;
279 if (strlen(newroomname) > 0) {
280 strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN);
281 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
284 strcpy(CC->fake_roomname, "");
286 cprintf("%d OK\n", OK);
289 void cmd_hchg(char *newhostname)
291 if ((newhostname) && (newhostname[0]))
293 memset(CC->fake_hostname, 0, 25);
294 strncpy(CC->fake_hostname, newhostname, 24);
297 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 strncpy(CC->fake_username, newusername, 31);
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 strncpy(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 strncpy(CC->cs_clientname,desc,31);
433 CC->cs_clientname[31] = 0;
435 if ((strlen(from_host)>0) &&
436 (is_public_client(CC->cs_host))) {
437 if (inet_aton(from_host, &addr))
438 locate_host(CC->cs_host, &addr);
440 strncpy(CC->cs_host,from_host,24);
444 set_wtmpsupp_to_current_room();
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 set_wtmpsupp_to_current_room();
487 cprintf("%d Ok\n",OK);
494 * display system messages or help
496 void cmd_mesg(char *mname)
503 extract(buf,mname,0);
508 strcpy(dirs[0],"messages");
509 strcpy(dirs[1],"help");
510 mesg_locate(targ,buf,2,dirs);
515 if (strlen(targ)==0) {
516 cprintf("%d '%s' not found.\n",ERROR,mname);
520 mfp = fopen(targ,"r");
522 cprintf("%d Cannot open '%s': %s\n",
523 ERROR,targ,strerror(errno));
526 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
528 while (fgets(buf,255,mfp)!=NULL) {
529 buf[strlen(buf)-1] = 0;
540 * enter system messages or help
542 void cmd_emsg(char *mname)
550 if (CC->usersupp.axlevel < 6) {
551 cprintf("%d You must be an Aide to edit system messages.\n",
552 ERROR+HIGHER_ACCESS_REQUIRED);
556 extract(buf,mname,0);
557 for (a=0; a<strlen(buf); ++a) { /* security measure */
558 if (buf[a] == '/') buf[a] = '.';
563 strcpy(dirs[0],"messages");
564 strcpy(dirs[1],"help");
565 mesg_locate(targ,buf,2,dirs);
569 if (strlen(targ)==0) {
570 snprintf(targ, sizeof targ, "./help/%s", buf);
573 mfp = fopen(targ,"w");
575 cprintf("%d Cannot open '%s': %s\n",
576 ERROR,targ,strerror(errno));
579 cprintf("%d %s\n", SEND_LISTING, targ);
581 while (client_gets(buf), strcmp(buf, "000")) {
582 fprintf(mfp, "%s\n", buf);
592 void cmd_rwho(void) {
593 struct CitContext *cptr;
596 char un[40], room[40], host[40], flags[5];
598 aide = CC->usersupp.axlevel >= 6;
599 cprintf("%d\n",LISTING_FOLLOWS);
601 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
606 if (cptr->cs_flags & CS_POSTING)
611 if (cptr->fake_username[0])
613 strcpy(un, cptr->fake_username);
617 strcpy(un, cptr->curr_user);
619 if (cptr->fake_hostname[0])
621 strcpy(host, cptr->fake_hostname);
625 strcpy(host, cptr->cs_host);
627 if (cptr->fake_roomname[0])
629 strcpy(room, cptr->fake_roomname);
633 strcpy(room, cptr->cs_room);
636 if ((aide) && (spoofed))
639 if ((cptr->cs_flags & CS_STEALTH) && (aide))
642 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
644 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
645 cptr->cs_pid, un, room,
646 host, cptr->cs_clientname,
647 (long)(cptr->lastidle),
648 cptr->lastcmdname, flags);
650 if ((spoofed) && (aide))
652 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
653 cptr->cs_pid, cptr->curr_user, cptr->cs_room,
654 cptr->cs_host, cptr->cs_clientname,
655 (long)(cptr->lastidle),
656 cptr->lastcmdname, flags);
665 * Terminate another running session
667 void cmd_term(char *cmdbuf)
670 struct CitContext *ccptr;
671 int session_to_kill = 0;
673 if (!CC->logged_in) {
674 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
678 if (CC->usersupp.axlevel < 6) {
679 cprintf("%d You must be an Aide to terminate sessions.\n",
680 ERROR+HIGHER_ACCESS_REQUIRED);
684 session_num = extract_int(cmdbuf, 0);
685 if (session_num == CC->cs_pid) {
686 cprintf("%d You can't kill your own session.\n", ERROR);
690 lprintf(9, "Locating session to kill\n");
691 begin_critical_section(S_SESSION_TABLE);
692 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
693 if (session_num == ccptr->cs_pid) {
694 session_to_kill = ccptr->cs_pid;
697 end_critical_section(S_SESSION_TABLE);
698 lprintf(9, "session_to_kill == %d\n", session_to_kill);
700 if (session_to_kill > 0) {
701 lprintf(9, "calling kill_session()\n");
702 kill_session(session_to_kill);
703 cprintf("%d Session terminated.\n", OK);
706 cprintf("%d No such session.\n", ERROR);
715 * get the paginator prompt
717 void cmd_more(void) {
718 cprintf("%d %s\n",OK,config.c_moreprompt);
724 void cmd_echo(char *etext)
726 cprintf("%d %s\n",OK,etext);
732 * identify as internal program
734 void cmd_ipgm(char *argbuf)
738 secret = extract_int(argbuf, 0);
739 if (secret == config.c_ipgm_secret) {
740 CC->internal_pgm = 1;
741 strcpy(CC->curr_user, "<internal program>");
742 CC->cs_flags = CC->cs_flags|CS_STEALTH;
743 cprintf("%d Authenticated as an internal program.\n",OK);
746 cprintf("%d Authentication failed.\n",ERROR);
752 * Shut down the server
754 void cmd_down(void) {
755 if (!CC->logged_in) {
756 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
760 if (CC->usersupp.axlevel < 6) {
761 cprintf("%d You must be an Aide to shut down the server.\n",
762 ERROR+HIGHER_ACCESS_REQUIRED);
766 cprintf("%d Shutting down server. Goodbye.\n", OK);
771 * Schedule or cancel a server shutdown
773 void cmd_scdn(char *argbuf)
777 if (!CC->logged_in) {
778 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
782 if (CC->usersupp.axlevel < 6) {
783 cprintf("%d You must be an Aide to schedule a shutdown.\n",
784 ERROR+HIGHER_ACCESS_REQUIRED);
788 new_state = extract_int(argbuf, 0);
789 if ((new_state == 0) || (new_state == 1)) {
790 ScheduledShutdown = new_state;
792 cprintf("%d %d\n", OK, ScheduledShutdown);
799 void *context_loop(struct CitContext *con)
802 int num_sessions, len;
803 struct sockaddr_in sin;
806 * Wedge our way into the context table.
811 * Initialize some variables specific to our context.
814 CC->internal_pgm = 0;
815 CC->download_fp = NULL;
816 CC->upload_fp = NULL;
817 CC->cs_pid = con->client_socket; /* not necessarily portable */
818 CC->FirstExpressMessage = NULL;
823 strcpy(CC->lastcmdname, " ");
824 strcpy(CC->cs_clientname, "(unknown)");
825 strcpy(CC->curr_user,"(not logged in)");
826 strcpy(CC->net_node,"");
827 snprintf(CC->temp, sizeof CC->temp, tmpnam(NULL));
828 strcpy(CC->cs_room, "(no room)");
829 strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
830 CC->cs_host[sizeof CC->cs_host - 1] = 0;
832 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
833 locate_host(CC->cs_host, &sin.sin_addr);
835 CC->upload_type = UPL_FILE;
837 CC->FirstSessData = NULL;
839 num_sessions = session_count();
841 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
844 if (CC->nologin==1) {
845 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
846 ERROR+MAX_SESSIONS_EXCEEDED,
847 config.c_nodename,config.c_maxsessions);
850 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
853 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
855 /* Run any session startup routines registered by loadable modules */
856 PerformSessionHooks(EVT_START);
858 rec_log(CL_CONNECT, "");
862 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
863 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
864 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
867 * Let other clients see the last command we executed, but
868 * exclude NOOP because that would be boring.
870 if (strncasecmp(cmdbuf, "NOOP", 4)) {
871 strcpy(CC->lastcmdname, " ");
872 strncpy(CC->lastcmdname, cmdbuf, 4);
876 if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
878 CC->cs_flags &= ~CS_POSTING;
882 * This loop recognizes all server commands.
885 if (!strncasecmp(cmdbuf,"NOOP",4)) {
886 cprintf("%d%cok\n",OK,check_express());
889 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
890 cprintf("%d Goodbye.\n",OK);
893 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
894 if (CC->logged_in) logout(CC);
895 cprintf("%d logged out.\n",OK);
898 else if (!strncasecmp(cmdbuf,"USER",4)) {
899 cmd_user(&cmdbuf[5]);
902 else if (!strncasecmp(cmdbuf,"PASS",4)) {
903 cmd_pass(&cmdbuf[5]);
906 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
907 cmd_newu(&cmdbuf[5]);
910 else if (!strncasecmp(cmdbuf,"SETP",4)) {
911 cmd_setp(&cmdbuf[5]);
914 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
915 cmd_lrms(&cmdbuf[5]);
918 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
919 cmd_lkra(&cmdbuf[5]);
922 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
923 cmd_lkrn(&cmdbuf[5]);
926 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
927 cmd_lkro(&cmdbuf[5]);
930 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
931 cmd_lzrm(&cmdbuf[5]);
934 else if (!strncasecmp(cmdbuf,"GETU",4)) {
938 else if (!strncasecmp(cmdbuf,"SETU",4)) {
939 cmd_setu(&cmdbuf[5]);
942 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
943 cmd_goto(&cmdbuf[5]);
946 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
947 cmd_msgs(&cmdbuf[5]);
950 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
954 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
958 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
959 cmd_msg0(&cmdbuf[5]);
962 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
963 cmd_msg2(&cmdbuf[5]);
966 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
967 cmd_msg3(&cmdbuf[5]);
970 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
971 cmd_msg4(&cmdbuf[5]);
974 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
975 cmd_opna(&cmdbuf[5]);
978 else if (!strncasecmp(cmdbuf,"INFO",4)) {
982 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
983 cmd_slrp(&cmdbuf[5]);
986 else if (!strncasecmp(cmdbuf,"INVT",4)) {
987 cmd_invt_kick(&cmdbuf[5],1);
990 else if (!strncasecmp(cmdbuf,"KICK",4)) {
991 cmd_invt_kick(&cmdbuf[5],0);
994 else if (!strncasecmp(cmdbuf,"GETR",4)) {
998 else if (!strncasecmp(cmdbuf,"SETR",4)) {
999 cmd_setr(&cmdbuf[5]);
1002 else if (!strncasecmp(cmdbuf,"GETA",4)) {
1006 else if (!strncasecmp(cmdbuf,"SETA",4)) {
1007 cmd_seta(&cmdbuf[5]);
1010 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1011 cmd_ent0(&cmdbuf[5]);
1014 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1015 cmd_ent3(&cmdbuf[5]);
1018 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1022 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1023 cmd_dele(&cmdbuf[5]);
1026 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1027 cmd_kill(&cmdbuf[5]);
1030 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1031 cmd_cre8(&cmdbuf[5]);
1034 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1035 cmd_move(&cmdbuf[5]);
1038 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1042 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1043 cmd_mesg(&cmdbuf[5]);
1046 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1047 cmd_emsg(&cmdbuf[5]);
1050 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1054 else if (!strncasecmp(cmdbuf,"GREG",4)) {
1055 cmd_greg(&cmdbuf[5]);
1058 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1059 cmd_vali(&cmdbuf[5]);
1062 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1063 cmd_einf(&cmdbuf[5]);
1066 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1070 else if (!strncasecmp(cmdbuf,"REGI",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 } while(strncasecmp(cmdbuf, "QUIT", 4));
1256 cleanup(EXIT_NORMAL);