bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more 5.3.0 issues on cygwin


From: Jim Meyering
Subject: Re: more 5.3.0 issues on cygwin
Date: Tue, 18 Jan 2005 00:09:52 +0100

Eric Blake <address@hidden> wrote:
...
>         * src/od.c (OPENMODE): New macro.
>         (open_next_file): Use OPENMODE in fopen call.
...
> Index: src/od.c
> ===================================================================
> RCS file: /cvsroot/coreutils/coreutils/src/od.c,v
> retrieving revision 1.152
> diff -u -p -r1.152 od.c
> --- src/od.c  28 Sep 2004 01:09:03 -0000      1.152
> +++ src/od.c  17 Jan 2005 13:09:07 -0000
> @@ -70,6 +70,12 @@ typedef unsigned long long int ulonglong
>  typedef unsigned long int ulonglong_t;
>  #endif
>
> +#ifdef O_BINARY
> +# define OPENMODE "rb"
> +#else
> +# define OPENMODE "r"
> +#endif
> +
>  enum size_spec
>    {
>      NO_SIZE,
> @@ -906,7 +912,7 @@ open_next_file (void)
>       }
>        else
>       {
> -       in_stream = fopen (input_filename, "r");
> +       in_stream = fopen (input_filename, OPENMODE);
>         if (in_stream == NULL)
>           {
>             error (0, errno, "%s", input_filename);

Why is that needed?
od.c already does this:

  SET_BINARY (fileno (in_stream));

where that macro is defined in system.h:

#if O_BINARY
# ifndef __DJGPP__
#  define setmode _setmode
#  define fileno(_fp) _fileno (_fp)
# endif /* not DJGPP */
# define SET_MODE(_f, _m) setmode (_f, _m)
# define SET_BINARY(_f) do {if (!isatty(_f)) setmode (_f, O_BINARY);} while (0)

Maybe those #if directives don't work on your system?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]