Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/man Handle '_crunch' section.
details: https://anonhg.NetBSD.org/src/rev/b58312997329
branches: trunk
changeset: 471547:b58312997329
user: dante <dante%NetBSD.org@localhost>
date: Sun Apr 04 16:57:36 1999 +0000
description:
Handle '_crunch' section.
Add removelist() function
Add renamelist() function
diffstat:
usr.bin/man/config.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
usr.bin/man/config.h | 4 +++-
2 files changed, 44 insertions(+), 9 deletions(-)
diffs (93 lines):
diff -r d9c98b1967ec -r b58312997329 usr.bin/man/config.c
--- a/usr.bin/man/config.c Sun Apr 04 16:52:34 1999 +0000
+++ b/usr.bin/man/config.c Sun Apr 04 16:57:36 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.c,v 1.9 1998/11/06 22:33:47 christos Exp $ */
+/* $NetBSD: config.c,v 1.10 1999/04/04 16:57:36 dante Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)config.c 8.8 (Berkeley) 1/31/95";
#else
-__RCSID("$NetBSD: config.c,v 1.9 1998/11/06 22:33:47 christos Exp $");
+__RCSID("$NetBSD: config.c,v 1.10 1999/04/04 16:57:36 dante Exp $");
#endif
#endif /* not lint */
@@ -110,13 +110,14 @@
tp = addlist(p);
/*
- * Attach new records. The keyword _build takes the rest of
- * the line as a single entity, everything else is white
- * space separated. The reason we're not just using strtok(3)
- * for all of the parsing is so we don't get caught if a line
- * has only a single token on it.
+ * Attach new records. The keywords _build and _crunch takes
+ * the rest of the line as a single entity, everything else is
+ * whitespace separated.
+ * The reason we're not just using strtok(3) for all of the
+ * parsing is so we don't get caught if a line has only a
+ * single token on it.
*/
- if (!strcmp(p, "_build")) {
+ if (!strcmp(p, "_build") || !strcmp(p, "_crunch")) {
while (*++t && isspace((unsigned char)*t));
if ((ep = malloc(sizeof(ENTRY))) == NULL ||
(ep->s = strdup(t)) == NULL)
@@ -168,6 +169,38 @@
}
void
+removelist(name)
+ char *name;
+{
+ TAG *tp;
+ ENTRY *ep;
+
+ tp = getlist(name);
+ while ((ep = tp->list.tqh_first) != NULL) {
+ free(ep->s);
+ TAILQ_REMOVE(&tp->list, ep, q);
+ }
+ free(tp->s);
+ TAILQ_REMOVE(&head, tp, q);
+
+}
+
+TAG *
+renamelist(oldname, newname)
+ char *oldname;
+ char *newname;
+{
+ TAG *tp;
+
+ if(!(tp = getlist(oldname)))
+ return (NULL);
+ free(tp->s);
+ if(!(tp->s = strdup(newname)))
+ err(1, "malloc");
+ return (tp);
+}
+
+void
debug(l)
char *l;
{
diff -r d9c98b1967ec -r b58312997329 usr.bin/man/config.h
--- a/usr.bin/man/config.h Sun Apr 04 16:52:34 1999 +0000
+++ b/usr.bin/man/config.h Sun Apr 04 16:57:36 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config.h,v 1.2 1995/09/28 06:05:28 tls Exp $ */
+/* $NetBSD: config.h,v 1.3 1999/04/04 16:57:36 dante Exp $ */
/*-
* Copyright (c) 1993
@@ -57,3 +57,5 @@
void config __P((char *));
void debug __P((char *));
TAG *getlist __P((char *));
+void removelist __P((char *));
+TAG *renamelist __P((char *, char *));
Home |
Main Index |
Thread Index |
Old Index