rn file format

Alvin "the Chipmunk" Sylvain asylvain at felix.UUCP
Wed Apr 17 14:21:08 AEST 1991


Written in article <1991Apr14.024245.23227 at skypod.uucp>
    by marc at skypod.uucp (Marc Fournier):

> 	I presume someone out there knows the answer to this question...
> I'm writing a program that needs to read in the records in .newsrc, but
> I'm having serious problems doing so.  I'm using fscanf, which I presume
> is correct, because it is reading half of it in.
> 
> 	the format that I am using is fscanf(f1,"%s %d", group, upper), but
> it seems to only read in the group, pass through the loop fine and then
> read the upper (the numeric component).  I want it to read both in at
> once.

You've made three mistakes.  The first one was posting your question to
comp.misc, instead of comp.lang.c (to where I've cross-posted my
response, and hopefully you'll get more intelligent answers).

Your second mistake is assuming that 'fscanf' works the way you think it
will.  This is why you need sage advice from the folks who are C
experts.  I guarantee you it works absolutely nothing like F*rtr*n.

Your third mistake, which is probably the one you really thought you
were asking advice about, is the format of the .newsrc file.  It is
_not_ a group followed by whitespace followed by a number.  It is more
along the following lines:

    <group>[:|!][<number range>][,<number range>] ...

where: <group> is, of course, the newsgroup in it's format, that we all 
know and love(hate?).  [:|!]  means either a colon (:) or a bang (!)  
(the bang means unsubscribed).  [<number range>] is optional, and can be 
either a single number, or two numbers separated by a dash.  Number 
ranges are separated by commas.  

Someone who is a better 'rn' expert may be able to amplify/correct this,
as this is only from observation of the actual file in use.

> 	I hope I've been specific enough, so if someone has an idea of
> what format I should be using, please help.
> 
> Thanks in advance...
> 
> Marc
> -- 
> | Marc G. Fournier   (416) 250-8589  |   Haven't thought of anything  |
> | Toronto, Ontario                   |     real witty to say here!    | 
> | uucp:  marc at skypod.uucp            ---------  And probably...       |
> | Bitnet: marc%skypod at ugw.utcs.utoronto.ca   |          never will!   | 

Good luck.  You're going to need it.
--
=========== Opinions are Mine, Typos belong to /usr/ucb/vi ===========
"We're sorry, but the reality you have dialed is no longer in service.
Please check the value of pi, or see your SysOp for assistance."
=============== Factual Errors belong to /usr/local/rn ===============
asylvain at felix.UUCP                              hplabs!felix!asylvain



More information about the Comp.lang.c mailing list