By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,435 Members | 1,499 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,435 IT Pros & Developers. It's quick & easy.

C-FAQ 19.7

P: n/a
This is what is there now (2006, 20 Dec)

How can I do serial (``comm'') port I/O?

It's system-dependent. Under Unix, you typically open, read, and write a
device file in /dev, and use the facilities of the terminal driver to
adjust its characteristics. (See also questions 19.1 and 19.2.) Under
MS-DOS, you can use the predefined stream stdaux, or a special file like
COM1, or some primitive BIOS interrupts, or (if you require decent
performance) any number of interrupt-driven serial I/O packages. Several
netters recommend the book C Programmer's Guide to Serial
Communications, by Joe Campbell.

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

I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.

The proposed replacement text is below:

It's system-dependent. Under Unix, you typically open, read, and write a
device file in /dev, and use the facilities of the terminal driver to
adjust its characteristics. (See also questions 19.1 and 19.2.)

Under windows (Win32) you can use the primitives CreateFile, ReadFile,
and WriteFile to open a serial communications port, and read/write
to/from it. For more information see:

http://msdn.microsoft.com/library/de...sdn_serial.asp
Dec 21 '06 #1
Share this Question
Share on Google+
56 Replies


P: n/a
jacob navia said:

[C FAQ 19.7]
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
Nevertheless, it is still used, even by people learning C. I see no benefit
to removing the text.
The proposed replacement text is below:
<snip>
Under windows (Win32) you can use the primitives CreateFile, ReadFile,
and WriteFile to open a serial communications port, and read/write
to/from it. For more information see:
It is, however, reasonable to add a reference to a Windows technique, as you
suggest.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 21 '06 #2

P: n/a
On Thu, 21 Dec 2006 13:33:15 +0100, in comp.lang.c , jacob navia
<ja***@jacob.remcomp.frwrote:
>
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
Well, yes, but so has Windows 95 and there are plenty of users of
that. There are probably still plenty of DOS users.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Dec 21 '06 #3

P: n/a
jacob navia wrote:
This is what is there now (2006, 20 Dec)
[...]
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
[...]
Why bother comp.lang.c with the matter? The FAQ belongs
to Steve Summit; take your suggestions to him.

--
Eric Sosman
es*****@acm-dot-org.invalid
Dec 21 '06 #4

P: n/a
Eric Sosman said:
jacob navia wrote:
>This is what is there now (2006, 20 Dec)
[...]
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
[...]

Why bother comp.lang.c with the matter? The FAQ belongs
to Steve Summit; take your suggestions to him.
Either it's the comp.lang.c FAQ list or it isn't. If it is, discussing it is
relevant here. And if it isn't, we could sure use an FAQ list.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 21 '06 #5

P: n/a
Mark McIntyre a écrit :
On Thu, 21 Dec 2006 13:33:15 +0100, in comp.lang.c , jacob navia
<ja***@jacob.remcomp.frwrote:

>>I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.


Well, yes, but so has Windows 95 and there are plenty of users of
that. There are probably still plenty of DOS users.
There are also Mac OS7 users, VAX VMS, and many others.
Why should we reference MSDOS only?

The rationale behind my proposal is to have one reference
for Unix and another for Microsoft, as the original FAQ
had it.
Dec 21 '06 #6

P: n/a
jacob navia said:
Mark McIntyre a écrit :
>On Thu, 21 Dec 2006 13:33:15 +0100, in comp.lang.c , jacob navia
<ja***@jacob.remcomp.frwrote:

>>>I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.


Well, yes, but so has Windows 95 and there are plenty of users of
that. There are probably still plenty of DOS users.

There are also Mac OS7 users, VAX VMS, and many others.
Why should we reference MSDOS only?
A fair point. If C experts who are familiar with those systems would care to
document how to do serial I/O, no doubt Steve Summit will be happy to
incorporate their advice in the FAQ.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 21 '06 #7

P: n/a
On Thu, 21 Dec 2006 17:09:39 +0100, in comp.lang.c , jacob navia
<ja***@jacob.remcomp.frwrote:
>There are also Mac OS7 users, VAX VMS, and many others.
Why should we reference MSDOS only?
I guess because the FAQ is targetted at noobs who only have experience
of 'starter' systems. Many folks in less developed countries will be
using older PCs running W95 and DOS. Contrariwise I'd not describe VMS
as a beginner's OS, and MACOS7 programmers were always like hens
teeth.
>The rationale behind my proposal is to have one reference
for Unix and another for Microsoft, as the original FAQ
had it.
I've no problem with adding the windows redirect.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Dec 21 '06 #8

P: n/a
Richard Heathfield wrote:
Eric Sosman said:
>jacob navia wrote:
>>This is what is there now (2006, 20 Dec)
[...]
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
[...]
Why bother comp.lang.c with the matter? The FAQ belongs
to Steve Summit; take your suggestions to him.

