summaryrefslogtreecommitdiff
path: root/usr.bin/m4/misc.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-03-11 15:54:45 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-03-11 15:54:45 +0000
commitd7d5044e2ea6ec17428055f7a436dfe704ec1fb7 (patch)
tree21d4a2a719735a47b678a8ef6ad9186cd7aeda53 /usr.bin/m4/misc.c
parent707f7f6570f648e1885c1617c09fabdc49b48e09 (diff)
Add a few builtins for greater compatibility with gnu-m4, and extended
functionality. * regular expressions, * line-number reporting * `meta'-macros, builtin and indir. Reviewed by pjanzen@, tested by fries@ and a few others.
Diffstat (limited to 'usr.bin/m4/misc.c')
-rw-r--r--usr.bin/m4/misc.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c
index 68bf5b4ae3a..8858bad5e4c 100644
--- a/usr.bin/m4/misc.c
+++ b/usr.bin/m4/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.17 2000/01/15 14:26:00 espie Exp $ */
+/* $OpenBSD: misc.c,v 1.18 2000/03/11 15:54:44 espie Exp $ */
/* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */
/*
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: misc.c,v 1.17 2000/01/15 14:26:00 espie Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.18 2000/03/11 15:54:44 espie Exp $";
#endif
#endif /* not lint */
@@ -142,6 +142,18 @@ pbnum(n)
putback('-');
}
+/*
+ * pbunsigned - convert unsigned long to string, push back on input.
+ */
+void
+pbunsigned(n)
+ unsigned long n;
+{
+ do {
+ putback(n % 10 + '0');
+ }
+ while ((n /= 10) > 0);
+}
void
initspaces()
@@ -269,7 +281,7 @@ killdiv()
}
}
-char *
+void *
xalloc(n)
size_t n;
{
@@ -334,3 +346,17 @@ release_input(f)
* error information pointing to it.
*/
}
+
+void
+doprintlineno(f)
+ struct input_file *f;
+{
+ pbunsigned(f->lineno);
+}
+
+void
+doprintfilename(f)
+ struct input_file *f;
+{
+ pbstr(f->name);
+}