* 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.
+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
#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>
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);
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);
+2015-02-20 Paul Eggert <eggert@cs.ucla.edu>
+
+ Simplify binary I/O configuration
+ * lread.c (Fload): Prefer FOPEN_TEXT and FOPEN_BINARY to #ifdef DOS_NT.
+ * sysstdio.h: Add copyright notice. Include <fcntl.h>.
+ (FOPEN_BINARY, FOPEN_TEXT): New macros.
+ * xfaces.c (Fx_load_color_file): Use FOPEN_TEXT, since POSIX
+ doesn't guarantee that "t" will work.
+
2015-02-19 Eli Zaretskii <eliz@gnu.org>
* keyboard.c (read_char): Make sure this_single_command_key_start
bool compiled = 0;
Lisp_Object handler;
bool safe_p = 1;
- const char *fmode = "r";
+ const char *fmode = "r" FOPEN_TEXT;
int version;
-#ifdef DOS_NT
- fmode = "rt";
-#endif /* DOS_NT */
-
CHECK_STRING (file);
/* If file name is magic, call the handler. */
compiled = 1;
efound = ENCODE_FILE (found);
-
-#ifdef DOS_NT
- fmode = "rb";
-#endif /* DOS_NT */
+ fmode = "r" FOPEN_BINARY;
/* openp already checked for newness, no point doing it again.
FIXME would be nice to get a message when openp
+/* Standard I/O for Emacs.
+
+Copyright 2013-2015 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
#include <stdio.h>
+
extern FILE *emacs_fopen (char const *, char const *);
+
+#if O_BINARY
+# define FOPEN_BINARY "b"
+# define FOPEN_TEXT "t"
+#else
+# define FOPEN_BINARY ""
+# define FOPEN_TEXT ""
+#endif
abspath = Fexpand_file_name (filename, Qnil);
block_input ();
- fp = emacs_fopen (SSDATA (abspath), "rt");
+ fp = emacs_fopen (SSDATA (abspath), "r" FOPEN_TEXT);
if (fp)
{
char buf[512];