Either it's the comp.lang.c FAQ list or it isn't. If it is, discussing it is
relevant here. And if it isn't, we could sure use an FAQ list.
Discussing it, sure. We can point out errors and omissions
and overinclusions in the FAQ to our hearts' content, and maybe
even invent a sort of supplementary FAQ or counter-FAQ. (C.f.
the IFAQ.) But what we can't do is effect a change, because the
power to change the FAQ is Mr. Summit's alone. This forum is
therefore not a particularly effective means toward Mr. Navia's
stated end; if he truly wants to accomplish something he should
take his petition elsewhere. (It's possible he's trying to start
a "Write your Congressman" or "Storm the Bastille" movement, but
using pressure tactics as one's opening move suggests both a
manipulative personality and a rash demeanor. Not long ago I
learned that newsrooms refer to such orchestrated campaigns with
the term "turf," short for "AstroTurf," meaning "artificial
grass-roots.")

By the bye, the Mann Act is woefully out of date and would
be vastly improved by the following changes: ...

--
Eric Sosman
es*****@acm-dot-org.invalid
Dec 22 '06 #9

P: n/a
Eric Sosman wrote:
Richard Heathfield wrote:
Eric Sosman said:
jacob navia wrote:
This is what is there now (2006, 20 Dec)
[...]
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
[...]
Why bother comp.lang.c with the matter? The FAQ belongs
to Steve Summit; take your suggestions to him.
Either it's the comp.lang.c FAQ list or it isn't. If it is, discussing it is
relevant here. And if it isn't, we could sure use an FAQ list.

Discussing it, sure. We can point out errors and omissions
and overinclusions in the FAQ to our hearts' content, and maybe
even invent a sort of supplementary FAQ or counter-FAQ. (C.f.
the IFAQ.) But what we can't do is effect a change, because the
power to change the FAQ is Mr. Summit's alone. This forum is
therefore not a particularly effective means toward Mr. Navia's
stated end; if he truly wants to accomplish something he should
take his petition elsewhere. (It's possible he's trying to start
a "Write your Congressman" or "Storm the Bastille" movement, but
using pressure tactics as one's opening move suggests both a
manipulative personality and a rash demeanor.
Or perhaps he wanted to get opinions before writing to Steve
Summit. Or perhaps he just assumes that Mr. Summit already
reads the group so he will read about Jacob's suggestion here.

Dec 22 '06 #10

P: n/a
2006-12-22 <GJ******************************@comcast.com>,
Eric Sosman wrote:
Discussing it, sure. We can point out errors and omissions and
overinclusions in the FAQ to our hearts' content, and maybe even
invent a sort of supplementary FAQ or counter-FAQ. (C.f. the IFAQ.)
But what we can't do is effect a change, because the power to change
the FAQ is Mr. Summit's alone. This forum is therefore not
a particularly effective means toward Mr. Navia's stated end; if he
truly wants to accomplish something he should take his petition
elsewhere. (It's possible he's trying to start a "Write your
Congressman" or "Storm the Bastille" movement, but using pressure
tactics as one's opening move suggests both a manipulative personality
and a rash demeanor.
Or maybe he honestly thinks that we should have a FAQ.

In the past I've brought this up and some people don't seem to like my
questioning Mr. Summit's position. But the simple facts are: comp.lang.c
does not have a faq controlled by its regulars. This faq, which is
apparently the sole property of Mr. Summit, is being marketed using this
newsgroup and its name.

It's not at all clear to me how this state of affairs was allowed to
come about. If he wrote it himself, why is it the comp.lang.c faq? If it
started as the clc (or nlc) faq, what happened to the rights of the
other contributers? The earliest record of the FAQ on google groups is
from 1990, and it was clearly already well-established by then.

I guess my question is: Who wrote the FAQ? If it was Mr. Summit, why did
it become "our" faq? If it was _not_ Mr. Summit, why does he have sole
control over it and the right to publish it in a book for a profit?

Another FAQ (the same faq?) is mentioned in a 1989 post as being "owned"
by Chris Torek? What happened to this FAQ? Is it the same FAQ? If so,
why does Chris Torek not now have the right to modify it?

Why don't Mark Brader, Joe Buehler, Christopher Calabrese, Stephen M.
Dunn, Tony Hansen, Guy Harris, Karl Heuer, Blair Houghton, Kirk Johnson,
Andrew Koenig, John Lauro, Christopher Lott, Rich Salz, Joshua Simons,
and Erik Talvola, get any say?

Why is it copyright 1990-2004 now but was copyright 1988-1990 in 1990?
Who is this Steve Summit guy, anyway? What ever happened to Chris Torek?

I know these are harsh questions, but I think they need answers.
Not long ago I learned that newsrooms refer to such orchestrated
campaigns with the term "turf," short for "AstroTurf," meaning
"artificial grass-roots.")
Then you've missed the distinction between astroturfing and _actual_
grassroots movements. If no-one says anything to anyone else, that is,
If no-one's there to "start a movement", we can't have a grassroots
movement. Astroturf is when the individuals involved in the campaign
_don't_ really care about the issue but are simply being paid by, say,
Microsoft, to act like they do.
Dec 22 '06 #11

P: n/a
Mark McIntyre wrote:
<ja***@jacob.remcomp.frwrote:
>I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.

Well, yes, but so has Windows 95 and there are plenty of users of
that. There are probably still plenty of DOS users.
Not to mention users of FreeDOS and DRDOS.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 22 '06 #12

P: n/a
jacob navia wrote:
Mark McIntyre a écrit :
><ja***@jacob.remcomp.frwrote:
>>I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.

Well, yes, but so has Windows 95 and there are plenty of users
of that. There are probably still plenty of DOS users.

There are also Mac OS7 users, VAX VMS, and many others.
Why should we reference MSDOS only?

The rationale behind my proposal is to have one reference
for Unix and another for Microsoft, as the original FAQ
had it.
The world is considerably larger than your experience. There is
also a large clientele for various RTOSs in the embedded world, not
to mention the DOS clones (which are maintained). Those users may
well outnumber the Windoze users.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 22 '06 #13

P: n/a
Mark McIntyre <ma**********@spamcop.netwrote:
On Thu, 21 Dec 2006 17:09:39 +0100, in comp.lang.c , jacob navia
<ja***@jacob.remcomp.frwrote:
The rationale behind my proposal is to have one reference
for Unix and another for Microsoft, as the original FAQ
had it.

I've no problem with adding the windows redirect.
I have no problem with adding MS Windows information, but I do think
there should not be a URL to the MS website. For starters, I have yet to
see a resource that never reorganises its website, and that would cause
link rot.

Richard
Dec 22 '06 #14

P: n/a
On Thu, 21 Dec 2006 22:00:35 -0500, CBFalconer <cb********@yahoo.com>
wrote:
>jacob navia wrote:
>Mark McIntyre a écrit :
>><ja***@jacob.remcomp.frwrote:

I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.

Well, yes, but so has Windows 95 and there are plenty of users
of that. There are probably still plenty of DOS users.

There are also Mac OS7 users, VAX VMS, and many others.
Why should we reference MSDOS only?

The rationale behind my proposal is to have one reference
for Unix and another for Microsoft, as the original FAQ
had it.

The world is considerably larger than your experience. There is
also a large clientele for various RTOSs in the embedded world, not
to mention the DOS clones (which are maintained). Those users may
well outnumber the Windoze users.
Outnumber them in terms of what?

Surely the number of Windoze [sic] users who have access to and read
this newsgroup, let alone read the C FAQ, heavily outweigh those who
run DOS and have access to and read this newsgroup and, let alone,
read the C FAQ. I'd bet the latter group is near a proverbial "Big
Goose Egg".

I would eliminate the reference to MS-DOS in the FAQ of concern. It
adds absolutely nothing to the FAQ.

--
jay

PS:
OH and for all...Using "Windoze", "M$" or any other juvenile
phraseology when referrng to Microsoft or Windows cheapens and weakens
any argument you might have been able to make.
http://talkback.zdnet.com/5208-1009-...ssageID=169319

Dec 22 '06 #15

P: n/a
jaysome said:

<snip>
I would eliminate the reference to MS-DOS in the FAQ of concern. It
adds absolutely nothing to the FAQ.
....unless you happen to need the information it provides. It's very short -
just a handful of bytes - so why not leave it alone? It harms nobody.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Dec 22 '06 #16

P: n/a
Spiros Bousbouras a écrit :
Eric Sosman wrote:
>>Richard Heathfield wrote:
>>>Eric Sosman said:
jacob navia wrote:

>This is what is there now (2006, 20 Dec)
>[...]
>I would eliminate all references to MSDOS, a system that
>is obsolete since more than a decade now.
>[...]

Why bother comp.lang.c with the matter? The FAQ belongs
to Steve Summit; take your suggestions to him.

Either it's the comp.lang.c FAQ list or it isn't. If it is, discussing it is
relevant here. And if it isn't, we could sure use an FAQ list.

Discussing it, sure. We can point out errors and omissions
and overinclusions in the FAQ to our hearts' content, and maybe
even invent a sort of supplementary FAQ or counter-FAQ. (C.f.
the IFAQ.) But what we can't do is effect a change, because the
power to change the FAQ is Mr. Summit's alone. This forum is
therefore not a particularly effective means toward Mr. Navia's
stated end; if he truly wants to accomplish something he should
take his petition elsewhere. (It's possible he's trying to start
a "Write your Congressman" or "Storm the Bastille" movement, but
using pressure tactics as one's opening move suggests both a
manipulative personality and a rash demeanor.


Or perhaps he wanted to get opinions before writing to Steve
Summit. Or perhaps he just assumes that Mr. Summit already
reads the group so he will read about Jacob's suggestion here.
Before asking Mr Summit I thought it would be useful
to ask here the opinion of this group.

Why must I have always some dark motive? Can't paranoia cease for
some time?

I gather that most people do not object to adding windows references
but want to keep MSDOS, contrary to what I thought. It is important
to know that, and now that I know I will write to Mr Summit and
propose the change. (Carbon copy this group)

jacob
Dec 22 '06 #17

P: n/a
On Thu, 21 Dec 2006 21:07:50 -0500, in comp.lang.c , Eric Sosman
<es*****@acm-dot-org.invalidwrote:
Discussing it, sure. We can point out errors and omissions
and overinclusions in the FAQ to our hearts' content, and maybe
even invent a sort of supplementary FAQ or counter-FAQ. (C.f.
the IFAQ.) But what we can't do is effect a change, because the
power to change the FAQ is Mr. Summit's alone. This forum is
therefore not a particularly effective means toward Mr. Navia's
stated end;
If CLC can't effect change in the CLC FAQ, then its not the CLC FAQ
and should be renamed.

Sure, Steve has to take in the change but still, the result of
discussion here should be an extremely strong agent for change.

I therefore strongly disagree with the idea that discussing new or
changed FAQ entries is offtopic or inappropriate.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Dec 22 '06 #18

P: n/a
On Fri, 22 Dec 2006 01:25:48 -0800, in comp.lang.c , jaysome
<ja*****@hotmail.comwrote:
>On Thu, 21 Dec 2006 22:00:35 -0500, CBFalconer <cb********@yahoo.com>
wrote:
>>also a large clientele for various RTOSs in the embedded world, not
to mention the DOS clones (which are maintained). Those users may
well outnumber the Windoze users.

Outnumber them in terms of what?

Surely the number of Windoze [sic] users who have access to and read
this newsgroup, let alone read the C FAQ, heavily outweigh those who
run DOS
Possibly. Possibly not. However CBF was referring to users of RTOSen,
which group will massively outweigh windows in any measure. Its
interesting to note for instance that an appreciable percentage of the
regulars here programme for embedded systems, and yet we have very
little material in the FAQ germane to them.
>I would eliminate the reference to MS-DOS in the FAQ of concern. It
adds absolutely nothing to the FAQ.
Nor does it detract from it. The FAQ is, lets remember, aimed at
newbies and beginners.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Dec 22 '06 #19

P: n/a

"CBFalconer" <cb********@yahoo.comwrote in message
news:45***************@yahoo.com...
Mark McIntyre wrote:
<ja***@jacob.remcomp.frwrote:
I would eliminate all references to MSDOS, a system that
is obsolete since more than a decade now.
Well, yes, but so has Windows 95 and there are plenty of users of
that. There are probably still plenty of DOS users.

Not to mention users of FreeDOS and DRDOS.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

DRDOS of course still sells on millions of units a year.
Dec 22 '06 #20

P: n/a
On Fri, 22 Dec 2006 07:26:28 GMT, in comp.lang.c ,
rl*@hoekstra-uitgeverij.nl (Richard Bos) wrote:
>I have no problem with adding MS Windows information, but I do think
there should not be a URL to the MS website. For starters, I have yet to
see a resource that never reorganises its website, and that would cause
link rot.
The FAQ has several other links, some of which have rotted already. MS
isn't unique in doing this, and indeed personal websites are perhaps
more prone to unexpected death. I agree however a generic pointer to
the MS website might be safer
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Dec 22 '06 #21

P: n/a
Random832 wrote:
[...] But the simple facts are: comp.lang.c
does not have a faq controlled by its regulars.
Ah, yes, the famous "regulars." Nudds, for instance.
This faq, which is
apparently the sole property of Mr. Summit,
... who wrote it, assembled it, revised it, corrected it,
re-wrote it, and has maintained it on-line for years and years.
Just under one year ago, after this long history of abusive
behavior, he had the gall to give the FAQ both a face-lift and
a better-connected Net-home and offer it to c.l.c. as a Christmas
present. A transparent attempt to buy us off, no doubt. What
a scum-bag monopolist he is!
is being marketed using this
newsgroup and its name.
For some reason, I'm not upset. Not in the least. He did
the work, he gets to reap the reward and retire rich. (Last I
heard, the print version was an Oprah selection and movie rights
were being negotiated; rumor has it that Undefined Behavior will
be played by Johnny Depp.)
It's not at all clear to me how this state of affairs was allowed to
come about.
Nos, nos, dico aperte, consules desumus.
If he wrote it himself, why is it the comp.lang.c faq? [...]
It strikes me that many of your questions would be answered
or at least addressed if you would read ... (wait for it) ...
the FAQ.

--
Eric Sosman
es*****@acm-dot-org.invalid
Dec 22 '06 #22

P: n/a
Mark McIntyre a écrit :
On Fri, 22 Dec 2006 07:26:28 GMT, in comp.lang.c ,
rl*@hoekstra-uitgeverij.nl (Richard Bos) wrote:

>>I have no problem with adding MS Windows information, but I do think
there should not be a URL to the MS website. For starters, I have yet to
see a resource that never reorganises its website, and that would cause
link rot.


The FAQ has several other links, some of which have rotted already. MS
isn't unique in doing this, and indeed personal websites are perhaps
more prone to unexpected death. I agree however a generic pointer to
the MS website might be safer
Yes. I will change that to a generic

"Look at the MSDN documentation".

Dec 22 '06 #23

P: n/a
2006-12-22 <k4******************************@comcast.com>,
Eric Sosman wrote:
Random832 wrote:
>[...] But the simple facts are: comp.lang.c
does not have a faq controlled by its regulars.

Ah, yes, the famous "regulars." Nudds, for instance.
I find the claim that the members of this group cannot revise the FAQ by
consensus, but must submit all proposed changes for approval by one
person, disturbing. I don't believe this claim has actually been made
before this thread (previously, I'd believed that he maintains the faq,
rather than controlling it.)
>This faq, which is apparently the sole property of Mr. Summit,

... who wrote it, assembled it
Did he write it or did he assemble it?

Why does it say it was first composed in 1990 when the version on record
as being posted in 1990 has a copyright date of 1988?
revised it, corrected it,
re-wrote it, and has maintained it on-line for years and years.
Just under one year ago, after this long history of abusive
behavior, he had the gall to give the FAQ both a face-lift and
a better-connected Net-home
I'm not sure in what way any website is "better-connected" than usenet.
and offer it to c.l.c. as a Christmas present. A transparent attempt
to buy us off, no doubt. What a scum-bag monopolist he is!
I just want to know why it's "his" FAQ instead of "our" FAQ, and, since
it's _not_ "our" FAQ, why it's the "comp.lang.c FAQ". Is that really
such an unreasonable thing to ask? Why is it not called "Steve Summit's
C Programming FAQ"?

Is there a legitimate reason why, if he were to disappear or stop
maintaining or stop posting the faq, why shouldn't anyone else be
allowed to pick it up without starting over from scratch? What if he
gets hit by a bus?
>It's not at all clear to me how this state of affairs was allowed to
come about.

Nos, nos, dico aperte, consules desumus.
>If he wrote it himself, why is it the comp.lang.c faq? [...]

It strikes me that many of your questions would be answered
or at least addressed if you would read ... (wait for it) ...
the FAQ.

Last question: What ever happened to Chris Torek's "FAQ Database" which
is referred to in one post in 1989 before the first google instance of
the current faq? Is it the same faq or was it an unrelated one? If it is
the same, why does Steve Summit have a better claim to sole ownership
than Chris Torek?

I guess part of my issue is, no-one's explained satisfactorily _how_
Steve Summit managed to obtain exclusive rights to the FAQ in the first
place.
Dec 22 '06 #24

P: n/a

Random832 wrote:
>
I guess part of my issue is, no-one's explained satisfactorily _how_
Steve Summit managed to obtain exclusive rights to the FAQ in the first
place.
I can't explain satisfactorily your question either but I bought this
back in the 1990's:

http://www.amazon.com/Programming-FA...063366-7752834

Maybe it has to do with that book?

Dec 22 '06 #25

P: n/a
2006-12-22 <11**********************@42g2000cwt.googlegroups. com>,
Jalapeno wrote:
>
Random832 wrote:
>>
I guess part of my issue is, no-one's explained satisfactorily _how_
Steve Summit managed to obtain exclusive rights to the FAQ in the first
place.

I can't explain satisfactorily your question either but I bought this
back in the 1990's:

http://www.amazon.com/Programming-FA...063366-7752834

Maybe it has to do with that book?
Well, yeah, but generally acquiring the rights to some work is done
before publishing it as a book, rather than as a result of it. So
I figured there must be some other explanation.
Dec 22 '06 #26

P: n/a
In article <sl*******************@rlaptop.random.yi.orgra*******@gmail.com writes:
....
Last question: What ever happened to Chris Torek's "FAQ Database" which
is referred to in one post in 1989 before the first google instance of
the current faq? Is it the same faq or was it an unrelated one? If it is
the same, why does Steve Summit have a better claim to sole ownership
than Chris Torek?
Well, if Chris Torek reads this he will probably answer.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Dec 22 '06 #27

P: n/a
Random832 <ra****@random.yi.orgwrites:
2006-12-22 <k4******************************@comcast.com>,
Eric Sosman wrote:
>Random832 wrote:
>>[...] But the simple facts are: comp.lang.c
does not have a faq controlled by its regulars.

Ah, yes, the famous "regulars." Nudds, for instance.

I find the claim that the members of this group cannot revise the FAQ by
consensus, but must submit all proposed changes for approval by one
person, disturbing. I don't believe this claim has actually been made
before this thread (previously, I'd believed that he maintains the faq,
rather than controlling it.)
The FAQ, whoever owns it, is IMHO one of the better FAQs I've seen.
Steve Summit voluntarily maintains it and provides it as a free
resource. It's the de facto FAQ for this newsgroup because nobody
else has done the (largely redundant) work to create another one.

I think there was some discussion here about rights to the FAQ in
conjunction with the clc-wiki.net site (or maybe the discussion took
place on the wiki, which is currently down). I don't recall the
details, and I don't think any firm conclusions were reached. Since a
longer version of the FAQ is also published as a book, the folks at
Addison-Wesley would probably have something to say about it.

In the abstract, I don't necessarily disagree that having the FAQ
under the control of one person is potentially disturbing. In
reality, though, Steve is one of the few people I trust to do a good
job of it.

I seriously doubt that any process allowing input from the "regulars"
would have a better result.

[...]
> revised it, corrected it,
re-wrote it, and has maintained it on-line for years and years.
Just under one year ago, after this long history of abusive
behavior, he had the gall to give the FAQ both a face-lift and
a better-connected Net-home

I'm not sure in what way any website is "better-connected" than usenet.
I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.) And the FAQ is probably too big to post as a
single article.

[...]
Is there a legitimate reason why, if he were to disappear or stop
maintaining or stop posting the faq, why shouldn't anyone else be
allowed to pick it up without starting over from scratch? What if he
gets hit by a bus?
I don't know, but I agree that it's a good question.

[...]
I guess part of my issue is, no-one's explained satisfactorily _how_
Steve Summit managed to obtain exclusive rights to the FAQ in the first
place.
By creating it. (Yes, that ignores some of the historical questions
you've asked. Perhaps Steve and/or Chris will address them.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 22 '06 #28

P: n/a
2006-12-22 <ln************@nuthaus.mib.org>,
Keith Thompson wrote:
I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.) And the FAQ is probably too big to post as a
single article.
The FAQ is routinely posted as a single article. And google accepts
message-ids.
[...]
>Is there a legitimate reason why, if he were to disappear or stop
maintaining or stop posting the faq, why shouldn't anyone else be
allowed to pick it up without starting over from scratch? What if he
gets hit by a bus?

I don't know, but I agree that it's a good question.

[...]
>I guess part of my issue is, no-one's explained satisfactorily _how_
Steve Summit managed to obtain exclusive rights to the FAQ in the first
place.

By creating it. (Yes, that ignores some of the historical questions
you've asked. Perhaps Steve and/or Chris will address them.)
I hope I haven't screwed anything up - I spent a lot of effort making
sure my post was civil, and it did take effort. Part of the reason this
bothers me is that I do know that Steve's a nice guy, but I also feel
a certain sense of how things "ought to be" with FAQs in general, usenet
FAQs in particular, and it's not compatible with changes being subject
to a single person's approval, or with being published as a book (more
because of the entanglement with a publisher than anything against
selling it in general.)

As for input from regulars, etc... maybe we should form a committee to
recommend revisions and changes to the FAQ.
Dec 23 '06 #29

P: n/a
Random832 <ra****@random.yi.orgwrites:
2006-12-22 <ln************@nuthaus.mib.org>,
Keith Thompson wrote:
>I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.) And the FAQ is probably too big to post as a
single article.

The FAQ is routinely posted as a single article. And google accepts
message-ids.
But the c-faq.com web site is much easier to search (since thankfully,
the FAQ is not posted to Usenet in HTML). Regardless of who controls
and/or owns it, I strongly prefer to have the FAQ available on a web
site.

[...]
I hope I haven't screwed anything up - I spent a lot of effort making
sure my post was civil, and it did take effort. Part of the reason this
bothers me is that I do know that Steve's a nice guy, but I also feel
a certain sense of how things "ought to be" with FAQs in general, usenet
FAQs in particular, and it's not compatible with changes being subject
to a single person's approval, or with being published as a book (more
because of the entanglement with a publisher than anything against
selling it in general.)

