Hi,

I was trying to get diffutils 3.5 working  while using Visual Studio. I.e. I 
like to generate native Windows binaries, that do not need Cygwin.

Based on recommendation in the thread at 
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25814, I'm sending a request to 
you.

Can you please fix the same_file (and same_file_attributes) macros in system.h 
in such way that they are usable on Windows too?
At default, Microsoft Visual studio runtime does not support inodes (while 
Cygwin does). The same applies to uid and gid. Either a translation layer
is needed, or  the macro need to be changed in a similar (quick and dirty way) 
like I did:

if _WIN32
# define same_file(s, t) 0
#else
# define same_file(s, t) \
    ((((s)->st_ino == (t)->st_ino) && ((s)->st_dev == (t)->st_dev)) \
     || same_special_file (s, t))
#endif

and

#ifndef same_file_attributes
#if _WIN32
# define same_file_attributes(s, t) 0
#else
# define same_file_attributes(s, t) \
   ((s)->st_mode == (t)->st_mode \
    && (s)->st_nlink == (t)->st_nlink \
    && (s)->st_uid == (t)->st_uid \
    && (s)->st_gid == (t)->st_gid \
    && (s)->st_size == (t)->st_size \
    && (s)->st_mtime == (t)->st_mtime \
    && (s)->st_ctime == (t)->st_ctime)
#endif
#endif

Not sure whether this is a very nice fix (I think it isn't), but in the way how 
Microsoft provides stat/fstat information, there is not much to choose.
I'm in doubt whether this is proposal ok for you, but I really like of gnulib 
became supported on native Windows/Visual Studio as well.

Regards,
Kees

Reply via email to