Module Name: src Committed By: snj Date: Fri Aug 14 20:39:04 UTC 2009
Modified Files: src/bin/pax [netbsd-5-0]: options.c src/dist/nawk [netbsd-5-0]: maketab.c proctab.c proto.h run.c src/usr.bin/ctags [netbsd-5-0]: C.c ctags.h fortran.c lisp.c print.c yacc.c src/usr.bin/gencat [netbsd-5-0]: gencat.c Log Message: Pull up following revision(s) (requested by roy in ticket #885): bin/pax/options.c: revision 1.105 dist/nawk/maketab.c: revision 1.12 dist/nawk/proctab.c: revision 1.11 dist/nawk/proto.h: revision 1.9 dist/nawk/run.c: revision 1.29 usr.bin/ctags/C.c: revision 1.19 usr.bin/ctags/ctags.h: revision 1.9 usr.bin/ctags/fortran.c: revision 1.11 usr.bin/ctags/lisp.c: revision 1.11 usr.bin/ctags/print.c: revision 1.10 usr.bin/ctags/yacc.c: revision 1.12 usr.bin/gencat/gencat.c: revision 1.30 Rename internal getline() function to get_line() so it does conflict with the soon to be added getline(3) libc function. To generate a diff of this commit: cvs rdiff -u -r1.101.12.2 -r1.101.12.2.2.1 src/bin/pax/options.c cvs rdiff -u -r1.11 -r1.11.6.1 src/dist/nawk/maketab.c cvs rdiff -u -r1.10 -r1.10.6.1 src/dist/nawk/proctab.c cvs rdiff -u -r1.6.12.1 -r1.6.12.1.2.1 src/dist/nawk/proto.h cvs rdiff -u -r1.25 -r1.25.6.1 src/dist/nawk/run.c cvs rdiff -u -r1.15 -r1.15.32.1 src/usr.bin/ctags/C.c cvs rdiff -u -r1.8 -r1.8.38.1 src/usr.bin/ctags/ctags.h cvs rdiff -u -r1.10 -r1.10.38.1 src/usr.bin/ctags/fortran.c \ src/usr.bin/ctags/lisp.c cvs rdiff -u -r1.9 -r1.9.38.1 src/usr.bin/ctags/print.c cvs rdiff -u -r1.11 -r1.11.32.1 src/usr.bin/ctags/yacc.c cvs rdiff -u -r1.25 -r1.25.8.1 src/usr.bin/gencat/gencat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/pax/options.c diff -u src/bin/pax/options.c:1.101.12.2 src/bin/pax/options.c:1.101.12.2.2.1 --- src/bin/pax/options.c:1.101.12.2 Mon Apr 13 20:42:59 2009 +++ src/bin/pax/options.c Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: options.c,v 1.101.12.2 2009/04/13 20:42:59 snj Exp $ */ +/* $NetBSD: options.c,v 1.101.12.2.2.1 2009/08/14 20:39:03 snj Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: options.c,v 1.101.12.2 2009/04/13 20:42:59 snj Exp $"); +__RCSID("$NetBSD: options.c,v 1.101.12.2.2.1 2009/08/14 20:39:03 snj Exp $"); #endif #endif /* not lint */ @@ -85,7 +85,7 @@ static void printflg(unsigned int); static int c_frmt(const void *, const void *); static off_t str_offt(char *); -static char *getline(FILE *fp); +static char *get_line(FILE *fp); static void pax_options(int, char **); static void pax_usage(void); static void tar_options(int, char **); @@ -95,10 +95,10 @@ static void cpio_usage(void); #endif -/* errors from getline */ +/* errors from get_line */ #define GETLINE_FILE_CORRUPT 1 #define GETLINE_OUT_OF_MEM 2 -static int getline_error; +static int get_line_error; #define BZIP2_CMD "bzip2" /* command to run as bzip2 */ #define GZIP_CMD "gzip" /* command to run as gzip */ @@ -1210,7 +1210,7 @@ tty_warn(1, "Unable to open file '%s' for read", file); tar_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = get_line(fp)) != NULL) { if (dirisnext) { if (dir && mustfreedir) free(dir); @@ -1245,7 +1245,7 @@ free(dir); if (strcmp(file, "-") != 0) fclose(fp); - if (getline_error) { + if (get_line_error) { tty_warn(1, "Problem with file '%s'", file); tar_usage(); } @@ -1315,7 +1315,7 @@ tty_warn(1, "Unable to open file '%s' for read", file); tar_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = get_line(fp)) != NULL) { if (dirisnext) { if (ftree_add(str, 1) < 0) tar_usage(); @@ -1339,7 +1339,7 @@ tar_usage(); if (strcmp(file, "-") != 0) fclose(fp); - if (getline_error) { + if (get_line_error) { tty_warn(1, "Problem with file '%s'", file); tar_usage(); @@ -1640,11 +1640,11 @@ optarg); cpio_usage(); } - while ((str = getline(fp)) != NULL) { + while ((str = get_line(fp)) != NULL) { pat_add(str, NULL, 0); } fclose(fp); - if (getline_error) { + if (get_line_error) { tty_warn(1, "Problem with file '%s'", optarg); cpio_usage(); } @@ -1803,10 +1803,10 @@ * no read errors allowed on updates/append operation! */ maxflt = 0; - while ((str = getline(stdin)) != NULL) { + while ((str = get_line(stdin)) != NULL) { ftree_add(str, 0); } - if (getline_error) { + if (get_line_error) { tty_warn(1, "Problem while reading stdin"); cpio_usage(); } @@ -2034,21 +2034,21 @@ } char * -getline(FILE *f) +get_line(FILE *f) { char *name, *temp; size_t len; name = fgetln(f, &len); if (!name) { - getline_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0; + get_line_error = ferror(f) ? GETLINE_FILE_CORRUPT : 0; return 0; } if (name[len-1] != '\n') len++; temp = malloc(len); if (!temp) { - getline_error = GETLINE_OUT_OF_MEM; + get_line_error = GETLINE_OUT_OF_MEM; return 0; } memcpy(temp, name, len-1); Index: src/dist/nawk/maketab.c diff -u src/dist/nawk/maketab.c:1.11 src/dist/nawk/maketab.c:1.11.6.1 --- src/dist/nawk/maketab.c:1.11 Sun Oct 19 19:33:47 2008 +++ src/dist/nawk/maketab.c Fri Aug 14 20:39:03 2009 @@ -106,7 +106,7 @@ { CALL, "call", "call" }, { ARG, "arg", "arg" }, { VARNF, "getnf", "NF" }, - { GETLINE, "getline", "getline" }, + { GETLINE, "get_line", "getline" }, { GENSUB, "gensub", "gensub" }, { 0, "", "" }, }; Index: src/dist/nawk/proctab.c diff -u src/dist/nawk/proctab.c:1.10 src/dist/nawk/proctab.c:1.10.6.1 --- src/dist/nawk/proctab.c:1.10 Sun Oct 19 19:33:47 2008 +++ src/dist/nawk/proctab.c Fri Aug 14 20:39:03 2009 @@ -185,7 +185,7 @@ nullproc, /* NUMBER */ nullproc, /* STRING */ nullproc, /* REGEXPR */ - getline, /* GETLINE */ + get_line, /* GETLINE */ gensub, /* GENSUB */ jump, /* RETURN */ split, /* SPLIT */ Index: src/dist/nawk/proto.h diff -u src/dist/nawk/proto.h:1.6.12.1 src/dist/nawk/proto.h:1.6.12.1.2.1 --- src/dist/nawk/proto.h:1.6.12.1 Fri Nov 28 06:43:23 2008 +++ src/dist/nawk/proto.h Fri Aug 14 20:39:03 2009 @@ -152,7 +152,7 @@ extern Cell *copycell(Cell *); extern Cell *arg(Node **, int); extern Cell *jump(Node **, int); -extern Cell *getline(Node **, int); +extern Cell *get_line(Node **, int); extern Cell *getnf(Node **, int); extern Cell *array(Node **, int); extern Cell *awkdelete(Node **, int); Index: src/dist/nawk/run.c diff -u src/dist/nawk/run.c:1.25 src/dist/nawk/run.c:1.25.6.1 --- src/dist/nawk/run.c:1.25 Sun Oct 19 19:33:47 2008 +++ src/dist/nawk/run.c Fri Aug 14 20:39:03 2009 @@ -398,7 +398,7 @@ return 0; /* not reached */ } -Cell *getline(Node **a, int n) /* get next line from specific input */ +Cell *get_line(Node **a, int n) /* get next line from specific input */ { /* a[0] is variable, a[1] is operator, a[2] is filename */ Cell *r, *x; extern Cell **fldtab; @@ -408,11 +408,11 @@ int mode; if ((buf = (char *) malloc(bufsize)) == NULL) - FATAL("out of memory in getline"); + FATAL("out of memory in get_line"); fflush(stdout); /* in case someone is waiting for a prompt */ r = gettemp(); - if (a[1] != NULL) { /* getline < file */ + if (a[1] != NULL) { /* get_line < file */ x = execute(a[2]); /* filename */ mode = ptoi(a[1]); if (mode == '|') /* input pipe */ @@ -425,21 +425,21 @@ n = readrec(&buf, &bufsize, fp); if (n <= 0) { ; - } else if (a[0] != NULL) { /* getline var <file */ + } else if (a[0] != NULL) { /* get_line var <file */ x = execute(a[0]); setsval(x, buf); tempfree(x); - } else { /* getline <file */ + } else { /* get_line <file */ setsval(fldtab[0], buf); if (is_number(fldtab[0]->sval)) { fldtab[0]->fval = atof(fldtab[0]->sval); fldtab[0]->tval |= NUM; } } - } else { /* bare getline; use current input */ - if (a[0] == NULL) /* getline */ + } else { /* bare get_line; use current input */ + if (a[0] == NULL) /* get_line */ n = getrec(&record, &recsize, 1); - else { /* getline var */ + else { /* get_line var */ n = getrec(&buf, &bufsize, 0); x = execute(a[0]); setsval(x, buf); @@ -1746,7 +1746,7 @@ FILE *fp = 0; if (*s == '\0') - FATAL("null file name in print or getline"); + FATAL("null file name in print or get_line"); for (i = 0; i < nfiles; i++) if (files[i].fname && strcmp(s, files[i].fname) == 0) { if (a == files[i].mode || (a==APPEND && files[i].mode==GT)) @@ -1781,7 +1781,7 @@ fp = popen(s, "w"); } else if (a == LE) { /* input pipe */ fp = popen(s, "r"); - } else if (a == LT) { /* getline <file */ + } else if (a == LT) { /* get_line <file */ fp = strcmp(s, "-") == 0 ? stdin : fopen(s, "r"); /* "-" is stdin */ } else /* can't happen */ FATAL("illegal redirection %d", a); Index: src/usr.bin/ctags/C.c diff -u src/usr.bin/ctags/C.c:1.15 src/usr.bin/ctags/C.c:1.15.32.1 --- src/usr.bin/ctags/C.c:1.15 Sat Apr 22 17:46:48 2006 +++ src/usr.bin/ctags/C.c Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: C.c,v 1.15 2006/04/22 17:46:48 christos Exp $ */ +/* $NetBSD: C.c,v 1.15.32.1 2009/08/14 20:39:03 snj Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)C.c 8.4 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: C.c,v 1.15 2006/04/22 17:46:48 christos Exp $"); +__RCSID("$NetBSD: C.c,v 1.15.32.1 2009/08/14 20:39:03 snj Exp $"); #endif #endif /* not lint */ @@ -166,7 +166,7 @@ * foo\n * (arg1, */ - getline(); + get_line(); curline = lineno; if (func_entry()) { ++level; @@ -195,7 +195,7 @@ case ';': if (t_def && level == t_level) { t_def = NO; - getline(); + get_line(); if (sp != tok) *sp = EOS; pfnote(tok, lineno); @@ -232,7 +232,7 @@ * get line immediately; * may change before '{' */ - getline(); + get_line(); if (str_entry(c)) ++level; break; @@ -404,7 +404,7 @@ --sp; *sp = EOS; if (dflag || c == '(') { /* only want macros */ - getline(); + get_line(); pfnote(tok, curline); } skip: if (c == '\n') { /* get rid of rest of define */ Index: src/usr.bin/ctags/ctags.h diff -u src/usr.bin/ctags/ctags.h:1.8 src/usr.bin/ctags/ctags.h:1.8.38.1 --- src/usr.bin/ctags/ctags.h:1.8 Thu Feb 17 17:29:58 2005 +++ src/usr.bin/ctags/ctags.h Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ctags.h,v 1.8 2005/02/17 17:29:58 xtraeme Exp $ */ +/* $NetBSD: ctags.h,v 1.8.38.1 2009/08/14 20:39:03 snj Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -80,7 +80,7 @@ extern char searchar; /* ex search character */ extern int cicmp(const char *); -extern void getline(void); +extern void get_line(void); extern void pfnote(const char *, int); extern int skip_key(int); extern void put_entries(NODE *); Index: src/usr.bin/ctags/fortran.c diff -u src/usr.bin/ctags/fortran.c:1.10 src/usr.bin/ctags/fortran.c:1.10.38.1 --- src/usr.bin/ctags/fortran.c:1.10 Thu Feb 17 17:29:58 2005 +++ src/usr.bin/ctags/fortran.c Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: fortran.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $ */ +/* $NetBSD: fortran.c,v 1.10.38.1 2009/08/14 20:39:03 snj Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fortran.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: fortran.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $"); +__RCSID("$NetBSD: fortran.c,v 1.10.38.1 2009/08/14 20:39:03 snj Exp $"); #endif #endif /* not lint */ @@ -130,7 +130,7 @@ continue; *cp = EOS; (void)strlcpy(tok, lbp, sizeof(tok)); - getline(); /* process line for ex(1) */ + get_line(); /* process line for ex(1) */ pfnote(tok, lineno); pfcnt = YES; } Index: src/usr.bin/ctags/lisp.c diff -u src/usr.bin/ctags/lisp.c:1.10 src/usr.bin/ctags/lisp.c:1.10.38.1 --- src/usr.bin/ctags/lisp.c:1.10 Thu Feb 17 17:29:58 2005 +++ src/usr.bin/ctags/lisp.c Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: lisp.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $ */ +/* $NetBSD: lisp.c,v 1.10.38.1 2009/08/14 20:39:03 snj Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)lisp.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: lisp.c,v 1.10 2005/02/17 17:29:58 xtraeme Exp $"); +__RCSID("$NetBSD: lisp.c,v 1.10.38.1 2009/08/14 20:39:03 snj Exp $"); #endif #endif /* not lint */ @@ -105,7 +105,7 @@ *cp = EOS; (void)strlcpy(tok, lbp, sizeof(tok)); *cp = savedc; - getline(); + get_line(); pfnote(tok, lineno); } /*NOTREACHED*/ Index: src/usr.bin/ctags/print.c diff -u src/usr.bin/ctags/print.c:1.9 src/usr.bin/ctags/print.c:1.9.38.1 --- src/usr.bin/ctags/print.c:1.9 Thu Feb 17 17:29:58 2005 +++ src/usr.bin/ctags/print.c Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: print.c,v 1.9 2005/02/17 17:29:58 xtraeme Exp $ */ +/* $NetBSD: print.c,v 1.9.38.1 2009/08/14 20:39:03 snj Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)print.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: print.c,v 1.9 2005/02/17 17:29:58 xtraeme Exp $"); +__RCSID("$NetBSD: print.c,v 1.9.38.1 2009/08/14 20:39:03 snj Exp $"); #endif #endif /* not lint */ @@ -51,12 +51,12 @@ #include "ctags.h" /* - * getline -- + * get_line -- * get the line the token of interest occurred on, * prepare it for printing. */ void -getline(void) +get_line(void) { long saveftell; int c; Index: src/usr.bin/ctags/yacc.c diff -u src/usr.bin/ctags/yacc.c:1.11 src/usr.bin/ctags/yacc.c:1.11.32.1 --- src/usr.bin/ctags/yacc.c:1.11 Wed Apr 5 20:03:14 2006 +++ src/usr.bin/ctags/yacc.c Fri Aug 14 20:39:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: yacc.c,v 1.11 2006/04/05 20:03:14 dsl Exp $ */ +/* $NetBSD: yacc.c,v 1.11.32.1 2009/08/14 20:39:03 snj Exp $ */ /* * Copyright (c) 1987, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)yacc.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: yacc.c,v 1.11 2006/04/05 20:03:14 dsl Exp $"); +__RCSID("$NetBSD: yacc.c,v 1.11.32.1 2009/08/14 20:39:03 snj Exp $"); #endif #endif /* not lint */ @@ -105,7 +105,7 @@ while (GETC(!=, EOF) && (intoken(c) || c == '.')) *sp++ = c; *sp = EOS; - getline(); /* may change before ':' */ + get_line(); /* may change before ':' */ if (c == EOF) return; while (iswhite(c)) { Index: src/usr.bin/gencat/gencat.c diff -u src/usr.bin/gencat/gencat.c:1.25 src/usr.bin/gencat/gencat.c:1.25.8.1 --- src/usr.bin/gencat/gencat.c:1.25 Mon Apr 28 20:24:13 2008 +++ src/usr.bin/gencat/gencat.c Fri Aug 14 20:39:04 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gencat.c,v 1.25 2008/04/28 20:24:13 martin Exp $ */ +/* $NetBSD: gencat.c,v 1.25.8.1 2009/08/14 20:39:04 snj Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(lint) -__RCSID("$NetBSD: gencat.c,v 1.25 2008/04/28 20:24:13 martin Exp $"); +__RCSID("$NetBSD: gencat.c,v 1.25.8.1 2009/08/14 20:39:04 snj Exp $"); #endif /*********************************************************** @@ -117,7 +117,7 @@ static char *cskip(char *); static void error(const char *); -static char *getline(int); +static char *get_line(int); static char *getmsg(int, char *, char); static void warning(const char *, const char *); static char *wskip(char *); @@ -275,7 +275,7 @@ } static char * -getline(int fd) +get_line(int fd) { static long curlen = BUFSIZ; static char buf[BUFSIZ], *bptr = buf, *bend = buf; @@ -378,7 +378,7 @@ ++cptr; switch (*cptr) { case '\0': - cptr = getline(fd); + cptr = get_line(fd); if (!cptr) error("premature end of file"); msglen += strlen(cptr); @@ -451,7 +451,7 @@ /* XXX: init sethead? */ - while ((cptr = getline(fd))) { + while ((cptr = get_line(fd))) { if (*cptr == '$') { ++cptr; if (strncmp(cptr, "set", 3) == 0) {