As for input from regulars, etc... maybe we should form a committee to
recommend revisions and changes to the FAQ.
Maybe. In my opinion (and this is *only* my opinion), we should wait
for input from Steve before taking any action on this.

Let me just mention that you're the only person who currently seems to
be concerned about this. That absolutely is not meant to minimize
your concerns. But if anything is to be done, it will require some
sort of consensus. Perhaps this should wait until after the holidays.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 23 '06 #30

P: n/a
In article <ln************@nuthaus.mib.orgKeith Thompson <ks***@mib.orgwrites:
Random832 <ra****@random.yi.orgwrites:
....
As for input from regulars, etc... maybe we should form a committee to
recommend revisions and changes to the FAQ.

Maybe. In my opinion (and this is *only* my opinion), we should wait
for input from Steve before taking any action on this.
If I remember well (it is quite some time ago) Steve proposed a serious
FAQ (I disremember how Chris Torek's FAQ figures in it) and that was
almost commonly accepted. There has been much input from readers into
the FAQ (and I am one of those that did contribute), but the consensus
was that it was ultimately Steves work, so he should have the right to
it. And, indeed, he did put a lot of effort in it.

You may put up a committee, but the ultimate result will be that part
of the committee does not contribute anything, part of it will only
allow their own views and so the remaining part will just leave. If
you do not have somebody who has the final word, it is doomed to
failure. Steve has done pretty well in maintaining the FAQ, you
might state that sometimes he lapsed in attention, but nobody is
able to full-time maintain such a thing as an unpaid job. There are
newsgroups with a FAQ that is in worse state than this group.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Dec 23 '06 #31

P: n/a
Keith Thompson wrote:
Random832 <ra****@random.yi.orgwrites:
2006-12-22 <ln************@nuthaus.mib.org>,
Keith Thompson wrote:
I can post a URL for a web site. There's no really good way to
post a >reference to anything that exists only on Usenet. (Yes,
there's >Google Groups, but URLs there are not unique, and they
depend on a >single corporation.) And the FAQ is probably too big
to post as a >single article.

The FAQ is routinely posted as a single article. And google accepts
message-ids.

But the c-faq.com web site is much easier to search (since thankfully,
the FAQ is not posted to Usenet in HTML). Regardless of who controls
and/or owns it, I strongly prefer to have the FAQ available on a web
site.

[...]
I hope I haven't screwed anything up - I spent a lot of effort
making sure my post was civil, and it did take effort. Part of the
reason this bothers me is that I do know that Steve's a nice guy,
but I also feel a certain sense of how things "ought to be" with
FAQs in general, usenet FAQs in particular, and it's not compatible
with changes being subject to a single person's approval, or with
being published as a book (more because of the entanglement with a
publisher than anything against selling it in general.)

As for input from regulars, etc... maybe we should form a committee
to recommend revisions and changes to the FAQ.

Maybe. In my opinion (and this is only my opinion), we should wait
for input from Steve before taking any action on this.

Let me just mention that you're the only person who currently seems to
be concerned about this. That absolutely is not meant to minimize
your concerns. But if anything is to be done, it will require some
sort of consensus. Perhaps this should wait until after the holidays.

Well, "concerned" may be too strong a term, but I've always been a
little surprised by a newsgroup FAQ that specifically avoids any
newsgroup questions. It's unlike any newsgroup FAQ that I've ever
encountered elsewhere. With the FAQ not being a consensus of the group,
things like that can't get added because the maintainer guy doesn't
want them.

It is what it is, and it's not something that keeps me up at night.
It's also not a job I'd want, so I don't complain about it either.

Brian
Dec 23 '06 #32

P: n/a
(I have been holding off on replying to these until I could look
some of this up.)
>Random832 wrote:
>>This faq, which is apparently the sole property of Mr. Summit,
>2006-12-22 <k4******************************@comcast.com>,
Eric Sosman wrote:
> ... who wrote it, assembled it
In article <sl*******************@rlaptop.random.yi.org>
Random832 <ra*******@gmail.comwrote:
>Did he write it or did he assemble it?
Some of both, although as I recall, most of the text is his.
Much of the detail might be called "group wisdom", perhaps;
but I think most of the wording is Steve's.
>Last question: What ever happened to Chris Torek's "FAQ Database" which
is referred to in one post in 1989 before the first google instance of
the current faq?
It never existed.

The reference in <3C***************@midway.uchicago.edu(by Ben
Zimmer) talks about an article by Karl "The Walking Lint" W Z Heuer
(message-ID <13***@haddock.ima.isc.com>). He (Karl) seems to have
assumed that I had actually compiled a list of frequently-asked
questions, when all I really did was observe that there were such
questions. I made the observation back in the days of "net.lang.c",
before the Great Usenet Renaming. :-)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Dec 25 '06 #33

