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 * Gracefully terminate the session and thread.
93 * (This is called as a cleanup handler by the thread library.)
95 * All NON-system-dependent stuff is done in this function.
96 * System-dependent session/thread cleanup is in cleanup() in sysdep.c
98 void cleanup_stuff(void *arg)
101 lprintf(9, "cleanup_stuff() called\n");
103 lprintf(7, "Calling logout(%d)\n", CC->cs_pid);
106 rec_log(CL_TERMINATE,CC->curr_user);
108 lprintf(3, "citserver[%3d]: ended.\n",CC->cs_pid);
110 /* Run any cleanup routines registered by loadable modules */
111 PerformSessionHooks(EVT_STOP);
113 syslog(LOG_NOTICE,"session %d ended", CC->cs_pid);
115 /* Deallocate any message list we might have in memory */
116 if (CC->msglist != NULL) phree(CC->msglist);
118 /* Now get rid of the session and context */
119 lprintf(7, "cleanup_stuff() calling RemoveContext(%d)\n", CC->cs_pid);
122 /* While we still have an extra thread with no user attached to it,
123 * take the opportunity to do some housekeeping before exiting.
130 * set_wtmpsupp() - alter the session listing
132 void set_wtmpsupp(char *newtext)
134 strncpy(CC->cs_room,newtext,sizeof CC->cs_room);
135 CC->cs_room[sizeof CC->cs_room - 1] = 0;
136 time(&CC->cs_lastupdt);
138 /* Run any routines registered by loadable modules */
139 PerformSessionHooks(EVT_NEWROOM);
144 * call set_wtmpsupp() with the name of the current room, modified a bit...
146 void set_wtmpsupp_to_current_room() {
147 if (CC->quickroom.QRflags & QR_PRIVATE) {
148 set_wtmpsupp("<private room>");
150 else if (CC->quickroom.QRflags & QR_MAILBOX) {
151 set_wtmpsupp(&CC->quickroom.QRname[11]);
154 set_wtmpsupp(CC->quickroom.QRname);
161 * cmd_info() - tell the client about this server
163 void cmd_info(void) {
164 cprintf("%d Server info:\n",LISTING_FOLLOWS);
165 cprintf("%d\n",CC->cs_pid);
166 cprintf("%s\n",config.c_nodename);
167 cprintf("%s\n",config.c_humannode);
168 cprintf("%s\n",config.c_fqdn);
169 cprintf("%s\n",CITADEL);
170 cprintf("%d\n",REV_LEVEL);
171 cprintf("%s\n",config.c_bbs_city);
172 cprintf("%s\n",config.c_sysadm);
173 cprintf("%d\n",SERVER_TYPE);
174 cprintf("%s\n",config.c_moreprompt);
175 cprintf("1\n"); /* 1 = yes, this system supports floors */
176 cprintf("1\n"); /* 1 = we support the extended paging options */
180 void cmd_rchg(char *argbuf)
182 char newroomname[256]; /* set to 256 to prevent buffer overruns <dme>*/
184 extract(newroomname, argbuf, 0);
185 newroomname[ROOMNAMELEN] = 0;
186 if (strlen(newroomname) > 0) {
187 strncpy(CC->fake_roomname, newroomname, ROOMNAMELEN);
188 CC->fake_roomname[ROOMNAMELEN - 1] = 0;
191 strcpy(CC->fake_roomname, "");
193 cprintf("%d OK\n", OK);
196 void cmd_hchg(char *newhostname)
198 if ((newhostname) && (newhostname[0]))
200 memset(CC->fake_hostname, 0, 25);
201 strncpy(CC->fake_hostname, newhostname, 24);
204 strcpy(CC->fake_hostname, "");
205 cprintf("%d OK\n",OK);
208 void cmd_uchg(char *newusername)
210 if (CC->usersupp.axlevel < 6)
212 cprintf("%d You must be an Aide to use UCHG.\n",
213 ERROR+HIGHER_ACCESS_REQUIRED);
216 if ((newusername) && (newusername[0]))
218 CC->cs_flags &= ~CS_STEALTH;
219 memset(CC->fake_username, 0, 32);
220 if (strncasecmp(newusername, CC->curr_user, strlen(CC->curr_user)))
221 strncpy(CC->fake_username, newusername, 31);
225 CC->fake_username[0] = '\0';
226 CC->cs_flags |= CS_STEALTH;
232 * returns an asterisk if there are any express messages waiting,
235 char check_express(void) {
236 if (CC->FirstExpressMessage == NULL) {
250 cprintf("%d %ld\n", OK, tv);
254 * Check whether two hostnames match.
255 * "Realname" should be an actual name of a client that is trying to connect;
256 * "testname" should be the value we are comparing it with. The idea is that we
257 * want to compare with both the abbreviated and fully-qualified versions of
258 * "testname;" some people define "localhost" as "localhost.foo.com," etc.
260 static int hostnames_match(const char *realname, const char *testname) {
264 if (!strcasecmp(realname, testname))
267 #ifdef HAVE_NONREENTRANT_NETDB
268 begin_critical_section(S_NETDB);
271 if ((he = gethostbyname(testname)) != NULL)
272 if (!strcasecmp(realname, he->h_name))
275 #ifdef HAVE_NONREENTRANT_NETDB
276 end_critical_section(S_NETDB);
283 * check a hostname against the public_clients file
285 int is_public_client(char *where)
290 if (hostnames_match(where,"localhost")) return(1);
291 if (hostnames_match(where,config.c_fqdn)) return(1);
293 fp = fopen("public_clients","r");
294 if (fp == NULL) return(0);
296 while (fgets(buf,256,fp)!=NULL) {
297 while (isspace((buf[strlen(buf)-1])))
298 buf[strlen(buf)-1] = 0;
299 if (hostnames_match(where,buf)) {
311 * the client is identifying itself to the server
313 void cmd_iden(char *argbuf)
322 if (num_parms(argbuf)<4) {
323 cprintf("%d usage error\n",ERROR);
327 dev_code = extract_int(argbuf,0);
328 cli_code = extract_int(argbuf,1);
329 rev_level = extract_int(argbuf,2);
330 extract(desc,argbuf,3);
332 strncpy(from_host,config.c_fqdn,sizeof from_host);
333 from_host[sizeof from_host - 1] = 0;
334 if (num_parms(argbuf)>=5) extract(from_host,argbuf,4);
336 CC->cs_clientdev = dev_code;
337 CC->cs_clienttyp = cli_code;
338 CC->cs_clientver = rev_level;
339 strncpy(CC->cs_clientname,desc,31);
340 CC->cs_clientname[31] = 0;
342 if ((strlen(from_host)>0) &&
343 (is_public_client(CC->cs_host))) {
344 if (inet_aton(from_host, &addr))
345 locate_host(CC->cs_host, &addr);
347 strncpy(CC->cs_host,from_host,24);
351 set_wtmpsupp_to_current_room();
353 syslog(LOG_NOTICE,"client %d/%d/%01d.%02d (%s)\n",
359 cprintf("%d Ok\n",OK);
364 * enter or exit "stealth mode"
366 void cmd_stel(char *cmdbuf)
370 requested_mode = extract_int(cmdbuf,0);
371 if (requested_mode !=0) requested_mode = 1;
373 if (!CC->logged_in) {
374 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
378 if (CC->usersupp.axlevel < 6) {
379 cprintf("%d You must be an Aide to use stealth mode.\n",
380 ERROR+HIGHER_ACCESS_REQUIRED);
384 if (CC->cs_flags & CS_STEALTH) {
385 if (requested_mode == 0)
386 CC->cs_flags = CC->cs_flags-CS_STEALTH;
389 if (requested_mode == 1)
390 CC->cs_flags = CC->cs_flags|CS_STEALTH;
393 set_wtmpsupp_to_current_room();
394 cprintf("%d Ok\n",OK);
401 * display system messages or help
403 void cmd_mesg(char *mname)
410 extract(buf,mname,0);
415 strcpy(dirs[0],"messages");
416 strcpy(dirs[1],"help");
417 mesg_locate(targ,buf,2,dirs);
422 if (strlen(targ)==0) {
423 cprintf("%d '%s' not found.\n",ERROR,mname);
427 mfp = fopen(targ,"r");
429 cprintf("%d Cannot open '%s': %s\n",
430 ERROR,targ,strerror(errno));
433 cprintf("%d %s\n",LISTING_FOLLOWS,buf);
435 while (fgets(buf,255,mfp)!=NULL) {
436 buf[strlen(buf)-1] = 0;
447 * enter system messages or help
449 void cmd_emsg(char *mname)
457 if (CC->usersupp.axlevel < 6) {
458 cprintf("%d You must be an Aide to edit system messages.\n",
459 ERROR+HIGHER_ACCESS_REQUIRED);
463 extract(buf,mname,0);
464 for (a=0; a<strlen(buf); ++a) { /* security measure */
465 if (buf[a] == '/') buf[a] = '.';
470 strcpy(dirs[0],"messages");
471 strcpy(dirs[1],"help");
472 mesg_locate(targ,buf,2,dirs);
476 if (strlen(targ)==0) {
477 snprintf(targ, sizeof targ, "./help/%s", buf);
480 mfp = fopen(targ,"w");
482 cprintf("%d Cannot open '%s': %s\n",
483 ERROR,targ,strerror(errno));
486 cprintf("%d %s\n", SEND_LISTING, targ);
488 while (client_gets(buf), strcmp(buf, "000")) {
489 fprintf(mfp, "%s\n", buf);
499 void cmd_rwho(void) {
500 struct CitContext *cptr;
503 char un[40], room[40], host[40], flags[5];
505 aide = CC->usersupp.axlevel >= 6;
506 cprintf("%d\n",LISTING_FOLLOWS);
508 for (cptr = ContextList; cptr != NULL; cptr = cptr->next)
513 if (cptr->cs_flags & CS_POSTING)
518 if (cptr->fake_username[0])
520 strcpy(un, cptr->fake_username);
524 strcpy(un, cptr->curr_user);
526 if (cptr->fake_hostname[0])
528 strcpy(host, cptr->fake_hostname);
532 strcpy(host, cptr->cs_host);
534 if (cptr->fake_roomname[0])
536 strcpy(room, cptr->fake_roomname);
540 strcpy(room, cptr->cs_room);
543 if ((aide) && (spoofed))
546 if ((cptr->cs_flags & CS_STEALTH) && (aide))
549 if (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
551 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
552 cptr->cs_pid, un, room,
553 host, cptr->cs_clientname,
554 (long)(cptr->lastidle),
555 cptr->lastcmdname, flags);
557 if ((spoofed) && (aide))
559 cprintf("%d|%s|%s|%s|%s|%ld|%s|%s\n",
560 cptr->cs_pid, cptr->curr_user, cptr->cs_room,
561 cptr->cs_host, cptr->cs_clientname,
562 (long)(cptr->lastidle),
563 cptr->lastcmdname, flags);
572 * Terminate another running session
574 void cmd_term(char *cmdbuf)
577 struct CitContext *ccptr;
578 int session_to_kill = 0;
580 if (!CC->logged_in) {
581 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
585 if (CC->usersupp.axlevel < 6) {
586 cprintf("%d You must be an Aide to terminate sessions.\n",
587 ERROR+HIGHER_ACCESS_REQUIRED);
591 session_num = extract_int(cmdbuf, 0);
592 if (session_num == CC->cs_pid) {
593 cprintf("%d You can't kill your own session.\n", ERROR);
597 lprintf(9, "Locating session to kill\n");
598 begin_critical_section(S_SESSION_TABLE);
599 for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
600 if (session_num == ccptr->cs_pid) {
601 session_to_kill = ccptr->cs_pid;
604 end_critical_section(S_SESSION_TABLE);
605 lprintf(9, "session_to_kill == %d\n", session_to_kill);
607 if (session_to_kill > 0) {
608 lprintf(9, "calling kill_session()\n");
609 kill_session(session_to_kill);
610 cprintf("%d Session terminated.\n", OK);
613 cprintf("%d No such session.\n", ERROR);
622 * get the paginator prompt
624 void cmd_more(void) {
625 cprintf("%d %s\n",OK,config.c_moreprompt);
631 void cmd_echo(char *etext)
633 cprintf("%d %s\n",OK,etext);
639 * identify as internal program
641 void cmd_ipgm(char *argbuf)
645 secret = extract_int(argbuf, 0);
646 if (secret == config.c_ipgm_secret) {
647 CC->internal_pgm = 1;
648 strcpy(CC->curr_user, "<internal program>");
649 CC->cs_flags = CC->cs_flags|CS_STEALTH;
650 cprintf("%d Authenticated as an internal program.\n",OK);
653 cprintf("%d Authentication failed.\n",ERROR);
659 * Shut down the server
661 void cmd_down(void) {
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 shut down the server.\n",
669 ERROR+HIGHER_ACCESS_REQUIRED);
673 cprintf("%d Shutting down server. Goodbye.\n", OK);
678 * Schedule or cancel a server shutdown
680 void cmd_scdn(char *argbuf)
684 if (!CC->logged_in) {
685 cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN);
689 if (CC->usersupp.axlevel < 6) {
690 cprintf("%d You must be an Aide to schedule a shutdown.\n",
691 ERROR+HIGHER_ACCESS_REQUIRED);
695 new_state = extract_int(argbuf, 0);
696 if ((new_state == 0) || (new_state == 1)) {
697 ScheduledShutdown = new_state;
699 cprintf("%d %d\n", OK, ScheduledShutdown);
706 void *context_loop(struct CitContext *con)
709 int num_sessions, len;
710 struct sockaddr_in sin;
713 * Wedge our way into the context table.
718 * Initialize some variables specific to our context.
721 CC->internal_pgm = 0;
722 CC->download_fp = NULL;
723 CC->upload_fp = NULL;
724 CC->cs_pid = con->client_socket; /* not necessarily portable */
725 CC->FirstExpressMessage = NULL;
730 strcpy(CC->lastcmdname, " ");
731 strcpy(CC->cs_clientname, "(unknown)");
732 strcpy(CC->curr_user,"(not logged in)");
733 strcpy(CC->net_node,"");
734 snprintf(CC->temp, sizeof CC->temp, "/tmp/CitServer.%d.%d", getpid(), CC->cs_pid);
735 strcpy(CC->cs_room, "(no room)");
736 strncpy(CC->cs_host, config.c_fqdn, sizeof CC->cs_host);
737 CC->cs_host[sizeof CC->cs_host - 1] = 0;
739 if (!getpeername(CC->client_socket, (struct sockaddr *) &sin, &len))
740 locate_host(CC->cs_host, &sin.sin_addr);
742 CC->upload_type = UPL_FILE;
745 num_sessions = session_count();
747 if ((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions))
750 if (CC->nologin==1) {
751 cprintf("%d %s: Too many users are already online (maximum is %d)\n",
752 ERROR+MAX_SESSIONS_EXCEEDED,
753 config.c_nodename,config.c_maxsessions);
756 cprintf("%d %s Citadel/UX server ready.\n",OK,config.c_nodename);
759 lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
761 /* Run any session startup routines registered by loadable modules */
762 PerformSessionHooks(EVT_START);
764 rec_log(CL_CONNECT, "");
768 memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
769 if (client_gets(cmdbuf) < 1) cleanup(EXIT_NULL);
770 lprintf(5, "citserver[%3d]: %s\n", CC->cs_pid, cmdbuf);
773 * Let other clients see the last command we executed, but
774 * exclude NOOP because that would be boring.
776 if (strncasecmp(cmdbuf, "NOOP", 4)) {
777 strcpy(CC->lastcmdname, " ");
778 strncpy(CC->lastcmdname, cmdbuf, 4);
782 if ((strncasecmp(cmdbuf, "ENT0", 4)) && (strncasecmp(cmdbuf, "MESG", 4)) && (strncasecmp(cmdbuf, "MSGS", 4)))
784 CC->cs_flags &= ~CS_POSTING;
788 * This loop recognizes all server commands.
791 if (!strncasecmp(cmdbuf,"NOOP",4)) {
792 cprintf("%d%cok\n",OK,check_express());
795 else if (!strncasecmp(cmdbuf,"QUIT",4)) {
796 cprintf("%d Goodbye.\n",OK);
799 else if (!strncasecmp(cmdbuf,"LOUT",4)) {
800 if (CC->logged_in) logout(CC);
801 cprintf("%d logged out.\n",OK);
804 else if (!strncasecmp(cmdbuf,"USER",4)) {
805 cmd_user(&cmdbuf[5]);
808 else if (!strncasecmp(cmdbuf,"PASS",4)) {
809 cmd_pass(&cmdbuf[5]);
812 else if (!strncasecmp(cmdbuf,"NEWU",4)) {
813 cmd_newu(&cmdbuf[5]);
816 else if (!strncasecmp(cmdbuf,"SETP",4)) {
817 cmd_setp(&cmdbuf[5]);
820 else if (!strncasecmp(cmdbuf,"LRMS",4)) {
821 cmd_lrms(&cmdbuf[5]);
824 else if (!strncasecmp(cmdbuf,"LKRA",4)) {
825 cmd_lkra(&cmdbuf[5]);
828 else if (!strncasecmp(cmdbuf,"LKRN",4)) {
829 cmd_lkrn(&cmdbuf[5]);
832 else if (!strncasecmp(cmdbuf,"LKRO",4)) {
833 cmd_lkro(&cmdbuf[5]);
836 else if (!strncasecmp(cmdbuf,"LZRM",4)) {
837 cmd_lzrm(&cmdbuf[5]);
840 else if (!strncasecmp(cmdbuf,"GETU",4)) {
844 else if (!strncasecmp(cmdbuf,"SETU",4)) {
845 cmd_setu(&cmdbuf[5]);
848 else if (!strncasecmp(cmdbuf,"GOTO",4)) {
849 cmd_goto(&cmdbuf[5]);
852 else if (!strncasecmp(cmdbuf,"MSGS",4)) {
853 cmd_msgs(&cmdbuf[5]);
856 else if (!strncasecmp(cmdbuf,"WHOK",4)) {
860 else if (!strncasecmp(cmdbuf,"RDIR",4)) {
864 else if (!strncasecmp(cmdbuf,"MSG0",4)) {
865 cmd_msg0(&cmdbuf[5]);
868 else if (!strncasecmp(cmdbuf,"MSG2",4)) {
869 cmd_msg2(&cmdbuf[5]);
872 else if (!strncasecmp(cmdbuf,"MSG3",4)) {
873 cmd_msg3(&cmdbuf[5]);
876 else if (!strncasecmp(cmdbuf,"MSG4",4)) {
877 cmd_msg4(&cmdbuf[5]);
880 else if (!strncasecmp(cmdbuf,"OPNA",4)) {
881 cmd_opna(&cmdbuf[5]);
884 else if (!strncasecmp(cmdbuf,"INFO",4)) {
888 else if (!strncasecmp(cmdbuf,"SLRP",4)) {
889 cmd_slrp(&cmdbuf[5]);
892 else if (!strncasecmp(cmdbuf,"INVT",4)) {
893 cmd_invt_kick(&cmdbuf[5],1);
896 else if (!strncasecmp(cmdbuf,"KICK",4)) {
897 cmd_invt_kick(&cmdbuf[5],0);
900 else if (!strncasecmp(cmdbuf,"GETR",4)) {
904 else if (!strncasecmp(cmdbuf,"SETR",4)) {
905 cmd_setr(&cmdbuf[5]);
908 else if (!strncasecmp(cmdbuf,"GETA",4)) {
912 else if (!strncasecmp(cmdbuf,"SETA",4)) {
913 cmd_seta(&cmdbuf[5]);
916 else if (!strncasecmp(cmdbuf,"ENT0",4)) {
917 cmd_ent0(&cmdbuf[5]);
920 else if (!strncasecmp(cmdbuf,"ENT3",4)) {
921 cmd_ent3(&cmdbuf[5]);
924 else if (!strncasecmp(cmdbuf,"RINF",4)) {
928 else if (!strncasecmp(cmdbuf,"DELE",4)) {
929 cmd_dele(&cmdbuf[5]);
932 else if (!strncasecmp(cmdbuf,"KILL",4)) {
933 cmd_kill(&cmdbuf[5]);
936 else if (!strncasecmp(cmdbuf,"CRE8",4)) {
937 cmd_cre8(&cmdbuf[5]);
940 else if (!strncasecmp(cmdbuf,"MOVE",4)) {
941 cmd_move(&cmdbuf[5]);
944 else if (!strncasecmp(cmdbuf,"FORG",4)) {
948 else if (!strncasecmp(cmdbuf,"MESG",4)) {
949 cmd_mesg(&cmdbuf[5]);
952 else if (!strncasecmp(cmdbuf,"EMSG",4)) {
953 cmd_emsg(&cmdbuf[5]);
956 else if (!strncasecmp(cmdbuf,"GNUR",4)) {
960 else if (!strncasecmp(cmdbuf,"GREG",4)) {
961 cmd_greg(&cmdbuf[5]);
964 else if (!strncasecmp(cmdbuf,"VALI",4)) {
965 cmd_vali(&cmdbuf[5]);
968 else if (!strncasecmp(cmdbuf,"EINF",4)) {
969 cmd_einf(&cmdbuf[5]);
972 else if (!strncasecmp(cmdbuf,"LIST",4)) {
976 else if (!strncasecmp(cmdbuf,"REGI",4)) {
980 else if (!strncasecmp(cmdbuf,"CHEK",4)) {
984 else if (!strncasecmp(cmdbuf,"DELF",4)) {
985 cmd_delf(&cmdbuf[5]);
988 else if (!strncasecmp(cmdbuf,"MOVF",4)) {
989 cmd_movf(&cmdbuf[5]);
992 else if (!strncasecmp(cmdbuf,"NETF",4)) {
993 cmd_netf(&cmdbuf[5]);
996 else if (!strncasecmp(cmdbuf,"RWHO",4)) {
1000 else if (!strncasecmp(cmdbuf,"OPEN",4)) {
1001 cmd_open(&cmdbuf[5]);
1004 else if (!strncasecmp(cmdbuf,"CLOS",4)) {
1008 else if (!strncasecmp(cmdbuf,"UOPN",4)) {
1009 cmd_uopn(&cmdbuf[5]);
1012 else if (!strncasecmp(cmdbuf,"UCLS",4)) {
1013 cmd_ucls(&cmdbuf[5]);
1016 else if (!strncasecmp(cmdbuf,"READ",4)) {
1017 cmd_read(&cmdbuf[5]);
1020 else if (!strncasecmp(cmdbuf,"WRIT",4)) {
1021 cmd_writ(&cmdbuf[5]);
1024 else if (!strncasecmp(cmdbuf,"QUSR",4)) {
1025 cmd_qusr(&cmdbuf[5]);
1028 else if (!strncasecmp(cmdbuf,"ECHO",4)) {
1029 cmd_echo(&cmdbuf[5]);
1032 else if (!strncasecmp(cmdbuf,"OIMG",4)) {
1033 cmd_oimg(&cmdbuf[5]);
1036 else if (!strncasecmp(cmdbuf,"MORE",4)) {
1040 else if (!strncasecmp(cmdbuf,"NETP",4)) {
1041 cmd_netp(&cmdbuf[5]);
1044 else if (!strncasecmp(cmdbuf,"NDOP",4)) {
1045 cmd_ndop(&cmdbuf[5]);
1048 else if (!strncasecmp(cmdbuf,"NUOP",4)) {
1049 cmd_nuop(&cmdbuf[5]);
1052 else if (!strncasecmp(cmdbuf,"LFLR",4)) {
1056 else if (!strncasecmp(cmdbuf,"CFLR",4)) {
1057 cmd_cflr(&cmdbuf[5]);
1060 else if (!strncasecmp(cmdbuf,"KFLR",4)) {
1061 cmd_kflr(&cmdbuf[5]);
1064 else if (!strncasecmp(cmdbuf,"EFLR",4)) {
1065 cmd_eflr(&cmdbuf[5]);
1068 else if (!strncasecmp(cmdbuf,"IDEN",4)) {
1069 cmd_iden(&cmdbuf[5]);
1072 else if (!strncasecmp(cmdbuf,"IPGM",4)) {
1073 cmd_ipgm(&cmdbuf[5]);
1076 else if (!strncasecmp(cmdbuf,"EBIO",4)) {
1080 else if (!strncasecmp(cmdbuf,"RBIO",4)) {
1081 cmd_rbio(&cmdbuf[5]);
1084 else if (!strncasecmp(cmdbuf,"LBIO",4)) {
1088 else if (!strncasecmp(cmdbuf,"STEL",4)) {
1089 cmd_stel(&cmdbuf[5]);
1092 else if (!strncasecmp(cmdbuf,"TERM",4)) {
1093 cmd_term(&cmdbuf[5]);
1096 else if (!strncasecmp(cmdbuf,"DOWN",4)) {
1100 else if (!strncasecmp(cmdbuf,"SCDN",4)) {
1101 cmd_scdn(&cmdbuf[5]);
1104 else if (!strncasecmp(cmdbuf, "NSET", 4)) {
1105 cmd_nset(&cmdbuf[5]);
1108 else if (!strncasecmp(cmdbuf, "UIMG", 4)) {
1109 cmd_uimg(&cmdbuf[5]);
1112 else if (!strncasecmp(cmdbuf, "UCHG", 4)) {
1113 cmd_uchg(&cmdbuf[5]);
1116 else if (!strncasecmp(cmdbuf, "TIME", 4)) {
1120 else if (!strncasecmp(cmdbuf, "HCHG", 4)) {
1121 cmd_hchg(&cmdbuf[5]);
1124 else if (!strncasecmp(cmdbuf, "RCHG", 4)) {
1125 cmd_rchg(&cmdbuf[5]);
1128 else if (!strncasecmp(cmdbuf, "AGUP", 4)) {
1129 cmd_agup(&cmdbuf[5]);
1132 else if (!strncasecmp(cmdbuf, "ASUP", 4)) {
1133 cmd_asup(&cmdbuf[5]);
1136 else if (!strncasecmp(cmdbuf, "GPEX", 4)) {
1137 cmd_gpex(&cmdbuf[5]);
1140 else if (!strncasecmp(cmdbuf, "SPEX", 4)) {
1141 cmd_spex(&cmdbuf[5]);
1144 else if (!strncasecmp(cmdbuf, "CONF", 4)) {
1145 cmd_conf(&cmdbuf[5]);
1148 #ifdef DEBUG_MEMORY_LEAKS
1149 else if (!strncasecmp(cmdbuf, "LEAK", 4)) {
1154 else if (!DLoader_Exec_Cmd(cmdbuf))
1156 cprintf("%d Unrecognized or unsupported command.\n",
1160 } while(strncasecmp(cmdbuf, "QUIT", 4));
1162 cleanup(EXIT_NORMAL);