*BSD News Article 14382


Return to BSD News archive

Newsgroups: comp.os.386bsd.apps
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!csn!boulder!ucsu!rintintin.Colorado.EDU!galbrait
From: galbrait@rintintin.Colorado.EDU (GALBRAITH JOHN)
Subject: cnews patches
Message-ID: <1993Apr12.235421.25971@ucsu.Colorado.EDU>
Keywords: cnews
Sender: news@ucsu.Colorado.EDU (USENET News System)
Nntp-Posting-Host: rintintin.colorado.edu
Organization: University of Colorado, Boulder
Date: Mon, 12 Apr 1993 23:54:21 GMT
Lines: 510

For those of you who don't know what c-news is, (I didn't a month ago,)
it is the software that handles the posting, reading, and archiving 
of news.  Not to be confused with nntp, which is the software that 
is used to transfer news from one machine to the other.  Also not
to be confused with rn or the newsreader itself.  This is about the 
limits of my knowledge.  I am really new to this software.

You need to get the normal c-news tar file from "any comp.sources.unix
archive site" and apply these patches to the untarred tree from the 
base c-news directory. (The same directory that you did the "tar" command
from.)  The distribution that I used did not mention a version number
but did say that it was a maintenance release of February 20, 1993. 

Also very important is to switch /bin/sh with /bin/bash.  I know that this
is a touchy issue, but this software WILL NOT COMPILE with ash.  As far
as problems with bash, I did not run into any with this software.  This
issue was discussed in the 386bsd newsgroups.

There is really only one patch.  I added the function ftime() to 
the library of fake routines that c-news comes with.  Again, I don't
know what the issues involved here are.  I don't know what the difference
between ftime() and gettimeofday() really are at the kernel level or
anything.  I just know that c-news wanted ftime(), so I provided it.  If
anybody knows a better way, it would be a totally easy fix.  Just write
your function, and use the ftime() call in libfake/ftime.c as a wrapper
to your new and improved function.

The rest of the install is exactly the same as with any other system.  The
c-news authors did a good job of making it go smoothly.  (Assuming your
/bin/sh works right.)  A transcription of my successful "build" script
for 386BSD is in the file "build.386bsd.log".

The time function stuff is largely untested, so check it out.
Also, I am not even
on a network other than a slow modem so that stuff has not been
tested by me on a 386bsd system either.

Please inform me of any problems, as I am eager to return services
to the net from which I have taken advantage of so many times.