P: n/a
Keith Thompson <ks***@mib.orgwrote:
Random832 <ra****@random.yi.orgwrites:
2006-12-22 <k4******************************@comcast.com>,
Eric Sosman wrote:
Random832 wrote:
[...] But the simple facts are: comp.lang.c
does not have a faq controlled by its regulars.

Ah, yes, the famous "regulars." Nudds, for instance.
I find the claim that the members of this group cannot revise the FAQ by
consensus, but must submit all proposed changes for approval by one
person, disturbing. I don't believe this claim has actually been made
before this thread (previously, I'd believed that he maintains the faq,
rather than controlling it.)
And how, pray, is something as nebulous as "the group" going to actively
maintain a FAQ list? Yes, you could put it on a wiki, but then it'd be
as reliable as Wikipedia.
The FAQ, whoever owns it, is IMHO one of the better FAQs I've seen.
Steve Summit voluntarily maintains it and provides it as a free
resource. It's the de facto FAQ for this newsgroup because nobody
else has done the (largely redundant) work to create another one.
That said, there are one or two questions that crop up frequently here
and are not answered in the FAQ. I can't remember any of them ATM,
though, which should be an indication of how trivial they are.
I'm not sure in what way any website is "better-connected" than usenet.

I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.)
The Message-ID for your message is <ln************@nuthaus.mib.org>, and
will be forever. Anybody can look your message up in a good or even a
halfway usable Usenet archive, using nothing but that Message-ID.
And the FAQ is probably too big to post as a single article.
It used to be. And even if the larger complete version would have to be
split over two articles, that's two Message-IDs. Not something to break
your back over, I'd say.
There are, IMO, good arguments to be made for the viewpoint that the
primary location for a newsgroup FAQ should be _that_ newsgroup, with
anything else, including .d newsgroups, a website, www.faqs.org, or
whatever, being purely additional.
Is there a legitimate reason why, if he were to disappear or stop
maintaining or stop posting the faq, why shouldn't anyone else be
allowed to pick it up without starting over from scratch? What if he
gets hit by a bus?

