From: "Tim Van Holder" To: Subject: Re: getdate prototype Date: Mon, 13 Aug 2001 10:53:16 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0004_01C123E6.27F80360" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <200108122255.SAA09919@envy.delorie.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_0004_01C123E6.27F80360 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > This will cause link problems with new programs and old libraries, or > visa versa. If we're going this route, neither of the real functions > should be called `getdate', so that there's no chance of accidentally > linking in the wrong one. Right. The attached diff fixes this by naming the POSIX getdate _posix_getdate. It also adds a weak getdate symbol, which is aliased to _dos_getdate; this way, old libraries will still be able to link properly. It also means that sources that declare/use the POSIX getdate without including time.h will get linked to the DOS getdate though - but since that is user error, I'm not sure it is all that important. It also moves the getdate prototype to the right place (POSIX, not ANSI) in time.h, and adds the declaration for getdate_err. ------=_NextPart_000_0004_01C123E6.27F80360 Content-Type: application/octet-stream; name="getdate2.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="getdate2.diff" Index: include/dos.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/djgpp/djgpp/include/dos.h,v retrieving revision 1.9 diff -u -r1.9 dos.h --- include/dos.h 2001/07/27 10:42:44 1.9 +++ include/dos.h 2001/08/13 08:45:47 @@ -164,10 +164,21 @@ int getcbrk(void); int setcbrk(int _new_value); =20 -void getdate(struct date *); +void _dos_getdate(struct date *); void gettime(struct time *); void setdate(struct date *); void settime(struct time *); + +/* This is to resolve the name clash between our getdate and the one + from the POSIX spec (in time.h). + IMPORTANT: + If both dos.h and time.h are included, the getdate function used + will always be the POSIX one, and never this DOS-oriented one (which + will then only be available as _dos_getdate). */ +#ifndef __POSIX_GETDATE +# undef getdate +# define getdate _dos_getdate +#endif =20 void getdfree(unsigned char _drive, struct dfree *_ptr); =20 Index: include/time.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/djgpp/djgpp/include/time.h,v retrieving revision 1.5 diff -u -r1.5 time.h --- include/time.h 2000/12/05 14:05:53 1.5 +++ include/time.h 2001/08/13 08:45:49 @@ -1,3 +1,4 @@ +/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ @@ -62,9 +63,16 @@ =20 #define CLK_TCK CLOCKS_PER_SEC =20 -extern char *tzname[2]; +extern char * tzname[2]; +extern int getdate_err; =20 -void tzset(void); +void tzset(void); +struct tm * _posix_getdate(const char * _spec); + +/* This helps with the nameclash for getdate (see dos.h for details) */ +#define __POSIX_GETDATE +#undef getdate +#define getdate _posix_getdate =20 #ifndef _POSIX_SOURCE =20 Index: src/libc/dos/dos/getdate.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/djgpp/djgpp/src/libc/dos/dos/getdate.c,v retrieving revision 1.1 diff -u -r1.1 getdate.c --- src/libc/dos/dos/getdate.c 1995/03/21 07:25:42 1.1 +++ src/libc/dos/dos/getdate.c 2001/08/13 08:45:57 @@ -1,8 +1,9 @@ +/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include #include =20 -void getdate( struct date *dateblk) +void getdate(struct date *dateblk) { __dpmi_regs regs; =20 @@ -12,3 +13,8 @@ dateblk-> da_mon =3D regs.h.dh; dateblk-> da_day =3D regs.h.dl; } + +#undef getdate +/* Set up a weak alias for this function, so old code will be able to + link properly */ +void getdate( struct date *dateblk) __attribute__ ((weak, alias = ("_dos_getdate"))); ------=_NextPart_000_0004_01C123E6.27F80360--