[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] grep: prefer fgets to printf, _ to gettext
From: |
Paul Eggert |
Subject: |
[PATCH] grep: prefer fgets to printf, _ to gettext |
Date: |
Sun, 01 Jan 2012 02:11:23 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0 |
Here's a proposed minor cleanup patch.
* lib/colorize.h (print_end_colorize):
* lib/ms/colorize-impl.c (print_end_colorize):
Use fputs instead of printf.
* src/main.c (usage): Likewise. Use _ instead of gettext.
---
lib/colorize.h | 2 +-
lib/ms/colorize-impl.c | 2 +-
src/main.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/colorize.h b/lib/colorize.h
index 7890fbc..104f7a0 100644
--- a/lib/colorize.h
+++ b/lib/colorize.h
@@ -33,5 +33,5 @@ print_start_colorize (char const *sgr_start, char const
*sgr_seq)
static inline void
print_end_colorize (char const *sgr_end)
{
- printf ("%s", sgr_end);
+ fputs (sgr_end, stdout);
}
diff --git a/lib/ms/colorize-impl.c b/lib/ms/colorize-impl.c
index 3c8c73a..d9d9b95 100644
--- a/lib/ms/colorize-impl.c
+++ b/lib/ms/colorize-impl.c
@@ -212,5 +212,5 @@ print_end_colorize (char const *sgr_end)
w32_clreol ();
}
else
- printf ("%s", sgr_end);
+ fputs (sgr_end, stdout);
}
diff --git a/src/main.c b/src/main.c
index 6fdc982..f54ae82 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1408,7 +1408,7 @@ usage (int status)
printf (_("Usage: %s [OPTION]... PATTERN [FILE]...\n"), program_name);
printf (_("\
Search for PATTERN in each FILE or standard input.\n"));
- printf ("%s", gettext (before_options));
+ fputs (_(before_options), stdout);
printf (_("\
Example: %s -i 'hello world' menu.h main.c\n\
\n\
@@ -1489,7 +1489,7 @@ Context control:\n\
-u, --unix-byte-offsets report offsets as if CRs were not there\n\
(MSDOS/Windows)\n\
\n"));
- printf ("%s", _(after_options));
+ fputs (_(after_options), stdout);
printf (_("\
With no FILE, or when FILE is -, read standard input. If less than two
FILEs\n\
are given, assume -h. Exit status is 0 if any line was selected, 1
otherwise;\n\
--
1.7.6.4
- [PATCH] grep: prefer fgets to printf, _ to gettext,
Paul Eggert <=