I don't know, but I agree that it's a good question.
Well, let's ask Steve, shan't we?

Richard
Dec 27 '06 #34

P: n/a
Richard Bos wrote:
Keith Thompson <ks***@mib.orgwrote:
The FAQ, whoever owns it, is IMHO one of the better FAQs I've seen.
Steve Summit voluntarily maintains it and provides it as a free
resource. It's the de facto FAQ for this newsgroup because nobody
else has done the (largely redundant) work to create another one.

That said, there are one or two questions that crop up frequently here
and are not answered in the FAQ. I can't remember any of them ATM,
though, which should be an indication of how trivial they are.

Besides questions related to the newsgroup itself, the most glaring
omission in the FAQ that comes readily to mind is any discussion of
strtok(). It needs: "How do use this crazy thing?"; "Why not use it?";
and "What can be used instead?" at the least.

Brian
Dec 27 '06 #35

P: n/a
Default User wrote:
Keith Thompson wrote:
>Random832 <ra****@random.yi.orgwrites:
>>Keith Thompson wrote:

I can post a URL for a web site. There's no really good way to
post a reference to anything that exists only on Usenet. (Yes,
there's Google Groups, but URLs there are not unique, and they
depend on a single corporation.) And the FAQ is probably too
big to post as a single article.

The FAQ is routinely posted as a single article. And google
accepts message-ids.

