X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fnetconf.c;h=caecca46f42681401be6e724d4067d40fd0a8864;hb=efccdcf4db04e63bfa3512c80215357ee9ffd98f;hp=107328a7c988cb26fe412ee8a10b5581144e1844;hpb=f5c1330914acc193f96892efc191a32ee537dfb5;p=citadel.git diff --git a/webcit/netconf.c b/webcit/netconf.c index 107328a7c..caecca46f 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -78,7 +78,6 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP) HashList *Hash; char nnn[64]; char buf[SIZ]; - long len; int nUsed; NodeConf *Node; @@ -88,14 +87,13 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP) Hash = NewHash(1, NULL); Buf = NewStrBuf(); - while ((len = StrBuf_ServGetln(Buf), - strcmp(ChrPtr(Buf), "000"))) { + while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) { Node = NewNode(Buf); - if (Node == NULL) - continue; - nUsed = GetCount(Hash); - nUsed = snprintf(nnn, sizeof(nnn), "%d", nUsed+1); - Put(Hash, nnn, nUsed, Node, DeleteNodeConf); + if (Node != NULL) { + nUsed = GetCount(Hash); + nUsed = snprintf(nnn, sizeof(nnn), "%d", nUsed+1); + Put(Hash, nnn, nUsed, Node, DeleteNodeConf); + } } FreeStrBuf(&Buf); return Hash; @@ -155,7 +153,7 @@ void edit_node(void) { Index = sbstr("index"); NewNode = HttpGetNewNode(); if ((NewNode == NULL) || (Index == NULL)) { - sprintf(WC->ImportantMessage, _("Invalid Parameter")); + AppendImportantMessage(_("Invalid Parameter"), -1); url_do_template(); return; } @@ -182,7 +180,7 @@ void display_edit_node(void) Index = sbstr("index"); if (Index == NULL) { - sprintf(WC->ImportantMessage, _("Invalid Parameter")); + AppendImportantMessage(_("Invalid Parameter"), -1); url_do_template(); return; } @@ -190,7 +188,7 @@ void display_edit_node(void) NodeConfig = load_netconf(NULL, &NoCtx); if (!GetHash(NodeConfig, ChrPtr(Index), StrLength(Index), &vNode) || (vNode == NULL)) { - sprintf(WC->ImportantMessage, _("Invalid Parameter")); + AppendImportantMessage(_("Invalid Parameter"), -1); url_do_template(); DeleteHash(&NodeConfig); return; @@ -238,7 +236,7 @@ void delete_node(void) Index = sbstr("index"); if (Index == NULL) { - sprintf(WC->ImportantMessage, _("Invalid Parameter")); + AppendImportantMessage(_("Invalid Parameter"), -1); url_do_template(); return; } @@ -246,7 +244,7 @@ void delete_node(void) NodeConfig = load_netconf(NULL, &NoCtx); if (!GetHash(NodeConfig, ChrPtr(Index), StrLength(Index), &vNode) || (vNode == NULL)) { - sprintf(WC->ImportantMessage, _("Invalid Parameter")); + AppendImportantMessage(_("Invalid Parameter"), -1); url_do_template(); DeleteHash(&NodeConfig); return;