summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-12-28 15:36:49 +0100
committerJim Meyering <meyering@redhat.com>2011-12-28 15:38:06 +0100
commit7d1ea00d64fae62fb6a3b166f35278db6f842bba (patch)
treeca42052b265925aa0005996c15b09b6d2b35b3ee
parent18c0337917db10703c6c5f5265b142971af43e10 (diff)
downloadgrep-7d1ea00d64fae62fb6a3b166f35278db6f842bba.tar.gz
avoid new syntax-check failures
* cfg.mk (old_NEWS_hash): Update, to accommodate old NEWS modification. * src/main.c: Indent solely with spaces, never with TABs. (should_colorize): Remove useless parens in #if directive.
-rw-r--r--cfg.mk2
-rw-r--r--src/main.c125
2 files changed, 63 insertions, 64 deletions
diff --git a/cfg.mk b/cfg.mk
index 5dab0827..d7cb9c42 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -31,7 +31,7 @@ bootstrap-tools = autoconf,automake,gnulib
# Now that we have better tests, make this the default.
export VERBOSE = yes
-old_NEWS_hash = eef39d21f882ff61aa48eddb34eb38fe
+old_NEWS_hash = 25ce2f420ad2d0f4ec68b23237691054
# Many m4 macros names once began with `jm_'.
# Make sure that none are inadvertently reintroduced.
diff --git a/src/main.c b/src/main.c
index 46d28738..cb8d4443 100644
--- a/src/main.c
+++ b/src/main.c
@@ -326,50 +326,49 @@ w32_sgr2attr (const char *sgr_seq)
for (s = p = sgr_seq; *s; p++)
{
-
if (*p == ';' || *p == '\0')
- {
- code = strtol (s, NULL, 10);
- s = p + (*p != '\0');
-
- switch (code)
- {
- case 0: /* all attributes off */
- fg = norm_attr & 15;
- bg = norm_attr & (15 << 4);
- bright = 0;
- inverse = 0;
- break;
- case 1: /* intensity on */
- bright = 1;
- break;
- case 7: /* inverse video */
- inverse = 1;
- break;
- case 22: /* intensity off */
- bright = 0;
- break;
- case 27: /* inverse off */
- inverse = 0;
- break;
- case 30: case 31: case 32: case 33: /* foreground color */
- case 34: case 35: case 36: case 37:
- fg = fg_color[code - 30];
- break;
- case 39: /* default foreground */
- fg = norm_attr & 15;
- break;
- case 40: case 41: case 42: case 43: /* background color */
- case 44: case 45: case 46: case 47:
- bg = bg_color[code - 40];
- break;
- case 49: /* default background */
- bg = norm_attr & (15 << 4);
- break;
- default:
- break;
- }
- }
+ {
+ code = strtol (s, NULL, 10);
+ s = p + (*p != '\0');
+
+ switch (code)
+ {
+ case 0: /* all attributes off */
+ fg = norm_attr & 15;
+ bg = norm_attr & (15 << 4);
+ bright = 0;
+ inverse = 0;
+ break;
+ case 1: /* intensity on */
+ bright = 1;
+ break;
+ case 7: /* inverse video */
+ inverse = 1;
+ break;
+ case 22: /* intensity off */
+ bright = 0;
+ break;
+ case 27: /* inverse off */
+ inverse = 0;
+ break;
+ case 30: case 31: case 32: case 33: /* foreground color */
+ case 34: case 35: case 36: case 37:
+ fg = fg_color[code - 30];
+ break;
+ case 39: /* default foreground */
+ fg = norm_attr & 15;
+ break;
+ case 40: case 41: case 42: case 43: /* background color */
+ case 44: case 45: case 46: case 47:
+ bg = bg_color[code - 40];
+ break;
+ case 49: /* default background */
+ bg = norm_attr & (15 << 4);
+ break;
+ default:
+ break;
+ }
+ }
}
if (inverse)
{
@@ -395,12 +394,12 @@ pr_sgr_start (const char *sgr_seq, int cond)
if (cond && *sgr_seq)
{
if (hstdout != INVALID_HANDLE_VALUE)
- {
- SHORT attr = w32_sgr2attr (sgr_seq);
- SetConsoleTextAttribute (hstdout, attr);
- }
+ {
+ SHORT attr = w32_sgr2attr (sgr_seq);
+ SetConsoleTextAttribute (hstdout, attr);
+ }
else
- printf (sgr_start, sgr_seq);
+ printf (sgr_start, sgr_seq);
}
}
@@ -424,7 +423,7 @@ w32_clreol (void)
nchars = csbi.dwSize.X - start_pos.X;
FillConsoleOutputAttribute (hstdout, norm_attr, nchars, start_pos,
- &written);
+ &written);
FillConsoleOutputCharacter (hstdout, ' ', nchars, start_pos, &written);
}
@@ -435,12 +434,12 @@ pr_sgr_end (const char *sgr_seq, int cond)
if (cond && *sgr_seq)
{
if (hstdout != INVALID_HANDLE_VALUE)
- {
- SetConsoleTextAttribute (hstdout, norm_attr);
- w32_clreol ();
- }
+ {
+ SetConsoleTextAttribute (hstdout, norm_attr);
+ w32_clreol ();
+ }
else
- printf ("%s", sgr_end);
+ printf ("%s", sgr_end);
}
}
#else
@@ -1900,16 +1899,16 @@ parse_grep_colors (void)
if (cap->var)
{
if (val)
- *(cap->var) = val;
+ *(cap->var) = val;
else
- error(0, 0, _("in GREP_COLORS=\"%s\", the \"%s\" capacity "
+ error(0, 0, _("in GREP_COLORS=\"%s\", the \"%s\" capacity "
"needs a value (\"=...\"); skipped"), p, name);
- }
- else if (val)
- error(0, 0, _("in GREP_COLORS=\"%s\", the \"%s\" capacity "
- "is boolean and cannot take a value (\"=%s\"); skipped"),
- p, name, val);
- }
+ }
+ else if (val)
+ error(0, 0, _("in GREP_COLORS=\"%s\", the \"%s\" capacity "
+ "is boolean and cannot take a value (\"=%s\"); skipped"),
+ p, name, val);
+ }
if (cap->fct)
{
const char *err_str = cap->fct();
@@ -1948,7 +1947,7 @@ should_colorize (int fd)
{
const char *t;
-#if defined(__MINGW32__) || defined(__DJGPP__)
+#if defined __MINGW32__ || defined __DJGPP__
return
isatty (fd)
#ifdef __MINGW32__