2011/01/17 18:11:10,usr.bin/ldd
2012/02/10 16:16:12,usr.bin/login
2012/10/17 12:00:00,usr.bin/lorder
-2010/05/14 17:14:28,usr.bin/m4
+2012/10/17 12:00:00,usr.bin/m4
2012/03/31 00:12:24,usr.bin/make
2012/10/17 12:00:00,usr.bin/Makefile
2012/10/17 12:00:00,usr.bin/Makefile.inc
CLEANFILES+=parser.c parser.h tokenizer.o
-# LSC Until it compiles cleanly...
-NOGCCERROR:=yes
-
.include <bsd.prog.mk>
/* $OpenBSD: eval.c,v 1.66 2008/08/21 21:01:47 espie Exp $ */
-/* $NetBSD: eval.c,v 1.20 2009/10/26 21:11:28 christos Exp $ */
+/* $NetBSD: eval.c,v 1.22 2011/08/21 23:38:43 dholland Exp $ */
/*
* Copyright (c) 1989, 1993
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: eval.c,v 1.20 2009/10/26 21:11:28 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.22 2011/08/21 23:38:43 dholland Exp $");
#include <sys/types.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
+#include <stdint.h>
#include <string.h>
#include <fcntl.h>
#include "mdef.h"
*/
if (argc > 2) {
for (n = 2; n < argc; n++)
- fprintf(stderr, "%s ", argv[n]);
- fprintf(stderr, "\n");
+ fprintf(stderr, "%s%s",
+ mimic_gnu && n == 2 ? "" : " ",
+ argv[n]);
+ if (!mimic_gnu)
+ fprintf(stderr, "\n");
}
break;
/* $OpenBSD: extern.h,v 1.49 2009/10/14 17:19:47 sthen Exp $ */
-/* $NetBSD: extern.h,v 1.14 2009/10/26 21:12:47 christos Exp $ */
+/* $NetBSD: extern.h,v 1.16 2012/03/15 02:02:23 joerg Exp $ */
/*-
* Copyright (c) 1991, 1993
extern ptrdiff_t indx(const char *, const char *);
extern void initspaces(void);
extern void killdiv(void);
-extern void onintr(int);
extern void pbnum(int);
extern void pbnumbase(int, int, int);
extern void pbunsigned(unsigned long);
extern void pbstr(const char *);
extern void pushback(int);
-extern void *xalloc(size_t, const char *fmt, ...);
-extern void *xrealloc(void *, size_t, const char *fmt, ...);
+extern void *xalloc(size_t, const char *fmt, ...) __printflike(2, 3);
+extern void *xrealloc(void *, size_t, const char *fmt, ...)
+ __printflike(3, 4);
extern char *xstrdup(const char *);
-extern void usage(void);
extern void resizedivs(int);
extern size_t buffer_mark(void);
extern void dump_buffer(FILE *, size_t);
-extern void __dead m4errx(int, const char *, ...);
+extern void __dead m4errx(int, const char *, ...) __printflike(2, 3);
extern int obtain_char(struct input_file *);
extern void set_input(struct input_file *, FILE *, const char *);
-/* $NetBSD: gnum4.c,v 1.7 2009/10/26 21:16:49 christos Exp $ */
+/* $NetBSD: gnum4.c,v 1.9 2012/03/20 20:34:58 matt Exp $ */
/* $OpenBSD: gnum4.c,v 1.39 2008/08/21 21:01:04 espie Exp $ */
/*
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: gnum4.c,v 1.7 2009/10/26 21:16:49 christos Exp $");
+__RCSID("$NetBSD: gnum4.c,v 1.9 2012/03/20 20:34:58 matt Exp $");
#include <sys/param.h>
#include <sys/types.h>
}
static void
-ensure_m4path()
+ensure_m4path(void)
{
static int envpathdone = 0;
char *envpath;
static void addchar(int);
static char *twiddle(const char *);
static char *getstring(void);
-static void exit_regerror(int, regex_t *);
+static void exit_regerror(int, regex_t *) __dead;
static void do_subst(const char *, regex_t *, const char *, regmatch_t *);
static void do_regexpindex(const char *, regex_t *, regmatch_t *);
static void do_regexp(const char *, regex_t *, const char *, regmatch_t *);
}
static char *
-getstring()
+getstring(void)
{
addchar('\0');
current = 0;
-/* $NetBSD: look.c,v 1.11 2009/10/26 21:11:28 christos Exp $ */
+/* $NetBSD: look.c,v 1.12 2012/03/20 20:34:58 matt Exp $ */
/* $OpenBSD: look.c,v 1.21 2009/10/14 17:23:17 sthen Exp $ */
/*
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: look.c,v 1.11 2009/10/26 21:11:28 christos Exp $");
+__RCSID("$NetBSD: look.c,v 1.12 2012/03/20 20:34:58 matt Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
/* Support routines for hash tables. */
void *
-hash_alloc(s, u)
- size_t s;
- void *u UNUSED;
+hash_alloc(size_t s, void *u UNUSED)
{
void *storage = xalloc(s, "hash alloc");
if (storage)
}
void
-hash_free(p, s, u)
- void *p;
- size_t s UNUSED;
- void *u UNUSED;
+hash_free(void *p, size_t s UNUSED, void *u UNUSED)
{
free(p);
}
void *
-element_alloc(s, u)
- size_t s;
- void *u UNUSED;
+element_alloc(size_t s, void *u UNUSED)
{
return xalloc(s, "element alloc");
}
void
-init_macros()
+init_macros(void)
{
ohash_init(¯os, 10, ¯o_info);
}
-.\" $NetBSD: m4.1,v 1.22 2010/05/14 17:14:28 joerg Exp $
+.\" $NetBSD: m4.1,v 1.23 2012/04/08 22:00:39 wiz Exp $
.\" @(#) $OpenBSD: m4.1,v 1.56 2009/10/14 17:19:47 sthen Exp $
.\"
.\" Copyright (c) 1989, 1993
.Op Fl d Ar flags
.Op Fl I Ar dirname
.Op Fl o Ar filename
-.Bk -words
.Op Fl t Ar macro
.Op Fl U Ns Ar name
.Op Ar
-.Ek
.Sh DESCRIPTION
The
.Nm m4
/* $OpenBSD: main.c,v 1.77 2009/10/14 17:19:47 sthen Exp $ */
-/* $NetBSD: main.c,v 1.39 2009/11/06 15:13:27 joerg Exp $ */
+/* $NetBSD: main.c,v 1.42 2012/04/25 18:23:58 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.39 2009/11/06 15:13:27 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.42 2012/04/25 18:23:58 christos Exp $");
#include <assert.h>
#include <signal.h>
#include <err.h>
static void enlarge_stack(void);
-int main(int, char *[]);
+__dead static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [-gPs] [-Dname[=value]] [-d flags] "
+ "[-I dirname] [-o filename]\n"
+ "\t[-t macro] [-Uname] [file ...]\n", getprogname());
+ exit(1);
+}
+
+__dead static void
+onintr(int signo)
+{
+ char intrmessage[] = "m4: interrupted.\n";
+ write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1);
+ _exit(1);
+}
int
main(int argc, char *argv[])
default:
if (LOOK_AHEAD(t, scommt)) {
char *q;
- for (q = scommt; *q; p++)
+ for (q = scommt; *q; q++)
chrsave(*q);
for(;;) {
t = gpbc();
return NULL;
}
- p = ohash_find(¯os, ohash_qlookupi(¯os, name, (const char **)&tp));
+ p = ohash_find(¯os, ohash_qlookupi(¯os, name, (void *)&tp));
if (p == NULL)
return NULL;
if (macro_getdef(p) == NULL)
/* $OpenBSD: mdef.h,v 1.29 2006/03/20 20:27:45 espie Exp $ */
-/* $NetBSD: mdef.h,v 1.13 2009/10/26 21:11:28 christos Exp $ */
+/* $NetBSD: mdef.h,v 1.14 2011/03/05 16:37:50 christos Exp $ */
/*
* Copyright (c) 1989, 1993
#define CURRENT_NAME (infile[ilevel].name)
#define CURRENT_LINE (infile[ilevel].lineno)
+#define TOKEN_LINE(f) (f->lineno - (f->c == '\n' ? 1 : 0))
+
/*
* macros for readibility and/or speed
*
/* $OpenBSD: misc.c,v 1.41 2009/10/14 17:19:47 sthen Exp $ */
-/* $NetBSD: misc.c,v 1.20 2009/11/06 15:13:27 joerg Exp $ */
+/* $NetBSD: misc.c,v 1.23 2012/03/20 20:34:58 matt Exp $ */
/*
* Copyright (c) 1989, 1993
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: misc.c,v 1.20 2009/11/06 15:13:27 joerg Exp $");
+__RCSID("$NetBSD: misc.c,v 1.23 2012/03/20 20:34:58 matt Exp $");
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
}
void
-initspaces()
+initspaces(void)
{
int i;
}
void
-enlarge_strspace()
+enlarge_strspace(void)
{
char *newstrspace;
int i;
}
void
-enlarge_bufspace()
+enlarge_bufspace(void)
{
unsigned char *newbuf;
int i;
outfile[n] = NULL;
}
-void
-onintr(int signo)
-{
-#define intrmessage "m4: interrupted.\n"
- write(STDERR_FILENO, intrmessage, sizeof(intrmessage)-1);
- _exit(1);
-}
-
/*
* killdiv - get rid of the diversion files
*/
void
-killdiv()
+killdiv(void)
{
int n;
return p;
}
-void
-usage(void)
-{
- fprintf(stderr, "usage: %s [-gPs] [-Dname[=value]] [-d flags] "
- "[-I dirname] [-o filename]\n"
- "\t[-t macro] [-Uname] [file ...]\n", getprogname());
- exit(1);
-}
-
int
obtain_char(struct input_file *f)
{
}
void
-do_emit_synchline()
+do_emit_synchline(void)
{
fprintf(active, "#line %lu \"%s\"\n",
infile[ilevel].lineno, infile[ilevel].name);
void
doprintlineno(struct input_file *f)
{
- pbunsigned(f->lineno);
+ pbunsigned(TOKEN_LINE(f));
}
void
* and later dump everything that was added since then to a file.
*/
size_t
-buffer_mark()
+buffer_mark(void)
{
return bp - buf;
}
-/* $NetBSD: pathnames.h,v 1.13 2009/10/31 23:25:04 joerg Exp $ */
+/* $NetBSD: pathnames.h,v 1.15 2011/03/08 23:55:19 riz Exp $ */
/*
* Copyright (c) 1989, 1993
%{
-/* $NetBSD: tokenizer.l,v 1.4 2009/10/29 14:49:03 christos Exp $ */
+/* $NetBSD: tokenizer.l,v 1.6 2012/03/20 20:34:58 matt Exp $ */
/* $OpenBSD: tokenizer.l,v 1.6 2008/08/21 21:00:14 espie Exp $ */
/*
* Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
#include "nbtool_config.h"
#endif
#include "parser.h"
-__RCSID("$NetBSD: tokenizer.l,v 1.4 2009/10/29 14:49:03 christos Exp $");
+__RCSID("$NetBSD: tokenizer.l,v 1.6 2012/03/20 20:34:58 matt Exp $");
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
%}
%option nounput
+%option noinput
delim [ \t\n]
ws {delim}+
%%
int32_t
-number()
+number(void)
{
long l;
}
int32_t
-parse_radix()
+parse_radix(void)
{
long base;
char *next;
-/* $NetBSD: trace.c,v 1.6 2009/10/26 21:11:28 christos Exp $ */
+/* $NetBSD: trace.c,v 1.8 2012/03/20 20:34:58 matt Exp $ */
/* $OpenBSD: trace.c,v 1.15 2006/03/24 08:03:44 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: trace.c,v 1.6 2009/10/26 21:11:28 christos Exp $");
+__RCSID("$NetBSD: trace.c,v 1.8 2012/03/20 20:34:58 matt Exp $");
#include <sys/types.h>
#include <err.h>
}
static int
-frame_level()
+frame_level(void)
{
int level;
int framep;
if (trace_flags & TRACE_FILENAME)
fprintf(traceout, "%s:", inp->name);
if (trace_flags & TRACE_LINENO)
- fprintf(traceout, "%lu:", inp->lineno);
+ fprintf(traceout, "%lu:", TOKEN_LINE(inp));
fprintf(traceout, " -%d- ", frame_level());
if (trace_flags & TRACE_ID)
fprintf(traceout, "id %lu: ", expansion_id);