head 1.2; access; symbols pkgsrc-2026Q1:1.2.0.108 pkgsrc-2026Q1-base:1.2 pkgsrc-2025Q4:1.2.0.106 pkgsrc-2025Q4-base:1.2 pkgsrc-2025Q3:1.2.0.104 pkgsrc-2025Q3-base:1.2 pkgsrc-2025Q2:1.2.0.102 pkgsrc-2025Q2-base:1.2 pkgsrc-2025Q1:1.2.0.100 pkgsrc-2025Q1-base:1.2 pkgsrc-2024Q4:1.2.0.98 pkgsrc-2024Q4-base:1.2 pkgsrc-2024Q3:1.2.0.96 pkgsrc-2024Q3-base:1.2 pkgsrc-2024Q2:1.2.0.94 pkgsrc-2024Q2-base:1.2 pkgsrc-2024Q1:1.2.0.92 pkgsrc-2024Q1-base:1.2 pkgsrc-2023Q4:1.2.0.90 pkgsrc-2023Q4-base:1.2 pkgsrc-2023Q3:1.2.0.88 pkgsrc-2023Q3-base:1.2 pkgsrc-2023Q2:1.2.0.86 pkgsrc-2023Q2-base:1.2 pkgsrc-2023Q1:1.2.0.84 pkgsrc-2023Q1-base:1.2 pkgsrc-2022Q4:1.2.0.82 pkgsrc-2022Q4-base:1.2 pkgsrc-2022Q3:1.2.0.80 pkgsrc-2022Q3-base:1.2 pkgsrc-2022Q2:1.2.0.78 pkgsrc-2022Q2-base:1.2 pkgsrc-2022Q1:1.2.0.76 pkgsrc-2022Q1-base:1.2 pkgsrc-2021Q4:1.2.0.74 pkgsrc-2021Q4-base:1.2 pkgsrc-2021Q3:1.2.0.72 pkgsrc-2021Q3-base:1.2 pkgsrc-2021Q2:1.2.0.70 pkgsrc-2021Q2-base:1.2 pkgsrc-2021Q1:1.2.0.68 pkgsrc-2021Q1-base:1.2 pkgsrc-2020Q4:1.2.0.66 pkgsrc-2020Q4-base:1.2 pkgsrc-2020Q3:1.2.0.64 pkgsrc-2020Q3-base:1.2 pkgsrc-2020Q2:1.2.0.60 pkgsrc-2020Q2-base:1.2 pkgsrc-2020Q1:1.2.0.40 pkgsrc-2020Q1-base:1.2 pkgsrc-2019Q4:1.2.0.62 pkgsrc-2019Q4-base:1.2 pkgsrc-2019Q3:1.2.0.58 pkgsrc-2019Q3-base:1.2 pkgsrc-2019Q2:1.2.0.56 pkgsrc-2019Q2-base:1.2 pkgsrc-2019Q1:1.2.0.54 pkgsrc-2019Q1-base:1.2 pkgsrc-2018Q4:1.2.0.52 pkgsrc-2018Q4-base:1.2 pkgsrc-2018Q3:1.2.0.50 pkgsrc-2018Q3-base:1.2 pkgsrc-2018Q2:1.2.0.48 pkgsrc-2018Q2-base:1.2 pkgsrc-2018Q1:1.2.0.46 pkgsrc-2018Q1-base:1.2 pkgsrc-2017Q4:1.2.0.44 pkgsrc-2017Q4-base:1.2 pkgsrc-2017Q3:1.2.0.42 pkgsrc-2017Q3-base:1.2 pkgsrc-2017Q2:1.2.0.38 pkgsrc-2017Q2-base:1.2 pkgsrc-2017Q1:1.2.0.36 pkgsrc-2017Q1-base:1.2 pkgsrc-2016Q4:1.2.0.34 pkgsrc-2016Q4-base:1.2 pkgsrc-2016Q3:1.2.0.32 pkgsrc-2016Q3-base:1.2 pkgsrc-2016Q2:1.2.0.30 pkgsrc-2016Q2-base:1.2 pkgsrc-2016Q1:1.2.0.28 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.26 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.24 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.22 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.20 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.2.0.18 pkgsrc-2014Q4-base:1.2 pkgsrc-2014Q3:1.2.0.16 pkgsrc-2014Q3-base:1.2 pkgsrc-2014Q2:1.2.0.14 pkgsrc-2014Q2-base:1.2 pkgsrc-2014Q1:1.2.0.12 pkgsrc-2014Q1-base:1.2 pkgsrc-2013Q4:1.2.0.10 pkgsrc-2013Q4-base:1.2 pkgsrc-2013Q3:1.2.0.8 pkgsrc-2013Q3-base:1.2 pkgsrc-2013Q2:1.2.0.6 pkgsrc-2013Q2-base:1.2 pkgsrc-2013Q1:1.2.0.4 pkgsrc-2013Q1-base:1.2 pkgsrc-2012Q4:1.2.0.2 pkgsrc-2012Q4-base:1.2 pkgsrc-2012Q3:1.1.1.1.0.58 pkgsrc-2012Q3-base:1.1.1.1 pkgsrc-2012Q2:1.1.1.1.0.56 pkgsrc-2012Q2-base:1.1.1.1 pkgsrc-2012Q1:1.1.1.1.0.54 pkgsrc-2012Q1-base:1.1.1.1 pkgsrc-2011Q4:1.1.1.1.0.52 pkgsrc-2011Q4-base:1.1.1.1 pkgsrc-2011Q3:1.1.1.1.0.50 pkgsrc-2011Q3-base:1.1.1.1 pkgsrc-2011Q2:1.1.1.1.0.48 pkgsrc-2011Q2-base:1.1.1.1 pkgsrc-2011Q1:1.1.1.1.0.46 pkgsrc-2011Q1-base:1.1.1.1 pkgsrc-2010Q4:1.1.1.1.0.44 pkgsrc-2010Q4-base:1.1.1.1 pkgsrc-2010Q3:1.1.1.1.0.42 pkgsrc-2010Q3-base:1.1.1.1 pkgsrc-2010Q2:1.1.1.1.0.40 pkgsrc-2010Q2-base:1.1.1.1 pkgsrc-2010Q1:1.1.1.1.0.38 pkgsrc-2010Q1-base:1.1.1.1 pkgsrc-2009Q4:1.1.1.1.0.36 pkgsrc-2009Q4-base:1.1.1.1 pkgsrc-2009Q3:1.1.1.1.0.34 pkgsrc-2009Q3-base:1.1.1.1 pkgsrc-2009Q2:1.1.1.1.0.32 pkgsrc-2009Q2-base:1.1.1.1 pkgsrc-2009Q1:1.1.1.1.0.30 pkgsrc-2009Q1-base:1.1.1.1 pkgsrc-2008Q4:1.1.1.1.0.28 pkgsrc-2008Q4-base:1.1.1.1 pkgsrc-2008Q3:1.1.1.1.0.26 pkgsrc-2008Q3-base:1.1.1.1 cube-native-xorg:1.1.1.1.0.24 cube-native-xorg-base:1.1.1.1 pkgsrc-2008Q2:1.1.1.1.0.22 pkgsrc-2008Q2-base:1.1.1.1 cwrapper:1.1.1.1.0.20 pkgsrc-2008Q1:1.1.1.1.0.18 pkgsrc-2008Q1-base:1.1.1.1 pkgsrc-2007Q4:1.1.1.1.0.16 pkgsrc-2007Q4-base:1.1.1.1 pkgsrc-2007Q3:1.1.1.1.0.14 pkgsrc-2007Q3-base:1.1.1.1 pkgsrc-2007Q2:1.1.1.1.0.12 pkgsrc-2007Q2-base:1.1.1.1 pkgsrc-2007Q1:1.1.1.1.0.10 pkgsrc-2007Q1-base:1.1.1.1 pkgsrc-2006Q4:1.1.1.1.0.8 pkgsrc-2006Q4-base:1.1.1.1 pkgsrc-2006Q3:1.1.1.1.0.6 pkgsrc-2006Q3-base:1.1.1.1 pkgsrc-2006Q2:1.1.1.1.0.4 pkgsrc-2006Q2-base:1.1.1.1 pkgsrc-2006Q1:1.1.1.1.0.2 pkgsrc-2006Q1-base:1.1.1.1 pkgsrc-base:1.1.1.1 TNF:1.1.1; locks; strict; comment @# @; 1.2 date 2012.12.27.06.13.20; author dholland; state Exp; branches; next 1.1; 1.1 date 2005.12.28.22.29.17; author is; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2005.12.28.22.29.17; author is; state Exp; branches; next ; desc @@ 1.2 log @Clean up legacy C. Now passes gcc -Wall -Wextra -Wmissing-declarations -Wwrite-strings on gcc45. May build with clang now too. Changes: - use standard headers - don't declare own errno, fopen(), getenv(), or malloc() - declare own functions - declare void functions void - avoid implicit int - use C89 - use some const - use some static - fix signed/unsigned mismatches - call execl() properly - don't cast return value of malloc - initialize struct sigaction correctly - use functions correctly - don't index arrays with (signed) char - don't put function declarations inside function bodies - patch up two uninitialized variables - silence some compiler warnings that are not bugs - remove some unused objects and: - add patch comments for preexisting patches - correct some minor pkglint As a couple of these things fixed bugs (e.g. the execl calls), bump PKGREVISION. @ text @$NetBSD$ - use standard headers - handle EOF from getc() correctly - move function declarations to the header file - use some static - declare void functions void - use some c89 - don't index arrays with (signed) char - call execl() properly --- te_exec2.c.orig 1993-08-05 22:29:34.000000000 +0000 +++ te_exec2.c @@@@ -19,6 +19,7 @@@@ /* add directory command, header file display 03/26/92 14.59 */ #include "te_defs.h" +#include #include #include #include @@@@ -35,21 +36,26 @@@@ struct outfiledata po_file, so_file; /* struct outfiledata *outfile = &po_file; /* pointer to currently active output file structure */ FILE *eisw; /* indirect command file pointer */ int second_buff = 0; /* variable for which buffer is selected */ -VOID init_wd(); -VOID update_header(); + +static int do_e_slash(void); /* routine to handle "change directory" command */ +static int read_stream(FILE *file, int *ff_found, struct qp *rbuff, + int *nchars, int endsw, int crlf_sw, int ff_sw); +static VOID write_stream(FILE *file, struct qp *wbuff, int nchars, + int crlf_sw); + + /* process E commands */ -do_e() +VOID do_e(void) { - char c; /* temps */ + int c; /* temps */ int old_var; FILE *t_eisw; struct stat statbuff; /* buffer to fetch file stat (mode) of open file for EB */ int t_access; /* result from provisional "open" */ - int do_e_slash(); /* routine to handle "change directory" command */ - switch (mapch_l[getcmdc(trace_sw)]) /* read next character and dispatch */ + switch (mapch_l[(unsigned char)getcmdc(trace_sw)]) /* read next character and dispatch */ { /* numeric values */ @@@@ -386,7 +392,7 @@@@ int do_eq() t = vfork(); /* fork a new process */ if (t == 0) /* if this is the child */ { - execl(pname, pname, SHELL_OPT, &sysbuf.f->ch[0], 0); /* call the named Unix routine */ + execl(pname, pname, SHELL_OPT, &sysbuf.f->ch[0], (void *)NULL); /* call the named Unix routine */ printf("Error in 'execl'\n"); /* normally shouldn't get here */ exit(1); } @@@@ -493,7 +499,7 @@@@ int do_eq1(shell) if (ll == 0) /* if there are no characters to send */ { close(pipe_in[1]); /* close exec'd process' new "stdin" so "read" will find eof */ - execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], 0); /* execute specified routine */ + execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], (void *)NULL); /* execute specified routine */ fputs("execl failed\n", stderr); exit(1); } /* end "orig m,nEQ command had zero range" */ @@@@ -520,7 +526,7 @@@@ int do_eq1(shell) else /* this process is the grandchild */ { close(pipe_in[1]); /* close "input" for writing */ - execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], 0); /* execute specified routine */ + execl(shell, shell, SHELL_OPT, &sysbuf.f->ch[0], (void *)NULL); /* execute specified routine */ fputs("execl failed\n", stderr); exit(1); } /* end "this is the grandchild" */ @@@@ -559,7 +565,7 @@@@ int do_en() } /* routine to handle "change directory" command */ -int do_e_slash() +static int do_e_slash(void) { int rv = -1; /* return value */ int err_code = E_DIR; @@@@ -609,7 +615,7 @@@@ int do_glob(gbuff, sbuff) { char glob_cmd[CELLSIZE+5]; /* "glob filespec" command string */ int t; - char c; + int c; int glob_pipe[2]; /* pipe to forked shell for expanding filenames */ struct qp glob_ptr; /* pointer for loading result buffer */ FILE *xx_out; /* stream for reading chars from pipe */ @@@@ -668,7 +674,7 @@@@ int do_glob(gbuff, sbuff) close(glob_pipe[0]); /* child won't read */ dup2(glob_pipe[1], fileno(stdout)); /* substitute pipe for standard out */ close(glob_pipe[1]); /* don't need that anymore */ - execl("/bin/csh", "csh", "-fc", glob_cmd, 0); /* execute the "glob" */ + execl("/bin/csh", "csh", "-fc", glob_cmd, (void *)NULL); /* execute the "glob" */ fputs("execl failed\n", stderr); exit(1); } @@@@ -676,7 +682,7 @@@@ int do_glob(gbuff, sbuff) /* routine to get next file spec from "EN" list into filespec buffer */ -do_en_next() +VOID do_en_next(void) { char c; @@@@ -778,7 +784,7 @@@@ int read_filename(flag, func) /* fetch or set variable */ -set_var(extend, arg) +VOID set_var(extend, arg) int extend; /* nonzero if arg is 16 bits to be sign extended */ int *arg; /* argument is pointer to variable */ { @@@@ -820,12 +826,12 @@@@ int read_file(rbuff, nchars, endsw) /* address of a switch to set if read ended with a FF, crlf_sw is lf->crlf */ /* conversion, ff_sw indicates whether to stop on a form feed. */ -int read_stream(file, ff_found, rbuff, nchars, endsw, crlf_sw, ff_sw) +static int read_stream(file, ff_found, rbuff, nchars, endsw, crlf_sw, ff_sw) FILE *file; struct qp *rbuff; int *ff_found, *nchars, endsw, crlf_sw, ff_sw; { - char chr; + int chr; int crflag; register struct buffcell *p; register int c; @@@@ -874,7 +880,7 @@@@ int read_stream(file, ff_found, rbuff, n /* arguments are qp to start of text, number of characters, */ /* and an "append FF" switch */ -write_file(wbuff, nchars, ffsw) +VOID write_file(wbuff, nchars, ffsw) struct qp *wbuff; int nchars, ffsw; { @@@@ -889,7 +895,7 @@@@ write_file(wbuff, nchars, ffsw) /* Unix processes. Arguments wbuff, nchars as above; file */ /* is stream pointer, crlf_sw zero converts CRLF to LF */ -write_stream(file, wbuff, nchars, crlf_sw) +static VOID write_stream(file, wbuff, nchars, crlf_sw) FILE *file; struct qp *wbuff; int nchars, crlf_sw; @@@@ -919,7 +925,7 @@@@ write_stream(file, wbuff, nchars, crlf_s /* routine to kill output file: argument is pointer to an output file structure */ -kill_output(outptr) +VOID kill_output(outptr) struct outfiledata *outptr; { if (outptr->fd) @@@@ -934,7 +940,7 @@@@ kill_output(outptr) static char panic_name[16] = "TECO_SAVED.tmp"; /* name of file created to save buffer */ -panic() +VOID panic(void) { int i; /* counter of buffers to save */ int t_access; /* file descriptor returned by open() */ @@@@ -959,13 +965,13 @@@@ panic() } /* do "F" commands */ -do_f() +VOID do_f(void) { struct buffcell *delete_p; int temp_dot; VOID do_fm(); - switch (mapch_l[getcmdc(trace_sw)]) /* read next character and dispatch */ + switch (mapch_l[(unsigned char)getcmdc(trace_sw)]) /* read next character and dispatch */ { case '<': /* back to beginning of current iteration */ if (cptr.flag & F_ITER) /* if in iteration */ @@@@ -1138,7 +1144,7 @@@@ do_f() /* pop iteration: if arg nonzero, exit unconditionally */ /* else check exit conditions and exit or reiterate */ -pop_iteration(arg) +VOID pop_iteration(arg) int arg; { if (!arg && (!cptr.il->dflag || (--(cptr.il->count) > 0)) ) /* if reiteration */ @@@@ -1157,7 +1163,7 @@@@ pop_iteration(arg) /* find end of iteration - read over arbitrary <> and one > */ -find_enditer() +VOID find_enditer(void) { register int icnt; @@@@ -1172,7 +1178,7 @@@@ find_enditer() /* find end of conditional */ -char find_endcond(arg) +VOID find_endcond(arg) char arg; { register int icnt; @ 1.1 log @Initial revision @ text @d3 10 a12 1 --- te_exec2.c.orig 1993-08-06 00:29:34.000000000 +0200 d14 2 a15 1 @@@@ -42,7 +42,7 @@@@ VOID update_header(); d17 24 a40 1 do_e() d47 45 a91 1 @@@@ -609,7 +609,7 @@@@ int do_glob(gbuff, sbuff) d100 34 a133 1 @@@@ -825,7 +825,7 @@@@ int read_stream(file, ff_found, rbuff, n d142 79 @ 1.1.1.1 log @Mark C. Henderson's port of Matt Fichtenbaums TECO for Ultrix. @ text @@