But the c-faq.com web site is much easier to search (since
thankfully, the FAQ is not posted to Usenet in HTML). Regardless
of who controls and/or owns it, I strongly prefer to have the FAQ
available on a web site.

[...]
>>I hope I haven't screwed anything up - I spent a lot of effort
making sure my post was civil, and it did take effort. Part of
the reason this bothers me is that I do know that Steve's a nice
guy, but I also feel a certain sense of how things "ought to be"
with FAQs in general, usenet FAQs in particular, and it's not
compatible with changes being subject to a single person's
approval, or with being published as a book (more because of the
entanglement with a publisher than anything against selling it
in general.)

As for input from regulars, etc... maybe we should form a
committee to recommend revisions and changes to the FAQ.

Maybe. In my opinion (and this is only my opinion), we should
wait for input from Steve before taking any action on this.

Let me just mention that you're the only person who currently
seems to be concerned about this. That absolutely is not meant
to minimize your concerns. But if anything is to be done, it
will require some sort of consensus. Perhaps this should wait
until after the holidays.

Well, "concerned" may be too strong a term, but I've always been a
little surprised by a newsgroup FAQ that specifically avoids any
newsgroup questions. It's unlike any newsgroup FAQ that I've ever
encountered elsewhere. With the FAQ not being a consensus of the
group, things like that can't get added because the maintainer guy
doesn't want them.

It is what it is, and it's not something that keeps me up at night.
It's also not a job I'd want, so I don't complain about it either.
The following is a quote from the text version of the FAQ. I think
it covers this subject adequately.

"This article is Copyright 1990-2004 by Steve Summit. Content
from the book _C Programming FAQs: Frequently Asked Questions_ is
made available here by permission of the author and the publisher
as a service to the community. It is intended to complement the
use of the published text and is protected by international
copyright laws. The on-line content may be accessed freely for
personal use but may not be republished without permission.

"Certain topics come up again and again on this newsgroup. They
are good questions, and the answers may not be immediately
obvious, but each time they recur, much net bandwidth and reader
time is wasted on repetitive responses, and on tedious
corrections to any incorrect answers which may unfortunately be
posted. This article, which is posted monthly, attempts to
answer these common questions definitively and succinctly, so
that net discussion can move on to more constructive topics
without continual regression to first principles.

"No mere newsgroup article can substitute for thoughtful perusal
of a full-length tutorial or language reference manual. Anyone
interested enough in C to be following this newsgroup should also
be interested enough to read and study one or more such manuals,
preferably several times. Some C books and compiler manuals are
unfortunately inadequate; a few even perpetuate some of the myths
which this article attempts to refute. Several noteworthy books
on C are listed in this article's bibliography; see also
questions 18.9 and 18.10. Many of the questions and answers are
cross- referenced to these books, for further study by the
interested and dedicated reader.

"If you have a question about C which is not answered in this
article, you might first try to answer it by checking a few of
the referenced books, or one of the expanded versions mentioned
below, before posing your question to the net at large. There
are many people on the net who are happy to answer questions, but
the volume of repetitive answers posted to one question, as well
as the growing number of questions as the net attracts more
readers, can become oppressive. If you have questions or
comments prompted by this article, please reply by mail rather
than following up -- this article is meant to decrease net
traffic, not increase it."

At most Steve might consider adding a few words here about Usenet
protocol, i.e. top-posting, quoting, snipping, flaming. References
to links would do nicely. The following come to mind:

Some informative links:
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 27 '06 #36

P: n/a
Default User wrote:
Richard Bos wrote:
.... snip ...
>>
That said, there are one or two questions that crop up
frequently here and are not answered in the FAQ. I can't
remember any of them ATM, though, which should be an indication
of how trivial they are.

Besides questions related to the newsgroup itself, the most
glaring omission in the FAQ that comes readily to mind is any
discussion of strtok(). It needs: "How do use this crazy thing?";
"Why not use it?"; and "What can be used instead?" at the least.
At most that requires slight expansion of 19.6

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 27 '06 #37

P: n/a
Keith Thompson <ks***@mib.orgwrote:
Random832 <ra****@random.yi.orgwrites:
2006-12-22 <ln************@nuthaus.mib.org>,
Keith Thompson wrote:
I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.) And the FAQ is probably too big to post as a
single article.
The FAQ is routinely posted as a single article. And google accepts
message-ids.

But the c-faq.com web site is much easier to search (since thankfully,
the FAQ is not posted to Usenet in HTML).
Erm...

Web site: download the lot and do a directory search in your favourite
browser, use a web search engine that lets you limit searches to domain
(and you can't limit it to just the FAQ list itself, since things like
the version page are at the same level), or find the site's own search
engine which I don't think exists; and if the first hit isn't what you
wanted, go back in your browser and click the next link.

Usenet article: hit Ctrl-F in your newsreader. If the first hit isn't
what you wanted, hit F3. (Or other keys in other newsreaders.)

STM a Usenet article is easier to search than a website.

Richard
Dec 27 '06 #38

P: n/a
CBFalconer <cb********@yahoo.comwrote:
"Certain topics come up again and again on this newsgroup. They
are good questions, and the answers may not be immediately
obvious, but each time they recur, much net bandwidth and reader
time is wasted on repetitive responses, and on tedious
corrections to any incorrect answers which may unfortunately be
posted. This article, which is posted monthly, attempts to
answer these common questions definitively and succinctly, so
that net discussion can move on to more constructive topics
without continual regression to first principles.
At most Steve might consider adding a few words here about Usenet
protocol, i.e. top-posting, quoting, snipping, flaming. References
to links would do nicely. The following come to mind:
And topicality.

Richard
Dec 27 '06 #39

P: n/a
2006-12-27 <45***************@yahoo.com>,
CBFalconer wrote:
Default User wrote:
>Richard Bos wrote:
... snip ...
>>>
That said, there are one or two questions that crop up
frequently here and are not answered in the FAQ. I can't
remember any of them ATM, though, which should be an indication
of how trivial they are.

Besides questions related to the newsgroup itself, the most
glaring omission in the FAQ that comes readily to mind is any
discussion of strtok(). It needs: "How do use this crazy thing?";
"Why not use it?"; and "What can be used instead?" at the least.

At most that requires slight expansion of 19.6
"How do I read the mouse?"?

Are you reading some other FAQ?

*searches the rest of th* OH... you mean 13.6
Dec 27 '06 #40

P: n/a
CBFalconer wrote:
Default User wrote:
Besides questions related to the newsgroup itself, the most
glaring omission in the FAQ that comes readily to mind is any
discussion of strtok(). It needs: "How do use this crazy thing?";
"Why not use it?"; and "What can be used instead?" at the least.

At most that requires slight expansion of 19.6

Ah. I'd missed that when I went over it, as there wasn't a question
with strtok() in the subject and the search feature didn't turn up one
either. If I were a newbie looking for help on strtok() I suspect I'd
have similar difficulty.

