INN commit: trunk/nnrpd (group.c list.c)
INN Commit
Russ_Allbery at isc.org
Tue Sep 16 19:37:47 UTC 2008
Date: Tuesday, September 16, 2008 @ 12:37:47
Author: iulius
Revision: 8028
LIST HEADERS and LIST NEWSGROUPS are mandatory.
Prettier answers.
Modified:
trunk/nnrpd/group.c
trunk/nnrpd/list.c
---------+
group.c | 2 +-
list.c | 30 ++++++++++++++++--------------
2 files changed, 17 insertions(+), 15 deletions(-)
Modified: group.c
===================================================================
--- group.c 2008-09-16 19:04:12 UTC (rev 8027)
+++ group.c 2008-09-16 19:37:47 UTC (rev 8028)
@@ -279,7 +279,7 @@
/* Open the file, get ready to scan. */
if ((qp = QIOopen(NEWSGROUPS)) == NULL) {
- syslog(L_ERROR, "%s cant open %s %m", Client.host, NEWSGROUPS);
+ syslog(L_ERROR, "%s can't open %s %m", Client.host, NEWSGROUPS);
Printf("%d Can't open %s\r\n", NNTP_FAIL_XGTITLE, NEWSGROUPS);
return;
}
Modified: list.c
===================================================================
--- list.c 2008-09-16 19:04:12 UTC (rev 8027)
+++ list.c 2008-09-16 19:37:47 UTC (rev 8028)
@@ -41,7 +41,7 @@
"Distributions in form \"area description\""
};
static LISTINFO INFOheaders = {
- "HEADERS", NULL, cmd_list_headers, false, "supported headers and metadata",
+ "HEADERS", NULL, cmd_list_headers, true, "supported headers and metadata",
"Headers and metadata items supported"
};
static LISTINFO INFOsubs = {
@@ -57,7 +57,7 @@
"Supported NNTP extensions"
};
static LISTINFO INFOgroups = {
- "NEWSGROUPS", INN_PATH_NEWSGROUPS, NULL, false, "newsgroup descriptions",
+ "NEWSGROUPS", INN_PATH_NEWSGROUPS, NULL, true, "newsgroup descriptions",
"Descriptions in form \"group description\""
};
static LISTINFO INFOmoderators = {
@@ -185,8 +185,9 @@
return false;
}
if (OVgroupstats(group, &lo, &hi, NULL, &flag) && flag != '=') {
- Reply("%d %s.\r\n", NNTP_OK_LIST, INFOactive.Format);
- Printf("%s %010u %010u %c\r\n.\r\n", group, hi, lo, flag);
+ Reply("%d %s\r\n", NNTP_OK_LIST, INFOactive.Format);
+ Printf("%s %010u %010u %c\r\n", group, hi, lo, flag);
+ Printf(".\r\n");
return true;
}
return false;
@@ -194,7 +195,7 @@
/*
-** List active newsgroups, newsgroup descriptions, and distributions.
+** Main LIST function.
*/
void
CMDlist(int ac, char *av[])
@@ -226,8 +227,8 @@
}
/* If no defined LIST keyword is found, we return. */
if (lp == NULL) {
- Reply("%s\r\n", NNTP_SYNTAX_USE);
- return;
+ Reply("%d Unknown LIST keyword\r\n", NNTP_ERR_SYNTAX);
+ return;
}
if (lp == &INFOactive) {
@@ -245,8 +246,8 @@
/* Three arguments can be passed only when ACTIVE, ACTIVE.TIMES,
* HEADERS or NEWSGROUPS keywords are used. */
if (ac > 2 && !wildarg) {
- Reply("%s\r\n", NNTP_SYNTAX_USE);
- return;
+ Reply("%d Unexpected wildmat\r\n", NNTP_ERR_SYNTAX);
+ return;
}
/* If a function is provided for the given keyword, we call it. */
@@ -264,18 +265,19 @@
qp = QIOopen(path);
free(path);
if (qp == NULL) {
- Reply("%d No list of %s available.\r\n",
+ Reply("%d No list of %s available\r\n",
NNTP_ERR_UNAVAILABLE, lp->Items);
- /* Only the active and overview.fmt files are required (but the last
- * one has already called cmd_list_schema). */
+ /* Only the active, newsgroups and overview.fmt files are required
+ * (but the last one has already called cmd_list_schema).
+ * LIST HEADERS has also called its own function cmd_list_headers. */
if (lp->Required || errno != ENOENT) {
/* %m outputs strerror(errno). */
- syslog(L_ERROR, "%s cant fopen %s %m", Client.host, lp->File);
+ syslog(L_ERROR, "%s can't fopen %s %m", Client.host, lp->File);
}
return;
}
- Reply("%d %s.\r\n", NNTP_OK_LIST, lp->Format);
+ Reply("%d %s\r\n", NNTP_OK_LIST, lp->Format);
if (!PERMspecified) {
/* Optimize for unlikely case of no permissions and false default. */
QIOclose(qp);
More information about the inn-committers
mailing list