ctime






spacefor − check available space for news
queuelen − get length of outbound‐news uucp queues
sizeof − get size of file(s) for news
ctime, getabsdate − convert dates to and from internal representation for news
newshostname − get host name for news
gngp − search text using a newsgroup pattern
canonhdr − extract header and canonicalize
newslock − do locking for news

/usr/lib/news/spacefor filesize location [ site ]
/usr/lib/news/queuelen site
/usr/lib/news/sizeof [ −i ] file ...
/usr/lib/news/ctime [ −i ] [ −u ] decimaldate
/usr/lib/news/getabsdate absolute‐printable‐date
/usr/lib/news/newshostname
/usr/lib/news/gngp [ −arv ] ngpattern file ...
/usr/lib/news/canonhdr [ −dm ] [ file ] ...
/usr/lib/news/newslock locktemp lockname

These programs are minor utilities used by various parts of C News.

     Spacefor determines how many files of size filesize can fit in location
(incoming, articles, control, archive, or outbound to site) without cramping
things unduly.  The precise locations of these places, and how low space gets
before it is unduly cramped, are site‐specific.  Spacefor invokes df(1) or the
equivalent system call to determine the available space.

     Queuelen reports how many news batches uucp has queued up for site.

     Sizeof reports the total number of bytes in the file(s).  (This may seem
redundant with ls −l, but the format of ls −l varies between systems and sizeof
looks after all that.)  Nonexistent files are silently ignored.  If the −i
option is given, sizeof prints one line per (existing) file, with name and size,
and does not print the total.

     and getabsdate convert dates in human‐readable form to (getabsdate) and
from (ctime) decimal ASCII representations of Unix’s internal integer dates.
Their functionality resembles that of their namesakes in the C library.
Getabsdate parses only absolute dates, not relative dates.  Under ctime will
print GMT instead of local time.  Under ctime will print the time in GMT in
Internet format.

     Newshostname reports the name of this system for news purposes.  This may
differ from the name of the particular CPU it is run on; a cluster of CPUs
sharing a filesystem tree would all have the same newshostname name.  Typically
newshostname gets the name from /var/lib/news/whoami; failing that, it consults
various other possible sources (e.g. the hostname command).

     Gngp resembles grep except that its search is based on newsgroup patterns
(e.g. ‘comp’, which matches ‘comp’, ‘comp.lang’, ‘comp.lang.c’, ...;
‘comp,!comp.lang.c’ which matches ‘comp’ and ‘comp.lang’ but not ‘comp.lang.c’;
etc.).  Gngp prints only the line(s) that contain a substring that matches the
ngpattern.  Normally the substring must run from a point in the line to its end.
If the −a flag is given, the eligible substrings start at the beginning of the









                                       ‐2‐


line and end at white space or the end of the line.  The −v option prints only
lines that do not match.  The −r flag reverses the inputs, with patterns coming
from the file and the argument taken as the line(s).

     Canonhdr takes the concatenation of its input file(s) (standard input if
none) as an article, and outputs the header from the article with header
keywords canonicalized for easier processing.  Canonicalization forces all
alphabetics to lower case except the first letter of each (hyphen‐separated)
word in the keyword, which is forced to upper case.  (One exception: ‘‘Message‐
ID’’ is the canonical form of [e.g.] ‘‘message‐id’’.)  Under canonhdr will also
canonicalise dates in Date: and Expires: headers, adding a Date: header if none
is present.  Under it will accept RFC 822 headers and rewrite them as RFC 1036
headers.

     Newslock makes a link named lockname to the file locktemp, and returns exit
status 0 for success, 1 if the link could not be made (typically because
lockname already existed).  This is used for shell‐file locking in C News.  It
is a subset of ln(1) except that (a) no error messages are ever produced and (b)
the link is guaranteed to fail if lockname already exists.  (Some brain‐damaged
versions of ln helpfully remove lockname in that case, making them useless for
locking.)


/usr/spool/uucp/*       uucp queues
/var/lib/news/whoami    news host name
/var/lib/news/L.*       lock temporaries
/var/lib/news/LOCK*     lock files

df(1), uucp(1), ls(1), ctime(3), grep(1), newsdb(5), expire(8CN),
newsbatch(8CN), rnews(8CN), newsmaint(8CN)
Internet RFCs 822, 1036 and 1123

Written at U of Toronto by Henry Spencer and Geoff Collyer.

Spacefor and queuelen are unfortunately somewhat system‐specific, since df
output and uucp file layout vary between different versions.  (Using system
calls in spacefor doesn’t help, as the system calls differ too.)

     Queuelen probably ought to count bytes rather than batches, but that would
make its system‐dependency even worse.

     The need for sizeof and newslock is a botch.

     Ctime probably shouldn’t assume GMT under but dealing with local time zones
gets into a swamp of portability problems.