Examples from: Stevens, Advanced Programming ... 
Author Message
 Examples from: Stevens, Advanced Programming ...

Hi there,

I am reading W. Richard Stevens' "Advanced Programming in the UNIX
environment", and I have downloaded the examples from
ftp.uu.net. Unfortunately, none of this compiles under Linux, as the
book has been written in 1992, and the sources follow either Sun, BSD
or SysVR4 conventions.

Before I start rewriting stuff: Has anyone been working with this book
on a Linux system and already done the modifications? Please let me
know. Thanks in advance.

--


"Toto? - I have a feeling we're not in Kansas anymore."



Mon, 13 Nov 2000 03:00:00 GMT  
 Examples from: Stevens, Advanced Programming ...



Quote:
>Hi there,

>I am reading W. Richard Stevens' "Advanced Programming in the UNIX
>environment", and I have downloaded the examples from
>ftp.uu.net. Unfortunately, none of this compiles under Linux, as the
>book has been written in 1992, and the sources follow either Sun, BSD
>or SysVR4 conventions.

Sonce your question is about Unix rather than about the C programming
language you'll need to ask it in a more appropriate newsgroup.
comp.unix.programmer is good for general Unix programming questions.
There is a comp.os.linux.* hierarchy for Linux related questions.

--
-----------------------------------------


-----------------------------------------



Tue, 14 Nov 2000 03:00:00 GMT  
 Examples from: Stevens, Advanced Programming ...


Quote:
> Sonce your question is about Unix rather than about the C programming
> language you'll need to ask it in a more appropriate newsgroup.
> comp.unix.programmer is good for general Unix programming questions.
> There is a comp.os.linux.* hierarchy for Linux related questions.

Thanks for your advice. I'm not convinced though that C programming
under Unix is more about Unix than about C. C is supposed to be an
extremely portable language, and its origins are related to
Unix. Unfortunately, each and every operating system treats C and its
standard libraries in a different fashion, and this can drive you
nuts. Of course, if we all ignore the fact that there are more
operating systems around than M$ Windows, then portability is not an
issue.

--


"Toto? - I have a feeling we're not in Kansas anymore."



Wed, 15 Nov 2000 03:00:00 GMT  
 Examples from: Stevens, Advanced Programming ...



Quote:

>Thanks for your advice. I'm not convinced though that C programming
>under Unix is more about Unix than about C. C is supposed to be an
>extremely portable language, and its origins are related to
>Unix.

This is, of course, true, but the standardisation committee went to some
lengths to make Standard C (aka "ANSI C", "ISO C") as system-independent
as possible.  I think the fact that C has become a popular language on
so many platforms proves that it's escaped its UNIX roots.  Of course UNIX
users (including myself) do make up a large and important part of the
C community.

Quote:
>Unfortunately, each and every operating system treats C and its
>standard libraries in a different fashion, and this can drive you
>nuts.

Well, if you truly stick to the *standard* libraries, then you shouldn't
have too many problems.  :-)  Of course, the standard libraries offer
quite limited functionality and it's hard to write many types of program
without straying outside them.  But discussion of what happens when you
step outside the standard library surely fits better in an OS-specific
group, since these details do vary from OS to OS (and indeed sometimes
from compiler to compiler).

Quote:
>Of course, if we all ignore the fact that there are more
>operating systems around than M$ Windows, then portability is not an
>issue.

I assure you there's no pro-MS bias in comp.lang.c -- quite the contrary,
in fact.

I understand your point that "C under UNIX" questions could reasonably
fit in comp.lang.c.  However, consider what would happen if this style
of question were welcomed.  Since C is such a widely-used language, much
of the traffic in the OS-specific groups would also be considered relevant
to comp.lang.c, and (as you'll see if you look at the volume of articles
in those other groups) such a mass of material -- only a small proportion
of it of interest to each poster -- would make c.l.c effectively unusable.

The preference among the frequent posters, then, is to restrict discussion
to Standard C and to refer questions about using the language with specific
operating systems to the OS-related groups.

It's important to note that exactly the same objections would be raised
to "C under DOS" or "C under Windows" questions, at least by the more
regular and knowledgeable posters.

Cheers,
Richard
--
Richard Stamp
Churchill College, Cambridge



Wed, 15 Nov 2000 03:00:00 GMT  
 Examples from: Stevens, Advanced Programming ...



Quote:

>> Sonce your question is about Unix rather than about the C programming
>> language you'll need to ask it in a more appropriate newsgroup.
>> comp.unix.programmer is good for general Unix programming questions.
>> There is a comp.os.linux.* hierarchy for Linux related questions.