John Galbraith
galbrait@rintintin.colorado.edu


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	README.386BSD
#	build.diff
#	libfake/ftime.c
#	build.386bsd.log
#
echo x - README.386BSD
sed 's/^X//' >README.386BSD << 'END-of-README.386BSD'
XWell, after saying what a pain patches to cnews would be I actually
Xread some man pages and it was cake.
X
XFor those of you who don't know what c-news is, (I didn't a month ago,)
Xit is the software that handles the posting, reading, and archiving 
Xof news.  Not to be confused with nntp, which is the software that 
Xis used to transfer news from one machine to the other.  Also not
Xto be confused with rn or the newsreader itself.  This is about the 
Xlimits of my knowledge.  I am really new to this software.
X
XYou need to get the normal c-news tar file from "any comp.sources.unix
Xarchive site" and apply these patches to the untarred tree from the 
Xbase c-news directory. (The same directory that you did the "tar" command
Xfrom.)  The distribution that I used did not mention a version number
Xbut did say that it was a maintenance release of February 20, 1993. 
X
XAlso very important is to switch /bin/sh with /bin/bash.  I know that this
Xis a touchy issue, but this software WILL NOT COMPILE with ash.  As far
Xas problems with bash, I did not run into any with this software.  This
Xissue was discussed in the 386bsd newsgroups.
X
XThere is really only one patch.  I added the function ftime() to 
Xthe library of fake routines that c-news comes with.  Again, I don't
Xknow what the issues involved here are.  I don't know what the difference
Xbetween ftime() and gettimeofday() really are at the kernel level or
Xanything.  I just know that c-news wanted ftime(), so I provided it.  If
Xanybody knows a better way, it would be a totally easy fix.  Just write
Xyour function, and use the ftime() call in libfake/ftime.c as a wrapper
Xto your new and improved function.
X
XThe rest of the install is exactly the same as with any other system.  The
Xc-news authors did a good job of making it go smoothly.  (Assuming your
X/bin/sh works right.)  A transcription of my successful "build" script
Xfor 386BSD is in the file "build.386bsd.log".
X
XThe time function stuff is largely untested, so check it out.
XAlso, I am not even
Xon a network other than a slow modem so that stuff has not been
Xtested by me on a 386bsd system either.
X
XPlease inform me of any problems, as I am eager to return services
Xto the net from which I have taken advantage of so many times.
X
XJohn Galbraith
Xgalbrait@rintintin.colorado.edu
END-of-README.386BSD
echo x - build.diff
sed 's/^X//' >build.diff << 'END-of-build.diff'
X*** ../cnews.normal/conf/build	Mon Apr 20 18:09:22 1992
X--- conf/build	Mon Apr 12 14:25:28 1993
X***************
X*** 14,20 ****
X  
X  # functions and headers we are prepared to fake
X  mightfake='fsync getopt memcpy memcmp memchr memset mkdir
X! 	putenv strchr strrchr strpbrk strspn strcspn strtok symlink strerror'
X  mightfakehdrs='string.h stdlib.h stddef.h'
X  
X  # directories in which to do makes
X--- 14,21 ----
X  
X  # functions and headers we are prepared to fake
X  mightfake='fsync getopt memcpy memcmp memchr memset mkdir
X! 	putenv strchr strrchr strpbrk strspn strcspn strtok symlink strerror
X! 	ftime'
X  mightfakehdrs='string.h stdlib.h stddef.h'
X  
X  # directories in which to do makes
X***************
X*** 955,961 ****
X  	do
X  		for f in `ls ../man | egrep -v "$exclude" | egrep "\.$chap\$"`
X  		do
X! 			echo "cp $f $manpages/man$chap/$f"
X  		done
X  	done
X  	echo ': done'
X--- 956,962 ----
X  	do
X  		for f in `ls ../man | egrep -v "$exclude" | egrep "\.$chap\$"`
X  		do
X! 			echo "nroff -mandoc $f > $manpages/cat$chap/$f"
X  		done
X  	done
X  	echo ': done'
END-of-build.diff
echo x - libfake/ftime.c
sed 's/^X//' >libfake/ftime.c << 'END-of-libfake/ftime.c'
X#include <stdio.h>
X#include <sys/types.h>
X#include <time.h>
X#include <sys/time.h>
X#include <sys/timeb.h>
X
Xvoid ftime(tp)
Xstruct timeb *tp;
X{
X     struct timezone zone2;
X     struct timeval time2;
X
X     gettimeofday(&time2, &zone2);
X     tp->time = time2.tv_sec;
X     tp->millitm = time2.tv_usec*1000;
X     tp->timezone = zone2.tz_minuteswest;
X     tp->dstflag = zone2.tz_dsttime;
X}
END-of-libfake/ftime.c
echo x - build.386bsd.log
sed 's/^X//' >build.386bsd.log << 'END-of-build.386bsd.log'
XThis interactive command will build shell files named doit.root,
Xdoit.bin, doit.news, and again.root to do all the work.  It will not
Xactually do anything itself, so feel free to abort and start again.
X
XYou probably need your system manuals handy.
X
XWhen a question is asked in the form `How are you [okay]? ', the
Xanswer in brackets is what you will get if you just hit RETURN.
X(If you want give an empty string as the answer, type a single
X`-' instead.)
X
XC News wants to keep most of its files under a uid which preferably
Xshould be all its own.  Its programs, however, can and probably should
Xbe owned by another user, typically the same one who owns most of the
Xrest of the system.  (Note that on a system running NFS, any program
Xnot owned by "root" is a gaping security hole.)
XWhat user id should be used for news files [news]? 
XWhat group id should be used for news files [news]? 
XWhat user id should be used for news programs [bin]? 
XWhat group id should be used for news programs [bin]? 
XDo the C News sources belong to bin [yes]? 
X
XIt would appear that your system is among the victims of the
X4.4BSD / SVR4 directory reorganization, with (e.g.) shared
Xdata in /usr/share.  Is this correct [yes]? 
XThis will affect where C News directories go.  We recommend
Xmaking the directories wherever they have to go and then making
Xsymbolic links to them under the standard names that are used
Xas defaults in the following questions.  Should such links
Xbe made [yes]? 
XOur 4.4ish friends suggest putting articles in /var/spool/news
Xand control files in /usr/share/news, with programs left where
Xthey are in /usr/lib/newsbin.
X
XC News lives primarily under three directories:  one for articles (and
Xincoming and outgoing spooling), one for control files, and one for
Xprograms.
XWhere should articles live [/usr/spool/news]? /usr/local/spool/news
XWhere should control files live [/usr/lib/news]? /usr/local/lib/news
XWhere should programs live [/usr/lib/newsbin]? /usr/local/lib/newsbin
X
XC News by default assumes that all normal Unix programs can be
Xfound in /bin or /usr/bin.  This is naive, especially on
XBerkeley-derived systems where some standard programs
Xinexplicably moved to /usr/ucb.
XIt appears that /usr/ucb does not exist or that no
Xstandard programs live there (and only there) on your
Xsystem.  Is that right [yes]? 
XIs there any other directory which should be searched
Xto find standard programs on your system [no]? yes
XWhat is the full name of the directory [/urk]? /usr/local/bin
XShould it go after (as opposed to before) the others [yes]? no
XIs there any other directory which should be searched
Xto find standard programs on your system [no]? 
X
XC News normally uses a umask of 002, turning off only the others-write
Xbit in the permissions of files used.  (The correspondence between bits
Xand number is:  rwx = 421, so turning off group-write bits and all
Xothers-access bits would be a mask of 027, for example.)  Usually
Xa umask of 002 or 022 is appropriate.
XWhat umask should C News use [002]? 
X
XC News wants to mail some forms of trouble reports to an administrator.
XYou probably want to make this a system mailbox, rather than that of a
Xspecific user, so you won't have to change the software when you get a
Xnew administrator.
XWhere should C News mail trouble reports [usenet]? 
X
XThe shell files that are everywhere in C News want to pick up their
Xconfiguration parameters (mostly, the last few questions you have
Xanswered) from a file at a known location; this is very hard to avoid
Xunless you play tricks with environment variables (see documentation).
XWhere should the shell configuration file be
Xlocated [/usr/local/lib/news/bin/config]? 
X
XWhat is the full pathname of the chown command [/etc/chown]? /usr/sbin/chown
XCan I say `/usr/sbin/chown news.news file' to change both the user id
Xand group id of a file [yes]? no
XWhat is the full pathname of chgrp [/etc/chgrp]? /usr/bin/chgrp
X
Xbuilding doit.root...
Xdone
X
XC News has libraries for several kinds of Unix:
X        bsd42   4.2BSD and successors
X        usg     AT&T System V
X        v7      Version 7 (4.1BSD is pretty close, ditto Xenix)
X        v8      Version 8, aka Eighth Edition
XWhich best describes your system [v7]? bsd42
X
XC News has libraries for small address spaces (16 bits) and big
Xones (preferably 32 bits, but anything rather bigger than 16).
XWhich best describes your system [big]? 
X
XSystems vary in whether certain library functions and system calls
Xare present.  C News contains reasonably-portable versions of the
Xpossibly-missing library functions, and fake versions of the
Xpossibly-missing system calls, but it needs to know which are missing.
XDoes your system have  fsync() [yes]? 
XDoes your system have  getopt() [yes]? 
XDoes your system have  memcpy() [yes]? 
XDoes your system have  memcmp() [yes]? 
XDoes your system have  memchr() [yes]? 
X
XDoes your system have  memset() [yes]? 
XDoes your system have  mkdir() [yes]? 
XDoes your system have  putenv() [yes]? 
XDoes your system have  strchr() [yes]? 
XDoes your system have  strrchr() [yes]? 
XDoes your system have  strpbrk() [yes]? 
XDoes your system have  strspn() [yes]? 
XDoes your system have  strcspn() [yes]? 
XDoes your system have  strtok() [yes]? 
XDoes your system have  symlink() [yes]? 
XDoes your system have  strerror() [yes]? 
XDoes your system have  ftime() [yes]? no
X
XThe news system uses a database package, typically the old "dbm"
Xlibrary from Version 7 or a lookalike, as an indexing system.  We
Xsupply a version of the "dbz" library, which is faster than "dbm",
Xuses much less disk space, and is program-compatible (although
Xit is *not* file-compatible, so anything else using the database
X[notably NNTP, if applicable] has to be relinked with it).  Dbz
Xis usually preferable to dbm, barring major backward-compatibility
Xproblems.  Do you want to use our "dbz" library [yes]? 
X
XMany systems, notably older ones, have implementations of the Standard
XI/O library ("stdio") in which fgets, fputs, fread, and fwrite are
Xquite slow.  We supply versions of these functions which are faster
Xthan those in any stdio we know; they are compatible with most old
XAT&T-derived stdios.  (They tend not to work on modern System V,
Xbut the modern System V stdio is respectably fast.)  They can be a
Xmajor performance win for C News.  There is a fairly thorough
Xcompatibility check run after the library is built; as far as we
Xknow, if the test works, the functions do (even on SunOS 4.0).
XDo you want to use our fast stdio library [yes]? no
X
XThe strchr() function is usually slower than in-line C code
Xwhen small strings are involved, unless your compiler is very
Xclever and can generate in-line code for strchr().  Is your
Xcompiler that good (okay to guess) [no]? 
X
XModern Unixes can generally use the setuid() system call to set the
Xreal and effective user ids to the current effective user id.  In
Xold Unixes, only "root" can change the real user id.  This causes
Xvarious problems for C News.  C News provides a small program named
X"setnewsids" to run setuserid-root; all it does is change user and
Xgroup ids and then execute C News "relaynews".  It is needed only on
Xuncooperative systems.  Relaynews invokes it automatically if needed
X(and it then invokes relaynews in return).  Can this system do
Xsetuid(geteuid()) to change the real uid/gid [yes]? no
X
XSome systems have header files that others lack, and C News
Xis prepared to fake missing ones.
XDoes your system have an ANSI-C-conforming <string.h> [yes]? 
XDoes your system have an ANSI-C-conforming <stdlib.h> [yes]? 
XDoes your system have an ANSI-C-conforming <stddef.h> [yes]? 
XDoes your system have <sys/timeb.h> [yes]? 
X
XVery old Unix systems needed the order of object modules in a library
Xchosen very carefully.  V7 introduced "ranlib" which removes the need
Xfor this.  Recent System Vs have had the same facility built into "ar"
X(look for the "symdef" feature in the "ar" manual page) so "ranlib"
Xis not needed.  Does your system use ranlib [no]? yes
X
XHistorically the C compiler is named "cc", but this is not true on
Xsome systems, and on others there are several different C compilers.
XWhat is the name of the C compiler to be used [cc]? 
X
XHistorically the only normal compilation option needed for most
Xprograms is -O, but again compilers, especially newer ones, differ.
X(NOTE:  many 386 compilers miscompile dbz if -O is used!)
XWhat options should be given to the compiler [-O]? -O -traditional
X
XThe final linking ("ld") step of compiling might need an option,
Xsuch as -n or -i, to produce the preferred form of executable file.
XOn most modern systems the default is right.  What options, if any,
Xshould be given for linking []? 
X
XOn unusual systems it may be necessary to link C News programs with
Xlibraries other than the usual C library.  These can be specified as
Xeither full pathnames or -l... options.  What libraries, in addition
Xto the one(s) picked up automatically by the compiler, should be used
Xwhen linking C News []? 
X
XDoes your system have a "hostname" command [yes]? 
X
XC News tries to limit the backlog of news batches spooled up for
Xtransmission to a site, to control use of disk space.  To do this,
Xit needs to be able to determine the length of the queue of news
Xbatches for a particular site.  This is UUCP-version-dependent.
XThere is a good chance that you will have to customize the "queuelen"
Xprogram.  C News knows about several versions:
X        hdb     Honey DanBer, aka Basic Networking Utilities
X        sub     old uucp with subdirectories (e.g. /usr/spool/uucp/C.)
X        old     very old uucp, no subdirectories
X        pre     prehistoric uucp, no subdirectories, no -g option on uux
X        null    don't run uucp or don't care about queue lengths
XWhich one is most appropriate [hdb]? null
X
XC News often wants to ask how much disk space is available.  The
Xformat of output from the "df" command unfortunately varies a lot,
Xas does the availability of a system call to get the same information.
XC News knows about several different versions (the first three are
Xpreferred):
X        statfs  system with standard statfs() (SunOS, 4.4BSD, not System V)
X        ustat   system with ustat() (most System Vs)
X        ultrix  DEC Ultrix with DEC's own bizarre statfs()
X        bsd     4.2/4.3BSD
X        sysv    old System Vs
X        xenix   some (all?) Xenixes; some System Vs, e.g. Microport, HP?
X        sgi     Silicon Graphics Iris systems
X        v7      plain old style:  no headers or fluff, just name and number
X        null    don't know or don't care how much space is available
XWhich one is most appropriate [bsd]? 
X
XSome "df" commands, especially on old systems, must be given the
Xname of a device.  Modern ones can be given any directory name and
Xthe system handles the details of figuring out what device is meant.
XA few will take a directory only if it is the "top" of a filesystem.
XWill "df" accept any directory name as an argument [yes]? 
X
XAre you planning to use expire to archive news on disk [no]? 
X
XAre you particularly short of disk space [no]? 
XYou may want to inspect "spacefor" to make sure its defaults
Xfor things like desired free space are appropriate for your
Xsystem, although the defaults are fairly conservative.
X
XIt is very difficult to do anything useful with incoming news when
Xthere is no space for it.  Normally, C News simply discards it and
Xmails a trouble report.  On a single-user system, it may be better
Xto just have the news reception stall until more space becomes
Xavailable.  Warning:  this may stall processing of other incoming
Xtraffic, e.g. mail, as well, and the queue of unprocessed traffic
Xmay well grow until your disk fills up.  Should news reception
Xstall if space gets short [no]? yes
X
XNews processing is much more efficient when done in bulk, so C News
Xnormally just saves incoming news and processes it once an hour.
XIf you have ample resources and are wildly impatient to make news
Xavailable the instant it arrives, that is expensive but possible.
XDo you want immediate processing [no]? yes
X
XAre you running C News on a group of machines hooked together with NFS,
Xrun essentially as a single system with a single administration,
Xwith articles filed on one "server" machine [no]? 
X
XSeveral programs need to know an overall name for the system news is
Xbeing run on, where "system" may include multiple machines if they
Xshare a common set of control files and articles; this is used in
Xarticle headers and related places.  For uucp sites, this usually
Xshould be the uucp name.  It is VITAL that you and your neighboring
Xsites agree on this name -- if their news systems know you by a
Xdifferent name, or even a slightly-different variation of the same
Xoverall name, there will be trouble.  What is the name of the
Xoverall system for news purposes [nowhere]? gandalf
X
XThe "From:" lines of news postings, on the other hand, should carry
Xa mailing address, which in particular should be a domain address
Xfor sites that have one.  What is the mailing-address name of this
Xsystem, preferably a domain address [gandalf.uucp]? rintintin.colorado.edu
X
XWhat is the name of the organization, for insertion into articles
Xposted from here [Godcorp]? University of Colorado
X
XManual pages are normally stored in a tree structure under /usr/man.
XLocal practices vary a great deal, however, and System V has also
Xintroduced some bizarre distortions into this once-simple structure.
XWhat is the top-level manual-page directory [/usr/man]? /usr/local/man    
X
XC News adds manual pages to chapters 1 (programs), 5 (files), and
X8 (administrative programs).  These chapter numbers have changed
Xin some variants of Unix.  Also, originally pages from chapter 5 (for
Xexample) were stored in /usr/local/man/man5.  This has also changed in
Xsome variants.  Has your system made such changes [no]? yes
XYou will have to hand-edit the last few lines of doit.bin
Xto install the manual pages where they belong on your system.
X
XThe "rnews" and "cunbatch" commands (which are identical, the latter
Xbeing purely for backward compatibility with seriously-old systems)
Xhave to be installed somewhere where uucp can find them to execute
Xthem.  It is not normally necessary for users to be able to run
Xthem, so they need not go in the directories searched for normal
Xcommands... although uucp often searches only those directories.
XWhat directory should "rnews" and "cunbatch" go in [/bin]? /usr/local/bin
X
XOur "postnews", "readnews", and "checknews" are included mostly for
Xcompleteness.  They are very simple and crude compared to the user
Xinterface many users are accustomed to.  As far as we know, B News
X(or other) versions should run fine with C News.  If you are already
Xrunning such user-interface software, you may not want to change.
XDo you want to install our user-interface programs [yes]? no
X
XThe "inews" command(s) should
Xgo in one of the directories searched for normal commands, so users
Xcan run them without special arrangements.  What directory should
Xthese commands go in [/bin]? /usr/local/bin
X
XFor replies to control messages, C News invokes "mail" (typically
X/bin/mail unless you make special arrangements) with either an
XInternet-style "@" address or a uucp-style "!" address.  Internet
Xstyle is probably better... if your mailer supports it at all.
XWill "mail" handle "@" addresses [no]? yes
X
XThe ihave/sendme protocol, although marginally useful in some cases,
Xis a security hole -- it lets another site ask for any article by
XMessage-ID, and if your Message-IDs are predictable enough (which
XC News's generally are not, mind you), that site can get any article
Xcurrently on your system.  Do you have any newsgroups containing
Xconfidential or proprietary material [no]? 
X
Xbuilding doit.bin...
Xdone
X
Xbuilding doit.news...
Xdone
X
Xbuilding again.root...
Xdone
X
X
Xsaving defaults...
Xdone
X
XYou should now run doit.root as root, doit.bin as bin, doit.news
Xas news, and again.root as root, in that order.  (This assumes
Xthat the source directories are owned by bin.  If you need to do
Xinstallation work by hand, run 'doit.bin -i' as the owner; this will
Xcreate the programs but won't install them.)  (It is not necessary
Xto log in as these users; use of 'su' suffices.)  Finally, you will
Xwant to add the contents of 'cron', or something similar, to your
Xcron's work-to-be-done file(s), and the contents of 'rc', or something
Xsimilar, to /etc/rc or whatever your system executes when booting.
X
X"make gclean" will clean up everything afterwards.  "make lclean"
Xdoes a less drastic cleanup affecting only the library directories.
X"make spotless" does "make gclean" and also removes the doit files.
X
XGood luck and happy news reading.
END-of-build.386bsd.log
exit