X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fnetconf.c;h=caecca46f42681401be6e724d4067d40fd0a8864;hb=efccdcf4db04e63bfa3512c80215357ee9ffd98f;hp=09cfb9d111e4cf1a09c63c7e4ebd2c42bf3960c4;hpb=137e0f86bf37be3b34c86ec5e31c86c054ab5412;p=citadel.git diff --git a/webcit/netconf.c b/webcit/netconf.c index 09cfb9d11..caecca46f 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -1,12 +1,3 @@ -/* - * $Id$ - */ -/** - * \defgroup NetShareConf Functions which handle network and sharing configuration. - * - * \ingroup CitadelConfig - */ -/*@{*/ #include "webcit.h" void display_netconf(void); @@ -87,7 +78,6 @@ HashList *load_netconf(StrBuf *Target, WCTemplputParams *TP) HashList *Hash; char nnn[64]; char buf[SIZ]; - long len; int nUsed; NodeConf *Node; @@ -97,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; @@ -152,8 +141,8 @@ void save_net_conf(HashList *Nodelist) -/** - * \brief edit a network node +/* + * edit a network node */ void edit_node(void) { HashList *NodeConfig; @@ -164,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; } @@ -178,8 +167,8 @@ void edit_node(void) { } -/** - * \brief modify an existing node +/* + * modify an existing node */ void display_edit_node(void) { @@ -191,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; } @@ -199,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; @@ -218,16 +207,16 @@ void display_edit_node(void) } -/** - * \brief display all configured nodes +/* + * display all configured nodes */ void display_netconf(void) { wDumpContent(1); } -/** - * \brief display the dialog to verify the deletion +/* + * display the dialog to verify the deletion */ void display_confirm_delete_node(void) { @@ -235,8 +224,8 @@ void display_confirm_delete_node(void) } -/** - * \brief actually delete the node +/* + * actually delete the node */ void delete_node(void) { @@ -247,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; } @@ -255,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; @@ -313,4 +302,3 @@ InitModule_NETCONF RegisterIterator("NODECONFIG", 0, NULL, load_netconf, NULL, DeleteHash, CTX_NODECONF, CTX_NONE, IT_NOFLAG); } -/*@}*/