>Thanks for your advice. I'm not convinced though that C programming
>under Unix is more about Unix than about C.

Most of the examples in Stevens' book use facilities that the C language
does not define. What the book describes is the Unix system interface.

Quote:
>C is supposed to be an extremely portable language,

It is, but to get that portability you must restrict yourself to
the facilities defined by the language. Steven's book talks mostly about
things that are not; it talks about how to program under Unix using the
Unix system interface. Most of the program there won't run on other platforms.
Even functions like open() (and anything that uses int file descriptors)
are not standard C.

Quote:
>and its origins are related to
>Unix.

True, but it since the ANSI standard came out in 1989 it is now essentially
divorced from those origins. The Unix interface definitons may be based
on C but they are on other platforms too.

Quote:
>Unfortunately, each and every operating system treats C and its
>standard libraries in a different fashion, and this can drive you
>nuts.

That's why it is essential to know the difference between the standard C
library and platform-specific extensions. That is why we make a big deal
of the distinction in comp.lang.c.

Quote:
>Of course, if we all ignore the fact that there are more
>operating systems around than M$ Windows, then portability is not an
>issue.

comp.lang.c is more often accused of being anti-MS than pro. The truth is
that we try to stick to standard C and redirect any plsatform-specific
stuff to platform related newsgroups. That happens a lot more to MS related
newsgroups because a lot more MS related questions get posted. The regulars
(myself included) have tended to have more of a Unix than MS background
so it is probably true that Unix related questions are more likely
to get a helpful comment along with the redirection. It is also easier
to write in standard C on Unix platforms, a native Windows application
can't avoid non-standard extensions.

--
-----------------------------------------


-----------------------------------------



Thu, 16 Nov 2000 03:00:00 GMT  
 Examples from: Stevens, Advanced Programming ...

Quote:

> comp.lang.c is more often accused of being anti-MS than pro. The truth is
> that we try to stick to standard C and redirect any plsatform-specific
> stuff to platform related newsgroups. That happens a lot more to MS related
> newsgroups because a lot more MS related questions get posted. The regulars
> (myself included) have tended to have more of a Unix than MS background
> so it is probably true that Unix related questions are more likely
> to get a helpful comment along with the redirection. It is also easier
> to write in standard C on Unix platforms, a native Windows application
> can't avoid non-standard extensions.

Thanks. You've been very helpful. I'll try to follow both comp.lang.c
*and* comp.unix.programmer in the future.

--


"Toto? - I have a feeling we're not in Kansas anymore."



Thu, 16 Nov 2000 03:00:00 GMT  
 Examples from: Stevens, Advanced Programming ...


Quote:

>> Sonce your question is about Unix rather than about the C programming
>> language you'll need to ask it in a more appropriate newsgroup.
>> comp.unix.programmer is good for general Unix programming questions.
>> There is a comp.os.linux.* hierarchy for Linux related questions.

>Thanks for your advice. I'm not convinced though that C programming
>under Unix is more about Unix than about C.

It is more about UNIX if your focus is systems programming as
described in the Advanced Programming textbook. The meaning of a
program which relies on UNIX system calls (albeit dressed up behind
a C language function call interface) is entirely specific to
that operating system. The program won't work without the
infrastructure of the OS working to interpret its meaning.

Quote:
>extremely portable language, and its origins are related to
>Unix.

C stops being an extremely portable language once you start relying
on OS-specific library features like fork() or ioctl().
These functions aren't required components of a C implementation.

Quote:
> Unfortunately, each and every operating system treats C and its
>standard libraries in a different fashion, and this can drive you
>nuts.

This is rarely a problem if you know what the requirements are for
the standard C library and rely only on those requirements being
implemented. (There are some legacy systems with oudated libraries
that don't meet the 1989 ANSI C standard, e.g. SunOS 4.1.x).


Fri, 17 Nov 2000 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Unix Network Programming by Stevens

2. Advanced Finite Automaton as a simple HTML formatter [Crazy Example]

3. HELP: I need an example Thanks In Advance

4. Stevens' "Advanced Programming" and Linux

5. Advanced Finite Automaton as a simple HTML formatter [Crazy Example]

6. Help! Linux and Stevens Advanced Programming in the UNIX Envionment

7. Proposal: alt.binaries.examples.vb4 , alt.binaries.examples.vcpp , alt.binaries.examples.java

8. Advanced C programming books?

9. Page on advanced programming

10. The Bible of C or Advanced Programming

11. Can anyone help out with this program or any ideas?Thanks in advance

12. Good book about Advanced C Programming?

 

 
Powered by phpBB® Forum Software