diff --git a/contrib/sort/init.c b/contrib/sort/init.c index 3f5c068bdb0..0d97ff883aa 100644 --- a/contrib/sort/init.c +++ b/contrib/sort/init.c @@ -34,6 +34,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ #include "sort.h" @@ -127,7 +129,7 @@ setcolumn(pos, cur_fld, gflag) int tmp; col = cur_fld->icol.num ? (&(*cur_fld).tcol) : (&(*cur_fld).icol); pos += sscanf(pos, "%d", &(col->num)); - while (isdigit(*pos)) + while (isdigit((u_char)*pos)) pos++; if (col->num <= 0 && !(col->num == 0 && col == &(cur_fld->tcol))) errx(2, "field numbers must be positive"); @@ -136,7 +138,7 @@ setcolumn(pos, cur_fld, gflag) errx(2, "cannot indent end of line"); ++pos; pos += sscanf(pos, "%d", &(col->indent)); - while (isdigit(*pos)) + while (isdigit((u_char)*pos)) pos++; if (&cur_fld->icol == col) col->indent--; @@ -243,7 +245,7 @@ fixit(argc, argv) argv[i] = vpos; vpos += sprintf(vpos, "-k"); tpos += sscanf(tpos, "%d", &v); - while (isdigit(*tpos)) + while (isdigit((u_char)*tpos)) tpos++; vpos += sprintf(vpos, "%d", v+1); if (*tpos == '.') { @@ -255,16 +257,16 @@ fixit(argc, argv) *vpos++ = *tpos++; vpos += sprintf(vpos, ","); if (argv[i+1] && - argv[i+1][0] == '-' && isdigit(argv[i+1][1])) { + argv[i+1][0] == '-' && isdigit((u_char)argv[i+1][1])) { tpos = argv[i+1] + 1; tpos += sscanf(tpos, "%d", &w); - while (isdigit(*tpos)) + while (isdigit((u_char)*tpos)) tpos++; x = 0; if (*tpos == '.') { ++tpos; tpos += sscanf(tpos, "%d", &x); - while (isdigit(*tpos)) + while (isdigit((u_char)*tpos)) tpos++; } if (x) { diff --git a/contrib/sort/sort.c b/contrib/sort/sort.c index a119b7da218..3f61406bbfc 100644 --- a/contrib/sort/sort.c +++ b/contrib/sort/sort.c @@ -34,6 +34,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ /* Sort sorts a file using an optional user-defined key. @@ -46,8 +48,7 @@ #include "pathnames.h" #ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1993\n\ - The Regents of the University of California. All rights reserved.\n"); +__COPYRIGHT("@(#) Copyright (c) 1993 The Regents of the University of California. All rights reserved."); #endif /* not lint */ #ifndef lint @@ -112,8 +113,7 @@ main(argc, argv) memset(fldtab, 0, (ND+2)*sizeof(struct field)); memset(d_mask, 0, NBINS); - d_mask[REC_D = '\n'] = REC_D_F; - SINGL_FLD = SEP_FLAG = 0; + d_mask[REC_D] = REC_D_F; d_mask['\t'] = d_mask[' '] = BLANK | FLD_D; ftpos = fldtab; many_files(); @@ -172,7 +172,7 @@ main(argc, argv) case 'R': if (REC_D != '\n') usage("multiple record delimiters"); - if ('\n' == (REC_D = *optarg)) + if ('\n' == (REC_D = (u_char)*optarg)) break; d_mask['\n'] = d_mask[' ']; d_mask[REC_D] = REC_D_F; @@ -252,7 +252,7 @@ main(argc, argv) } else if (!(ch = access(outpath, 0)) && strncmp(_PATH_DEV, outpath, 5)) { static const struct sigaction act = - { onsignal, {{0}}, SA_RESTART | SA_RESETHAND }; + { { onsignal }, SA_RESTART | SA_RESETHAND, { { 0 } } }; static const int sigtable[] = {SIGHUP, SIGINT, SIGPIPE, SIGXCPU, SIGXFSZ, SIGVTALRM, SIGPROF, 0}; int outfd;