Perhaps then an index for each function mentioned within the FAQ would
help.

Brian
Dec 27 '06 #41

P: n/a
Default User wrote:
[snip]
Besides questions related to the newsgroup itself, the most glaring
omission in the FAQ that comes readily to mind is any discussion of
strtok(). It needs: "How do use this crazy thing?"; "Why not use it?";
and "What can be used instead?" at the least.
Here is a trivially simple replacement that I use from time to time:

#include <string.h>
#include <limits.h>
#include <stdlib.h>
#include <ctype.h>

/* The default delimiters are chosen as some ordinary white space
characters: */
static const char default_delimiters[] = {' ', '\n', '\t', '\r', '\f',
0};

/*
* The tokenize() function is similar to a reentrant version of
strtok().
* It parses tokens from 'string', where tokens are substrings
separated by characters from 'delimiter_list'.
* To get the first token from 'string', tokenize() is called with
'string' as its first parameter.
* Remaining tokens from 'string' are obtained by calling tokenize()
with NULL for the first parameter.
* The string of delimiters, identified by 'delimiter_list', can change
from call to call.
* If the string of delimiters is NULL, then the standard list
'default_delimiters' (see above) is used.
* tokenize() modifies the memory pointed to by 'string', because it
writes null characters into the buffer.
*/
char *tokenize(char *string, const char *delimiter_list, char
**placeholder)
{
if (delimiter_list == NULL)
delimiter_list = default_delimiters;

if (delimiter_list[0] == 0)
delimiter_list = default_delimiters;

if (string == NULL)
string = *placeholder;

if (string == NULL)
return NULL;
/*
* The strspn() function computes the length of the initial segment of
the first string
* that consists entirely of characters contained in the second string.
*/
string += strspn(string, delimiter_list);
if (!string[0]) {
*placeholder = string;
return NULL;
} else {
char *token;
token = string;
/*
* The strpbrk() function finds the first occurrence of any character
contained in the second string
* found in the first string.
*/
string = strpbrk(token, delimiter_list);
if (string == NULL)
*placeholder = token + strlen(token);
else {
*string++ = 0;
*placeholder = string;
}
return token;
}
}

#ifdef UNIT_TEST
char test_string0[] = "This is a test. This is only a test.
If it were an actual emergency, you would be dead.";
char test_string1[] = "This is a also a test. This is only
a test. If it were an actual emergency, you would be dead. 12345";
char test_string2[] = "The quick brown fox jumped over the
lazy dog's back 1234567890 times.";
char test_string3[] = " \t\r\n\fThe quick brown fox jumped
over the lazy dog's back 1234567890 times.";
char test_string4[] = "This is a test. This is only a test.
If it were an actual emergency, you would be dead.";
char test_string5[] = "This is a also a test. This is only
a test. If it were an actual emergency, you would be dead. 12345";
char test_string6[] = "The quick brown fox jumped over the
lazy dog's back 1234567890 times.";
char test_string7[] = " \t\r\n\fThe quick brown fox jumped
over the lazy dog's back 1234567890 times.";

#include <stdio.h>

char whitespace[UCHAR_MAX + 1];

/* This test will create token separators as any whitespace or any
punctuation marks: */
void init_whitespace()
{
int i;
int index = 0;
for (i = 0; i < UCHAR_MAX; i++) {
if (isspace(i)) {
whitespace[index++] = (char) i;
}
if (ispunct(i)) {
whitespace[index++] = (char) i;
}
}
}

/*
TNX Gerd.
*/
void spin_test(char *test_string, char *white)
{
char *p = NULL;
char *token;
token = tokenize(test_string, white, &p);
while (token) {
puts(token);
token = tokenize(NULL, white, &p);
}
}

int main(void)
{
init_whitespace();
puts("Whitespace is whitespace+punctuation");
spin_test(test_string0, whitespace);
spin_test(test_string1, whitespace);
spin_test(test_string2, whitespace);
spin_test(test_string3, whitespace);
puts("Whitespace is simple whitespace");
spin_test(test_string4, NULL);
spin_test(test_string5, NULL);
spin_test(test_string6, NULL);
spin_test(test_string7, NULL);
return 0;
}
#endif

Dec 27 '06 #42

P: n/a
Default User wrote:
CBFalconer wrote:
>Default User wrote:
>>Besides questions related to the newsgroup itself, the most
glaring omission in the FAQ that comes readily to mind is any
discussion of strtok(). It needs: "How do use this crazy thing?";
"Why not use it?"; and "What can be used instead?" at the least.

At most that requires slight expansion of 19.6

Ah. I'd missed that when I went over it, as there wasn't a question
with strtok() in the subject and the search feature didn't turn up
one either. If I were a newbie looking for help on strtok() I
suspect I'd have similar difficulty.

Perhaps then an index for each function mentioned within the FAQ
would help.
As has been pointed out, that should have read 13.6. All this
points out the advantage of text format (available). I simply
access that with less and search for whatever is of interest,
including possible section.question numbers. The result is instant
gratification. I can use the identical mechanism on N869.txt, a
suitable formatted version of which is available on my site (bz2
compressed for quick download).

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 27 '06 #43

P: n/a
dc*****@connx.com wrote:
Default User wrote:
[snip]
>Besides questions related to the newsgroup itself, the most
glaring omission in the FAQ that comes readily to mind is any
discussion of strtok(). It needs: "How do use this crazy thing?";
"Why not use it?"; and "What can be used instead?" at the least.

Here is a trivially simple replacement that I use from time to
time:
.... snip code ...
>
and here is one I use:

/* ------- file toksplit.h ----------*/
#ifndef H_toksplit_h
# define H_toksplit_h

# ifdef __cplusplus
extern "C" {
# endif

#include <stddef.h>

/* copy over the next token from an input string, after
skipping leading blanks (or other whitespace?). The
token is terminated by the first appearance of tokchar,
or by the end of the source string.

The caller must supply sufficient space in token to
receive any token, Otherwise tokens will be truncated.

Returns: a pointer past the terminating tokchar.

This will happily return an infinity of empty tokens if
called with src pointing to the end of a string. Tokens
will never include a copy of tokchar.

released to Public Domain, by C.B. Falconer.
Published 2006-02-20. Attribution appreciated.
*/

const char *toksplit(const char *src, /* Source of tokens */
char tokchar, /* token delimiting char */
char *token, /* receiver of parsed token */
size_t lgh); /* length token can receive */
/* not including final '\0' */

# ifdef __cplusplus
}
# endif
#endif
/* ------- end file toksplit.h ----------*/

/* ------- file toksplit.c ----------*/
#include "toksplit.h"

/* copy over the next token from an input string, after
skipping leading blanks (or other whitespace?). The
token is terminated by the first appearance of tokchar,
or by the end of the source string.

The caller must supply sufficient space in token to
receive any token, Otherwise tokens will be truncated.

Returns: a pointer past the terminating tokchar.

This will happily return an infinity of empty tokens if
called with src pointing to the end of a string. Tokens
will never include a copy of tokchar.

A better name would be "strtkn", except that is reserved
for the system namespace. Change to that at your risk.

released to Public Domain, by C.B. Falconer.
Published 2006-02-20. Attribution appreciated.
Revised 2006-06-13
*/

