move fltab outside main and make it static, eliminate two memset()s

g/c superfluous extern definition for clist[] and ncols
make toutpath[] static
This commit is contained in:
jdolecek 2002-12-24 13:09:38 +00:00
parent 93b65fbd1d
commit 77d4ae97df
1 changed files with 6 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sort.c,v 1.29 2002/11/27 16:47:13 tron Exp $ */
/* $NetBSD: sort.c,v 1.30 2002/12/24 13:09:38 jdolecek Exp $ */
/*-
* Copyright (c) 1993
@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#endif /* not lint */
#ifndef lint
__RCSID("$NetBSD: sort.c,v 1.29 2002/11/27 16:47:13 tron Exp $");
__RCSID("$NetBSD: sort.c,v 1.30 2002/12/24 13:09:38 jdolecek Exp $");
__SCCSID("@(#)sort.c 8.1 (Berkeley) 6/6/93");
#endif /* not lint */
@ -68,6 +68,7 @@ __SCCSID("@(#)sort.c 8.1 (Berkeley) 6/6/93");
int REC_D = '\n';
u_char d_mask[NBINS]; /* flags for rec_d, field_d, <blank> */
/*
* weight tables. Gweights is one of ascii, Rascii..
* modified to weight rec_d = 0 (or 255)
@ -76,15 +77,14 @@ u_char ascii[NBINS], Rascii[NBINS], RFtable[NBINS], Ftable[NBINS];
int SINGL_FLD = 0, SEP_FLAG = 0, UNIQUE = 0;
struct coldesc clist[(ND+1)*2];
int ncols = 0;
extern struct coldesc clist[(ND+1)*2];
extern int ncols;
/*
* Default to stable sort.
*/
int stable_sort = 1;
char toutpath[MAXPATHLEN];
static char toutpath[MAXPATHLEN];
static struct field fldtab[ND+2];
const char *tmpdir; /* where temporary files should be put */
@ -104,14 +104,12 @@ main(argc, argv)
int ch, i, stdinflag = 0, tmp = 0;
char cflag = 0, mflag = 0;
char *outfile, *outpath = 0;
struct field fldtab[ND+2], *ftpos;
struct field *ftpos;
struct filelist filelist;
FILE *outfp = NULL;
setlocale(LC_ALL, "");
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['\t'] = d_mask[' '] = BLANK | FLD_D;