From: Michael Hampton Date: Fri, 12 Mar 2004 19:32:09 +0000 (+0000) Subject: * routines2.c: Convert multiple functions to use new IPC code (almost done!) X-Git-Tag: v7.86~5541 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=c7f137cb878ca5fbed77ed3cb89a8bc487d973e0;p=citadel.git * routines2.c: Convert multiple functions to use new IPC code (almost done!) --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index b975fdb09..8ec9477fe 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 614.72 2004/03/12 19:32:09 error + * routines2.c: Convert multiple functions to use new IPC code (almost done!) + Revision 614.71 2004/03/12 19:30:06 error * citadel.c: main(): Fix error response for RCHG, HCHG and UCHG commands. @@ -5484,3 +5487,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/routines2.c b/citadel/routines2.c index 320f40c1c..23b4a057d 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -1020,6 +1020,8 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment) char addr[SIZ]; FILE *tempfp; FILE *changefp; + char *listing = NULL; + int r; if (strlen(editor_paths[0]) == 0) { scr_printf("You must have an external editor configured in" @@ -1041,10 +1043,11 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment) fprintf(tempfp, "# Specify one per line.\n" "\n\n"); - CtdlIPC_putline(ipc, "GNET"); - CtdlIPC_getline(ipc, buf); - if (buf[0] == '1') { - while(CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) { + r = CtdlIPCGetRoomNetworkConfig(ipc, &listing, buf); + if (r / 100 == 1) { + while(listing && strlen(listing)) { + extract_token(buf, listing, 0, '\n'); + remove_token(listing, 0, '\n'); extract(instr, buf, 0); if (!strcasecmp(instr, entrytype)) { extract(addr, buf, 1); @@ -1052,6 +1055,10 @@ void network_config_management(CtdlIPC *ipc, char *entrytype, char *comment) } } } + if (listing) { + free(listing); + listing = NULL; + } fclose(tempfp); e_ex_code = 1; /* start with a failed exit code */ @@ -1138,18 +1145,21 @@ void do_ignet_configuration(CtdlIPC *ipc) { int badkey; int i, j; int quitting = 0; - + char *listing = NULL; + int r; + + r = CtdlIPCGetSystemConfigByType(ipc, IGNETCFG, listing, buf); + if (r / 100 == 1) while (*listing && strlen(listing)) { + extract_token(buf, listing, 0, '\n'); + remove_token(listing, 0, '\n'); - snprintf(buf, sizeof buf, "CONF getsys|%s", IGNETCFG); - CtdlIPC_putline(ipc, buf); - CtdlIPC_getline(ipc, buf); - if (buf[0] == '1') while (CtdlIPC_getline(ipc, buf), strcmp(buf, "000")) { ++num_recs; if (num_recs == 1) recs = malloc(sizeof(char *)); else recs = realloc(recs, (sizeof(char *)) * num_recs); recs[num_recs-1] = malloc(SIZ); strcpy(recs[num_recs-1], buf); } + if (listing) free(listing); do { scr_printf("\n"); @@ -1212,17 +1222,21 @@ void do_ignet_configuration(CtdlIPC *ipc) { recs[j] = recs[j+1]; break; case 's': - snprintf(buf, sizeof buf, "CONF putsys|%s", IGNETCFG); - CtdlIPC_putline(ipc, buf); - CtdlIPC_getline(ipc, buf); - if (buf[0] == '4') { - for (i=0; i