Re: patch/ mg(1) include time.h for struct timespec
Brian Callahan writes: On 06/21/15 19:56, Kamil Rytarowski wrote: On 22.06.2015 01:55, Brian Callahan wrote: This is quite obviously the wrong place to put any headers. It's odd, otherwise then the code should be refactored and the following struct perhaps moved away, together with struct buffer? /* * Previously from sysdef.h * Only used in struct buffer. */ struct fileinfo { uid_t fi_uid; gid_t fi_gid; mode_t fi_mode; struct timespec fi_mtime; /* Last modified time */ }; Are there better ideas? I did some digging. signal.h-sys/signal.h-sys/siginfo.h-sys/time.h sys/time.h has the timespec definition. So this appears to be an issue specific to NetBSD. Or, at least, not an issue on OpenBSD. Maybe better to refer to POSIX directly, which states: The signal.h header shall define the timespec structure as described in time.h. -- Anthony J. Bentley
Re: patch/ mg(1) include time.h for struct timespec
On 06/21/15 21:21, Anthony J. Bentley wrote: Brian Callahan writes: On 06/21/15 19:56, Kamil Rytarowski wrote: On 22.06.2015 01:55, Brian Callahan wrote: This is quite obviously the wrong place to put any headers. It's odd, otherwise then the code should be refactored and the following struct perhaps moved away, together with struct buffer? /* * Previously from sysdef.h * Only used in struct buffer. */ struct fileinfo { uid_t fi_uid; gid_t fi_gid; mode_t fi_mode; struct timespec fi_mtime; /* Last modified time */ }; Are there better ideas? I did some digging. signal.h-sys/signal.h-sys/siginfo.h-sys/time.h sys/time.h has the timespec definition. So this appears to be an issue specific to NetBSD. Or, at least, not an issue on OpenBSD. Maybe better to refer to POSIX directly, which states: The signal.h header shall define the timespec structure as described in time.h. Even better, thanks! :-)
Re: patch/ mg(1) include time.h for struct timespec
This is quite obviously the wrong place to put any headers. On 06/21/15 19:41, Kamil Rytarowski wrote: Caught on NetBSD. Index: def.h === RCS file: /cvs/src/usr.bin/mg/def.h,v retrieving revision 1.147 diff -u -r1.147 def.h --- def.h 3 Jun 2015 23:40:01 - 1.147 +++ def.h 21 Jun 2015 23:43:23 - @@ -10,6 +10,8 @@ * per-terminal definitions are in special header files. */ +#include time.h + #include chrdef.h typedef int (*PF)(int, int);/* generally useful type */
Re: patch/ mg(1) include time.h for struct timespec
On 06/21/15 19:56, Kamil Rytarowski wrote: On 22.06.2015 01:55, Brian Callahan wrote: This is quite obviously the wrong place to put any headers. It's odd, otherwise then the code should be refactored and the following struct perhaps moved away, together with struct buffer? /* * Previously from sysdef.h * Only used in struct buffer. */ struct fileinfo { uid_t fi_uid; gid_t fi_gid; mode_t fi_mode; struct timespec fi_mtime; /* Last modified time */ }; Are there better ideas? I did some digging. signal.h-sys/signal.h-sys/siginfo.h-sys/time.h sys/time.h has the timespec definition. So this appears to be an issue specific to NetBSD. Or, at least, not an issue on OpenBSD. ~Brian
Re: patch/ mg(1) include time.h for struct timespec
On 22.06.2015 01:55, Brian Callahan wrote: This is quite obviously the wrong place to put any headers. It's odd, otherwise then the code should be refactored and the following struct perhaps moved away, together with struct buffer? /* * Previously from sysdef.h * Only used in struct buffer. */ struct fileinfo { uid_t fi_uid; gid_t fi_gid; mode_t fi_mode; struct timespec fi_mtime; /* Last modified time */ }; Are there better ideas?