[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trouble Compiling Lout
From: |
Valeriy E. Ushakov |
Subject: |
Re: Trouble Compiling Lout |
Date: |
Wed, 30 Aug 1995 15:25:46 +0400 (MSD) |
On Tue, 29 Aug 1995, Russell Todd wrote:
> I downloaded lout.3.06 and tried to compile it on my SPARC 10 running
> SunOS 4.1.3.
[skipped]
> I tried using GNU C but it ended up dying on a file where it said
> something wasn't defined. Does anybody have any suggestions on how I
> can get lout to compile?
I wrote Jeff about this trouble
| I've just installed the new lout (Lout 3.05, SunOS-4.1.3). The only
| problem I encountered is that z41.c needs <unistd.h> to get SEEK_END
| defined.
And following is the detailed explanation (sent two days later)
| Date: Thu, 13 Jul 1995 16:05:47 +0400 (MSD)
| From: "Valeriy E. Ushakov" <address@hidden>
| To: address@hidden
| Subject: standard.ld && unistd.h problems
|
| Hi, Jeff!
|
| > Thanks, you're the second person who told me that. But according to
| > my Unix and DOS manual entries, SEEK_END is supposed to be defined in
| > stdio.h, which is certainly included in z41.c (via externs). So at
| > present I've decided that Lout is right and your compiler is wrong; if
| > you have any evidence to the contrary, please let me know about it.
|
| Hmm... I have no POSIX reference at hands but I have checked at least
| the following: SunOS4.1.3, Ultrix4.3, FreeBSD-1.1.5.1
|
| Well what I can conclude is: <stdio.h> has SEEK_* defined as `whence'
| argument for fseek(3). But <unistd.h> has SEEK_* defined to the same
| values as `whence' argument for lseek(2). What a mess!
|
| Perhaps FreeBSD treats this most cleanly.
|
| [Manual on lseek(2) requires <unistd.h>]
| STANDARDS
| The lseek() function conforms to IEEE Std 1003.1-1988 (``POSIX'').
|
| [Manual on fseek(3) requires <stdio.h>]
| STANDARDS
| The fgetpos(), fsetpos(), fseek(), ftell(), and rewind() functions
| conform to ISO 9899:1990 (``ANSI C'').
|
|
| from sys/unistd.h (included by <unistd.h>)
|
|
| /* whence values for lseek(2) */
| #define SEEK_SET 0 /* set file offset to offset */
| #define SEEK_CUR 1 /* set file offset to current plus offset */
| #define SEEK_END 2 /* set file offset to EOF plus offset */
|
| #ifndef _POSIX_SOURCE
| /* whence values for lseek(2); renamed by POSIX 1003.1 */
| #define L_SET SEEK_SET
| #define L_INCR SEEK_CUR
| #define L_XTND SEEK_END
| #endif
|
|
| And in stdio.h:
|
| #ifndef SEEK_SET
| #define SEEK_SET 0 /* set file offset to offset */
| #endif
| #ifndef SEEK_CUR
| #define SEEK_CUR 1 /* set file offset to current plus offset */
| #endif
| #ifndef SEEK_END
| #define SEEK_END 2 /* set file offset to EOF plus offset */
| #endif
|
| Since SunOS-4.1.3 has non ANSI cc by default, that's why its includes
| are not ANSI conformant. In fact SEEK_* for fseek(3) and SEEK_* for
| lseek(2) are quite different things conceptually. So perhaps here two
| standard have a name clash. Sigh.
|
| You may put some reference to this into README, so that people know
| that lout is right as ANSI program. Or you can define SEEK_*
| yourself to fix if they are not defined by <stdio.h>. <unistd.h> is
| certainly shouldn't be included for them (its SEEK_*'s are for
| lseek(2)!).
So this is the story.
To work around this problem just add #include <unistd.h> to z41.c
Hope it helps.
Best regards!
SY, Uwe.
--------
Valeriy E. Ushakov (aka Uwe) | Zu Grunde kommen
address@hidden | Ist zu Grunde gehen