NEWSAUX(8)

NAME
spacefor - check available space for news
queuelen - get length of outbound-news uucp queues
sizeof - get size of file(s) for news
ctime, getdate, 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

SYNOPSIS
/usr/lib/newsbin/spacefor filesize location [ site ]
/usr/lib/newsbin/queuelen site
/usr/lib/newsbin/sizeof [ -i ] file ...
/usr/lib/newsbin/ctime [ -u ] decimaldate
/usr/lib/newsbin/getdate printabledate
/usr/lib/newsbin/getabsdate absolute-printable-date
/usr/lib/newsbin/newshostname
/usr/lib/newsbin/gngp [ -arv ] ngpattern file ...
/usr/lib/newsbin/canonhdr [ -dm ] [ file ] ...
/usr/lib/newsbin/newslock locktemp lockname

DESCRIPTION
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.

Ctime, getdate and getabsdate convert dates in human-readable form to (getdate and 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. Both ctime and getdate recognise the argument now to mean the current time. Under -u, ctime will print GMT instead of local time.

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 /usr/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 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 -d, canonhdr will also canonicalise dates in Date: and Expires: headers. Under -m, 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.)

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

SEE ALSO
df(1), uucp(1), ls(1), ctime(3), getdate(3), hostname(1), grep(1), news(5), expire(8), newsbatch(8), rnews(8), newsmaint(8)

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

BUGS
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.