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.
157 * Return a pointer to some generic per-session user data.
158 * (This function returns NULL if the requested symbol is not allocated.)
160 * NOTE: we use critical sections for allocating and de-allocating these,
161 * but not for locating one.
163 void *CtdlGetUserData(unsigned long requested_sym)
165 struct CtdlSessData *ptr;
167 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next)
168 if (ptr->sym_id == requested_sym)
169 return(ptr->sym_data);
171 lprintf(2, "ERROR! CtdlGetUserData(%ld) symbol not allocated\n",
178 * Allocate some generic per-session user data.
180 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes)
182 struct CtdlSessData *ptr;
184 lprintf(9, "CtdlAllocUserData(%ld) called\n", requested_sym);
186 for (ptr = CC->FirstSessData; ptr != NULL; ptr = ptr->next) {
187 if (ptr->sym_id == requested_sym) {
188 lprintf(2, "ERROR: CtdlAllocUserData() requested for"
189 " symbol id %ld already registered\n",
195 ptr = mallok(sizeof(struct CtdlSessData));
196 ptr->sym_id = requested_sym;
197 ptr->sym_data = mallok(num_bytes);
199 begin_critical_section(S_SESSION_TABLE);
200 ptr->next = CC->FirstSessData;
201 CC->FirstSessData = ptr;
202 end_critical_section(S_SESSION_TABLE);
204 lprintf(9, "CtdlAllocUserData(%ld) finished\n", requested_sym);
212 * set_wtmpsupp() - alter the session listing
214 void set_wtmpsupp(char *newtext)
216 strncpy(CC->cs_room,newtext,sizeof CC->cs_room);
217 CC->cs_room[sizeof CC->cs_room - 1] = 0;
218 time(&CC->cs_lastupdt);
220 /* Run any routines registered by loadable modules */
221 PerformSessionHooks(EVT_NEWROOM);
226 * call set_wtmpsupp() with the name of the current room, modified a bit...
228 void set_wtmpsupp_to_current_room() {
229 if (CC->quickroom.QRflags & QR_PRIVATE) {
230 set_wtmpsupp("<private room>");
232 else if (CC->quickroom.QRflags & QR_MAILBOX) {
233 set_wtmpsupp(&CC->quickroom.QRname[11]);
236 set_wtmpsupp(CC->quickroom.QRname);
243 * cmd_info() - tell the client about this server
245 void cmd_info(void) {
246 cprintf("%d Server info:\n",LISTING_FOLLOWS);
247 cprintf("%d\n",CC->cs_pid);
248 cprintf("%s\n",config.c_nodename);
249 cprintf("%s\n",config.c_humannode);
250 cprintf("%s\n",config.c_fqdn);
251 cprintf("%s\n",CITADEL);
252 cprintf("%d\n",REV_LEVEL);
253 cprintf("%s\n",config.c_bbs_city);
254 cprintf("%s\n",config.c_sysadm);
255 cprintf("%d\n",SERVER_TYPE);
256 cprintf("%s\n",config.c_moreprompt);
257 cprintf("1\n"); /* 1 = yes, this system supports floors */
258 cprintf("1\n"); /* 1 = we support the extended paging options */
262 void cmd_rchg(char *argbuf)
264 char newroomname[256]; /* set to 256 to prevent buffer overruns <dme>*/
266 extract(newroomname, argbuf, 0);
267 newroomname[ROOMNAMELEN] = 0;
268 if (strlen(newroomname) > 0) {
269 strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN);
270 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
273 strcpy(CC->fake_roomname, "");
275 cprintf("%d OK\n", OK);
278 void cmd_hchg(char *newhostname)
280 if ((newhostname) && (newhostname[0]))
282 memset(CC->fake_hostname, 0, 25);
283 strncpy(CC->fake_hostname, newhostname, 24);
286 strcpy(CC->fake_hostname, "");
287 cprintf("%d OK\n",OK);
290 void cmd_uchg(char *newusername)
292 if (CC->usersupp.axlevel < 6)
294 cprintf("%d You must be an Aide to use UCHG.\n",
295 ERROR+HIGHER_ACCESS_REQUIRED);
298 if ((newusername) && (newusername[0]))
300 CC->cs_flags &= ~CS_STEALTH;
301 memset(CC->fake_username, 0, 32);
302 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
303 strncpy(CC->fake_username, newusername, 31);
307 CC->fake_username[0] = '\0';
308 CC->cs_flags |= CS_STEALTH;
314 * returns an asterisk if there are any express messages waiting,
317 char check_express(void) {
318 if (CC->FirstExpressMessage == NULL) {
332 cprintf("%d %ld\n", OK, tv);
336 * Check whether two hostnames match.
337 * "Realname" should be an actual name of a client that is trying to connect;
338 * "testname" should be the value we are comparing it with. The idea is that we
339 * want to compare with both the abbreviated and fully-qualified versions of
340 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
342 static int hostnames_match(const char *realname, const char *testname) {
346 if (!strcasecmp(realname, testname))
349 #ifdef HAVE_NONREENTRANT_NETDB
350 begin_critical_section(S_NETDB);
353 if ((he = gethostbyname(testname)) != NULL)
354 if (!strcasecmp(realname, he->h_name))
357 #ifdef HAVE_NONREENTRANT_NETDB
358 end_critical_section(S_NETDB);
365 * check a hostname against the public_clients file
367 int is_public_client(char *where)
372 if (hostnames_match(where,"localhost")) return(1);
373 if (hostnames_match(where,config.c_fqdn)) return(1);
375 fp = fopen("public_clients","r");
376 if (fp == NULL) return(0);
378 while (fgets(buf,256,fp)!=NULL) {
379 while (isspace((buf[strlen(buf)-1])))
380 buf[strlen(buf)-1] = 0;
381 if (hostnames_match(where,buf)) {
393 * the client is identifying itself to the server
395 void cmd_iden(char *argbuf)
404 if (num_parms(argbuf)<4) {
405 cprintf("%d usage error\n",ERROR);
409 dev_code = extract_int(argbuf,0);
410 cli_code = extract_int(argbuf,1);
411 rev_level = extract_int(argbuf,2);
412 extract(desc,argbuf,3);
414 strncpy(from_host,config.c_fqdn,sizeof from_host);
415 from_host[sizeof from_host - 1] = 0;
416 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
418 CC->cs_clientdev = dev_code;
419 CC->cs_clienttyp = cli_code;
420 CC->cs_clientver = rev_level;
421 strncpy(CC->cs_clientname,desc,31);
422 CC->cs_clientname[31] = 0;
424 if ((strlen(from_host)>0) &&
425 (is_public_client(CC->cs_host))) {
426 if (inet_aton(from_host, &addr))
427 locate_host(CC->cs_host, &addr);
429 strncpy(CC->cs_host,from_host,24);
433 set_wtmpsupp_to_current_room();
435 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
441 cprintf("%d Ok\n",OK);
446 * enter or exit "stealth mode"
448 void cmd_stel(char *cmdbuf)
452 requested_mode = extract_int(cmdbuf,0);
453 if (requested_mode !=0) requested_mode = 1;
455 if (!CC->logged_in) {
456 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
460 if (CC->usersupp.axlevel < 6) {
461 cprintf("%d You must be an Aide to use stealth mode.\n",
462 ERROR+HIGHER_ACCESS_REQUIRED);
466 if (CC->cs_flags & CS_STEALTH) {
467 if (requested_mode == 0)
468 CC->cs_flags = CC->cs_flags-CS_STEALTH;
471 if (requested_mode == 1)
472 CC->cs_flags = CC->cs_flags|CS_STEALTH;
475 set_wtmpsupp_to_current_room();
476 cprintf("%d Ok\n",OK);
483 * display system messages or help
485 void cmd_mesg(char *mname)
492 extract(buf,mname,0);
497 strcpy(dirs[0],"messages");
498 strcpy(dirs[1],"help");
499 mesg_locate(targ,buf,2,dirs);
504 if (strlen(targ)==0) {
505 cprintf("%d '%s' not found.\n",ERROR,mname);
509 mfp = fopen(targ,"r");
511 cprintf("%d Cannot open '%s': %s\n",
512 ERROR,targ,strerror(errno));
515 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
517 while (fgets(buf,255,mfp)!=NULL) {
518 buf[strlen(buf)-1] = 0;
529 * enter system messages or help
531 void cmd_emsg(char *mname)
539 if (CC->usersupp.axlevel < 6) {
540 cprintf("%d You must be an Aide to edit system messages.\n",
541 ERROR+HIGHER_ACCESS_REQUIRED);
545 extract(buf,mname,0);
546 for (a=0; a<strlen(buf); ++a) { /* security measure */
547 if (buf[a] == '/') buf[a] = '.';
552 strcpy(dirs[0],"messages");
553 strcpy(dirs[1],"help");
554 mesg_locate(targ,buf,2,dirs);
558 if (strlen(targ)==0) {
559 snprintf(targ, sizeof targ, "./help/%s", buf);
562 mfp = fopen(targ,"w");
564 cprintf("%d Cannot open '%s': %s\n",
565 ERROR,targ,strerror(errno));
568 cprintf("%d %s\n", SEND_LISTING, targ);
570 while (client_gets(buf), strcmp(buf, "000")) {
571 fprintf(mfp, "%s\n", buf);
581 void cmd_rwho(void) {
582 struct CitContext *cptr;
585 char un[40], room[40], host[40], flags[5];
587 aide = CC->usersupp.axlevel >= 6;
588 cprintf("%d\n",LISTING_FOLLOWS);
590 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
595 if (cptr->cs_flags & CS_POSTING)
600 if (cptr->fake_username[0])
602 strcpy(un, cptr->fake_username);
606 strcpy(un, cptr->curr_user);
608 if (cptr->fake_hostname[0])
610 strcpy(host, cptr->fake_hostname);
614 strcpy(host, cptr->cs_host);
616 if (cptr->fake_roomname[0])
618 strcpy(room, cptr->fake_roomname);
622 strcpy(room, cptr->cs_room);
625 if ((aide) && (spoofed))
628 if ((cptr->cs_flags & CS_STEALTH) && (aide))
631 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
633 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
634 cptr->cs_pid, un, room,
635 host, cptr->cs_clientname,
636 (long)(cptr->lastidle),
637 cptr->lastcmdname, flags);
639 if ((spoofed) && (aide))
641 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
642 cptr->cs_pid, cptr->curr_user, cptr->cs_room,
643 cptr->cs_host, cptr->cs_clientname,
644 (long)(cptr->lastidle),
645 cptr->lastcmdname, flags);
654 * Terminate another running session
656 void cmd_term(char *cmdbuf)
659 struct CitContext *ccptr;
660 int session_to_kill = 0;
662 if (!CC->logged_in) {
663 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
667 if (CC->usersupp.axlevel < 6) {
668 cprintf("%d You must be an Aide to terminate sessions.\n",
669 ERROR+HIGHER_ACCESS_REQUIRED);
673 session_num = extract_int(cmdbuf, 0);
674 if (session_num == CC->cs_pid) {
675 cprintf("%d You can't kill your own session.\n", ERROR);
679 lprintf(9, "Locating session to kill\n");
680 begin_critical_section(S_SESSION_TABLE);
681 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
682 if (session_num == ccptr->cs_pid) {
683 session_to_kill = ccptr->cs_pid;
686 end_critical_section(S_SESSION_TABLE);
687 lprintf(9, "session_to_kill == %d\n", session_to_kill);
689 if (session_to_kill > 0) {
690 lprintf(9, "calling kill_session()\n");
691 kill_session(session_to_kill);
692 cprintf("%d Session terminated.\n", OK);
695 cprintf("%d No such session.\n", ERROR);
704 * get the paginator prompt
706 void cmd_more(void) {
707 cprintf("%d %s\n",OK,config.c_moreprompt);
713 void cmd_echo(char *etext)
715 cprintf("%d %s\n",OK,etext);
721 * identify as internal program
723 void cmd_ipgm(char *argbuf)
727 secret = extract_int(argbuf, 0);
728 if (secret == config.c_ipgm_secret) {
729 CC->internal_pgm = 1;
730 strcpy(CC->curr_user, "<internal program>");
731 CC->cs_flags = CC->cs_flags|CS_STEALTH;
732 cprintf("%d Authenticated as an internal program.\n",OK);
735 cprintf("%d Authentication failed.\n",ERROR);
741 * Shut down the server
743 void cmd_down(void) {
744 if (!CC->logged_in) {
745 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
749 if (CC->usersupp.axlevel < 6) {
750 cprintf("%d You must be an Aide to shut down the server.\n",
751 ERROR+HIGHER_ACCESS_REQUIRED);
755 cprintf("%d Shutting down server. Goodbye.\n", OK);
760 * Schedule or cancel a server shutdown
762 void cmd_scdn(char *argbuf)
766 if (!CC->logged_in) {
767 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
771 if (CC->usersupp.axlevel < 6) {
772 cprintf("%d You must be an Aide to schedule a shutdown.\n",
773 ERROR+HIGHER_ACCESS_REQUIRED);
777 new_state = extract_int(argbuf, 0);
778 if ((new_state == 0) || (new_state == 1)) {
779 ScheduledShutdown = new_state;
781 cprintf("%d %d\n", OK, ScheduledShutdown);
788 void *context_loop(struct CitContext *con)
791 int num_sessions, len;
792 struct sockaddr_in sin;
795 * Wedge our way into the context table.
800 * Initialize some variables specific to our context.
803 CC->internal_pgm = 0;
804 CC->download_fp = NULL;
805 CC->upload_fp = NULL;
806 CC->cs_pid = con->client_socket; /* not necessarily portable */
807 CC->FirstExpressMessage = NULL;
812 strcpy(CC->lastcmdname, " ");
813 strcpy(CC->cs_clientname, "(unknown)");
814 strcpy(CC->curr_user,"(not logged in)");
815 strcpy(CC->net_node,"");
816 snprintf(CC->temp, sizeof CC->temp, "/tmp/CitServer.%d.%d", getpid(), CC->cs_pid);
817 strcpy(CC->cs_room, "(no room)");
818 strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
819 CC->cs_host[sizeof CC->cs_host - 1] = 0;
821 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
822 locate_host(CC->cs_host, &sin.sin_addr);
824 CC->upload_type = UPL_FILE;
826 CC->FirstSessData = NULL;
828 num_sessions = session_count();
830 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
833 if (CC->nologin==1) {
834 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
835 ERROR+MAX_SESSIONS_EXCEEDED,
836 config.c_nodename,config.c_maxsessions);
839 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
842 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
844 /* Run any session startup routines registered by loadable modules */
845 PerformSessionHooks(EVT_START);
847 rec_log(CL_CONNECT, "");
851 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
852 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
853 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
856 * Let other clients see the last command we executed, but
857 * exclude NOOP because that would be boring.
859 if (strncasecmp(cmdbuf, "NOOP", 4)) {
860 strcpy(CC->lastcmdname, " ");
861 strncpy(CC->lastcmdname, cmdbuf, 4);
865 if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
867 CC->cs_flags &= ~CS_POSTING;
871 * This loop recognizes all server commands.
874 if (!strncasecmp(cmdbuf,"NOOP",4)) {
875 cprintf("%d%cok\n",OK,check_express());
878 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
879 cprintf("%d Goodbye.\n",OK);
882 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
883 if (CC->logged_in) logout(CC);
884 cprintf("%d logged out.\n",OK);
887 else if (!strncasecmp(cmdbuf,"USER",4)) {
888 cmd_user(&cmdbuf[5]);
891 else if (!strncasecmp(cmdbuf,"PASS",4)) {
892 cmd_pass(&cmdbuf[5]);
895 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
896 cmd_newu(&cmdbuf[5]);
899 else if (!strncasecmp(cmdbuf,"SETP",4)) {
900 cmd_setp(&cmdbuf[5]);
903 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
904 cmd_lrms(&cmdbuf[5]);
907 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
908 cmd_lkra(&cmdbuf[5]);
911 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
912 cmd_lkrn(&cmdbuf[5]);
915 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
916 cmd_lkro(&cmdbuf[5]);
919 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
920 cmd_lzrm(&cmdbuf[5]);
923 else if (!strncasecmp(cmdbuf,"GETU",4)) {
927 else if (!strncasecmp(cmdbuf,"SETU",4)) {
928 cmd_setu(&cmdbuf[5]);
931 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
932 cmd_goto(&cmdbuf[5]);
935 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
936 cmd_msgs(&cmdbuf[5]);
939 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
943 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
947 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
948 cmd_msg0(&cmdbuf[5]);
951 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
952 cmd_msg2(&cmdbuf[5]);
955 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
956 cmd_msg3(&cmdbuf[5]);
959 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
960 cmd_msg4(&cmdbuf[5]);
963 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
964 cmd_opna(&cmdbuf[5]);
967 else if (!strncasecmp(cmdbuf,"INFO",4)) {
971 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
972 cmd_slrp(&cmdbuf[5]);
975 else if (!strncasecmp(cmdbuf,"INVT",4)) {
976 cmd_invt_kick(&cmdbuf[5],1);
979 else if (!strncasecmp(cmdbuf,"KICK",4)) {
980 cmd_invt_kick(&cmdbuf[5],0);
983 else if (!strncasecmp(cmdbuf,"GETR",4)) {
987 else if (!strncasecmp(cmdbuf,"SETR",4)) {
988 cmd_setr(&cmdbuf[5]);
991 else if (!strncasecmp(cmdbuf,"GETA",4)) {
995 else if (!strncasecmp(cmdbuf,"SETA",4)) {
996 cmd_seta(&cmdbuf[5]);
999 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
1000 cmd_ent0(&cmdbuf[5]);
1003 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
1004 cmd_ent3(&cmdbuf[5]);
1007 else if (!strncasecmp(cmdbuf,"RINF",4)) {
1011 else if (!strncasecmp(cmdbuf,"DELE",4)) {
1012 cmd_dele(&cmdbuf[5]);
1015 else if (!strncasecmp(cmdbuf,"KILL",4)) {
1016 cmd_kill(&cmdbuf[5]);
1019 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
1020 cmd_cre8(&cmdbuf[5]);
1023 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
1024 cmd_move(&cmdbuf[5]);
1027 else if (!strncasecmp(cmdbuf,"FORG",4)) {
1031 else if (!strncasecmp(cmdbuf,"MESG",4)) {
1032 cmd_mesg(&cmdbuf[5]);
1035 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
1036 cmd_emsg(&cmdbuf[5]);
1039 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
1043 else if (!strncasecmp(cmdbuf,"GREG",4)) {
1044 cmd_greg(&cmdbuf[5]);
1047 else if (!strncasecmp(cmdbuf,"VALI",4)) {
1048 cmd_vali(&cmdbuf[5]);
1051 else if (!strncasecmp(cmdbuf,"EINF",4)) {
1052 cmd_einf(&cmdbuf[5]);
1055 else if (!strncasecmp(cmdbuf,"LIST",4)) {
1059 else if (!strncasecmp(cmdbuf,"REGI",4)) {
1063 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
1067 else if (!strncasecmp(cmdbuf,"DELF",4)) {
1068 cmd_delf(&cmdbuf[5]);
1071 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
1072 cmd_movf(&cmdbuf[5]);
1075 else if (!strncasecmp(cmdbuf,"NETF",4)) {
1076 cmd_netf(&cmdbuf[5]);
1079 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1083 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1084 cmd_open(&cmdbuf[5]);
1087 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1091 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1092 cmd_uopn(&cmdbuf[5]);
1095 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1096 cmd_ucls(&cmdbuf[5]);
1099 else if (!strncasecmp(cmdbuf,"READ",4)) {
1100 cmd_read(&cmdbuf[5]);
1103 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1104 cmd_writ(&cmdbuf[5]);
1107 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1108 cmd_qusr(&cmdbuf[5]);
1111 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1112 cmd_echo(&cmdbuf[5]);
1115 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1116 cmd_oimg(&cmdbuf[5]);
1119 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1123 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1124 cmd_netp(&cmdbuf[5]);
1127 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1128 cmd_ndop(&cmdbuf[5]);
1131 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1132 cmd_nuop(&cmdbuf[5]);
1135 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1139 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1140 cmd_cflr(&cmdbuf[5]);
1143 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1144 cmd_kflr(&cmdbuf[5]);
1147 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1148 cmd_eflr(&cmdbuf[5]);
1151 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1152 cmd_iden(&cmdbuf[5]);
1155 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1156 cmd_ipgm(&cmdbuf[5]);
1159 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1163 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1164 cmd_rbio(&cmdbuf[5]);
1167 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1171 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1172 cmd_stel(&cmdbuf[5]);
1175 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1176 cmd_term(&cmdbuf[5]);
1179 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1183 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1184 cmd_scdn(&cmdbuf[5]);
1187 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1188 cmd_nset(&cmdbuf[5]);
1191 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1192 cmd_uimg(&cmdbuf[5]);
1195 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1196 cmd_uchg(&cmdbuf[5]);
1199 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1203 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1204 cmd_hchg(&cmdbuf[5]);
1207 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1208 cmd_rchg(&cmdbuf[5]);
1211 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1212 cmd_agup(&cmdbuf[5]);
1215 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1216 cmd_asup(&cmdbuf[5]);
1219 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1220 cmd_gpex(&cmdbuf[5]);
1223 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1224 cmd_spex(&cmdbuf[5]);
1227 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1228 cmd_conf(&cmdbuf[5]);
1231 #ifdef DEBUG_MEMORY_LEAKS
1232 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1237 else if (!DLoader_Exec_Cmd(cmdbuf))
1239 cprintf("%d Unrecognized or unsupported command.\n",
1243 } while(strncasecmp(cmdbuf, "QUIT", 4));
1245 cleanup(EXIT_NORMAL);