=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/m4/eval.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/m4/eval.c 1999/11/17 14:57:21 1.19 --- src/usr.bin/m4/eval.c 1999/11/17 15:34:13 1.20 *************** *** 1,4 **** ! /* $OpenBSD: eval.c,v 1.19 1999/11/17 14:57:21 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: eval.c,v 1.20 1999/11/17 15:34:13 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* *************** *** 41,47 **** #if 0 static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; #else ! static char rcsid[] = "$OpenBSD: eval.c,v 1.19 1999/11/17 14:57:21 espie Exp $"; #endif #endif /* not lint */ --- 41,47 ---- #if 0 static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; #else ! static char rcsid[] = "$OpenBSD: eval.c,v 1.20 1999/11/17 15:34:13 espie Exp $"; #endif #endif /* not lint */ *************** *** 65,70 **** --- 65,82 ---- #include "extern.h" #include "pathnames.h" + static void dodefn __P((const char *)); + static void dopushdef __P((const char *, const char *)); + static void dodump __P((const char *[], int)); + static void doifelse __P((const char *[], int)); + static int doincl __P((const char *)); + static int dopaste __P((const char *)); + static void dochq __P((const char *[], int)); + static void dochc __P((const char *[], int)); + static void dodiv __P((int)); + static void doundiv __P((const char *[], int)); + static void dosub __P((const char *[], int)); + static void map __P((char *, const char *, const char *, const char *)); /* * eval - evaluate built-in macros. * argc - number of elements in argv. *************** *** 86,92 **** void eval(argv, argc, td) ! char *argv[]; int argc; int td; { --- 98,104 ---- void eval(argv, argc, td) ! const char *argv[]; int argc; int td; { *************** *** 299,310 **** */ if (argc > 2) { int fd; ! fd = mkstemp(argv[2]); if (fd == -1) err(1, "couldn't make temp file %s", argv[2]); close(fd); ! pbstr(argv[2]); } break; --- 311,326 ---- */ if (argc > 2) { int fd; + char *temp; + + temp = xstrdup(argv[2]); ! fd = mkstemp(temp); if (fd == -1) err(1, "couldn't make temp file %s", argv[2]); close(fd); ! pbstr(temp); ! free(temp); } break; *************** *** 391,401 **** */ void expand(argv, argc) ! char *argv[]; int argc; { ! char *t; ! char *p; int n; int argno; --- 407,417 ---- */ void expand(argv, argc) ! const char *argv[]; int argc; { ! const char *t; ! const char *p; int n; int argno; *************** *** 462,469 **** */ void dodefine(name, defn) ! char *name; ! char *defn; { ndptr p; --- 478,485 ---- */ void dodefine(name, defn) ! const char *name; ! const char *defn; { ndptr p; *************** *** 486,494 **** * dodefn - push back a quoted definition of * the given name. */ ! void dodefn(name) ! char *name; { ndptr p; --- 502,510 ---- * dodefn - push back a quoted definition of * the given name. */ ! static void dodefn(name) ! const char *name; { ndptr p; *************** *** 506,515 **** * hash bucket, it hides a previous definition from * lookup. */ ! void dopushdef(name, defn) ! char *name; ! char *defn; { ndptr p; --- 522,531 ---- * hash bucket, it hides a previous definition from * lookup. */ ! static void dopushdef(name, defn) ! const char *name; ! const char *defn; { ndptr p; *************** *** 530,538 **** * table to stderr. If nothing is specified, the entire * hash table is dumped. */ ! void dodump(argv, argc) ! char *argv[]; int argc; { int n; --- 546,554 ---- * table to stderr. If nothing is specified, the entire * hash table is dumped. */ ! static void dodump(argv, argc) ! const char *argv[]; int argc; { int n; *************** *** 554,562 **** /* * doifelse - select one of two alternatives - loop. */ ! void doifelse(argv, argc) ! char *argv[]; int argc; { cycle { --- 570,578 ---- /* * doifelse - select one of two alternatives - loop. */ ! static void doifelse(argv, argc) ! const char *argv[]; int argc; { cycle { *************** *** 576,584 **** /* * doinclude - include a given file. */ ! int doincl(ifile) ! char *ifile; { if (ilevel + 1 == MAXINP) errx(1, "too many include files."); --- 592,600 ---- /* * doinclude - include a given file. */ ! static int doincl(ifile) ! const char *ifile; { if (ilevel + 1 == MAXINP) errx(1, "too many include files."); *************** *** 595,603 **** * dopaste - include a given file without any * macro processing. */ ! int dopaste(pfile) ! char *pfile; { FILE *pf; int c; --- 611,619 ---- * dopaste - include a given file without any * macro processing. */ ! static int dopaste(pfile) ! const char *pfile; { FILE *pf; int c; *************** *** 615,623 **** /* * dochq - change quote characters */ ! void dochq(argv, argc) ! char *argv[]; int argc; { if (argc > 2) { --- 631,639 ---- /* * dochq - change quote characters */ ! static void dochq(argv, argc) ! const char *argv[]; int argc; { if (argc > 2) { *************** *** 641,649 **** /* * dochc - change comment characters */ ! void dochc(argv, argc) ! char *argv[]; int argc; { if (argc > 2) { --- 657,665 ---- /* * dochc - change comment characters */ ! static void dochc(argv, argc) ! const char *argv[]; int argc; { if (argc > 2) { *************** *** 665,671 **** /* * dodivert - divert the output to a temporary file */ ! void dodiv(n) int n; { --- 681,687 ---- /* * dodivert - divert the output to a temporary file */ ! static void dodiv(n) int n; { *************** *** 690,698 **** * doundivert - undivert a specified output, or all * other outputs, in numerical order. */ ! void doundiv(argv, argc) ! char *argv[]; int argc; { int ind; --- 706,714 ---- * doundivert - undivert a specified output, or all * other outputs, in numerical order. */ ! static void doundiv(argv, argc) ! const char *argv[]; int argc; { int ind; *************** *** 715,726 **** /* * dosub - select substring */ ! void dosub(argv, argc) ! char *argv[]; int argc; { ! char *ap, *fc, *k; int nc; if (argc < 5) --- 731,742 ---- /* * dosub - select substring */ ! static void dosub(argv, argc) ! const char *argv[]; int argc; { ! const char *ap, *fc, *k; int nc; if (argc < 5) *************** *** 767,780 **** * about 5 times faster than any algorithm that makes multiple passes over * destination string. */ ! void map(dest, src, from, to) char *dest; ! char *src; ! char *from; ! char *to; { ! char *tmp; unsigned char sch, dch; static unsigned char mapvec[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, --- 783,796 ---- * about 5 times faster than any algorithm that makes multiple passes over * destination string. */ ! static void map(dest, src, from, to) char *dest; ! const char *src; ! const char *from; ! const char *to; { ! const char *tmp; unsigned char sch, dch; static unsigned char mapvec[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,