From owner-p4-projects@FreeBSD.ORG Thu Mar 26 22:46:01 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BF1401065673; Thu, 26 Mar 2009 22:46:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E92F1065670 for ; Thu, 26 Mar 2009 22:46:00 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 615738FC17 for ; Thu, 26 Mar 2009 22:46:00 +0000 (UTC) (envelope-from gabor@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n2QMk0O4003340 for ; Thu, 26 Mar 2009 22:46:00 GMT (envelope-from gabor@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n2QMk0if003338 for perforce@freebsd.org; Thu, 26 Mar 2009 22:46:00 GMT (envelope-from gabor@freebsd.org) Date: Thu, 26 Mar 2009 22:46:00 GMT Message-Id: <200903262246.n2QMk0if003338@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gabor@freebsd.org using -f From: Gabor Kovesdan To: Perforce Change Reviews Cc: Subject: PERFORCE change 159879 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2009 22:46:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=159879 Change 159879 by gabor@gabor_server on 2009/03/26 22:45:13 - C99ify bool variables Affected files ... .. //depot/projects/soc2008/gabor_textproc/grep/fastgrep.c#12 edit .. //depot/projects/soc2008/gabor_textproc/grep/grep.c#87 edit .. //depot/projects/soc2008/gabor_textproc/grep/grep.h#48 edit Differences ... ==== //depot/projects/soc2008/gabor_textproc/grep/fastgrep.c#12 (text+ko) ==== @@ -41,6 +41,7 @@ #endif /* not lint */ #include +#include #include #include #include @@ -111,7 +112,7 @@ strncmp(pattern + fg->bol + fg->len - 7, "[[:>:]]", 7) == 0) { fg->len -= 14; /* Word boundary is handled separately in util.c */ - wflag = 1; + wflag = true; } /* ==== //depot/projects/soc2008/gabor_textproc/grep/grep.c#87 (text+ko) ==== @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -98,25 +99,25 @@ /* Command-line flags */ unsigned long long Aflag; /* -A x: print x lines trailing each match */ unsigned long long Bflag; /* -B x: print x lines leading each match */ -int Hflag; /* -H: always print file name */ -int Lflag; /* -L: only show names of files with no matches */ -int bflag; /* -b: show block numbers for each match */ -int cflag; /* -c: only show a count of matching lines */ -int hflag; /* -h: don't print filename headers */ -int iflag; /* -i: ignore case */ -int lflag; /* -l: only show names of files with matches */ -int mflag; /* -m x: stop reading the files after x matches */ +bool Hflag; /* -H: always print file name */ +bool Lflag; /* -L: only show names of files with no matches */ +bool bflag; /* -b: show block numbers for each match */ +bool cflag; /* -c: only show a count of matching lines */ +bool hflag; /* -h: don't print filename headers */ +bool iflag; /* -i: ignore case */ +bool lflag; /* -l: only show names of files with matches */ +bool mflag; /* -m x: stop reading the files after x matches */ unsigned long long mcount; /* count for -m */ -int nflag; /* -n: show line numbers in front of matching lines */ -int oflag; /* -o: print only matching part */ -int qflag; /* -q: quiet mode (don't output anything) */ -int sflag; /* -s: silent mode (ignore errors) */ -int vflag; /* -v: only show non-matching lines */ -int wflag; /* -w: pattern must start and end on word boundaries */ -int xflag; /* -x: pattern must match entire line */ -int lbflag; /* --line-buffered */ -int nullflag; /* --null */ -int exclflag; /* --exclude */ +bool nflag; /* -n: show line numbers in front of matching lines */ +bool oflag; /* -o: print only matching part */ +bool qflag; /* -q: quiet mode (don't output anything) */ +bool sflag; /* -s: silent mode (ignore errors) */ +bool vflag; /* -v: only show non-matching lines */ +bool wflag; /* -w: pattern must start and end on word boundaries */ +bool xflag; /* -x: pattern must match entire line */ +bool lbflag; /* --line-buffered */ +bool nullflag; /* --null */ +bool exclflag; /* --exclude */ char *label; /* --label */ char *color; /* --color */ int grepbehave = GREP_BASIC; /* -EFGP: type of the regex */ @@ -406,10 +407,10 @@ binbehave = BINFILE_TEXT; break; case 'b': - bflag = 1; + bflag = true; break; case 'c': - cflag = 1; + cflag = true; break; case 'D': if (strcmp(optarg, "skip") == 0) @@ -417,7 +418,7 @@ break; case 'd': if (strcmp("recurse", optarg) == 0) { - Hflag++; + Hflag = true; dirbehave = DIR_RECURSE; } else if (strcmp("skip", optarg) == 0) dirbehave = DIR_SKIP; @@ -444,33 +445,33 @@ grepbehave = GREP_BASIC; break; case 'H': - Hflag++; + Hflag = true; break; case 'h': - Hflag = 0; - hflag = 1; + Hflag = false; + hflag = true; break; case 'I': binbehave = BINFILE_SKIP; break; case 'i': case 'y': - iflag = 1; + iflag = true; cflags |= REG_ICASE; break; case 'J': filebehave = FILE_BZIP; break; case 'L': - lflag = 0; - Lflag = qflag = 1; + lflag = false; + Lflag = qflag = true; break; case 'l': - Lflag = 0; - lflag = qflag = 1; + Lflag = false; + lflag = qflag = true; break; case 'm': - mflag++; + mflag = true; mcount = strtoull(optarg, &ep, 10); if (((errno == ERANGE) && (mcount == ULLONG_MAX)) || ((errno == EINVAL) && (mcount == 0))) @@ -481,19 +482,19 @@ } break; case 'n': - nflag = 1; + nflag = true; break; case 'O': linkbehave = LINK_EXPLICIT; break; case 'o': - oflag++; + oflag = true; break; case 'p': linkbehave = LINK_SKIP; break; case 'q': - qflag = 1; + qflag = true; break; case 'S': linkbehave = LINK_GREP; @@ -501,10 +502,10 @@ case 'R': case 'r': dirbehave = DIR_RECURSE; - Hflag++; + Hflag = true; break; case 's': - sflag = 1; + sflag = true; break; case 'U': binbehave = BINFILE_BIN; @@ -517,13 +518,13 @@ printf(getstr(10), __progname, VERSION); exit(0); case 'v': - vflag = 1; + vflag = true; break; case 'w': - wflag = 1; + wflag = true; break; case 'x': - xflag = 1; + xflag = true; break; case 'Z': filebehave = FILE_GZIP; @@ -554,25 +555,25 @@ label = optarg; break; case LINEBUF_OPT: - lbflag = 1; + lbflag = true; break; case NULL_OPT: - nullflag = 1; + nullflag = true; break; case R_INCLUDE_OPT: - exclflag = 1; + exclflag = true; add_epattern(basename(optarg), strlen(basename(optarg)), FILE_PAT, INCL_PAT); break; case R_EXCLUDE_OPT: - exclflag = 1; + exclflag = true; add_epattern(basename(optarg), strlen(basename(optarg)), FILE_PAT, EXCL_PAT); break; case R_DINCLUDE_OPT: - exclflag = 1; + exclflag = true; add_epattern(basename(optarg), strlen(basename(optarg)), DIR_PAT, INCL_PAT); break; case R_DEXCLUDE_OPT: - exclflag = 1; + exclflag = true; add_epattern(basename(optarg), strlen(basename(optarg)), DIR_PAT, EXCL_PAT); break; case HELP_OPT: @@ -636,7 +637,7 @@ setlinebuf(stdout); if ((aargc == 0 || aargc == 1) && !Hflag) - hflag = 1; + hflag = true; if (aargc == 0) exit(!procfile("-")); ==== //depot/projects/soc2008/gabor_textproc/grep/grep.h#48 (text+ko) ==== @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -113,10 +114,10 @@ extern int cflags, eflags; /* Command line flags */ -extern int Eflag, Fflag, Gflag, Hflag, Lflag, +extern bool Eflag, Fflag, Gflag, Hflag, Lflag, bflag, cflag, hflag, iflag, lflag, mflag, nflag, oflag, qflag, sflag, vflag, wflag, xflag; -extern int nullflag, exclflag; +extern bool nullflag, exclflag; extern unsigned long long Aflag, Bflag, mcount; extern char *color, *label; extern int grepbehave, binbehave, filebehave, devbehave, dirbehave, linkbehave;