INN commit: trunk (11 files)
INN Commit
rra at isc.org
Thu Feb 4 22:15:28 UTC 2010
Date: Thursday, February 4, 2010 @ 14:15:27
Author: iulius
Revision: 8944
Do not hide "j" and "x" status in LIST ACTIVE answers.
Use NF_FLAG_* macro instead of hard-coded chars for the status
of a newsgroup.
Modified:
trunk/backends/actsync.c
trunk/frontends/ctlinnd.c
trunk/include/inn/options.h
trunk/innd/art.c
trunk/nnrpd/list.c
trunk/nnrpd/post.c
trunk/storage/ovdb/ovdb.c
trunk/storage/tradindexed/tdx-util.c
trunk/tests/overview/api-t.c
trunk/tests/overview/overview-t.c
trunk/tests/overview/xref-t.c
--------------------------------+
backends/actsync.c | 74 +++++++++++++++++++--------------------
frontends/ctlinnd.c | 4 +-
include/inn/options.h | 19 ++++++----
innd/art.c | 4 +-
nnrpd/list.c | 18 +--------
nnrpd/post.c | 2 -
storage/ovdb/ovdb.c | 2 -
storage/tradindexed/tdx-util.c | 2 -
tests/overview/api-t.c | 7 ++-
tests/overview/overview-t.c | 7 ++-
tests/overview/xref-t.c | 2 -
11 files changed, 69 insertions(+), 72 deletions(-)
Modified: backends/actsync.c
===================================================================
--- backends/actsync.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ backends/actsync.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -1012,16 +1012,16 @@
/* check for a bad group type */
switch (cur->type[0]) {
- case 'y':
+ case NF_FLAG_OK:
/* of COURSE: collabra has incompatible flags. but it */
/* looks like they can be fixed easily enough. */
if (cur->type[1] == 'g') {
cur->type[1] = '\0';
}
- case 'm':
- case 'j':
- case 'n':
- case 'x':
+ case NF_FLAG_MODERATED:
+ case NF_FLAG_JUNK:
+ case NF_FLAG_NOLOCAL:
+ case NF_FLAG_IGNORE:
if (cur->type[1] != '\0') {
if (!QUIET(hostid))
warn("line %d <%s> from %s has a bad newsgroup type",
@@ -1029,7 +1029,7 @@
cur->ignore |= ERROR_BADTYPE;
}
break;
- case '=':
+ case NF_FLAG_ALIAS:
if (cur->type[1] == '\0') {
if (!QUIET(hostid))
warn("line %d <%s> from %s has an empty =group name",
@@ -1049,7 +1049,7 @@
}
/* if an = type, check for bad = name */
- if (cur->type[0] == '=' && bad_grpname(&(cur->type[1]), num_check)) {
+ if (cur->type[0] == NF_FLAG_ALIAS && bad_grpname(&(cur->type[1]), num_check)) {
if (!QUIET(hostid))
warn("line %d <%s> from %s is equivalenced to a bad name:"
" <%s>", cnt+1, cur->name, host,
@@ -1059,7 +1059,7 @@
}
/* if an = type, check for long = name if requested */
- if (cur->type[0] == '=' && s_flag > 0 &&
+ if (cur->type[0] == NF_FLAG_ALIAS && s_flag > 0 &&
strlen(&(cur->type[1])) > (size_t)s_flag) {
if (!QUIET(hostid))
warn("line %d <%s> from %s is equivalenced to a long name:"
@@ -1345,18 +1345,18 @@
/* ensure that this next token is a valid type */
switch (p[0]) {
- case 'y':
- case 'm':
- case 'j':
- case 'n':
- case 'x':
+ case NF_FLAG_OK:
+ case NF_FLAG_MODERATED:
+ case NF_FLAG_JUNK:
+ case NF_FLAG_NOLOCAL:
+ case NF_FLAG_IGNORE:
if (p[1] != '\0') {
warn("field %d on line %d of %s not a valid type",
i, linenum, filename);
die("valid types are a char from [ymnjx=] or =name");
}
break;
- case '=':
+ case NF_FLAG_ALIAS:
break;
default:
warn("field %d on line %d of %s is not a valid type",
@@ -1368,12 +1368,12 @@
cur->type_match = 1;
/* ensure that type is not a duplicate */
- if ((p[0] == 'y' && cur->y_type) ||
- (p[0] == 'm' && cur->m_type) ||
- (p[0] == 'n' && cur->n_type) ||
- (p[0] == 'j' && cur->j_type) ||
- (p[0] == 'x' && cur->x_type) ||
- (p[0] == '=' && cur->eq_type)) {
+ if ((p[0] == NF_FLAG_OK && cur->y_type) ||
+ (p[0] == NF_FLAG_MODERATED && cur->m_type) ||
+ (p[0] == NF_FLAG_NOLOCAL && cur->n_type) ||
+ (p[0] == NF_FLAG_JUNK && cur->j_type) ||
+ (p[0] == NF_FLAG_IGNORE && cur->x_type) ||
+ (p[0] == NF_FLAG_ALIAS && cur->eq_type)) {
warn("only one %c type allowed per line", p[0]);
die("field %d on line %d of %s is a duplicate type",
i, linenum, filename);
@@ -1381,24 +1381,24 @@
/* note what we have seen */
switch (p[0]) {
- case 'y':
+ case NF_FLAG_OK:
cur->y_type = 1;
break;
- case 'm':
+ case NF_FLAG_MODERATED:
cur->m_type = 1;
break;
- case 'j':
+ case NF_FLAG_JUNK:
cur->j_type = 1;
break;
- case 'n':
+ case NF_FLAG_NOLOCAL:
cur->n_type = 1;
break;
- case 'x':
+ case NF_FLAG_IGNORE:
cur->x_type = 1;
break;
- case '=':
+ case NF_FLAG_ALIAS:
cur->eq_type = 1;
- if (p[0] == '=' && p[1] != '\0')
+ if (p[0] == NF_FLAG_ALIAS && p[1] != '\0')
cur->epat = xstrdup(p + 1);
break;
}
@@ -1470,22 +1470,22 @@
/* specific type required, check for match */
switch (gp->type[0]) {
- case 'y':
+ case NF_FLAG_OK:
if (! pp->y_type) continue; /* pattern does not apply */
break;
- case 'm':
+ case NF_FLAG_MODERATED:
if (! pp->m_type) continue; /* pattern does not apply */
break;
- case 'n':
+ case NF_FLAG_NOLOCAL:
if (! pp->n_type) continue; /* pattern does not apply */
break;
- case 'j':
+ case NF_FLAG_JUNK:
if (! pp->j_type) continue; /* pattern does not apply */
break;
- case 'x':
+ case NF_FLAG_IGNORE:
if (! pp->x_type) continue; /* pattern does not apply */
break;
- case '=':
+ case NF_FLAG_ALIAS:
if (! pp->eq_type) continue; /* pattern does not apply */
if (pp->epat != NULL && !uwildmat(&gp->type[1], pp->epat)) {
/* equiv pattern doesn't match, patt does not apply */
@@ -2353,7 +2353,7 @@
if (grp[i].hostid == hostid &&
! IS_ERROR(grp[i].ignore) &&
grp[i].type != NULL &&
- grp[i].type[0] == '=') {
+ grp[i].type[0] == NF_FLAG_ALIAS) {
++eq_cnt;
}
}
@@ -2371,7 +2371,7 @@
if (grp[i].hostid == hostid &&
! IS_ERROR(grp[i].ignore) &&
grp[i].type != NULL &&
- grp[i].type[0] == '=') {
+ grp[i].type[0] == NF_FLAG_ALIAS) {
/* initialize record */
eqgrp[j].skip = 0;
@@ -2436,7 +2436,7 @@
}
/* if =group refers to a valid group, we are done with it */
- if (grp[i].type != NULL && grp[i].type[0] != '=') {
+ if (grp[i].type != NULL && grp[i].type[0] != NF_FLAG_ALIAS) {
eqgrp[j].skip = 1;
--new_eq_cnt;
/* otherwise note the equiv name */
@@ -2569,7 +2569,7 @@
exit(43);
}
- /* if non-empty line doesn't start with 'y' or 'Y', skip command */
+ /* If non-empty line doesn't start with 'y' or 'Y', skip command. */
if (buf[0] != 'y' && buf[0] != 'Y' && buf[0] != '\n') {
/* indicate nothing was done */
return 0;
Modified: frontends/ctlinnd.c
===================================================================
--- frontends/ctlinnd.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ frontends/ctlinnd.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -180,7 +180,7 @@
int main(int ac, char *av[])
{
- static char Y[] = "y";
+ static char Y[] = NF_FLAG_OK_STRING;
static char EMPTY[] = "";
COMMAND *cp;
char *p;
@@ -289,7 +289,7 @@
Usage("Bad group mode");
/* NOTREACHED */
case NF_FLAG_ALIAS:
- case NF_FLAG_EXCLUDED:
+ case NF_FLAG_JUNK:
case NF_FLAG_MODERATED:
case NF_FLAG_OK:
case NF_FLAG_NOLOCAL:
Modified: include/inn/options.h
===================================================================
--- include/inn/options.h 2010-02-04 21:29:48 UTC (rev 8943)
+++ include/inn/options.h 2010-02-04 22:15:27 UTC (rev 8944)
@@ -173,13 +173,20 @@
#define MAX_BUILTIN_ARGV 20
/* active file flags. Should be moved to a more specific header file. */
-#define NF_FLAG_ALIAS '='
-#define NF_FLAG_EXCLUDED 'j'
-#define NF_FLAG_MODERATED 'm'
-#define NF_FLAG_OK 'y'
-#define NF_FLAG_NOLOCAL 'n'
-#define NF_FLAG_IGNORE 'x'
+#define NF_FLAG_ALIAS '='
+#define NF_FLAG_JUNK 'j'
+#define NF_FLAG_MODERATED 'm'
+#define NF_FLAG_OK 'y'
+#define NF_FLAG_NOLOCAL 'n'
+#define NF_FLAG_IGNORE 'x'
+#define NF_FLAG_ALIAS_STRING "="
+#define NF_FLAG_JUNK_STRING "j"
+#define NF_FLAG_MODERATED_STRING "m"
+#define NF_FLAG_OK_STRING "y"
+#define NF_FLAG_NOLOCAL_STRING "n"
+#define NF_FLAG_IGNORE_STRING "x"
+
/* Used for parsing the Newsgroups: header. Should be rolled into a library
for parsing headers, combining all the code that's currently scattered
all over INN for doing that. */
Modified: innd/art.c
===================================================================
--- innd/art.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ innd/art.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -2351,8 +2351,8 @@
}
}
- /* If it's excluded, don't file it. */
- if (ngp->Rest[0] == NF_FLAG_EXCLUDED)
+ /* If it's junk, don't file it. */
+ if (ngp->Rest[0] == NF_FLAG_JUNK)
continue;
/* Expand aliases, mark the article as getting filed in the group. */
Modified: nnrpd/list.c
===================================================================
--- nnrpd/list.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ nnrpd/list.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -149,10 +149,7 @@
if (!PERMmatch(PERMreadlist, grplist))
return false;
}
- if (OVgroupstats(group, &lo, &hi, &count, &flag) && flag != '=') {
- /* Convert flags to standardized ones, if possible. */
- if (flag == 'j' || flag == 'x')
- flag = 'n';
+ if (OVgroupstats(group, &lo, &hi, &count, &flag) && flag != NF_FLAG_ALIAS) {
/* When a newsgroup is empty, the high water mark should be one less
* than the low water mark according to RFC 3977. */
if (count == 0)
@@ -327,12 +324,12 @@
if (count == 0)
lo = hi + 1;
- if (flag != '=') {
+ if (flag != NF_FLAG_ALIAS) {
Printf("%s %u %u %u %c\r\n", p, hi, lo, count, flag);
} else if (savec != '\0') {
*save = savec;
- if ((q = strrchr(p, '=')) != NULL) {
+ if ((q = strrchr(p, NF_FLAG_ALIAS)) != NULL) {
*save = '\0';
Printf("%s %u %u %u %s\r\n", p, hi, lo, count, q);
}
@@ -345,15 +342,6 @@
if (savec != '\0')
*save = savec;
- if (lp == &INFOactive) {
- /* Convert flags to standardized ones, if possible. */
- if ((q = strrchr(p, ' ')) != NULL) {
- q++;
- if (*q == 'j' || *q == 'x')
- *q = 'n';
- }
- }
-
Printf("%s\r\n", p);
}
QIOclose(qp);
Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ nnrpd/post.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -773,7 +773,7 @@
snprintf(Error, sizeof(Error),
"Postings to \"%s\" are not allowed here", p);
break;
- case NF_FLAG_EXCLUDED:
+ case NF_FLAG_JUNK:
/* Do NOT return an error. */
break;
case NF_FLAG_ALIAS:
Modified: storage/ovdb/ovdb.c
===================================================================
--- storage/ovdb/ovdb.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ storage/ovdb/ovdb.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -1807,7 +1807,7 @@
return false;
}
- if(*flag == '=') {
+ if(*flag == NF_FLAG_ALIAS) {
key.data = (char *) group;
key.size = strlen(group);
val.data = flag + 1;
Modified: storage/tradindexed/tdx-util.c
===================================================================
--- storage/tradindexed/tdx-util.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ storage/tradindexed/tdx-util.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -295,7 +295,7 @@
die("cannot open group index");
entry = tdx_index_entry(index, group);
if (entry == NULL) {
- if (!tdx_index_add(index, group, 1, 0, "y"))
+ if (!tdx_index_add(index, group, 1, 0, NF_FLAG_OK_STRING))
die("cannot create group %s", group);
entry = tdx_index_entry(index, group);
if (entry == NULL)
Modified: tests/overview/api-t.c
===================================================================
--- tests/overview/api-t.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ tests/overview/api-t.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -158,7 +158,7 @@
char buffer[4096];
char *start;
unsigned long artnum;
- struct overview_group stats = { 0, 0, 0, 'y' };
+ struct overview_group stats = { 0, 0, 0, NF_FLAG_OK };
struct overview_data article;
/* Run through the overview data. Each time we see a group, we update our
@@ -251,8 +251,9 @@
stats.count, group->count);
verify->status = false;
}
- if (stats.flag != 'y') {
- warn("Flag wrong for %s: %c != y", group->group, stats.flag);
+ if (stats.flag != NF_FLAG_OK) {
+ warn("Flag wrong for %s: %c != %c", group->group, stats.flag,
+ NF_FLAG_OK);
verify->status = false;
}
}
Modified: tests/overview/overview-t.c
===================================================================
--- tests/overview/overview-t.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ tests/overview/overview-t.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -166,7 +166,7 @@
struct group *group;
FILE *overview;
char buffer[4096];
- char flag[] = "y";
+ char flag[] = NF_FLAG_OK_STRING;
char *start;
unsigned long artnum;
@@ -247,8 +247,9 @@
(unsigned long) count, group->count);
*status = false;
}
- if (flag != 'y') {
- warn("Flag wrong for %s: %c != y", group->group, (char) flag);
+ if (flag != NF_FLAG_OK) {
+ warn("Flag wrong for %s: %c != %c", group->group, (char) flag,
+ NF_FLAG_OK);
*status = false;
}
}
Modified: tests/overview/xref-t.c
===================================================================
--- tests/overview/xref-t.c 2010-02-04 21:29:48 UTC (rev 8943)
+++ tests/overview/xref-t.c 2010-02-04 22:15:27 UTC (rev 8944)
@@ -180,7 +180,7 @@
{
int n, count;
struct overview *overview;
- struct overview_group group = { 0, 0, 0, 'y' };
+ struct overview_group group = { 0, 0, 0, NF_FLAG_OK };
bool value;
char *article, *wire;
size_t size;
More information about the inn-committers
mailing list