const char *toksplit(const char *src, /* Source of tokens */
char tokchar, /* token delimiting char */
char *token, /* receiver of parsed token */
size_t lgh) /* length token can receive */
/* not including final '\0' */
{
if (src) {
while (' ' == *src) src++;

while (*src && (tokchar != *src)) {
if (lgh) {
*token++ = *src;
--lgh;
}
src++;
}
if (*src && (tokchar == *src)) src++;
}
*token = '\0';
return src;
} /* toksplit */

#ifdef TESTING
#include <stdio.h>

#define ABRsize 6 /* length of acceptable token abbreviations */

/* ---------------- */

static void showtoken(int i, char *tok)
{
putchar(i + '1'); putchar(':');
puts(tok);
} /* showtoken */

/* ---------------- */

int main(void)
{
char teststring[] = "This is a test, ,, abbrev, more";

const char *t, *s = teststring;
int i;
char token[ABRsize + 1];

puts(teststring);
t = s;
for (i = 0; i < 4; i++) {
t = toksplit(t, ',', token, ABRsize);
showtoken(i, token);
}

puts("\nHow to detect 'no more tokens' while truncating");
t = s; i = 0;
while (*t) {
t = toksplit(t, ',', token, 3);
showtoken(i, token);
i++;
}

puts("\nUsing blanks as token delimiters");
t = s; i = 0;
while (*t) {
t = toksplit(t, ' ', token, ABRsize);
showtoken(i, token);
i++;
}
return 0;
} /* main */

#endif
/* ------- end file toksplit.c ----------*/

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Dec 28 '06 #44

P: n/a
In article <45****************@news.xs4all.nlrl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
Keith Thompson <ks***@mib.orgwrote:
....
I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.)

The Message-ID for your message is <ln************@nuthaus.mib.org>, and
will be forever. Anybody can look your message up in a good or even a
halfway usable Usenet archive, using nothing but that Message-ID.
Not entirely true. It can be deleted from the archives, or even not make
it to the archives (and both do occur).
And the FAQ is probably too big to post as a single article.

It used to be. And even if the larger complete version would have to be
split over two articles, that's two Message-IDs. Not something to break
your back over, I'd say.
That's two Message-ID's for each time it is posted. And as in such
reposts a "Supercedes" header is in most cases is put in, it erases the
at the same time the old Message-ID's.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Dec 28 '06 #45

P: n/a
"Dik T. Winter" <Di********@cwi.nlwrites:
In article <45****************@news.xs4all.nl>
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
Keith Thompson <ks***@mib.orgwrote:
...
I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.)
>
The Message-ID for your message is <ln************@nuthaus.mib.org>, and
will be forever. Anybody can look your message up in a good or even a
halfway usable Usenet archive, using nothing but that Message-ID.

Not entirely true. It can be deleted from the archives, or even not make
it to the archives (and both do occur).
[...]

Right.

I like having the FAQ on a web site. The current FAQ happens to be on
a web site. Message-IDs change every time the Faq is posted, and can
be difficult or impossible to remember; the FAQ's URL has not changed
in some time, and is easy to remember. And if Message-IDs were so
much more convenient than URLs, people would use Message-IDs when they
cite the FAQ; I don't recall ever seeing anyone do so.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 28 '06 #46

P: n/a
CBFalconer wrote:
Default User wrote:
CBFalconer wrote:
Default User wrote:

Besides questions related to the newsgroup itself, the most
glaring omission in the FAQ that comes readily to mind is any
discussion of strtok(). It needs: "How do use this crazy thing?";
"Why not use it?"; and "What can be used instead?" at the least.
>
At most that requires slight expansion of 19.6
Ah. I'd missed that when I went over it, as there wasn't a question
with strtok() in the subject and the search feature didn't turn up
one either. If I were a newbie looking for help on strtok() I
suspect I'd have similar difficulty.

Perhaps then an index for each function mentioned within the FAQ
would help.

As has been pointed out, that should have read 13.6.
I saw that, and that wasn't what I was commenting about. There's no
question about strtok() itself, nor does it come up when using that
search feature on the page.

All this
points out the advantage of text format (available).
Or have an option for all questions and answers to be presented at
once. As it is, one can get all questions displayed, but if the desired
information doesn't actually appear in the question itself, that
doesn't help.
I simply
access that with less and search for whatever is of interest,
including possible section.question numbers. The result is instant
gratification. I can use the identical mechanism on N869.txt, a
suitable formatted version of which is available on my site (bz2
compressed for quick download).
On the whole, I'd rather direct people to the web site.

Brian
Dec 28 '06 #47

P: n/a
dc*****@connx.com wrote:
Default User wrote:
[snip]
Besides questions related to the newsgroup itself, the most glaring
omission in the FAQ that comes readily to mind is any discussion of
strtok(). It needs: "How do use this crazy thing?"; "Why not use
it?"; and "What can be used instead?" at the least.

Here is a trivially simple replacement that I use from time to time:
As this doesn't appear in the FAQ, it's not really helpful. I didn't
mention it because I'm unable to formulate my own solution, but because
it's a fairly frequently asked question here. Or rather, "how come this
strtok() thing doesn't work?" is.


Brian

Dec 28 '06 #48

P: n/a
Keith Thompson <ks***@mib.orgwrote:
"Dik T. Winter" <Di********@cwi.nlwrites:
In article <45****************@news.xs4all.nl>
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
Keith Thompson <ks***@mib.orgwrote:
...
I can post a URL for a web site. There's no really good way to post a
reference to anything that exists only on Usenet. (Yes, there's
Google Groups, but URLs there are not unique, and they depend on a
single corporation.)
>
The Message-ID for your message is <ln************@nuthaus.mib.org>, and
will be forever. Anybody can look your message up in a good or even a
halfway usable Usenet archive, using nothing but that Message-ID.
Not entirely true. It can be deleted from the archives, or even not make
it to the archives (and both do occur).
The latter, yes, but the FAQ is posted monthly. It would be unusual for
none of the copies to arrive at a given archive. The former, that should
not happen unless Steve puts an X-no-archive header in the FAQ, which
would surprise me.
Right.

I like having the FAQ on a web site.
So do I; but I much prefer having it on the newsgroup _as well_. In
fact, given the choice, I'd prefer having it on the group alone to
having just the website; but obviously having both is the superior
option by far.

Richard
Dec 28 '06 #49

P: n/a
rl*@hoekstra-uitgeverij.nl (Richard Bos) writes:
Keith Thompson <ks***@mib.orgwrote:
[...]
>I like having the FAQ on a web site.

So do I; but I much prefer having it on the newsgroup _as well_. In
fact, given the choice, I'd prefer having it on the group alone to
having just the website; but obviously having both is the superior
option by far.
Hypothetically, if the FAQ were just on the web site and not posted to
the newsgroup, we could still direct people to it with a URL and a
question number. If it were on the newsgroup but not on a web site,
the newbies who don't bother checking the FAQ before posting most
likely would not have the patience to track down the FAQ.

But yes, it's nice to have it in both places.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 29 '06 #50

56 Replies

This discussion thread is closed

Replies have been disabled for this discussion.