$Log$
+ Revision 572.21 2000/07/30 04:36:12 ajc
+ * Set up the SNET (Send NETwork config) and GNET (Get NETwork config) commands
+ for the network overhaul.
+
Revision 572.20 2000/07/29 05:29:19 ajc
* Changed the format of RWHO output to provide non-masqueraded user/room/host
names (to Aides only) as additional fields rather than an extra line of
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
-
*/
void who_is_online(int longlist)
{
- char buf[128], username[128], roomname[128], fromhost[128];
- char flags[128];
- char actual_user[128], actual_room[128], actual_host[128];
- char tbuf[128], clientsoft[128];
+ char buf[256], username[256], roomname[256], fromhost[256];
+ char flags[256];
+ char actual_user[256], actual_room[256], actual_host[256];
+ char tbuf[256], clientsoft[256];
time_t timenow = 0;
time_t idletime, idlehours, idlemins, idlesecs;
int last_session = (-1);
void cmd_gnet(char *argbuf) {
+ char filename[256];
+ char buf[256];
+ FILE *fp;
+
+ if (CtdlAccessCheck(ac_room_aide)) return;
+ assoc_file_name(filename, &CC->quickroom, "netconfigs");
+ cprintf("%d Network settings for room #%ld <%s>\n",
+ LISTING_FOLLOWS,
+ CC->quickroom.QRnumber, CC->quickroom.QRname);
+
+ fp = fopen(filename, "r");
+ if (fp != NULL) {
+ while (fgets(buf, sizeof buf, fp) != NULL) {
+ buf[strlen(buf)-1] = 0;
+ cprintf("%s\n", buf);
+ }
+ fclose(fp);
+ }
+
+ cprintf("000\n");
}
void cmd_snet(char *argbuf) {
+ char tempfilename[256];
+ char filename[256];
+ char buf[256];
+ FILE *fp;
+
+ if (CtdlAccessCheck(ac_room_aide)) return;
+ safestrncpy(tempfilename, tmpnam(NULL), sizeof tempfilename);
+ assoc_file_name(filename, &CC->quickroom, "netconfigs");
+
+ fp = fopen(tempfilename, "w");
+ if (fp == NULL) {
+ cprintf("%d Cannot open %s: %s\n",
+ ERROR+INTERNAL_ERROR,
+ tempfilename,
+ strerror(errno));
+ }
+
+ cprintf("%d %s\n", SEND_LISTING, tempfilename);
+ while (client_gets(buf), strcmp(buf, "000")) {
+ fprintf(fp, "%s\n", buf);
+ }
+ fclose(fp);
+
+ /* Now that we've got the whole file, put it in place */
+ unlink(filename);
+ link(tempfilename, filename);
+ unlink(tempfilename);
}