more sprintf removals
authorNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 00:03:43 +0000 (00:03 +0000)
committerNathan Bryant <loanshark@uncensored.citadel.org>
Tue, 12 Mar 2002 00:03:43 +0000 (00:03 +0000)
citadel/ChangeLog
citadel/file_ops.c
citadel/imap_misc.c
citadel/msgbase.c
citadel/msgbase.h
citadel/msgform.c
citadel/netsetup.c
citadel/room_ops.c
citadel/room_ops.h
citadel/serv_network.c

index 410c75f04f42b84074424084b20c1b80efc40546..5b1627b96e305582233cb39ba645831218ee8830 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 590.139  2002/03/12 00:03:43  nbryant
+ more sprintf removals
+
  Revision 590.138  2002/03/11 06:00:21  nbryant
  use <db.h> before <db3/db.h> or <db4/db.h>
  this is the only way i can think of to make it work everywhere; people on
@@ -3434,4 +3437,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index f1536050725fde00f6fb0ed8e0f2e665554367be..f6b3c90fcb3a83629e92492299eb9121f523d03a 100644 (file)
@@ -425,7 +425,7 @@ void cmd_oimg(char *cmdbuf)
                snprintf(pathname, sizeof pathname,
                         "./images/floor.%d.gif", which_floor);
        } else if (!strcasecmp(filename, "_roompic_")) {
-               assoc_file_name(pathname, &CC->quickroom, "images");
+               assoc_file_name(pathname, sizeof pathname, &CC->quickroom, "images");
        } else {
                for (a = 0; a < strlen(filename); ++a) {
                        filename[a] = tolower(filename[a]);
@@ -557,7 +557,7 @@ void cmd_uimg(char *cmdbuf)
        }
 
        if ((!strcasecmp(basenm, "_roompic_")) && (is_room_aide())) {
-               assoc_file_name(CC->upl_path, &CC->quickroom, "images");
+               assoc_file_name(CC->upl_path, sizeof CC->upl_path, &CC->quickroom, "images");
        }
 
        if (strlen(CC->upl_path) == 0) {
index b5b42d60c6a9d0f624a8dd628dea3f3a463e7b58..6468e3f9c89e24aaabf4f7700d51e8f6f261b040 100644 (file)
@@ -273,7 +273,7 @@ void imap_append(int num_parms, char *parms[]) {
        /* 
         * Can we post here?
         */
-       ret = CtdlDoIHavePermissionToPostInThisRoom(buf);
+       ret = CtdlDoIHavePermissionToPostInThisRoom(buf, sizeof buf);
 
        if (ret) {
                /* Nope ... print an error message */
index 0cd11884316994fa95a8731c3e023b80d8642d61..edafb1a6df69b3d5194920d2a5df711bb1132122 100644 (file)
@@ -336,17 +336,24 @@ void CtdlSetSeen(long target_msgnum, int target_setting) {
                }
                if (  ((is_seen == 0) && (was_seen == 1))
                   || ((is_seen == 1) && (i == num_msgs-1)) ) {
+                       size_t tmp;
+
                        if ( (strlen(newseen) + 20) > SIZ) {
                                strcpy(newseen, &newseen[20]);
                                newseen[0] = '*';
                        }
-                       if (strlen(newseen) > 0) strcat(newseen, ",");
+                       tmp = strlen(newseen);
+                       if (tmp > 0) {
+                               strcat(newseen, ",");
+                               tmp++;
+                       }
                        if (lo == hi) {
-                               sprintf(&newseen[strlen(newseen)], "%ld", lo);
+                               snprintf(&newseen[tmp], sizeof newseen - tmp,
+                                        "%ld", lo);
                        }
                        else {
-                               sprintf(&newseen[strlen(newseen)], "%ld:%ld",
-                                       lo, hi);
+                               snprintf(&newseen[tmp], sizeof newseen - tmp,
+                                        "%ld:%ld", lo, hi);
                        }
                        lo = (-1L);
                        hi = (-1L);
@@ -576,11 +583,11 @@ void do_help_subst(char *buffer)
        help_subst(buffer, "^humannode", config.c_humannode);
        help_subst(buffer, "^fqdn", config.c_fqdn);
        help_subst(buffer, "^username", CC->usersupp.fullname);
-       sprintf(buf2, "%ld", CC->usersupp.usernum);
+       snprintf(buf2, sizeof buf2, "%ld", CC->usersupp.usernum);
        help_subst(buffer, "^usernum", buf2);
        help_subst(buffer, "^sysadm", config.c_sysadm);
        help_subst(buffer, "^variantname", CITADEL);
-       sprintf(buf2, "%d", config.c_maxsessions);
+       snprintf(buf2, sizeof buf2, "%d", config.c_maxsessions);
        help_subst(buffer, "^maxsessions", buf2);
 }
 
@@ -1002,7 +1009,7 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
        char datestamp[SIZ];
        /*                                       */
 
-       sprintf(mid, "%ld", msg_num);
+       snprintf(mid, sizeof mid, "%ld", msg_num);
        nl = (crlf ? "\r\n" : "\n");
 
        if (!is_valid_message(TheMessage)) {
@@ -1080,8 +1087,10 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *TheMessage,
                        if ((is_room_aide())
                            && ((TheMessage->cm_anon_type == MES_ANONONLY)
                             || (TheMessage->cm_anon_type == MES_ANONOPT))) {
-                               sprintf(&display_name[strlen(display_name)],
-                                       " [%s]", buf);
+                               size_t tmp = strlen(display_name);
+                               snprintf(&display_name[tmp],
+                                        sizeof display_name - tmp,
+                                        " [%s]", buf);
                        }
                }
 
@@ -1541,7 +1550,7 @@ long send_message(struct CtdlMessage *msg,        /* pointer to buffer */
 
        /* Get a new message number */
        newmsgid = get_new_message_number();
-       sprintf(msgidbuf, "%ld@%s", newmsgid, config.c_fqdn);
+       snprintf(msgidbuf, sizeof msgidbuf, "%ld@%s", newmsgid, config.c_fqdn);
 
        /* Generate an ID if we don't have one already */
        if (msg->cm_fields['I']==NULL) {
@@ -1733,7 +1742,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
         */
        if (msg->cm_fields['T'] == NULL) {
                lprintf(9, "Generating timestamp\n");
-               sprintf(aaa, "%ld", (long)time(NULL));
+               snprintf(aaa, sizeof aaa, "%ld", (long)time(NULL));
                msg->cm_fields['T'] = strdoop(aaa);
        }
 
@@ -1929,7 +1938,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                
                serialize_message(&smr, msg);
                if (smr.len > 0) {
-                       sprintf(aaa,
+                       snprintf(aaa, sizeof aaa,
                                "./network/spoolin/netmail.%04lx.%04x.%04x",
                                (long) getpid(), CC->cs_pid, ++seqnum);
                        network_fp = fopen(aaa, "wb+");
@@ -1960,7 +1969,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
         if (recps->num_internet > 0) {
                lprintf(9, "Generating delivery instructions\n");
                instr = mallok(SIZ * 2);
-               sprintf(instr,
+               snprintf(instr, SIZ * 2,
                        "Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n"
                        "bounceto|%s@%s\n",
                        SPOOLMIME, newmsgid, (long)time(NULL),
@@ -1968,9 +1977,10 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,      /* message to save */
                );
 
                for (i=0; i<num_tokens(recps->recp_internet, '|'); ++i) {
+                       size_t tmp = strlen(instr);
                        extract(recipient, recps->recp_internet, i);
-                       sprintf(&instr[strlen(instr)],
-                               "remote|%s|0||\n", recipient);
+                       snprintf(&instr[tmp], SIZ * 2 - tmp,
+                                "remote|%s|0||\n", recipient);
                }
 
                imsg = mallok(sizeof(struct CtdlMessage));
@@ -2127,10 +2137,10 @@ static struct CtdlMessage *make_message(
 
        striplt(recipient);
 
-       sprintf(buf, "cit%ld", author->usernum);                /* Path */
+       snprintf(buf, sizeof buf, "cit%ld", author->usernum);   /* Path */
        msg->cm_fields['P'] = strdoop(buf);
 
-       sprintf(buf, "%ld", (long)time(NULL));                  /* timestamp */
+       snprintf(buf, sizeof buf, "%ld", (long)time(NULL));     /* timestamp */
        msg->cm_fields['T'] = strdoop(buf);
 
        if (fake_name[0])                                       /* author */
@@ -2178,29 +2188,29 @@ static struct CtdlMessage *make_message(
  * room.  Returns a *CITADEL ERROR CODE* and puts a message in errmsgbuf, or
  * returns 0 on success.
  */
-int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf) {
+int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf, size_t n) {
 
        if (!(CC->logged_in)) {
-               sprintf(errmsgbuf, "Not logged in.");
+               snprintf(errmsgbuf, n, "Not logged in.");
                return (ERROR + NOT_LOGGED_IN);
        }
 
        if ((CC->usersupp.axlevel < 2)
            && ((CC->quickroom.QRflags & QR_MAILBOX) == 0)) {
-               sprintf(errmsgbuf, "Need to be validated to enter "
+               snprintf(errmsgbuf, n, "Need to be validated to enter "
                                "(except in %s> to sysop)", MAILROOM);
                return (ERROR + HIGHER_ACCESS_REQUIRED);
        }
 
        if ((CC->usersupp.axlevel < 4)
           && (CC->quickroom.QRflags & QR_NETWORK)) {
-               sprintf(errmsgbuf, "Need net privileges to enter here.");
+               snprintf(errmsgbuf, n, "Need net privileges to enter here.");
                return (ERROR + HIGHER_ACCESS_REQUIRED);
        }
 
        if ((CC->usersupp.axlevel < 6)
           && (CC->quickroom.QRflags & QR_READONLY)) {
-               sprintf(errmsgbuf, "Sorry, this is a read-only room.");
+               snprintf(errmsgbuf, n, "Sorry, this is a read-only room.");
                return (ERROR + HIGHER_ACCESS_REQUIRED);
        }
 
@@ -2330,13 +2340,13 @@ struct recptypes *validate_recipients(char *recipients) {
                }
                if (invalid) {
                        if (strlen(ret->errormsg) == 0) {
-                               sprintf(append,
-                                       "Invalid recipient: %s",
-                                       this_recp);
+                               snprintf(append, sizeof append,
+                                        "Invalid recipient: %s",
+                                        this_recp);
                        }
                        else {
-                               sprintf(append, 
-                                       ", %s", this_recp);
+                               snprintf(append, sizeof append,
+                                        ", %s", this_recp);
                        }
                        if ( (strlen(ret->errormsg) + strlen(append)) < SIZ) {
                                strcat(ret->errormsg, append);
@@ -2347,7 +2357,8 @@ struct recptypes *validate_recipients(char *recipients) {
                                strcpy(append, this_recp);
                        }
                        else {
-                               sprintf(append, ", %s", this_recp);
+                               snprintf(append, sizeof append, ", %s",
+                                        this_recp);
                        }
                        if ( (strlen(ret->display_recp)+strlen(append)) < SIZ) {
                                strcat(ret->display_recp, append);
@@ -2399,7 +2410,7 @@ void cmd_ent0(char *entargs)
 
        /* first check to make sure the request is valid. */
 
-       err = CtdlDoIHavePermissionToPostInThisRoom(errmsg);
+       err = CtdlDoIHavePermissionToPostInThisRoom(errmsg, sizeof errmsg);
        if (err) {
                cprintf("%d %s\n", err, errmsg);
                return;
@@ -2863,7 +2874,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
                fprintf(fp, "Content-transfer-encoding: base64\n\n");
                fclose(tempfp);
                fclose(fp);
-               sprintf(cmdbuf, "./base64 -e <%s >>%s",
+               snprintf(cmdbuf, sizeof cmdbuf, "./base64 -e <%s >>%s",
                        tempfilename, filename);
                system(cmdbuf);
        }
index b42b3025bda2e50afd777ac0161f5e2f72c4e40f..fd9389ba4c58541108dd1ea0089f91d51d538db9 100644 (file)
@@ -115,6 +115,6 @@ int CtdlOutputPreLoadedMsg(struct CtdlMessage *,
                int crlf);
 int CtdlCopyMsgToRoom(long msgnum, char *dest);
 int CtdlDoIHavePermissionToDeleteMessagesFromThisRoom(void);
-int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf);
+int CtdlDoIHavePermissionToPostInThisRoom(char *errmsgbuf, size_t n);
 void CtdlSetSeen(long target_msgnum, int target_setting);
 struct recptypes *validate_recipients(char *recipients);
index f24bf8801b5ad5759da027f8845cd23511dbfabb..26de208eb009c31c0e943b1d902773f000003a38 100644 (file)
@@ -47,7 +47,7 @@ char *strerror(int e)
 {
        static char buf[32];
 
-       sprintf(buf,"errno = %d",e);
+       snprintf(buf, sizeof buf, "errno = %d",e);
        return(buf);
        }
 #endif
index 92710f021cdc82d1a9c92f4a6c4064d55d1dad25..a213ce6e13b496c36be2ccef43a49daf6efccefd 100644 (file)
@@ -38,7 +38,7 @@ struct netnode *load_node(char *nodename)
        struct netnode *newnn;
        struct roomshare *newrs;
 
-       sprintf(filename, "./network/systems/%s", nodename);
+       snprintf(filename, sizeof filename, "./network/systems/%s", nodename);
        fp = fopen(filename, "r");
        if (fp == NULL) {
                return NULL;
@@ -76,7 +76,7 @@ void save_node(struct netnode *nnptr)
        char filename[SIZ];
        struct roomshare *rsptr = NULL;
        
-       sprintf(filename, "./network/systems/%s", nnptr->nn_nodename);
+       snprintf(filename, sizeof filename, "./network/systems/%s", nnptr->nn_nodename);
        fp = fopen(filename, "w");
        if (fp == NULL) {
                fprintf(stderr, "%s\n", strerror(errno));
@@ -143,7 +143,7 @@ void add_node(char *NewNodeName)
        FILE *fp;
        char sysfilename[SIZ];
 
-       sprintf(sysfilename, "./network/systems/%s", NewNodeName);
+       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NewNodeName);
 
        fp = fopen(sysfilename, "r");
        if (fp != NULL) {
@@ -172,8 +172,8 @@ void delete_node(char *NodeName)
        char sysfilename[SIZ];
        char spooloutfilename[SIZ];
 
-       sprintf(sysfilename, "./network/systems/%s", NodeName);
-       sprintf(spooloutfilename, "./network/spoolout/%s", NodeName);
+       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NodeName);
+       snprintf(spooloutfilename, sizeof spooloutfilename, "./network/spoolout/%s", NodeName);
 
        fp = fopen(sysfilename, "r");
        if (fp == NULL) {
@@ -200,7 +200,7 @@ void do_roomlist(char *NodeName)
        char sysfilename[SIZ];
        char buf[SIZ];
 
-       sprintf(sysfilename, "./network/systems/%s", NodeName);
+       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NodeName);
 
        fp = fopen(sysfilename, "r");
        if (fp == NULL) {
@@ -228,7 +228,7 @@ void show_spool_cmd(char *NodeName)
        char sysfilename[SIZ];
        char buf[SIZ];
 
-       sprintf(sysfilename, "./network/systems/%s", NodeName);
+       snprintf(sysfilename, sizeof sysfilename, "./network/systems/%s", NodeName);
 
        fp = fopen(sysfilename, "r");
        if (fp == NULL) {
index 5ebefc703c85728e869c23ff6e7c5822f4a915b3..ecaf8d84b0d4192daccca9f8e34ed23605b37ea7 100644 (file)
@@ -192,8 +192,9 @@ int getroom(struct quickroom *qrbuf, char *room_name)
 
        /* If that didn't work, try the user's personal namespace */
        if (cdbqr == NULL) {
-               sprintf(personal_lowercase_name, "%010ld.%s",
-                       CC->usersupp.usernum, lowercase_name);
+               snprintf(personal_lowercase_name,
+                        sizeof personal_lowercase_name, "%010ld.%s",
+                        CC->usersupp.usernum, lowercase_name);
                cdbqr = cdb_fetch(CDB_QUICKROOM,
                                  personal_lowercase_name,
                                  strlen(personal_lowercase_name));
@@ -918,11 +919,11 @@ void cmd_rdir(void)
        cprintf("%d %s|%s/files/%s\n",
        LISTING_FOLLOWS, config.c_fqdn, BBSDIR, CC->quickroom.QRdirname);
 
-        sprintf(buf, "ls %s/files/%s  >%s 2> /dev/null",
+        snprintf(buf, sizeof buf, "ls %s/files/%s  >%s 2> /dev/null",
                 BBSDIR, CC->quickroom.QRdirname, CC->temp);
         system(buf);
 
-       sprintf(buf, "%s/files/%s/filedir", BBSDIR, CC->quickroom.QRdirname);
+       snprintf(buf, sizeof buf, "%s/files/%s/filedir", BBSDIR, CC->quickroom.QRdirname);
        fd = fopen(buf, "r");
        if (fd == NULL)
                fd = fopen("/dev/null", "r");
@@ -931,7 +932,7 @@ void cmd_rdir(void)
        while (fgets(flnm, sizeof flnm, ls) != NULL) {
                flnm[strlen(flnm) - 1] = 0;
                if (strcasecmp(flnm, "filedir")) {
-                       sprintf(buf, "%s/files/%s/%s",
+                       snprintf(buf, sizeof buf, "%s/files/%s/%s",
                                BBSDIR, CC->quickroom.QRdirname, flnm);
                        stat(buf, &statbuf);
                        strcpy(comment, "");
@@ -1081,12 +1082,12 @@ void cmd_setr(char *args)
 
        /* create a room directory if necessary */
        if (CC->quickroom.QRflags & QR_DIRECTORY) {
-               sprintf(buf,
+               snprintf(buf, sizeof buf,
                    "mkdir ./files/%s </dev/null >/dev/null 2>/dev/null",
                        CC->quickroom.QRdirname);
                system(buf);
        }
-       sprintf(buf, "%s> edited by %s\n", CC->quickroom.QRname, CC->curr_user);
+       snprintf(buf, sizeof buf, "%s> edited by %s\n", CC->quickroom.QRname, CC->curr_user);
        aide_message(buf);
        cprintf("%d Ok\n", OK);
 }
@@ -1145,7 +1146,7 @@ void cmd_seta(char *new_ra)
         * the room table, otherwise it would deadlock!
         */
        if (post_notice == 1) {
-               sprintf(buf, "%s is now room aide for %s>\n",
+               snprintf(buf, sizeof buf, "%s is now room aide for %s>\n",
                        usbuf.fullname, CC->quickroom.QRname);
                aide_message(buf);
        }
@@ -1155,9 +1156,10 @@ void cmd_seta(char *new_ra)
 /*
  * Generate an associated file name for a room
  */
-void assoc_file_name(char *buf, struct quickroom *qrbuf, char *prefix)
+void assoc_file_name(char *buf, size_t n,
+                    struct quickroom *qrbuf, const char *prefix)
 {
-       sprintf(buf, "./%s/%ld", prefix, qrbuf->QRnumber);
+       snprintf(buf, n, "./%s/%ld", prefix, qrbuf->QRnumber);
 }
 
 /* 
@@ -1169,7 +1171,7 @@ void cmd_rinf(void)
        char buf[SIZ];
        FILE *info_fp;
 
-       assoc_file_name(filename, &CC->quickroom, "info");
+       assoc_file_name(filename, sizeof filename, &CC->quickroom, "info");
        info_fp = fopen(filename, "r");
 
        if (info_fp == NULL) {
@@ -1197,15 +1199,15 @@ void delete_room(struct quickroom *qrbuf)
        lprintf(9, "Deleting room <%s>\n", qrbuf->QRname);
 
        /* Delete the info file */
-       assoc_file_name(filename, qrbuf, "info");
+       assoc_file_name(filename, sizeof filename, qrbuf, "info");
        unlink(filename);
 
        /* Delete the image file */
-       assoc_file_name(filename, qrbuf, "images");
+       assoc_file_name(filename, sizeof filename, qrbuf, "images");
        unlink(filename);
 
        /* Delete the room's network config file */
-       assoc_file_name(filename, qrbuf, "netconfigs");
+       assoc_file_name(filename, sizeof filename, qrbuf, "netconfigs");
        unlink(filename);
 
        /* Delete the messages in the room
@@ -1292,8 +1294,8 @@ void cmd_kill(char *argbuf)
                usergoto(BASEROOM, 0, NULL, NULL); /* Return to the Lobby */
 
                /* tell the world what we did */
-               sprintf(aaa, "%s> killed by %s\n",
-                       deleted_room_name, CC->curr_user);
+               snprintf(aaa, sizeof aaa, "%s> killed by %s\n",
+                        deleted_room_name, CC->curr_user);
                aide_message(aaa);
                cprintf("%d '%s' deleted.\n", OK, deleted_room_name);
        } else {
@@ -1505,7 +1507,7 @@ void cmd_einf(char *ok)
                cprintf("%d Ok.\n", OK);
                return;
        }
-       assoc_file_name(infofilename, &CC->quickroom, "info");
+       assoc_file_name(infofilename, sizeof infofilename, &CC->quickroom, "info");
        lprintf(9, "opening\n");
        fp = fopen(infofilename, "w");
        lprintf(9, "checking\n");
index 5adab90c45325ddf9478e4b86cd3185ff8fda5ea..573644320018a01a154daecc2f035f16b2085ce8 100644 (file)
@@ -45,7 +45,8 @@ void cmd_kflr (char *argbuf);
 void cmd_eflr (char *argbuf);
 void ForEachRoom(void (*CallBack)(struct quickroom *EachRoom, void *out_data),
        void *in_data);
-void assoc_file_name(char *buf, struct quickroom *qrbuf, char *prefix);
+void assoc_file_name(char *buf, size_t n,
+                    struct quickroom *qrbuf, const char *prefix);
 void delete_room(struct quickroom *qrbuf);
 void list_roomname(struct quickroom *qrbuf);
 int is_noneditable(struct quickroom *qrbuf);
index e8c5256152be100225373debe343d80f0e4bbfb2..164e890c9d9ecd75078c42785b279741f7e25326 100644 (file)
@@ -322,7 +322,7 @@ void cmd_gnet(char *argbuf) {
        FILE *fp;
 
        if (CtdlAccessCheck(ac_room_aide)) return;
-       assoc_file_name(filename, &CC->quickroom, "netconfigs");
+       assoc_file_name(filename, sizeof filename, &CC->quickroom, "netconfigs");
        cprintf("%d Network settings for room #%ld <%s>\n",
                LISTING_FOLLOWS,
                CC->quickroom.QRnumber, CC->quickroom.QRname);
@@ -348,7 +348,7 @@ void cmd_snet(char *argbuf) {
 
        if (CtdlAccessCheck(ac_room_aide)) return;
        safestrncpy(tempfilename, tmpnam(NULL), sizeof tempfilename);
-       assoc_file_name(filename, &CC->quickroom, "netconfigs");
+       assoc_file_name(filename, sizeof filename, &CC->quickroom, "netconfigs");
 
        fp = fopen(tempfilename, "w");
        if (fp == NULL) {
@@ -571,7 +571,7 @@ void network_spoolout_room(char *room_to_spool) {
        }
 
        memset(&sc, 0, sizeof(struct SpoolControl));
-       assoc_file_name(filename, &CC->quickroom, "netconfigs");
+       assoc_file_name(filename, sizeof filename, &CC->quickroom, "netconfigs");
 
        fp = fopen(filename, "r");
        if (fp == NULL) {