summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-02-19 19:20:35 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-02-19 19:21:32 -0800
commit3bbf5170722d9e555307259763623c74240a2555 (patch)
tree853912d230255ec479567a7feb0cb9d0506e9de4 /lib-src
parent12ab9571935d79c69ffab0fb1ea3f6e20f475860 (diff)
downloademacs-3bbf5170722d9e555307259763623c74240a2555.tar.gz
Simplify binary I/O configuration
* lib-src/etags.c: Include <sysstdio.h> rather than <stdio.h>. (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 <fcntl.h>. (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.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog7
-rw-r--r--lib-src/etags.c15
2 files changed, 11 insertions, 11 deletions
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 <eggert@cs.ucla.edu>
+
+ Simplify binary I/O configuration
+ * etags.c: Include <sysstdio.h> rather than <stdio.h>.
+ (process_file_name, analyze_regex): Use FOPEN_BINARY rather than
+ hard-coded "b".
+
2015-02-19 Eli Zaretskii <eliz@gnu.org>
* 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 <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <stdio.h>
+#include <sysstdio.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
@@ -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 (&regexbuf);