From 3bbf5170722d9e555307259763623c74240a2555 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 19 Feb 2015 19:20:35 -0800 Subject: Simplify binary I/O configuration * lib-src/etags.c: Include rather than . (process_file_name, analyze_regex): Use FOPEN_BINARY rather than hard-coded "b". * src/lread.c (Fload): Prefer FOPEN_TEXT and FOPEN_BINARY to #ifdef DOS_NT. * src/sysstdio.h: Add copyright notice. Include . (FOPEN_BINARY, FOPEN_TEXT): New macros. * src/xfaces.c (Fx_load_color_file): Use FOPEN_TEXT, since POSIX doesn't guarantee that "t" will work. --- lib-src/ChangeLog | 7 +++++++ lib-src/etags.c | 15 ++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'lib-src') diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 05511164706..4ac9638102f 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,10 @@ +2015-02-20 Paul Eggert + + Simplify binary I/O configuration + * etags.c: Include rather than . + (process_file_name, analyze_regex): Use FOPEN_BINARY rather than + hard-coded "b". + 2015-02-19 Eli Zaretskii * etags.c (process_file_name) [!DOS_NT]: Use "r", not "rb" in the diff --git a/lib-src/etags.c b/lib-src/etags.c index cdac9289230..7f1875547cf 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -122,7 +122,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; #include #include #include -#include +#include #include #include #include @@ -1532,18 +1532,11 @@ process_file_name (char *file, language *lang) if (real_name == compressed_name) { char *cmd = concat (compr->command, " ", real_name); - - /* Unix implementations of 'popen' generally don't support "rb", whereas - DOS_NT needs it. */ -#ifdef DOS_NT - inf = popen (cmd, "rb"); -#else - inf = popen (cmd, "r"); -#endif + inf = popen (cmd, "r" FOPEN_BINARY); free (cmd); } else - inf = fopen (real_name, "rb"); + inf = fopen (real_name, "r" FOPEN_BINARY); if (inf == NULL) { perror (real_name); @@ -5607,7 +5600,7 @@ analyze_regex (char *regex_arg) char *regexfile = regex_arg + 1; /* regexfile is a file containing regexps, one per line. */ - regexfp = fopen (regexfile, "rb"); + regexfp = fopen (regexfile, "r" FOPEN_BINARY); if (regexfp == NULL) pfatal (regexfile); linebuffer_init (®exbuf); -- cgit v1.2.1