To apply this patch, cd to the top of your INN source tree and do: patch -p < inn-1.5.1-to-inn.1.5.1sec there are a lot of changes, so you may want to add a '-s' option to the patch command. --------------------------------------------------------------------------- diff -Ncr ../inn-1.5.1.dist/CHANGES ./CHANGES *** ../inn-1.5.1.dist/CHANGES Wed Dec 18 11:54:01 1996 --- ./CHANGES Thu Jan 1 01:00:00 1970 *************** *** 1,1611 **** - From backends/ChangeLog - - Mon Dec 16 20:51:30 1996 James A. Brister - - * actsync.c: UNION_WAIT vs. DO_USE_UNION_WAIT fixup. - - Tue Dec 10 22:44:23 1996 James A. Brister - - * nntpget.c: Fixed unitialized variable. (J. Richard Sladkey) - Fixed offering an article to a server that doesn't - want it (J. Richard Sladkey) - - * innxmit.c: Added '-l' option to turn off logging of 437 - response. - - Fri Nov 29 15:16:59 1996 James A. Brister - - * actsync.c: subst update. - - Thu Nov 28 21:09:28 1996 James Brister - - * Makefile: Dropped the secs program. - - Tue Nov 26 14:36:36 1996 James Brister - - * innxmit.c: Try to keep offered count more-correct when not - issuing CHECK commands. (Dan Riley) - - * actsync.c: - Fixed bad parameter name in WEXITSTATUS and WTERMSIG macros. - - Tue Nov 19 20:19:43 1996 James Brister - - * crosspost.c: Check end of string against '\0' and not NULL. - - * crosspost.c: More include line swapping, this time for DEC Unix. - - * actmerge.sh, actsync.c, actsyncd.sh: chongo's updates - - Mon Nov 18 23:05:41 1996 James Brister - - * Makefile: Dropped the secs.sh program from the distribution. - Fixed up a typo in one of the lint commands. - - Thu Nov 14 01:08:59 1996 James Brister - - * crosspost.c: Swap #include lines for the sake of Ultrix. - - * actsyncd.sh: Fix permissions of created active file (Evan Champion) - - Wed Nov 6 19:06:20 1996 James Brister - - * actmerge.sh: Bug fix in if condition - - Sun Oct 27 17:19:14 1996 James Brister - - * actsync.c: - Use DO_USE_UNION_WAIT instead of UNION_WAIT. (korz@bach.cs.columbia.edu) - - Sun Oct 20 15:30:20 1996 James Brister - - * crosspost.c: Optimize out the second link(2) if the first one - fails due to EXDEV. - - Fri Oct 18 12:17:25 1996 James Brister - - * Makefile: Fixed lint rules to ignore return status. - - Wed Oct 16 15:14:20 1996 James Brister - - * actsync.c, archive.c, batcher.c, buffchan.c, crosspost.c, cvtbatch.c, filechan.c, innxbatch.c, innxmit.c, map.c, nntpget.c, overchan.c, rcompress.c, shlock.c, shrinkfile.c: - cleanup of compiler warnings (evanc@synapse.net) - - Fri Sep 27 22:13:24 1996 James Brister - - * innxmit.c: Fix check of MessageID length when it's NULL. - - * actsync.c: include signal.h so sig_atomic_t is seen when - necessary. - - Mon Sep 16 14:00:16 1996 James Brister - - * ChangeLog: snapshot for 1.5a3 - - Fri Sep 13 19:38:42 1996 James Brister - - * shrinkfile.c: chongo's updates. - - Tue Sep 10 19:40:24 1996 James Brister - - * Makefile: config variable substitution changes - - Fri Sep 6 06:57:41 1996 James Brister - - * actmerge.sh, sendxbatches.sh, Makefile: - config variable substitution changes - - Sun Aug 25 17:48:34 1996 James Brister - - * actsyncd.sh: Cleanup of some variable definitions. - - Mon Aug 12 06:59:29 1996 James Brister - - * actsync.c: update from chongo - - Wed Aug 7 12:52:49 1996 James Brister - - * innxmit.c: Explicitly catch response code 480. - - Wed Jul 17 20:09:43 1996 James Brister - - * ChangeLog: Initial revision - - Tue Jul 16 13:04:17 1996 James Brister - - * Makefile: Include innxbatch and sendxbatches. - - Fri Jul 12 23:25:03 1996 James Brister - - * Makefile: Added actmerge to ALL. - - * Makefile: actsync updates. - - * actmerge.sh: Subst update and binary location change. - - * innxmit.c: More robust handling of confused peers. - - * actsync.c: Chongo's update. - - Tue Jul 9 19:50:10 1996 James Brister - - * innxmit.c: Less syslog'ing when getting a NNTP_RESENDIT_VAL or a - NNTP_GOODBYE_VAL. - - Mon Jul 8 20:30:02 1996 James Brister - - * crosspost.c: Don't open file if not fsync'ing. - - - - ================================== - From config/ChangeLog - - Mon Dec 16 20:53:50 1996 James A. Brister - - * fixinterps.pl: Typo fixes. - - * Makefile: Default for 'all' is now 'quiet'. - Building 'quiet' now includes the interpreter - rule. - - Wed Dec 11 22:51:21 1996 James A. Brister - - * config.dist: subst formatting - - * config.dist: new MAIL_BADCONTROLS and TCL_INC variables. - - Thu Dec 5 00:11:00 1996 James A. Brister - - * config.dist: Fixed missing tabs. - - Fri Nov 29 15:16:59 1996 James A. Brister - - * files.list: Added actsync.c and actsync.8 - - * cmpconfigs.sh: Initial revision - - Tue Nov 26 14:11:17 1996 James Brister - - * config.dist: Added MSYNC_3_ARG variable. - Added _PATH_SORT variable. - Changed default for WANT_PGPVERIFY. - Fixed some typos. - - * Makefile: Dropped signcontrol from the interpreter fixup list. - - Sun Nov 10 20:58:56 1996 James Brister - - * files.list: Added new docs. Removed some unnecessaries. - - * config.dist: Drop PATCH. - 32-bit integer types. - Added MMAP_SYNC, SET_SOCKOPT, _PATH_CSH_SHELLVARS,. - - * Makefile: Added interpreter fixup code. - - Fri Nov 8 21:29:50 1996 James Brister - - * fixinterps.pl: Initial revision - - Wed Oct 16 15:14:20 1996 James Brister - - * config.dist, subst.c: - cleanup of compiler warnings (evanc@synapse.net) - - Tue Oct 15 16:30:45 1996 James Brister - - * config.dist: Comment fix. - Added RNEWS_GROUP for certain systems that don't have a group uucp. - - * subst.c: NetBSD fix. - - Thu Oct 10 19:52:46 1996 James Brister - - * config.dist: Comment for NetBSD and FreeBSD. - Type clarification ('unsigned int' instead of just - unsigned). - - * config.dist: Added the PATCH variable. - - * config.dist: - Added setproctitle support for BSD/OS (evanc@synapse.net) - - * config.dist: Added L suffix to some - numbers. (evanc@synapse.net) - - Sat Sep 28 16:53:33 1996 James Brister - - * config.dist: Reduce CLIENT_TIMEOUT. - ALLOW_NEWNEWS to DONT - Some spool path changes. - - Fri Sep 13 16:56:40 1996 James Brister - - * config.dist: Added perl section. - - Tue Sep 10 19:41:50 1996 James Brister - - * config.dist: Added _PATH_PERL. - config variable substitution changes - - Fri Sep 6 09:14:33 1996 James Brister - - * files.list: Added actmerge.sh actsyncd.sh sendxbatches.sh - Added innshellvars.pl innshellvars.tcl - - * config.dist: - Added INNWATCH_DF INNWATCH_INODES and INNWATCH_BLOCKS variables. - Added MMAP_PTR LIKE_PULLERS LOG_SIZE. - Changed default value for IPADDR_LOG. - - Tue Sep 3 14:57:54 1996 James Brister - - * config.dist: Path name cleanup (Evan Champion ). - Some changes to match bsd/os defaults. - - Wed Jul 17 20:09:43 1996 James Brister - - * files.list: include innxbatch.8. - - Tue Jul 16 13:07:09 1996 James Brister - - * config.dist: Include BSD4.4 style manpage in comment. - Make PATH_XBATCHES same as PATH_SPOOLNEWS. - - Fri Jul 12 23:15:06 1996 James Brister - - * files.list: Added in the actsync config and ignore files. - - * config.dist: Added Actsync section and _PATH_TEMPMODERATORS. - - Wed Jul 10 09:56:38 1996 James Brister - - * Makefile: NONE-checkout rule change. chongo sez: - - On a number of systems, such as IRIX, doing a chmod u+w - results in files with mode 0420 in the site directory. - - Tue Jul 9 19:52:58 1996 James Brister - - * config.dist: Added a local configuration section. - - * files.list: Added pgpverify. - - * config.dist: PGP off as default. - Added _PATH_PGP variable. - - Mon Jul 8 20:54:59 1996 James Brister - - * config.dist: Added _PATH_GZIP - - Mon Jul 8 17:53:09 1996 James Brister - - * config.dist: Added _PATH_XBATCHES, ALLOW_NEWNEWS, Tcl support - and PGP support. - - - - ================================== - From doc/ChangeLog - - Tue Dec 17 10:11:49 1996 James A. Brister - - * newsfeeds.5: Clarified description of behaviour of Ap. - - Mon Dec 16 22:25:02 1996 James A. Brister - - * actsync.8: Typo fix. - - Wed Dec 11 22:09:18 1996 James A. Brister - - * getlist.1: Use proper subst variables for distributions and - newsgroups locations. - - Tue Dec 10 23:44:48 1996 James A. Brister - - * news.daily.8: Cleanup of description of the notdaily keyword. - - * innxmit.8: Document the new '-l' flag. - - Fri Dec 6 14:57:23 1996 James A. Brister - - * innd.8: Fixed typo (Volker Schmidt) - - Fri Nov 29 15:16:59 1996 James A. Brister - - * actsync.8: subst update. - - Thu Nov 28 12:47:25 1996 James Brister - - * Makefile: Added some more missing doc files and tidied up a - little bit. - - Wed Nov 27 18:54:59 1996 James Brister - - * hosts.nntp.5: Fixed bogus reference to innd's `-c' - flag. (J. Porter Clark). - - Tue Nov 26 13:46:12 1996 James Brister - - * makehistory.8, innxmit.8: Typo fixes. - - * innwatch.8: Added HISTORY section. - - * Makefile: Install new doc files. - - Tue Nov 19 13:51:00 1996 James Brister - - * actsync.8: chongo's updates - - Wed Nov 13 21:23:24 1996 James Brister - - * shrinkfile.1: Fixed description of return value when using -n. - - Fri Nov 8 23:52:56 1996 James Brister - - * rnews.1: Documented the -N flag. - - * grephistory.1: Added '-t' documentation. - - Thu Nov 7 11:26:00 1996 James Brister - - * makehistory.8: Updated for -A and -a options. - - Tue Oct 29 23:25:05 1996 James Brister - - * active.5, archive.8, batcher.8, buffchan.8, convdate.1, ctlinnd.8, cvtbatch.8, expire.8, expire.ctl.5, expireover.8, fastrm.8, filechan.8, getlist.1, grephistory.1, inews.1, innconfval.1, innd.8, innxmit.8, installit.1, makeactive.8, news-recovery.8, news.daily.8, newslog.8, newsrequeue.8, nnrpd.8, nntpget.1, nntpsend.8, overchan.8, prunehistory.8, rnews.1, shlock.1, shrinkfile.1, subst.1: - Formatting updates - - * expirerm.8, inncheck.8, innlog.pl.8, innstat.8, innwatch.8, makehistory.8, scanlogs.8, tally.control.8, tally.unwanted.8, writelog.8: - Initial revision - - Thu Oct 24 20:08:07 1996 James Brister - - * nnrpd.8: Added the subscriptions section to the LIST command. - - Mon Oct 14 15:45:57 1996 James Brister - - * crosspost.8: Typo in example. - - Sat Sep 28 17:31:09 1996 James Brister - - * archive.8, batcher.8, buffchan.8, expireover.8, filechan.8, innxbatch.8, innxmit.8, newsfeeds.5, nntpsend.8, overchan.8, rnews.1: - config.data changes. - - Fri Sep 27 21:51:58 1996 James Brister - - * news.daily.8: notdaily keyword documented. - - Fri Sep 13 19:56:57 1996 James Brister - - * nntpsend.ctl.5, nntpsend.8, shrinkfile.1: chongo's updates. - - * ctlinnd.8: Perl support. - - Wed Sep 11 04:16:00 1996 James Brister - - * innd.8: too-many-connects support (stapes@mro.dec.com) - - Tue Sep 10 19:44:59 1996 James Brister - - * archive.8, crosspost.8, ctlinnd.8, innd.8, innxbatch.8, newsfeeds.5, newslog.5, overchan.8, rnews.1: - config variable substitution changes - - Fri Sep 6 10:40:50 1996 James Brister - - * Makefile, active.5, archive.8, batcher.8, buffchan.8, control.ctl.5, crosspost.8, ctlinnd.8, cvtbatch.8, distrib.pats.5, expire.ctl.5, expireover.8, filechan.8, getlist.1, history.5, hosts.nntp.5, inn.conf.5, innd.8, innwatch.ctl.5, innxbatch.8, innxmit.8, moderators.5, news-recovery.8, newsfeeds.5, newslog.5, nnrp.access.5, nntpsend.8, nntpsend.ctl.5, overchan.8, overview.fmt.5, passwd.nntp.5, prunehistory.8, rnews.1: - config variable substitution changes - - * expire.8: Described '-e' option. - Config variable changes. - - Thu Aug 8 20:38:47 1996 James Brister - - * newsfeeds.5: Poison newsgroup support - changes. (stapes@mro.dec.com). - - Wed Aug 7 13:00:27 1996 James Brister - - * innxbatch.8: subst changes - - - - ================================== - From expire/ChangeLog - - Mon Dec 16 22:27:23 1996 James A. Brister - - * expireover.c: Fixed parameter types for qsort callable functions. - Fixed bug with handling folded - headers (HolgerBurbach) - - * Makefile: Build dbz.o with no MMAP for expire and - makehistory (Per Hedeland and Larry Rosenman) - - Tue Nov 26 14:22:14 1996 James Brister - - * makehistory.c: Fixed bug in call to dbzfresh. - - Thu Nov 21 14:14:13 1996 James Brister - - * fastrm.c, expire.c, expireover.c: Added usage of CPOINTER - - Mon Nov 18 16:06:08 1996 James Brister - - * expire.c: Force an abort if multiple default lines seen - (otherwise it would ignore further lines in the - file) (Dan Riley). - - Thu Nov 14 00:31:20 1996 James Brister - - * expire.c: Permit comments anywhere on the control.ctl lines - (Michael Shields) - - Sun Nov 10 21:00:28 1996 James Brister - - * fastrm.c, expireover.c: - Have qsort-callable function have const parmeters. - - Fri Nov 8 23:34:21 1996 James Brister - - * grephistory.c: Added the '-t' flag for printing offset of - record. (Odd Einar Aurbakken). - - Thu Nov 7 00:50:51 1996 James Brister - - * makehistory.c: Usage fixup. - - Sun Oct 27 17:38:09 1996 James Brister - - * expire.c: Protect atof if it's a macro (Frederick Korz). - Make the qsort-callable function have const - params. - - Sun Oct 20 14:36:43 1996 James Brister - - * expireover.c: Memory allocation bug (off-by-one) - fixed. (bill@twwells.com) - - Fri Oct 18 12:17:25 1996 James Brister - - * Makefile: Fixed lint rules to ignore return status. - - Wed Oct 16 15:14:20 1996 James Brister - - * convdate.c, expire.c, expireover.c, fastrm.c, grephistory.c, makeactive.c, makehistory.c, newsrequeue.c, prunehistory.c: - cleanup of compiler warnings (evanc@synapse.net) - - Tue Oct 15 14:13:42 1996 James Brister - - * expireover.c: Handle multi-line headers properly - - - Fri Oct 11 22:42:13 1996 James Brister - - * fastrm.c: Put newlines on printfs when chdir() doesn't - work. (J. Porter Clark). - - Mon Sep 23 20:01:18 1996 James Brister - - * expire.c: Bump NGH_SIZE for speed (stapes@mro.dec.com). - - Wed Sep 18 14:50:52 1996 James Brister - - * expireover.c: Casts for those systems where iov_base is (correctly) - a void (rck@fangio.asd.sgi.com) - - Tue Sep 10 19:47:32 1996 James Brister - - * Makefile: config variable substitution changes - - Tue Sep 3 13:28:36 1996 James Brister - - * expire.c: Support for '-e' flag (John R Levine - ) - - Tue Jul 9 15:27:32 1996 James Brister - - * makehistory.c: - cd into the directory where the history file is, and not into NEWSLIB - (which can be different). - - * expire.c: - cd into directory where history is, not NEWSLIB (may be different). - - Mon Jul 8 20:38:35 1996 James Brister - - * makehistory.c: Don't DISPOSE of a static buffer. - - * fastrm.c: printf argument fix. - - * expire.c: Fixed History path construction in the '-d' case. - - Wed Jun 26 14:56:15 1996 James Brister - - * expire.c: Make sure new history is built in _PATH_HISTORY.n - instead of history.n. - - - - ================================== - From innd/ChangeLog - - Tue Dec 17 00:16:26 1996 James A. Brister - - * perl.c: Pass full Path into script. - Fixed bug with return value being freed before being - passed back out to ARTpost (Andrew Burgess and - Christophe Wolfhugel) - - * art.c: Pass the full Path into the Perl script. - - * Makefile: Added usage of TCLINC. - Better use of whoami(1). - - Tue Dec 10 23:39:39 1996 James A. Brister - - * nc.c: Fixed bug in handling TAKETHIS with missing - argument. - - * rc.c: syslog the address when "think it's a dotquad" - - Fri Nov 29 18:50:36 1996 James Brister - - * newsfeeds.c: Initialize Site buffer properly. (Peter Eriksson) - - Tue Nov 26 14:09:55 1996 James Brister - - * nc.c: Fixed reversed test for DO_SET_SOCKOPT. - - * icd.c: Add 3 arg version of msync(). - - * art.c: Added Keywords as a standard header so it - can go into overview (Karl Kleinpaste) - - Mon Nov 25 14:47:08 1996 James Brister - - * perl.c: Perl memory leaks plugged. (Christophe Wolfhugel) - - * art.c: Go back to checking Subject for 'cmsg' if no - control header. - - Thu Nov 21 14:13:38 1996 James Brister - - * art.c, ng.c: Added usage of CPOINTER - - Sun Nov 10 21:46:21 1996 James Brister - - * tcl.c: Use defined 32-bit types. - - * ng.c: compiler warning cleanup. - - * icd.c: msync usage updates. - - * art.c: compiler warning cleanup. - - * Makefile: Handle missing whoami(1) somewhat gracefully. - - Wed Oct 30 14:46:38 1996 James Brister - - * nc.c: Bug fix in searching for command in - NCquietlist. (John Stapleton). - - Sun Oct 27 21:28:53 1996 James Brister - - * chan.c: Fix of too many calls to - ICDwriteactive(). (Richard Michael Todd) - - Sun Oct 20 22:04:18 1996 James Brister - - * icd.c: Added msync to ICDwriteactive and deal with 2-arg - vs. 3-arg version. - - * chan.c: Compact BUFFER if large enough gap appears at the - beginning. (rmtodd@mailhost.ecn.ou.edu) - - Fri Oct 18 14:47:09 1996 James Brister - - * nc.c: Fix search through NCquietlist on non-existant - command. (stapes@mro.dec.com) - - * Makefile: Fixed lint rules to ignore return status. - Straightned out the PERL defines and usage. - - Wed Oct 16 15:14:20 1996 James Brister - - * art.c, cc.c, chan.c, his.c, icd.c, innd.c, innd.h, inndstart.c, lc.c, nc.c, newsfeeds.c, ng.c, perl.c, proc.c, rc.c, site.c, tcl.c: - cleanup of compiler warnings (evanc@synapse.net) - - Tue Oct 15 16:53:34 1996 James Brister - - * Makefile: Install inndstart root.news instead of just root. - - Fri Oct 11 20:34:09 1996 James Brister - - * nc.c: Bug fix with huge articles. (tale@uu.net). - - Thu Oct 10 18:52:34 1996 James Brister - - * art.c: Fixed typo. - - * innd.c: Const-casting fix. (tassin@eerie.fr> - - * perl.c: Const-casting fix. (tassin@eerie.fr> - NULL vs. FALSE fix (tassin@eerie.fr> - - Sat Sep 28 16:50:56 1996 James Brister - - * cc.c: Bug fix on constructing inndcomm messages. - - Fri Sep 27 21:36:26 1996 James Brister - - * innd.c: Fix const-incorrectness. - - Tue Sep 24 20:28:09 1996 James Brister - - * art.c: Do REMEMBER_TRASH in more spots. - - Mon Sep 16 12:06:48 1996 James Brister - - * innd.c: Turn on perl filtering after initial loading. - - Fri Sep 13 17:15:44 1996 James Brister - - * innd.c: Perl support (wolf@pasteur.fr) - - * art.h: Initial revision - - * art.c: Perl support (wolf@pasteur.fr) - - * Makefile: Perl support. - - * cc.c: Perl support (wolf@pasteur.fr) - - * perl.c: Initial revision - - Wed Sep 11 04:57:43 1996 James Brister - - * rc.c: Don't limit (via `-X') those hosts in - hosts.nntp.nolimit. - - * cc.c, chan.c, innd.c, innd.h, rc.c: - too-many-connects support (stapes@mro.dec.com) - - Tue Sep 10 20:02:06 1996 James Brister - - * Makefile: install innd and inndstart mode 550. - print message about chown needing to be done. - - * inndstart.c: set HOME to _PATH_NEWSHOME instead of _PATH_NEWSLIB - - * rc.c: Removed htonl prototype as it break on 64-bit machines. - - * art.c: Include article body as a TCL variable. - Log article size to syslog. - - Fri Sep 6 10:12:48 1996 James Brister - - * innd.h: bug fix on SITE and NOSITE defs. (stapes@mro.dec.com) - - Thu Sep 5 16:28:32 1996 James Brister - - * chan.c, nc.c: Use POLL_BUG define instead of SUNOS5 - - * Makefile: config variable substitution changes - - * newsfeeds.c: poison patch bugfix. - - * rc.c, site.c: wildmat call optimization (markd@mira.net.au) - - Tue Sep 3 13:03:18 1996 James Brister - - * proc.c: Initialize new PROCtable entries - (fletcher@cs.utexas.edu). - - Thu Aug 8 22:28:53 1996 James Brister - - * newsfeeds.c, site.c, ng.c, innd.h, cc.c: Poison newsgroup support - changes. (stapes@mro.dec.com). - - * art.c: Poison newsgroup support changes. (stapes@mro.dec.com) - - Wed Aug 7 12:48:42 1996 James Brister - - * innd.c: Removed the unused 'X' option. - - * ng.c: Boosted hash table size (stapes). - - * cc.c: Fixed up the non-UNIX domain system handling of - ctlinnd connection (brister). - - * art.c: REMEMBER_TRASH when TCL function is rejecting an - article. - - Wed Jul 17 20:09:43 1996 James Brister - - * nc.c: Typo fix. - - Tue Jul 16 15:53:44 1996 James Brister - - * innd.c, chan.c, rc.c, nc.c: Support for the ``/s'' hosts.nntp prefix. - - Mon Jul 15 13:40:47 1996 James Brister - - * innd.h, innd.c, art.c: Makes the Always Cross-posted option '-x' the - default. This results in the Xref header being - added to all article files regardless of whether - or not they are cross-posted. (dneedham). - - * cc.c: Catch SIGUSR1 so that we can recreate the control - channel when needed (i.e. something has deleted - our named socket (dneedham). - - * rc.c, nc.c: set keepalive on sockets used by network - connections to help detect a broken connection and - disconnect it (dneedham). - - * nc.c: check for wip overflow. - - Tue Jul 9 20:03:31 1996 James Brister - - * inndstart.c: - Call setgroups after getting the news groups id (so innd doesn't - inherit any root groups). - - * cc.c: Logging level change. - - Tue Jul 9 07:00:34 1996 James Brister - - * art.c: multiple cancels. - Ignore 'cmsg' in Subject. - - Sat Jun 29 00:40:57 1996 James Brister - - * cc.c (CCreader): Support for message-length and protcol version - prefix on control-socket messages. - - Fri Jun 28 20:30:55 1996 James Brister - - * site.c (SITEbuffer): Added 'p' support for Wxxx newsfeeds entry - (time posted). - - * rc.c (RCreadfile): Fixed memory leak. - - Tue Jun 25 12:26:24 1996 James Brister - - * chan.c: Added Alan Barrett work-limiter for the select loop. - - - - - - ================================== - From lib/ChangeLog - - Tue Dec 17 00:18:40 1996 James A. Brister - - * xmalloc.c: Added an ifdef'ed out memset() of the memory. - - * remopen.c: Fixed incorrect usage of htons - vs. ntohs. (tale@uunet) - - Mon Nov 18 08:15:25 1996 James Brister - - * Makefile: Don't quit make when makellib.sh fails. - - Wed Nov 13 23:43:26 1996 James Brister - - * getmodaddr.c: GMAclose instead of fclose (Andrew Vasilyev). - - Mon Nov 11 13:24:11 1996 James Brister - - * gettime.c: Fixed error in timezone calculation (Paul Eggert). - - Sun Nov 10 21:46:38 1996 James Brister - - * Makefile: drop PATCH config.data variable - - Wed Nov 6 10:57:58 1996 James Brister - - * qio.c: QIOread fix when read from non-file doesn't give - full amount and buffer not full. (Richard Michael - Todd) - - Sun Oct 20 21:17:37 1996 James Brister - - * inndcomm.c: Code reorganization to get around IRIX c compiler - optimizer bug (Robert Keller). - - * defdist.c: Handle the case where the distributions file has - size 0. - - Fri Oct 18 12:19:03 1996 James Brister - - * Makefile: Fixed lint rules to ignore return status. - Straightned out the PERL defines and usage. - - Wed Oct 16 15:14:20 1996 James Brister - - * checkart.c, cleanfrom.c, clientactive.c, clientlib.c, closeonexec.c, dbzalt.c, defdist.c, findheader.c, genid.c, getconfig.c, getdtab.c, getfqdn.c, getmodaddr.c, getopt.c, gettime.c, inet_ntoa.c, inndcomm.c, innvers.c, localopen.c, lock.c, lockfile.c, malloc.c, memchr.c, memcmp.c, memcpy.c, memset.c, mkfifo.c, nonblocking.c, parsedate.y, perl.c, qio.c, radix32.c, readin.c, remopen.c, sendpass.c, strcasecmp.c, strchr.c, strerror.c, strrchr.c, strspn.c, strtok.c, tempname.c, waitnb.c, wildmat.c, writev.c, xfopena.c, xmalloc.c, xmemerr.c, xrealloc.c, xwrite.c, xwritev.c: - cleanup of compiler warnings (evanc@synapse.net) - - Tue Oct 15 19:23:51 1996 James Brister - - * memmove.c: Initial revision - - Fri Oct 11 19:07:57 1996 James Brister - - * Makefile: Remove dbz.c if patching it fails (so rebuild will - try to patch again). - - Thu Oct 10 17:44:23 1996 James Brister - - * Makefile: Make patch(1) locattion and usage be configurable. - - * perl.c: Fixed a NULL vs. FALSE bug. (tassin@eerie.fr) - - Sat Sep 28 16:50:14 1996 James Brister - - * inndcomm.c: Include netinet/in.h - - Fri Sep 27 23:46:19 1996 James Brister - - * dbz.pch: minor cleanups (evanc@synapse.net) - - Wed Sep 18 14:50:45 1996 James Brister - - * xwritev.c: Casts for those systems where iov_base is (correctly) - a void (rck@fangio.asd.sgi.com) - - Mon Sep 16 11:27:42 1996 James Brister - - * perl.c: Bug fix in use of ENTER and SAVETMPs. - More robust handling of 'perl y' when filter not - defined. - - Fri Sep 13 17:17:42 1996 James Brister - - * Makefile: Perl support (wolf@pasteur.fr) - - * parsedate.y: Added some defines to make varaables static (due - to clash with Perl yacc from Perl hooks). - - * perl.c: Major code rearrangement. - - * perl.c: Initial revision - - Wed Aug 7 12:42:35 1996 James Brister - - * inndcomm.c: Fixed up the non-UNIX domain system handling of - ctlinnd connection (brister). - - Tue Jul 16 16:00:12 1996 James Brister - - * tempname.c: Initial revision - - Mon Jul 15 21:45:16 1996 James Brister - - * Makefile: Add in TempName function source. - ranlib the library to stop some makes from - relinking everything. - - Fri Jul 12 23:06:38 1996 James Brister - - * getmodaddr.c: Doug Needham's support for accessing moderators - file on a remote machines. - - Tue Jul 9 13:30:01 1996 James Brister - - * inndcomm.c: Fixed usage of RECVorREAD. - - * inndcomm.c: - Support for new message format , , . - - - ================================== - From nnrpd/ChangeLog - - Tue Dec 17 00:22:46 1996 James A. Brister - - * post.c: Fixed problem with buffer passed to syslog not - being initialized when posted article was for a - moderated group. - - * perl.c: Fixed bug in perl script return value being freed - before begin passed back to ARTpost() (Andrew - Burgess and Christophe Wolfhugel). - - * nnrpd.c: Typo in syslog format parameter. - - Tue Dec 10 14:27:41 1996 James A. Brister - - * post.c: Spooling race condition fixes (Ken Lalonde) - - Thu Nov 28 12:48:26 1996 James Brister - - * post.c: Added code (but ifdef's out) for changing Path on - POST. - - Tue Nov 26 14:26:17 1996 James Brister - - * commands.c: Fixed up some defines for the Next machine. - - Mon Nov 25 19:58:00 1996 James Brister - - * article.c: Do some alarm() calls to catch clients who - disappear while nnrpd is sending article - data. (Matt Thomas) - - * post.c: If no Control header and Subject starts with - "cmsg" then add appropriate Control - header. Subject is not changed if Control header - exists. - - Fri Nov 22 18:42:17 1996 James Brister - - * nnrpd.c: Syslog message typo. - - Thu Nov 21 14:13:38 1996 James Brister - - * group.c: Added usage of CPOINTER - - Sun Nov 10 21:54:33 1996 James Brister - - * nnrpd.c: cleanup help message for LIST command. - - * group.c: compiler warning cleanup. - - Sun Oct 27 21:04:51 1996 James Brister - - * commands.c: Change help message for INFOschema - Fix for old OS's that don't have S_IXUSR (Fred - Korz). - - Sun Oct 20 20:22:17 1996 James Brister - - * article.c: Fixed up uninitialized structure member (J Porter - Clark). - - * post.c: Dont spool failed article posting if remote didn't - acutally want it. - - * newnews.c: Protection against Exchange Web Service. (J Porter - Clark) - - Fri Oct 18 18:07:03 1996 James Brister - - * commands.c: Fixed bad handling of tabs in CMDlist: J. Porter - Clark. - - * newnews.c: Fixed double increment in GetFiles: (J. Porter Clark) - - * Makefile: Fixed lint rules to ignore return status. - Straightned out the PERL defines and usage. - - Wed Oct 16 15:14:20 1996 James Brister - - * article.c, commands.c, group.c, loadave.c, misc.c, newnews.c, nnrpd.c, nnrpd.h, perl.c, post.c: - cleanup of compiler warnings (evanc@synapse.net) - - Tue Oct 15 16:55:10 1996 James Brister - - * nnrpd.h, nnrpd.c: Change LogName type. - - * misc.c: Better PERMmatch'ing - - Fri Oct 11 18:51:39 1996 James Brister - - * group.c: Include the group name in the "No such group" - reply. - - Thu Oct 10 17:55:44 1996 James Brister - - * perl.c: Const-casting fix. (tassin@eerie.fr> - - * nnrpd.c: Added setproctitle support for BSD/OS (evanc@synapse.net) - - Mon Sep 16 11:33:11 1996 James Brister - - * perl.c: Added LogName so the lib/perl.c can do logging for - innd and nnrpd. - Made type of extern PerlFilterActive consistent. - - * nnrpd.c: Added LogName so the lib/perl.c can do logging for - innd and nnrpd. - Turn on perl filtering automatically at startup. - - * nnrpd.h: Added LogName so the lib/perl.c can do logging for - innd and nnrpd. - - * post.c: Slight code rearrangement. - - Fri Sep 13 17:19:41 1996 James Brister - - * post.h: Initial revision - - * post.c, nnrpd.c, Makefile: Perl support (wolf@pasteur.fr) - - * perl.c: Initial revision - - Wed Sep 11 04:16:00 1996 James Brister - - * nnrpd.c: too-many-connects support (stapes@mro.dec.com) - - Tue Sep 10 20:08:22 1996 James Brister - - * Makefile: config variable substitution changes - - * article.c: Put in a delay on ARTICLE HEAD and BODY commands. - - Fri Sep 6 09:13:36 1996 James Brister - - * Makefile: config variable substitution changes - - Wed Aug 7 12:51:29 1996 James Brister - - * nnrpd.c: Set the ClientHost to a non-null string "?" when - getpeername fails, so that log file entries are - consistent. - - Tue Jul 16 16:03:20 1996 James Brister - - * post.c: Spool articles for rnews to get if innd not - accepting. (dneedham). - - Fri Jul 12 23:20:04 1996 James Brister - - * post.c: Use new GetModeratorAddress function. - - * nnrpd.c: Update the HELP output to reflect reality and to - include LIST MODERATORS. - - * commands.c: Support the LIST MODERATORS command. - - Tue Jul 9 05:45:48 1996 James Brister - - * post.c: Stop messing with the Subject on control messages. - - * nnrpd.c: List subscriptions. - - * newnews.c: Permit disabling of newnews command. - - * misc.c: include and for linux. - - * loadave.c: Linux load average support. - - * commands.c: minor bug fix. - - * article.c: Continuation lines in overview generation. - - Wed Jun 26 16:46:59 1996 James Brister - - * loadave.c: Added linux version of load average from - - - - - ================================== - From sample-configs/ChangeLog - - Mon Dec 16 13:24:28 1996 James A. Brister - - * README: update - - * config.defaults: removed some variables - - * config.data-solaris2.3-4: set HAVE_SETPROCTITLE to DONT - - Thu Dec 12 10:45:25 1996 James A. Brister - - * config.data-newsos-4.2.1: Initial revision - - Wed Dec 11 23:24:52 1996 James A. Brister - - * config.data-linux-2.0.18, config.data-DU4.0, config.data-FreeBSD-2.0, config.data-OSF1.3a, config.data-OSF3.0, config.data-aix-4.1.4, config.data-aux3.1, config.data-dynixptx2.1, config.data-irix-5.2, config.data-next3.2, config.data-solaris2.3-4, config.data-sunos-4.1.x, config.data-ultrix4.3, config.data-ux4800, config.data-uxpds: - Subst updates - - * config.data-sunos-4.1.x: Initial revision - - Fri Dec 6 14:08:11 1996 James A. Brister - - * Makefile: Initial revision - - * config.data-DU4.0, config.data-FreeBSD-2.0, config.data-OSF1.3a, config.data-OSF3.0, config.data-aix-4.1.4, config.data-aux3.1, config.data-dynixptx2.1, config.data-irix-5.2, config.data-linux-2.0.18, config.data-next3.2, config.data-solaris2.3-4, config.data-ultrix4.3, config.data-ux4800, config.data-uxpds: - updates for 1.5 - - * config.defaults, config.data-ux4800: Initial revision - - Fri Nov 29 15:00:47 1996 James A. Brister - - * README: Add note about bsd/os. - - Thu Nov 28 21:33:26 1996 James A. Brister - - * README: README for the sample configs. - - * config.data-aix-4.1.4, config.data-irix-5.2, config.data-linux-2.0.18, config.data-uxpds: - Initial revision - - * config.data-DU4.0: fixed email address - - Mon Nov 11 13:58:31 1996 James A. Brister - - * config.data-DU4.0: Initial revision - - Fri Nov 8 20:26:19 1996 James A. Brister - - * README, config.data-FreeBSD-2.0, config.data-OSF1.3a, config.data-OSF3.0, config.data-aux3.1, config.data-dynixptx2.1, config.data-next3.2, config.data-solaris2.3-4, config.data-ultrix4.3: - Initial revision - - - ================================== - From samples/ChangeLog - - Tue Dec 17 13:17:35 1996 James A. Brister - - * innlog.pl: Bug fix in handling of $[ with an array - assignment. - - * version: new version 1.5.1 - - * sendsys: Quote the slash inside the character class. - - * scanlogs: Handle HP's broken sort(1) which adds a newline to - empty input. - - * parsecontrol: Fixed security hold with variable contents (Matt - Power). - Only do mailing of broken control messages if - config.data variable used. - - * newsfeeds: Tidied up the ME entry a bit. - - * hosts.nntp: Dropped foo.com sample as that's a valid domain - name. - - Thu Dec 12 23:21:17 1996 James A. Brister - - * control.ctl: Spelling correction and dropped the lines for kre - and Erik Fair. - - Tue Dec 10 23:36:14 1996 James A. Brister - - * rc.news: Turn on innwatch by default. - Locate all unfinished expirerm input files. - - * send-ihave: Fixed generated Subject header. - - * ihave: Added missing Subject header (Koichi Mouri) - - * scanlogs: Process the new control and pgp related log files. - - * filter_nnrpd.pl, filter_innd.pl, startup_innd.pl: - Fixes to 'my' statements (Ollivier Robert) - - Thu Dec 5 00:45:19 1996 James A. Brister - - * innshellvars, innshellvars.csh, innshellvars.pl, innshellvars.tcl: - Added MAIL_BADCONTROLS - - Thu Nov 28 23:45:10 1996 James Brister - - * news.daily: Fixed args to expireover to handle renamed RMFILE. - - * version: new version 1.5 - - * scanlogs: Add report on unwanted sites (Dan Riley). - - * pgpverify: Deal with missing pgp executable more robustly. - - * parsecontrol: Removed mailing of bad control headers and - writelog them to badcontrol.log instead - - * innshellvars, innshellvars.csh, innshellvars.pl, innshellvars.tcl: - Default of WANT_PGPVERIFY changed. - - * innlog.pl: Added catching a logmode message. - Fixed bogus variable reference (Christophe - Wolfhugel). - - Tue Nov 26 15:42:39 1996 James Brister - - * news.daily: - Added a message before second call to innstat (for the confused). - Rename the RMFILE so that new news.daily doesn't - prematurely blast old files. - - * innstat: Check overview dir for space too. - - * innshellvars.pl, innshellvars.tcl: Added sort variable. - - * innshellvars.csh, innshellvars: - Set some things inside quotes so multiwords values in - config.data does not break things. - Added SORT variable - - * inncheck: Now groks the '-v' flag inside nntpsend. - Also handles the optional '/s' suffix in hosts.nntp. - - * filter_innd.pl: Added some sample code from Christophe Wolfhugel. - - * control.ctl: Make pgpverify the default behaviour where - possible. - - Mon Nov 25 22:29:34 1996 James Brister - - * sendbatch: Use the COMPRESS variable as it is in innshellvars - - Tue Nov 19 13:05:46 1996 James Brister - - * innlog.pl: Greg's updates. - - * innlog.pl: Some Perl-hook-logging related fixes - and a few potential bugs-in-the-making - removed (Christophe Wolfhugel). - - Mon Nov 18 21:22:04 1996 James Brister - - * innshellvars, innshellvars.csh, innshellvars.pl, innshellvars.tcl: - Added overview dir to contents (John Stapleton) - - * parsecontrol: Fixed so that messages that fail pgp authentication - get mailed. (Dan Riley). - - Thu Nov 14 08:55:08 1996 James Brister - - * inncheck: Verify alias is a non-empty string. - - Mon Nov 11 23:29:35 1996 James Brister - - * control.ctl: Removed Karl Kleinpaste from gnu.* at his request. - - * innlog.pl: new updates from greg patten - - Sun Nov 10 22:22:03 1996 James Brister - - * actsync.clari.cfg, actsync.clari.ign, actsync.uunet.cfg, actsync.uunet.ign: - Initial revision - - * filter_innd.pl, filter_nnrpd.pl: - Expanded sample code (Ollivier Robert) - - * scanlogs: Removed out-of-date comment. - - * nntpsend: Pre-sort data appended to batchfile. (Matus Uhlar) - - * newsfeeds: Include poison character in sample. - Describe working of the sample ME patterns. - - * news.daily: Use full hostname on mail subject lines. - - * innshellvars: Added comment about innshellvars.csh - - Sat Nov 9 00:13:00 1996 James Brister - - * version: new version 1.5b2 - - Fri Nov 8 21:55:28 1996 James Brister - - * innlog.pl: Don't report innxmit 'rejected' messages as - unknown. - - Thu Nov 7 22:06:23 1996 James Brister - - * innlog.pl: Changes from greg and chongo. - - * innwatch.ctl: Check overview disk space too. - - * control.ctl: Heaps o' updates from Simon Lyall - - * moderators: Regional updates from Simon Lyall. - - Wed Oct 30 14:31:41 1996 James Brister - - * innlog.pl: Report on fast-connecting clients (Matus Uhlar). - - Sun Oct 27 22:14:06 1996 James Brister - - * news.daily: Change date(1) usage as not all systems do - strftime-style formatting. - - * parsecontrol: Change handling of pgpverify return status due to - some broken shells. - - Thu Oct 24 16:12:35 1996 James Brister - - * nntpsend: Handle the '-s' flag - (tmiller@carfax.ims.advantis.com). - - * innshellvars.csh: Initial revision - - Sun Oct 20 19:32:07 1996 James Brister - - * pgpverify: David's update for handling ViaCrypt PGP. - - * control.ctl: Australia changes. - - * innlog.pl: Catch syslog lines that say "SERVER" instead of - "ME". - - Fri Oct 18 12:22:54 1996 James Brister - - * innshellvars.tcl, innshellvars.pl: - Fixed a bunch of subst-related errors. - Synched up with innshellvers. - - * innshellvars: Added PERL and TCL sections. - - Tue Oct 15 16:58:32 1996 James Brister - - * news.daily: Fixed use of hostname for svr4 systems. - Slightly more sane mail subject line generation. - - * innlog.pl: Fixed substitution of debugging syslog entries. - - * control.ctl: Added fr.* groups. - - Fri Oct 11 22:37:34 1996 James Brister - - * innshellvars.pl: Fixed syntax bug. (kondou@uxd.fc.nec.co.jp) - - * innshellvars.pl: Typo on subst line. - - * innlog.pl: Ignore some of the Perl filtering messages. - - * send-ihave: Add a subject header to inews input as inews no - longer adds one to control messages. - - * scanlogs: Remove a sed pass over log file as the new perl - version handles that. - - Thu Oct 10 19:51:43 1996 James Brister - - * innshellvars, innshellvars.pl, innshellvars.tcl: - Add a configured value for df(1). - - * innstat: Use a configured version of df. - - * nntpsend: Variable name typo fixed. - - * control.ctl: Log instead of mail the alt.* newgroup and rmgroup - requests. - - Sat Sep 28 17:28:13 1996 James Brister - - * inncheck, innshellvars, innshellvars.pl, innshellvars.tcl, innwatch.ctl: - config.data changes. - - * news.daily: Set REASON correctly when expdir flag NOT used. - - * version: new version 1.5b1 - - Fri Sep 27 22:33:02 1996 James Brister - - * filter_innd.pl: Use 'my' where appropriate. - Comment out most of bodies. - - * filter_nnrpd.pl: Use 'my' where appropriate. - Comment out most of body. - - * innlog.pl: Format changes from chongo. - - * news.daily: Fixed up mail subject lines a bit. (dneedham) - Check if server throttles during expire. (dneedham) - Added a 'notdaily' flag. (dneedham) - - Mon Sep 23 19:57:49 1996 James Brister - - * innlog.pl: Greg's updates - - Fri Sep 13 21:44:39 1996 James Brister - - * nnrp.access: Added 127.0.0.1 - - * nnrp.access: Let localhost read. - - * nntpsend: Minor typo. - - * nntpsend.ctl, nntpsend: chongo's updates. - - * scanlogs: Include the '-a' flag to innlog.pl. - - * startup_innd.pl: Initial revision - - * filter_innd.pl: Strip out debugging prints. - - * filter_innd.pl, filter_nnrpd.pl: Initial revision - - Wed Sep 11 05:18:37 1996 James Brister - - * innlog.pl: Patch to fix double counting. (wolf@pasteur.fr) - - * hosts.nntp.nolimit: Initial revision - - * innlog.pl: too-many-connects support (stapes@mro.dec.com) - - Tue Sep 10 20:17:52 1996 James Brister - - * inncheck, scanspool: config variable substitution changes - - * innshellvars.tcl: config variable substitution changes - fixed broken subst line. - - * innshellvars: config variable substitution changes - Added PERL. - - * scanlogs: Call innlog.pl with args to generate reader stats. - - * innshellvars.pl: Fixed broken subst lines. - Finished with a '1;' so it can be required properly. - - * overview.fmt: Turn Xref on by default. - - * newsfeeds: Added !junk,!control*,!local* to ME entry. - path config subst. changes. - - Thu Sep 5 16:06:03 1996 James Brister - - * version: version number update - - * actsync.cfg, checkgroups, default, distrib.pats, docheckgroups, expirerm, hosts.nntp, ihave, inncheck, innshellvars, innshellvars.pl, innshellvars.tcl, innstat, innwatch, makegroup, newgroup, news.daily, nntpsend, parsecontrol, rc.news, rmgroup, scanlogs, scanspool, send-ihave, send-nntp, send-uucp, sendbatch, sendme, sendsys, senduuname, tally.control, tally.unwanted, version, writelog: - Config variable substitution changes. - - * innwatch.ctl: Use new config variables. - - Sun Aug 25 11:07:07 1996 James Brister - - * inncheck: Removed innlog.awk (depreciated). - - * filter.tcl: Commented out most of filter_news body. All it does - now is return "accept". - - * control.ctl: Changed GNU groups per Len Tower - . - - Sat Aug 24 23:05:58 1996 James Brister - - * innshellvars.tcl, innshellvars.pl: Stripped out testing code. - - * innshellvars.pl, innshellvars.tcl: Initial revision - - Wed Aug 7 12:40:27 1996 James Brister - - * moderators: Changed the UUNET mailing address. - - * inn.conf: Make localhost be the default server value. - - * hosts.nntp: Removed news.foo.com and put in localhost, which - is more likely to be correct. - - * distrib.pats: Stripped out old stuff. - - * innlog.awk: Handle log messages of response 480 from remote - (chongo). - - Thu Jul 18 06:39:16 1996 James Brister - - * innlog.awk: Fixed long lines that got newlines inserted somehow. - - Wed Jul 17 20:09:43 1996 James Brister - - * inncheck: Typo fix. - - Tue Jul 16 12:55:28 1996 James Brister - - * inncheck: Fixed mode extraction expression for directories. - - * inncheck: Bug fix on regexp usage. - Fixed mode extraction expression. - - Mon Jul 15 12:04:36 1996 James Brister - - * rmgroup: Fix grep-expression so period in argument only - matches period in active file. - - * news.daily, logwatch, innwatch: Do some mail tilde-character fix-up. - - Fri Jul 12 23:03:03 1996 James Brister - - * inncheck: Added innlog.pl. - - * actsync.cfg, actsync.ign: Initial revision - - Tue Jul 9 19:48:50 1996 James Brister - - * innshellvars: Include more variables from config.data. - Expand PATH to include the local bin directory NEWSLBIN. - - * inncheck: Update subst value. - - * innlog.awk: Chongo's updated version. - - * innstat: Update from chongo. - - * innshellvars: Make WANT_PGPVERIFY default to DONT. - - * signcontrol, sample.control: Initial revision - - * pgpverify: Make subst-ready. - - * pgpverify: Initial revision - - * parsecontrol: pgp verification support. - - * nnrp.access: Add 'stdin' reader. - - * innshellvars, inncheck: pgp verification support. - - * expirerm: Argument sanity checks. - - * ctlrun: No more checking of Subject for 'cmsg'. - - * control.ctl: pgp verification support. - - Tue Jun 25 15:22:32 1996 James Brister - - * inncheck: Add check for pgp verify action in control.ctl - - * parsecontrol: Added David Lawrence's PGP verification of control - messages patch (with slight mods). - - - - ================================== - From site/ChangeLog - - Tue Dec 17 00:31:17 1996 James A. Brister - - * Makefile: Added an empty default rule for '.csh:' as DEC - Unix has such a rule with breaks things badly. - - Tue Nov 26 14:29:15 1996 James Brister - - * Makefile: Added innshellvars.csh - - * do-subst.sh: Be smarter in handling RCS files. - - Mon Nov 11 14:49:20 1996 James Brister - - * Makefile: Dropped makegroup. - - Sun Nov 10 22:10:10 1996 James Brister - - * Makefile: Include new innshellvars.csh. - Install sample.control. - - Fri Oct 11 20:54:59 1996 James Brister - - * Makefile: Install scanspool that was being ignored before. - - Mon Sep 16 11:34:16 1996 James Brister - - * Makefile: Added the necessary bits for the perl filters. - - Wed Sep 11 05:32:36 1996 James Brister - - * Makefile: install a hosts.nntp.nolimit file - - Tue Sep 10 20:18:40 1996 James Brister - - * Makefile: config variable substitution changes - No longer install innlog.awk - - Fri Sep 6 13:18:28 1996 James Brister - - * Makefile: config variable substitution changes - - Fri Jul 12 23:20:53 1996 James Brister - - * Makefile: Include actsync rules. - - Tue Jul 9 06:30:45 1996 James Brister - - * Makefile: Added pgpverify support. - - Tue Jun 25 15:37:01 1996 James Brister - - * Makefile (pgpverify): Added rules for pgpverify installation. - - - --- 0 ---- diff -Ncr ../inn-1.5.1.dist/MANIFEST ./MANIFEST *** ../inn-1.5.1.dist/MANIFEST Tue Dec 17 15:40:40 1996 --- ./MANIFEST Sat Jul 26 01:06:52 1997 *************** *** 359,364 **** --- 359,376 ---- site/Makefile 1 Makefile for site-local files site/do-subst.sh 1 Run subst on site config file site/getsafe.sh 1 Safely get config file from samples directory + snprintf 1 snprintf replacement (Directory) + snprintf/Makefile 1 source + snprintf/floatio.h 1 source + snprintf/fvwrite.c 1 source + snprintf/fvwrite.h 1 source + snprintf/local.h 1 source + snprintf/snprintf.c 1 source + snprintf/strtod.c 1 source + snprintf/vfprintf.c 1 source + snprintf/vsnprintf.c 1 source + snprintf/xcdefs.h 1 source + snprintf/xstdio.h 1 source syslog 1 Modern version of syslog (Directory) syslog/README 1 Installation notes for syslog syslog/logger.1 1 Manpage for logger program diff -Ncr ../inn-1.5.1.dist/Makefile ./Makefile *** ../inn-1.5.1.dist/Makefile Tue Dec 17 15:40:40 1996 --- ./Makefile Fri Jul 25 16:54:11 1997 *************** *** 58,65 **** etags */*.c */*.h clean: ! @$(MAKE) $(FLAGS) WHAT_TO_MAKE=$@ common ! rm -f *~ libinn.a libinn_p.a llib-linn.ln FILELIST ## Common target. common: --- 58,65 ---- etags */*.c */*.h clean: ! @$(MAKE) $(FLAGS) WHAT_TO_MAKE=$@ DIRS="$(DIRS) snprintf" common ! rm -f *~ libinn.a libinn_p.a llib-linn.ln libsnprintf.a FILELIST ## Common target. common: diff -Ncr ../inn-1.5.1.dist/README.1st ./README.1st *** ../inn-1.5.1.dist/README.1st Thu Jan 1 01:00:00 1970 --- ./README.1st Tue Jul 29 17:21:02 1997 *************** *** 0 **** --- 1,14 ---- + This is 1.5.1sec. It is 1.5.1 patched to plug some security holes. There + are no new features -- bug fixes only. + + There's a new library integrated into the kits, which is necessary if you + *dont* have the function snprintf on your system. To go with this there are + three new variables in config.dist + + HAVE_SNPRINTF + LIBSNPRINTF + SNPRINTF_CFLAGS + + The comments in config.dist next to their entries explains their use. + + Please send all bug reports to inn-bugs@vix.com diff -Ncr ../inn-1.5.1.dist/backends/Makefile ./backends/Makefile *** ../inn-1.5.1.dist/backends/Makefile Tue Dec 17 15:40:40 1996 --- ./backends/Makefile Sat Jul 26 01:13:12 1997 *************** *** 32,37 **** --- 32,39 ---- LIBS = -lutil LIBNEWS = ../libinn.a LINTLIB = ../llib-linn.ln + ## =()@>()= + LIBSNPRINTF = SOURCES = archive.c batcher.c buffchan.c cvtbatch.c filechan.c \ innxmit.c innxbatch.c nntpget.c overchan.c shlock.c \ *************** *** 65,107 **** profiled: cp /dev/null profiled ! archive: $(P) archive.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ archive.o $(LIBNEWS) $(LIBS) ! batcher: $(P) batcher.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ batcher.o $(LIBNEWS) $(LIBS) ! buffchan: $(P) buffchan.o map.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ buffchan.o map.o $(LIBNEWS) $(LIBS) ! cvtbatch: $(P) cvtbatch.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ cvtbatch.o $(LIBNEWS) $(LIBS) ! filechan: $(P) filechan.o map.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ filechan.o map.o $(LIBNEWS) $(LIBS) ! nntpget: $(P) nntpget.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ nntpget.o $(LIBNEWS) $(LIBS) ! innxmit: $(P) innxmit.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ innxmit.o $(LIBNEWS) $(LIBS) ! innxbatch: $(P) innxbatch.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ innxbatch.o $(LIBNEWS) $(LIBS) sendxbatches: $(P) sendxbatches.sh rm -f $@ cp $? $@ chmod +x $@ ! overchan: $(P) overchan.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ overchan.o $(LIBNEWS) $(LIBS) ! crosspost: $(P) crosspost.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ crosspost.o $(LIBNEWS) $(LIBS) ! actsync: $(P) actsync.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ actsync.o $(LIBNEWS) $(LIBS) actsyncd: $(P) actsyncd.sh rm -f $@ --- 67,109 ---- profiled: cp /dev/null profiled ! archive: $(P) archive.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ archive.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! batcher: $(P) batcher.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ batcher.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! buffchan: $(P) buffchan.o map.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ buffchan.o map.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! cvtbatch: $(P) cvtbatch.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ cvtbatch.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! filechan: $(P) filechan.o map.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ filechan.o map.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! nntpget: $(P) nntpget.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ nntpget.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! innxmit: $(P) innxmit.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ innxmit.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! innxbatch: $(P) innxbatch.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ innxbatch.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) sendxbatches: $(P) sendxbatches.sh rm -f $@ cp $? $@ chmod +x $@ ! overchan: $(P) overchan.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ overchan.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! crosspost: $(P) crosspost.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ crosspost.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! actsync: $(P) actsync.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ actsync.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) actsyncd: $(P) actsyncd.sh rm -f $@ *************** *** 113,123 **** cp $? $@ chmod +x $@ ! shlock: $(P) shlock.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ shlock.o $(LIBNEWS) $(LIBS) ! shrinkfile: $(P) shrinkfile.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ shrinkfile.o $(LIBNEWS) $(LIBS) lint: $(ALL) --- 115,125 ---- cp $? $@ chmod +x $@ ! shlock: $(P) shlock.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ shlock.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! shrinkfile: $(P) shrinkfile.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ shrinkfile.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) lint: $(ALL) *************** *** 138,143 **** --- 140,148 ---- $(LIBNEWS) $(LINTLIB): (cd ../lib ; $(MAKE) install) + + ../libsnprintf.a: + (cd ../snprintf ; $(MAKE) install) ## Low-level install actions. $D$(NEWSBIN)/archive: archive diff -Ncr ../inn-1.5.1.dist/config/config.dist ./config/config.dist *** ../inn-1.5.1.dist/config/config.dist Tue Dec 17 15:40:40 1996 --- ./config/config.dist Mon Jul 28 14:58:43 1997 *************** *** 42,47 **** --- 42,64 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 295,300 **** --- 312,321 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DO ## diff -Ncr ../inn-1.5.1.dist/config/files.list ./config/files.list *** ../inn-1.5.1.dist/config/files.list Tue Dec 17 15:40:40 1996 --- ./config/files.list Sat Jul 26 01:06:14 1997 *************** *** 104,109 **** --- 104,110 ---- ../samples/version ../samples/writelog ../site/Makefile + ../snprintf/Makefile ../syslog/syslog.c ../syslog/syslog.conf ../syslog/syslogd.c Binary files ../inn-1.5.1.dist/config/subst and ./config/subst differ diff -Ncr ../inn-1.5.1.dist/expire/Makefile ./expire/Makefile *** ../inn-1.5.1.dist/expire/Makefile Tue Dec 17 15:40:40 1996 --- ./expire/Makefile Sat Jul 26 01:13:17 1997 *************** *** 32,37 **** --- 32,39 ---- LIBS = -lutil LIBNEWS = ../libinn.a LINTLIB = ../llib-linn.ln + ## =()@>()= + LIBSNPRINTF = SOURCES = convdate.c expire.c expireover.c fastrm.c grephistory.c \ makeactive.c makehistory.c newsrequeue.c prunehistory.c *************** *** 54,85 **** tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c ../include/*.h ! convdate: $(P) convdate.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ convdate.o $(LIBNEWS) $(LIBS) ! expire: $(P) expire.o dbz.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ expire.o dbz.o $(LIBNEWS) $(LIBS) ! expireover: $(P) expireover.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ expireover.o $(LIBNEWS) $(LIBS) ! fastrm: $(P) fastrm.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ fastrm.o $(LIBNEWS) $(LIBS) ! grephistory: $(P) grephistory.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ grephistory.o $(LIBNEWS) $(LIBS) ! makeactive: $(P) makeactive.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ makeactive.o $(LIBNEWS) $(LIBS) ! makehistory: $(P) makehistory.o dbz.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ makehistory.o dbz.o $(LIBNEWS) $(LIBS) ! newsrequeue: $(P) newsrequeue.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ newsrequeue.o $(LIBNEWS) $(LIBS) ! prunehistory: $(P) prunehistory.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ prunehistory.o $(LIBNEWS) $(LIBS) lint: $(ALL) @rm -f lint --- 56,87 ---- tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c ../include/*.h ! convdate: $(P) convdate.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ convdate.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! expire: $(P) expire.o dbz.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ expire.o dbz.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! expireover: $(P) expireover.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ expireover.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! fastrm: $(P) fastrm.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ fastrm.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! grephistory: $(P) grephistory.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ grephistory.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! makeactive: $(P) makeactive.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ makeactive.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! makehistory: $(P) makehistory.o dbz.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ makehistory.o dbz.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! newsrequeue: $(P) newsrequeue.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ newsrequeue.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! prunehistory: $(P) prunehistory.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ prunehistory.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) lint: $(ALL) @rm -f lint *************** *** 103,108 **** --- 105,112 ---- (cd ../lib ; $(MAKE) ../include/dbz.h) $(LIBNEWS) $(LINTLIB): (cd ../lib ; $(MAKE) install) + ../libsnprintf.a: + (cd ../snprintf ; $(MAKE) install) ## Profiling. The rules are a bit brute-force, but good enough. profiled: expirep expireoverp diff -Ncr ../inn-1.5.1.dist/frontends/Makefile ./frontends/Makefile *** ../inn-1.5.1.dist/frontends/Makefile Tue Dec 17 15:40:40 1996 --- ./frontends/Makefile Sat Jul 26 01:13:17 1997 *************** *** 40,45 **** --- 40,47 ---- LIBS = -lutil LIBNEWS = ../libinn.a LINTLIB = ../llib-linn.ln + ## =()@>()= + LIBSNPRINTF = SOURCES = ctlinnd.c inews.c rnews.c *************** *** 60,85 **** tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c ../include/*.h ! inews: $(P) inews.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ inews.o $(NNTPLIB) $(LIBNEWS) $(LIBS) ! rnews: $(P) rnews.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ rnews.o $(NNTPLIB) $(LIBNEWS) $(LIBS) ! ctlinnd: $(P) ctlinnd.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ ctlinnd.o $(LIBNEWS) $(LIBS) ! getlist: $(P) getlist.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ getlist.o $(LIBNEWS) $(LIBS) ! innconfval: $(P) innconfval.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ innconfval.o $(LIBNEWS) $(LIBS) ! decode: $(P) decode.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ decode.o $(LIBNEWS) $(LIBS) ! encode: $(P) encode.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ encode.o $(LIBNEWS) $(LIBS) ## Not normally built. ! feedone: feedone.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ feedone.o $(LIBNEWS) $(LIBS) ! sys2nf: sys2nf.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ sys2nf.o $(LIBNEWS) $(LIBS) lint: $(ALL) --- 62,87 ---- tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c ../include/*.h ! inews: $(P) inews.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ inews.o $(NNTPLIB) $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! rnews: $(P) rnews.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ rnews.o $(NNTPLIB) $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! ctlinnd: $(P) ctlinnd.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ ctlinnd.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! getlist: $(P) getlist.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ getlist.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! innconfval: $(P) innconfval.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ innconfval.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! decode: $(P) decode.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ decode.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! encode: $(P) encode.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ encode.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ## Not normally built. ! feedone: feedone.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ feedone.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) ! sys2nf: sys2nf.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ sys2nf.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) lint: $(ALL) *************** *** 94,99 **** --- 96,104 ---- $(LIBNEWS) $(LINTLIB): (cd ../lib ; $(MAKE) install) + + ../libsnprintf.a: + (cd ../snprintf ; $(MAKE) install) profiled: cp /dev/null profiled diff -Ncr ../inn-1.5.1.dist/include/configdata.h ./include/configdata.h *** ../inn-1.5.1.dist/include/configdata.h Tue Dec 17 15:40:40 1996 --- ./include/configdata.h Mon Jul 28 11:52:51 1997 *************** *** 149,154 **** --- 149,161 ---- /* What predicate, if any, the macros need. */ /* =()<#define CTYPE(isXXXXX, c) (@@)>()= */ #define CTYPE(isXXXXX, c) ((isascii((c)) && isXXXXX((c)))) + /* If missing snprintf then use the xsnprintf supplied locally */ + /* =()<#define @@_HAVE_SNPRINTF>()= */ + #define DONT_HAVE_SNPRINTF + #if ! defined (DO_HAVE_SNPRINTF) + #define snprintf xsnprintf + #define vsnprintf xvsnprintf + #endif /* ** 6. MISCELLANEOUS CONFIG DATA diff -Ncr ../inn-1.5.1.dist/include/patchlevel.h ./include/patchlevel.h *** ../inn-1.5.1.dist/include/patchlevel.h Tue Dec 17 15:40:40 1996 --- ./include/patchlevel.h Fri Jul 25 17:01:34 1997 *************** *** 13,20 **** ** Try to avoid changing these. */ #define RELEASE "1" ! #define PATCHLEVEL "5.1" ! #define DATE "17-Dec-1996" /* --- 13,20 ---- ** Try to avoid changing these. */ #define RELEASE "1" ! #define PATCHLEVEL "5.1sec" ! #define DATE "25-Jul-1997" /* diff -Ncr ../inn-1.5.1.dist/innd/Makefile ./innd/Makefile *** ../inn-1.5.1.dist/innd/Makefile Tue Dec 17 15:40:40 1996 --- ./innd/Makefile Sat Jul 26 01:13:17 1997 *************** *** 44,49 **** --- 44,51 ---- LINTLIB = ../llib-linn.ln ## =()@>()= TCL_LIB = + ## =()@>()= + LIBSNPRINTF = SOURCES = \ art.c cc.c chan.c his.c icd.c innd.c lc.c nc.c newsfeeds.c ng.c \ *************** *** 67,77 **** tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c innd.h ../include/*.h ! innd: $(P) $(OBJECTS) $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBNEWS) $(TCL_LIB) $(PERLLIB) $(LIBS) ! inndstart: $(P) inndstart.o $(LIBNEWS) ! $(CC) $(LDFLAGS) -o $@ inndstart.o $(LIBNEWS) $(LIBS) lint: $(ALL) @rm -f lint --- 69,79 ---- tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c innd.h ../include/*.h ! innd: $(P) $(OBJECTS) $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBNEWS) $(LIBSNPRINTF) $(TCL_LIB) $(PERLLIB) $(LIBS) ! inndstart: $(P) inndstart.o $(LIBNEWS) $(LIBSNPRINTF) ! $(CC) $(LDFLAGS) -o $@ inndstart.o $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) lint: $(ALL) @rm -f lint *************** *** 82,87 **** --- 84,92 ---- (cd ../lib ; $(MAKE) ../include/dbz.h) $(LIBNEWS) $(LINTLIB): (cd ../lib ; $(MAKE) install) + + ../libsnprintf.a: + (cd ../snprintf ; $(MAKE) install) ## Profiling. The rules are a bit brute-force, but good enough. profiled: inndp diff -Ncr ../inn-1.5.1.dist/innd/art.c ./innd/art.c *** ../inn-1.5.1.dist/innd/art.c Tue Dec 17 15:40:40 1996 --- ./innd/art.c Sat Jul 26 00:47:05 1997 *************** *** 520,525 **** --- 520,542 ---- ** Article body. ** Also, the Data->Size field is filled in. */ + #if 0 + static char *strncpy (char *dest, const char *src, size_t amt) + { + char *rv = dest ; + + while (amt > 0) + { + *dest = *src ; + if (*src != '\0') + src++ ; + dest++ ; + amt-- ; + } + + return rv ; + } + #endif STATIC int ARTwrite(name, Article, Data) char *name; *************** *** 566,578 **** vp->iov_len = Data->Body - p; size += (vp++)->iov_len; if (ARTheaders[_lines].Found == 0) { ! (void)sprintf(Data->Lines, "Lines: %d\n", Data->LinesValue); i = strlen(Data->Lines); vp->iov_base = Data->Lines; (vp++)->iov_len = i; size += i; /* Install in header table; STRLEN("Lines: ") == 7. */ ! (void)strcpy(ARTheaders[_lines].Value, Data->Lines + 7); ARTheaders[_lines].Length = i - 7; ARTheaders[_lines].Found = 1; } --- 583,598 ---- vp->iov_len = Data->Body - p; size += (vp++)->iov_len; if (ARTheaders[_lines].Found == 0) { ! (void)snprintf(Data->Lines, sizeof(Data->Lines), ! "Lines: %d\n", Data->LinesValue); i = strlen(Data->Lines); vp->iov_base = Data->Lines; (vp++)->iov_len = i; size += i; /* Install in header table; STRLEN("Lines: ") == 7. */ ! (void)strncpy(ARTheaders[_lines].Value, Data->Lines + 7, ! MAXHEADERSIZE) ; ! ARTheaders[_lines].Value[ARTheaders[_lines].Length - 1] = '\0'; ARTheaders[_lines].Length = i - 7; ARTheaders[_lines].Found = 1; } *************** *** 595,601 **** vp->iov_len = &Article->Data[Article->Used] - Data->Body; size += (vp++)->iov_len; Data->SizeValue = size; ! (void)sprintf(Data->Size, "%ld", Data->SizeValue); Data->SizeLength = strlen(Data->Size); HDR(_bytes) = Data->Size; ARTheaders[_bytes].Length = Data->SizeLength; --- 615,621 ---- vp->iov_len = &Article->Data[Article->Used] - Data->Body; size += (vp++)->iov_len; Data->SizeValue = size; ! (void)snprintf(Data->Size, sizeof(Data->Size), "%ld", Data->SizeValue); Data->SizeLength = strlen(Data->Size); HDR(_bytes) = Data->Size; ARTheaders[_bytes].Length = Data->SizeLength; *************** *** 635,641 **** return 0; /* Figure out how much space we'll need and get it. */ ! (void)sprintf(bytesbuff, "Bytes: %ld\n", size); for (i = strlen(bytesbuff), vp = iov; vp < end; vp++) i += vp->iov_len; --- 655,661 ---- return 0; /* Figure out how much space we'll need and get it. */ ! (void)snprintf(bytesbuff, sizeof(bytesbuff), "Bytes: %ld\n", size); for (i = strlen(bytesbuff), vp = iov; vp < end; vp++) i += vp->iov_len; *************** *** 700,706 **** if (colon == NULL || !ISWHITE(colon[1])) { if ((p = strchr(start, '\n')) != NULL) *p = '\0'; ! (void)sprintf(buff, COLONSPACE, MaxLength(start, start)); *errorp = buff; return NULL; } --- 720,726 ---- if (colon == NULL || !ISWHITE(colon[1])) { if ((p = strchr(start, '\n')) != NULL) *p = '\0'; ! (void)snprintf(buff, sizeof(buff), COLONSPACE, MaxLength(start, start)); *errorp = buff; return NULL; } *************** *** 723,729 **** /* Not a system header, make sure we have . */ for (p = colon; --p != start; ) if (ISWHITE(*p)) { ! (void)sprintf(buff, "Space before colon in \"%s\" header", MaxLength(start, start)); *errorp = buff; return NULL; --- 743,750 ---- /* Not a system header, make sure we have . */ for (p = colon; --p != start; ) if (ISWHITE(*p)) { ! (void)snprintf(buff, sizeof(buff), ! "Space before colon in \"%s\" header", MaxLength(start, start)); *errorp = buff; return NULL; *************** *** 749,762 **** hp->Found++; /* Zap in the canonical form of the header, undoing the \0 that ! * strcpy put out (strncpy() spec isn't trustable, unfortunately). */ ! (void)strcpy(start, hp->Name); start[hp->Size] = ':'; /* Copy the header if not too big. */ i = (out - 1) - p; if (i >= MAXHEADERSIZE) { ! (void)sprintf(buff, "\"%s\" header too long", hp->Name); *errorp = buff; return NULL; } --- 770,788 ---- hp->Found++; /* Zap in the canonical form of the header, undoing the \0 that ! * strcpy put out (strncpy() spec isn't trustable, unfortunately). ! * ! * strcpy is safe, since the header name already exists, perhaps ! * not in the canonical form -of ! */ ! (void)strcpy(start, hp->Name); /* safe -of */ start[hp->Size] = ':'; /* Copy the header if not too big. */ i = (out - 1) - p; if (i >= MAXHEADERSIZE) { ! (void)snprintf(buff, sizeof(buff), ! "\"%s\" header too long", hp->Name); *errorp = buff; return NULL; } *************** *** 918,928 **** for (hp = ARTheaders; hp < ENDOF(ARTheaders); hp++) if (hp->Type == HTreq) { if (*hp->Value == '\0') { ! (void)sprintf(buff, "Missing \"%s\" header", hp->Name); return buff; } if (hp->Found > 1) { ! (void)sprintf(buff, "Duplicate \"%s\" header", hp->Name); return buff; } } --- 944,956 ---- for (hp = ARTheaders; hp < ENDOF(ARTheaders); hp++) if (hp->Type == HTreq) { if (*hp->Value == '\0') { ! (void)snprintf(buff, sizeof(buff), ! "Missing \"%s\" header", hp->Name); return buff; } if (hp->Found > 1) { ! (void)snprintf(buff, sizeof(buff), ! "Duplicate \"%s\" header", hp->Name); return buff; } } *************** *** 942,948 **** if (*p && (delta = i - atoi(p)) != 0 && abs(delta) > LINECOUNT_FUZZ) { if ((in = strchr(p, '\n')) != NULL) *in = '\0'; ! (void)sprintf(buff, "Linecount %s != %d +- %d", MaxLength(p, p), i, LINECOUNT_FUZZ); return buff; } --- 970,976 ---- if (*p && (delta = i - atoi(p)) != 0 && abs(delta) > LINECOUNT_FUZZ) { if ((in = strchr(p, '\n')) != NULL) *in = '\0'; ! (void)snprintf(buff, sizeof(buff), "Linecount %s != %d +- %d", MaxLength(p, p), i, LINECOUNT_FUZZ); return buff; } *************** *** 951,965 **** /* Is article too old? */ p = HDR(_date); if ((Data->Posted = parsedate(p, &Now)) == -1) { ! (void)sprintf(buff, "Bad \"Date\" header -- \"%s\"", MaxLength(p, p)); return buff; } if (Cutoff && Data->Posted < Now.time - Cutoff) { ! (void)sprintf(buff, "Too old -- \"%s\"", MaxLength(p, p)); return buff; } if (Data->Posted > Now.time + DATE_FUZZ) { ! (void)sprintf(buff, "Article posted in the future -- \"%s\"", MaxLength(p, p)); return buff; } --- 979,996 ---- /* Is article too old? */ p = HDR(_date); if ((Data->Posted = parsedate(p, &Now)) == -1) { ! (void)snprintf(buff, sizeof(buff), ! "Bad \"Date\" header -- \"%s\"", MaxLength(p, p)); return buff; } if (Cutoff && Data->Posted < Now.time - Cutoff) { ! (void)snprintf(buff, sizeof(buff), ! "Too old -- \"%s\"", MaxLength(p, p)); return buff; } if (Data->Posted > Now.time + DATE_FUZZ) { ! (void)snprintf(buff, sizeof(buff), ! "Article posted in the future -- \"%s\"", MaxLength(p, p)); return buff; } *************** *** 968,974 **** Data->Expires = 0; if (*p != '\0' && (Data->Expires = parsedate(p, &Now)) == -1) { #if 0 ! (void)sprintf(buff, "Bad \"Expires\" header -- \"%s\"", MaxLength(p, p)); return buff; #endif --- 999,1006 ---- Data->Expires = 0; if (*p != '\0' && (Data->Expires = parsedate(p, &Now)) == -1) { #if 0 ! (void)snprintf(buff, sizeof(buff), ! "Bad \"Expires\" header -- \"%s\"", MaxLength(p, p)); return buff; #endif *************** *** 979,985 **** return "Colon in \"Newsgroups\" header"; for (p = HDR(_newsgroups); *p; p++) if (ISWHITE(*p)) { ! (void)sprintf(buff, "Whitespace in \"Newsgroups\" header -- \"%s\"", MaxLength(HDR(_newsgroups), p)); return buff; --- 1011,1017 ---- return "Colon in \"Newsgroups\" header"; for (p = HDR(_newsgroups); *p; p++) if (ISWHITE(*p)) { ! (void)snprintf(buff, sizeof(buff), "Whitespace in \"Newsgroups\" header -- \"%s\"", MaxLength(HDR(_newsgroups), p)); return buff; *************** *** 993,1000 **** if (*p == 'c' && EQn(p, "cmsg ", 5)) { for (p += 5; *p && ISWHITE(*p); ) p++; ! if (*p) ! (void)strcpy(in, p); } } --- 1025,1040 ---- if (*p == 'c' && EQn(p, "cmsg ", 5)) { for (p += 5; *p && ISWHITE(*p); ) p++; ! if (*p) { ! if (strlen(p) > ARTheaders[_control].Length) { ! ARTheaders[_control].Length = strlen(p) + 1; ! ARTheaders[_control].Value = ! RENEW(ARTheaders[_control].Value, ! char, ARTheaders[_control].Length); ! in = HDR(_control); ! } ! (void)strcpy(in, p); /* safe -of */ ! } } } *************** *** 1086,1092 **** HeaderCleanFrom(p); if (!EQ(local, p)) { files = NULL; ! (void)sprintf(buff, "\"%.50s\" wants to cancel %s by \"%.50s\"", p, MaxLength(MessageID, MessageID), local); ARTlog(Data, ART_REJECT, buff); } --- 1126,1133 ---- HeaderCleanFrom(p); if (!EQ(local, p)) { files = NULL; ! (void)snprintf(buff, sizeof(buff), ! "\"%.50s\" wants to cancel %s by \"%.50s\"", p, MaxLength(MessageID, MessageID), local); ARTlog(Data, ART_REJECT, buff); } *************** *** 1154,1160 **** (void)HISwrite(Data, (char *)NULL); if (save != MessageID) Data->MessageID = save; ! (void)sprintf(buff, "Cancelling %s", MaxLength(msgid, msgid)); ARTlog(Data, ART_CANC, buff); Data->MessageID = save; if (c) --- 1195,1202 ---- (void)HISwrite(Data, (char *)NULL); if (save != MessageID) Data->MessageID = save; ! (void)snprintf(buff, sizeof(buff), ! "Cancelling %s", MaxLength(msgid, msgid)); ARTlog(Data, ART_CANC, buff); Data->MessageID = save; if (c) *************** *** 1236,1246 **** * the name is "safe" -- no slashes in the pathname. */ if (p - Control + STRLEN( _PATH_BADCONTROLPROG) >= SMBUF-4 || strchr(Control, '/') != NULL) ! FileGlue(buff, CTLBIN, '/', _PATH_BADCONTROLPROG); else { ! FileGlue(buff, CTLBIN, '/', Control); if (stat(buff, &Sb) < 0 || (Sb.st_mode & EXECUTE_BITS) == 0) ! FileGlue(buff, CTLBIN, '/', _PATH_BADCONTROLPROG); } /* If it's an ihave or sendme, check the site named in the message. */ --- 1278,1288 ---- * the name is "safe" -- no slashes in the pathname. */ if (p - Control + STRLEN( _PATH_BADCONTROLPROG) >= SMBUF-4 || strchr(Control, '/') != NULL) ! FileGlue(buff, CTLBIN, '/', _PATH_BADCONTROLPROG, sizeof(buff)); else { ! FileGlue(buff, CTLBIN, '/', Control, sizeof(buff)); if (stat(buff, &Sb) < 0 || (Sb.st_mode & EXECUTE_BITS) == 0) ! FileGlue(buff, CTLBIN, '/', _PATH_BADCONTROLPROG, sizeof(buff)); } /* If it's an ihave or sendme, check the site named in the message. */ *************** *** 1466,1472 **** continue; } ngp->Filenum = ngp->Last; ! (void)sprintf(p, " %s:%lu", ngp->Name, ngp->Filenum); p += strlen(p); } Xref.Used = p - Xref.Data; --- 1508,1515 ---- continue; } ngp->Filenum = ngp->Last; ! (void)snprintf(p, Xref.Size - Xref.Used, ! " %s:%lu", ngp->Name, ngp->Filenum); p += strlen(p); } Xref.Used = p - Xref.Data; *************** *** 1527,1533 **** /* Turn news.group/# into news.group:#, append to Xref. */ *q = ':'; *p++ = ' '; ! p += strlen(strcpy(p, name)); } Xref.Used = p - Xref.Data; --- 1570,1576 ---- /* Turn news.group/# into news.group:#, append to Xref. */ *q = ':'; *p++ = ' '; ! p += strlen(strcpy(p, name)); /* safe -of */ } Xref.Used = p - Xref.Data; *************** *** 1643,1653 **** if (funnel->FNLwantsnames) { bp = &funnel->FNLnames; p = &bp->Data[bp->Used]; ! if (bp->Used) { *p++ = ' '; bp->Used++; } ! bp->Used += strlen(strcpy(p, sp->Name)); } } } --- 1686,1698 ---- if (funnel->FNLwantsnames) { bp = &funnel->FNLnames; p = &bp->Data[bp->Used]; ! if (bp->Used && bp->Used < bp->Size) { *p++ = ' '; bp->Used++; } ! strncpy(p, sp->Name, bp->Size - 1) ; ! p[bp->Size - 1] = '\0'; ! bp->Used += strlen(p); } } } *************** *** 1763,1769 **** Data.Feedsite = hops && hops[0] ? hops[0] : CHANname(cp); #endif /* defined(DO_IPADDRLOG) */ Data.FeedsiteLength = strlen(Data.Feedsite); ! (void)sprintf(Data.TimeReceived, "%lu", Now.time); Data.TimeReceivedLength = strlen(Data.TimeReceived); /* A duplicate? */ --- 1808,1815 ---- Data.Feedsite = hops && hops[0] ? hops[0] : CHANname(cp); #endif /* defined(DO_IPADDRLOG) */ Data.FeedsiteLength = strlen(Data.Feedsite); ! (void)snprintf(Data.TimeReceived, sizeof(Data.TimeReceived), ! "%lu", Now.time); Data.TimeReceivedLength = strlen(Data.TimeReceived); /* A duplicate? */ *************** *** 1773,1779 **** /* And now check the path for unwanted sites -- Andy */ for( j = 0 ; ME.Exclusions && ME.Exclusions[j] ; j++ ) { if( ListHas(hops, ME.Exclusions[j]) ) { ! sprintf(ControlWord, "Unwanted site %s in path", ME.Exclusions[j]); error = ControlWord; break; } --- 1819,1826 ---- /* And now check the path for unwanted sites -- Andy */ for( j = 0 ; ME.Exclusions && ME.Exclusions[j] ; j++ ) { if( ListHas(hops, ME.Exclusions[j]) ) { ! snprintf(ControlWord, sizeof(ControlWord), ! "Unwanted site %s in path", ME.Exclusions[j]); error = ControlWord; break; } *************** *** 1781,1787 **** /* Now see if we got an error in the article. */ if (error != NULL) { ! (void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, error); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) if (Mode == OMrunning && !HISwrite(&Data, "")) --- 1828,1834 ---- /* Now see if we got an error in the article. */ if (error != NULL) { ! (void)snprintf(buff, sizeof(buff), "%d %s", NNTP_REJECTIT_VAL, error); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) if (Mode == OMrunning && !HISwrite(&Data, "")) *************** *** 1795,1801 **** #if defined(DO_PERL) pathForPerl = HeaderFind(article->Data, "Path", 4) ; if ((perlrc = (char *)HandleArticle()) != NULL) { ! (void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, perlrc); syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) --- 1842,1848 ---- #if defined(DO_PERL) pathForPerl = HeaderFind(article->Data, "Path", 4) ; if ((perlrc = (char *)HandleArticle()) != NULL) { ! (void)snprintf(buff, sizeof(buff), "%d %s", NNTP_REJECTIT_VAL, perlrc); syslog(L_NOTICE, "rejecting[perl] %s %s", HDR(_message_id), buff); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) *************** *** 1837,1843 **** (void)Tcl_UnsetVar(TCLInterpreter, "Headers", TCL_GLOBAL_ONLY); if (code == TCL_OK) { if (strcmp(TCLInterpreter->result, "accept") != 0) { ! (void)sprintf(buff, "%d %s", NNTP_REJECTIT_VAL, TCLInterpreter->result); syslog(L_NOTICE, "rejecting[tcl] %s %s", HDR(_message_id), buff); --- 1884,1890 ---- (void)Tcl_UnsetVar(TCLInterpreter, "Headers", TCL_GLOBAL_ONLY); if (code == TCL_OK) { if (strcmp(TCLInterpreter->result, "accept") != 0) { ! (void)snprintf(buff, sizeof(buff), "%d %s", NNTP_REJECTIT_VAL, TCLInterpreter->result); syslog(L_NOTICE, "rejecting[tcl] %s %s", HDR(_message_id), buff); *************** *** 1870,1876 **** Header.Size = i + 16; RENEW(Header.Data, char, Header.Size + 1); } ! (void)strcpy(Header.Data, p); Data.Newsgroups = Header.Data; Data.NewsgroupsLength = i; --- 1917,1923 ---- Header.Size = i + 16; RENEW(Header.Data, char, Header.Size + 1); } ! (void)strcpy(Header.Data, p); /* safe -of */ Data.Newsgroups = Header.Data; Data.NewsgroupsLength = i; *************** *** 1881,1887 **** DISTparse(distributions, &Data); if (ME.Distributions && !DISTwantany(ME.Distributions, distributions)) { ! (void)sprintf(buff, "%d Unwanted distribution \"%s\"", NNTP_REJECTIT_VAL, MaxLength(distributions[0], distributions[0])); ARTlog(&Data, ART_REJECT, buff); --- 1928,1935 ---- DISTparse(distributions, &Data); if (ME.Distributions && !DISTwantany(ME.Distributions, distributions)) { ! (void)snprintf(buff, sizeof(buff), ! "%d Unwanted distribution \"%s\"", NNTP_REJECTIT_VAL, MaxLength(distributions[0], distributions[0])); ARTlog(&Data, ART_REJECT, buff); *************** *** 1927,1933 **** } if (ControlHeader >= 0) { /* Nip off the first word into lowercase. */ ! (void)strncpy(ControlWord, HDR(ControlHeader), sizeof ControlWord); ControlWord[sizeof ControlWord - 1] = '\0'; for (p = ControlWord; *p && !ISWHITE(*p); p++) if (CTYPE(isupper, *p)) --- 1975,1981 ---- } if (ControlHeader >= 0) { /* Nip off the first word into lowercase. */ ! (void)strncpy(ControlWord, HDR(ControlHeader), sizeof ControlWord - 1); ControlWord[sizeof ControlWord - 1] = '\0'; for (p = ControlWord; *p && !ISWHITE(*p); p++) if (CTYPE(isupper, *p)) *************** *** 1991,1997 **** /* Basic validity check. */ if (ngp->Rest[0] == NF_FLAG_MODERATED && !Approved) { ! (void)sprintf(buff, "%d Unapproved for \"%s\"", NNTP_REJECTIT_VAL, ngp->Name); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) --- 2039,2046 ---- /* Basic validity check. */ if (ngp->Rest[0] == NF_FLAG_MODERATED && !Approved) { ! (void)snprintf(buff, sizeof(buff), ! "%d Unapproved for \"%s\"", NNTP_REJECTIT_VAL, ngp->Name); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) *************** *** 2039,2045 **** /* Control messages not filed in "to" get filed only in control.name * or control. */ if (ControlHeader >= 0 && Accepted && !ToGroup) { ! FileGlue(buff, "control", '.', ControlWord); if ((ngp = NGfind(buff)) == NULL) ngp = NGfind(ARTctl); ngp->PostCount = 0; --- 2088,2094 ---- /* Control messages not filed in "to" get filed only in control.name * or control. */ if (ControlHeader >= 0 && Accepted && !ToGroup) { ! FileGlue(buff, "control", '.', ControlWord, sizeof(buff)); if ((ngp = NGfind(buff)) == NULL) ngp = NGfind(ARTctl); ngp->PostCount = 0; *************** *** 2060,2066 **** * under junk so that downstream feeds can get it. */ if (!Accepted || ngptr == GroupPointers) { if (!Accepted) { ! (void)sprintf(buff, "%d Unwanted newsgroup \"%s\"", NNTP_REJECTIT_VAL, MaxLength(HDR(_newsgroups), HDR(_newsgroups))); ARTlog(&Data, ART_REJECT, buff); --- 2109,2115 ---- * under junk so that downstream feeds can get it. */ if (!Accepted || ngptr == GroupPointers) { if (!Accepted) { ! (void)snprintf(buff, sizeof(buff), "%d Unwanted newsgroup \"%s\"", NNTP_REJECTIT_VAL, MaxLength(HDR(_newsgroups), HDR(_newsgroups))); ARTlog(&Data, ART_REJECT, buff); *************** *** 2152,2164 **** if (Data.Name[0] == '\0') { /* Write the article the first time. */ ! (void)sprintf(Data.Name, "%s/%lu", ngp->Dir, ngp->Filenum); if (ARTwrite(Data.Name, article, &Data) < 0 && (!MakeSpoolDirectory(ngp->Dir) || ARTwrite(Data.Name, article, &Data) < 0)) { i = errno; syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name); ! (void)sprintf(buff, "%d cant write article %s, %s", NNTP_RESENDIT_VAL, Data.Name, strerror(i)); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) --- 2201,2215 ---- if (Data.Name[0] == '\0') { /* Write the article the first time. */ ! (void)snprintf(Data.Name, sizeof(Data.Name), ! "%s/%lu", ngp->Dir, ngp->Filenum); if (ARTwrite(Data.Name, article, &Data) < 0 && (!MakeSpoolDirectory(ngp->Dir) || ARTwrite(Data.Name, article, &Data) < 0)) { i = errno; syslog(L_ERROR, "%s cant write %s %m", LogName, Data.Name); ! (void)snprintf(buff, sizeof(buff), ! "%d cant write article %s, %s", NNTP_RESENDIT_VAL, Data.Name, strerror(i)); ARTlog(&Data, ART_REJECT, buff); #if defined(DO_REMEMBER_TRASH) *************** *** 2171,2182 **** ARTreject(buff, article); return buff; } ! p += strlen(strcpy(p, Data.Name)); Data.NameLength = strlen(Data.Name); } else { /* Link to the main article. */ ! (void)sprintf(linkname, "%s/%lu", ngp->Dir, ngp->Filenum); if (DoLinks && link(Data.Name, linkname) < 0 && (!MakeSpoolDirectory(ngp->Dir) || link(Data.Name, linkname) < 0)) { --- 2222,2236 ---- ARTreject(buff, article); return buff; } ! strncpy(p, Data.Name,Files.Size - strlen(Files.Data) - 1); ! Files.Data[Files.Size - 1] = '\0'; ! p += strlen(p); Data.NameLength = strlen(Data.Name); } else { /* Link to the main article. */ ! (void)snprintf(linkname, sizeof(linkname), ! "%s/%lu", ngp->Dir, ngp->Filenum); if (DoLinks && link(Data.Name, linkname) < 0 && (!MakeSpoolDirectory(ngp->Dir) || link(Data.Name, linkname) < 0)) { *************** *** 2188,2194 **** continue; #else /* Try to make a symbolic link to the full pathname. */ ! FileGlue(buff, SPOOL, '/', Data.Name); if (symlink(buff, linkname) < 0 && (!MakeSpoolDirectory(ngp->Dir) || symlink(buff, linkname) < 0)) { --- 2242,2248 ---- continue; #else /* Try to make a symbolic link to the full pathname. */ ! FileGlue(buff, SPOOL, '/', Data.Name, sizeof(buff)); if (symlink(buff, linkname) < 0 && (!MakeSpoolDirectory(ngp->Dir) || symlink(buff, linkname) < 0)) { *************** *** 2201,2207 **** #endif /* defined(DONT_HAVE_SYMLINK) */ } *p++ = ' '; ! p += strlen(strcpy(p, linkname)); } } --- 2255,2263 ---- #endif /* defined(DONT_HAVE_SYMLINK) */ } *p++ = ' '; ! strncpy(p, linkname,Files.Size - strlen(Files.Data) - 1); ! Files.Data[Files.Size - 1] = '\0'; ! p += strlen(p); } } *************** *** 2209,2215 **** if (Mode != OMrunning || !HISwrite(&Data, Files.Data)) { i = errno; syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); ! (void)sprintf(buff, "%d cant write history, %s", NNTP_RESENDIT_VAL, strerror(errno)); ARTlog(&Data, ART_REJECT, buff); if (distributions) --- 2265,2271 ---- if (Mode != OMrunning || !HISwrite(&Data, Files.Data)) { i = errno; syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID); ! (void)snprintf(buff, sizeof(buff), "%d cant write history, %s", NNTP_RESENDIT_VAL, strerror(errno)); ARTlog(&Data, ART_REJECT, buff); if (distributions) diff -Ncr ../inn-1.5.1.dist/innd/cc.c ./innd/cc.c *** ../inn-1.5.1.dist/innd/cc.c Tue Dec 17 15:40:40 1996 --- ./innd/cc.c Fri Jul 25 11:55:55 1997 *************** *** 153,159 **** /* Server's mode. */ switch (Mode) { default: ! (void)sprintf(buff, "Unknown %d", Mode); return buff; case OMrunning: return "running"; --- 153,159 ---- /* Server's mode. */ switch (Mode) { default: ! (void)snprintf(buff, sizeof(buff), "Unknown %d", Mode); return buff; case OMrunning: return "running"; *************** *** 197,203 **** RENEW(Save.Data, char, Save.Size); } *store = Save.Data; ! (void)sprintf(*store, "<%s>", p); return NULL; } --- 197,203 ---- RENEW(Save.Data, char, Save.Size); } *store = Save.Data; ! (void)snprintf(*store, Save.Size, "<%s>", p); return NULL; } *************** *** 461,473 **** if (errors == 0) return NULL; ! if (CCreply.Size == 0) { /* If we got the "-s" flag, then CCsetup hasn't been called yet. */ CCreply.Size = SMBUF; CCreply.Data = NEW(char, CCreply.Size); } ! (void)sprintf(CCreply.Data, "1 Found %d errors -- see syslog", errors); return CCreply.Data; } --- 461,478 ---- if (errors == 0) return NULL; ! if (CCreply.Data == NULL) { /* If we got the "-s" flag, then CCsetup hasn't been called yet. */ CCreply.Size = SMBUF; CCreply.Data = NEW(char, CCreply.Size); } + else if (CCreply.Size < SMBUF) { + CCreply.Size = SMBUF; + RENEW(CCreply.Data, char, CCreply.Size); + } ! (void)snprintf(CCreply.Data, CCreply.Size, ! "1 Found %d errors -- see syslog", errors); return CCreply.Data; } *************** *** 718,724 **** p = CHANname(cp); switch (cp->Type) { default: ! (void)sprintf(CCreply.Data, "1 Can't close %s", p); return CCreply.Data; case CTexploder: case CTprocess: --- 723,730 ---- p = CHANname(cp); switch (cp->Type) { default: ! (void)snprintf(CCreply.Data, CCreply.Size, ! "1 Can't close %s", p); return CCreply.Data; case CTexploder: case CTprocess: *************** *** 759,797 **** */ p = buff; ! p += strlen(strcpy(buff, "0 Server ")); /* Server's mode. */ switch (Mode) { default: ! (void)sprintf(p, "Unknown %d", Mode); p += strlen(p); break; case OMrunning: ! p += strlen(strcpy(p, "running")); break; case OMpaused: ! p += strlen(strcpy(p, "paused ")); ! p += strlen(strcpy(p, ModeReason)); break; case OMthrottled: ! p += strlen(strcpy(p, "throttled ")); ! p += strlen(strcpy(p, ModeReason)); break; } *p++ = '\n'; if (RejectReason) { ! p += strlen(strcpy(p, "Rejecting ")); ! p += strlen(strcpy(p, RejectReason)); } - else - p += strlen(strcpy(p, "Allowing remote connections")); /* Server parameters. */ for (i = 0, h = 0; CHANiter(&h, CTnntp) != NULL; ) i++; *p++ = '\n'; ! (void)sprintf(p, "Parameters c %ld i %d (%d) l %ld o %d t %ld H %d T %d X %d %s %s", (long)Cutoff / (24L * 60L * 60L), MaxIncoming, i, LargestArticle, MaxOutgoing, (long)TimeOut.tv_sec, --- 765,822 ---- */ p = buff; ! p += strlen(strcpy(buff, "0 Server ")); /* safe -of */ /* Server's mode. */ switch (Mode) { default: ! (void)snprintf(p, sizeof(buff) - strlen(buff), "Unknown %d", Mode); p += strlen(p); break; case OMrunning: ! strncpy(p, "running", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); break; case OMpaused: ! strncpy(p, "paused ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! strncpy(p, ModeReason, sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); break; case OMthrottled: ! strncpy(p, "throttled ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! strncpy(p, ModeReason, sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); break; } *p++ = '\n'; if (RejectReason) { ! strncpy(p, "Rejecting ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! strncpy(p, RejectReason, sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } ! else { ! strncpy(p, "Allowing remote connections", ! sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); } /* Server parameters. */ for (i = 0, h = 0; CHANiter(&h, CTnntp) != NULL; ) i++; *p++ = '\n'; ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "Parameters c %ld i %d (%d) l %ld o %d t %ld H %d T %d X %d %s %s", (long)Cutoff / (24L * 60L * 60L), MaxIncoming, i, LargestArticle, MaxOutgoing, (long)TimeOut.tv_sec, *************** *** 803,843 **** /* Reservation. */ *p++ = '\n'; if (Reservation) { ! (void)sprintf(p, "Reserved %s", Reservation); p += strlen(p); } - else - p += strlen(strcpy(p, "Not reserved")); /* Newsreaders. */ *p++ = '\n'; ! p += strlen(strcpy(p, "Readers ")); ! if (NNRPFollows) ! p += strlen(strcpy(p, "follow ")); ! else ! p += strlen(strcpy(p, "separate ")); ! if (NNRPReason == NULL) ! p += strlen(strcpy(p, "enabled")); ! else { ! (void)sprintf(p, "disabled %s", NNRPReason); p += strlen(p); } #if defined(DO_TCL) *p++ = '\n'; ! p += strlen(strcpy(p, "Tcl filtering ")); ! if (TCLFilterActive) ! p += strlen(strcpy(p, "enabled")); ! else ! p += strlen(strcpy(p, "disabled")); #endif /* defined(DO_TCL) */ #if defined(DO_PERL) *p++ = '\n'; ! p += strlen(strcpy(p, "Perl filtering ")); ! if (PerlFilterActive) ! p += strlen(strcpy(p, "enabled")); ! else ! p += strlen(strcpy(p, "disabled")); #endif /* defined(DO_PERL) */ i = strlen(buff); --- 828,896 ---- /* Reservation. */ *p++ = '\n'; if (Reservation) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "Reserved %s", Reservation); ! p += strlen(p); ! } ! else { ! strncpy(p, "Not reserved", sizeof(buff)-strlen(buff)-1); ! buff[sizeof(buff) - 1] = '\0'; p += strlen(p); } /* Newsreaders. */ *p++ = '\n'; ! strncpy(p, "Readers ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! if (NNRPFollows) { ! strncpy(p, "follow ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } else { ! strncpy(p, "separate ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } ! if (NNRPReason == NULL) { ! strncpy(p, "enabled", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } else { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "disabled %s", NNRPReason); p += strlen(p); } #if defined(DO_TCL) *p++ = '\n'; ! strncpy(p, "Tcl filtering ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! if (TCLFilterActive) { ! strncpy(p, "enabled", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } else { ! strncpy(p, "disabled", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } #endif /* defined(DO_TCL) */ #if defined(DO_PERL) *p++ = '\n'; ! strncpy(p, "Perl filtering ", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! if (PerlFilterActive) { ! strncpy(p, "enabled", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } else { ! strncpy(p, "disabled", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } #endif /* defined(DO_PERL) */ i = strlen(buff); *************** *** 845,851 **** CCreply.Size = i; RENEW(CCreply.Data, char, CCreply.Size + 1); } ! (void)strcpy(CCreply.Data, buff); return CCreply.Data; } --- 898,904 ---- CCreply.Size = i; RENEW(CCreply.Data, char, CCreply.Size + 1); } ! (void)strcpy(CCreply.Data, buff); /* safe -of */ return CCreply.Data; } *************** *** 881,887 **** if (*p != '\0') { if ((cp = CHANfromdescriptor(atoi(p))) == NULL) return COPY(CCnochannel); ! (void)sprintf(CCreply.Data, "0 %s", CHANname(cp)); return CCreply.Data; } BUFFset(&CCreply, "0 ", 2); --- 934,940 ---- if (*p != '\0') { if ((cp = CHANfromdescriptor(atoi(p))) == NULL) return COPY(CCnochannel); ! (void)snprintf(CCreply.Data, CCreply.Size, "0 %s", CHANname(cp)); return CCreply.Data; } BUFFset(&CCreply, "0 ", 2); *************** *** 950,956 **** who = av[2]; if (*who == '\0') who = NEWSMASTER; ! (void)sprintf(buff, "%s %ld %s\n", Name, Now.time, who); if (xwrite(fd, buff, strlen(buff)) < 0) { oerrno = errno; syslog(L_ERROR, "%s cant write %s %m", LogName, TIMES); --- 1003,1009 ---- who = av[2]; if (*who == '\0') who = NEWSMASTER; ! (void)snprintf(buff, sizeof(buff), "%s %ld %s\n", Name, Now.time, who); if (xwrite(fd, buff, strlen(buff)) < 0) { oerrno = errno; syslog(L_ERROR, "%s cant write %s %m", LogName, TIMES); *************** *** 1086,1092 **** if (Reservation) { if (!EQ(reason, Reservation)) { ! (void)sprintf(CCreply.Data, "1 Reserved \"%s\"", Reservation); return CCreply.Data; } DISPOSE(Reservation); --- 1139,1146 ---- if (Reservation) { if (!EQ(reason, Reservation)) { ! (void)snprintf(CCreply.Data, CCreply.Size, ! "1 Reserved \"%s\"", Reservation); return CCreply.Data; } DISPOSE(Reservation); *************** *** 1454,1460 **** oerrno = errno; syslog(L_ERROR, "%s cant kill %ld %d site %s, %m", LogName, (long) sp->pid, s, p); ! (void)sprintf(CCreply.Data, "1 Can't signal process %ld, %s", (long) sp->pid, strerror(oerrno)); return CCreply.Data; } --- 1508,1515 ---- oerrno = errno; syslog(L_ERROR, "%s cant kill %ld %d site %s, %m", LogName, (long) sp->pid, s, p); ! (void)snprintf(CCreply.Data, CCreply.Size, ! "1 Can't signal process %ld, %s", (long) sp->pid, strerror(oerrno)); return CCreply.Data; } *************** *** 1662,1668 **** #endif /* defined (DO_HAVE_UNIX_DOMAIN) */ /* Copy to a printable buffer, and log. */ ! (void)strcpy(copy, buff); for (p = NULL, q = copy; *q; q++) if (*q == SC_SEP) { *q = ':'; --- 1717,1724 ---- #endif /* defined (DO_HAVE_UNIX_DOMAIN) */ /* Copy to a printable buffer, and log. */ ! (void)strncpy(copy, buff, sizeof(copy) - 1); ! copy[sizeof(copy) - 1] = '\0'; for (p = NULL, q = copy; *q; q++) if (*q == SC_SEP) { *q = ':'; *************** *** 1708,1720 **** memcpy (tbuff,&bufflen,sizeof (bufflen)) ; tbuff += sizeof (bufflen) ; ! strcpy (tbuff,p) ; tbuff -= HEADER_SIZE ; #if defined(DO_HAVE_UNIX_DOMAIN) (void)memset((POINTER)&client, 0, sizeof client); client.sun_family = AF_UNIX; ! (void)strcpy(client.sun_path, argv[0]); if (sendto(CCwriter, tbuff, len, 0, (struct sockaddr *)&client, AF_UNIX_SOCKSIZE(client)) < 0) { i = errno; --- 1764,1777 ---- memcpy (tbuff,&bufflen,sizeof (bufflen)) ; tbuff += sizeof (bufflen) ; ! strcpy (tbuff,p) ; /* safe -of */ tbuff -= HEADER_SIZE ; #if defined(DO_HAVE_UNIX_DOMAIN) (void)memset((POINTER)&client, 0, sizeof client); client.sun_family = AF_UNIX; ! (void)strncpy(client.sun_path, argv[0], sizeof(client.sun_path) - 1); ! client.sun_path[sizeof(client.sun_path) - 1] = '\0'; if (sendto(CCwriter, tbuff, len, 0, (struct sockaddr *)&client, AF_UNIX_SOCKSIZE(client)) < 0) { i = errno; *************** *** 1776,1782 **** } (void)memset((POINTER)&server, 0, sizeof server); server.sun_family = AF_UNIX; ! (void)strcpy(server.sun_path, CCpath); if (bind(i, (struct sockaddr *)&server, AF_UNIX_SOCKSIZE(server)) < 0) { syslog(L_FATAL, "%s cant bind %s %m", LogName, CCpath); exit(1); --- 1833,1840 ---- } (void)memset((POINTER)&server, 0, sizeof server); server.sun_family = AF_UNIX; ! (void)strncpy(server.sun_path, CCpath, sizeof(server.sun_path) - 1); ! server.sun_path[sizeof(server.sun_path) - 1] = '\0'; if (bind(i, (struct sockaddr *)&server, AF_UNIX_SOCKSIZE(server)) < 0) { syslog(L_FATAL, "%s cant bind %s %m", LogName, CCpath); exit(1); diff -Ncr ../inn-1.5.1.dist/innd/chan.c ./innd/chan.c *** ../inn-1.5.1.dist/innd/chan.c Tue Dec 17 15:40:40 1996 --- ./innd/chan.c Thu Jul 24 23:08:01 1997 *************** *** 281,310 **** switch (cp->Type) { default: ! (void)sprintf(buff, "?%d(#%d@%d)?", cp->Type, cp->fd, cp - CHANtable); break; case CTany: ! (void)sprintf(buff, "any:%d", cp->fd); break; case CTfree: ! (void)sprintf(buff, "free:%d", cp->fd); break; case CTremconn: ! (void)sprintf(buff, "remconn:%d", cp->fd); break; case CTreject: ! (void)sprintf(buff, "%s rejected", RChostname(cp)); break; case CTnntp: ! (void)sprintf(buff, "%s:%d", cp->Address.s_addr == 0 ? "localhost" : RChostname(cp), cp->fd); break; case CTlocalconn: ! (void)sprintf(buff, "localconn:%d", cp->fd); break; case CTcontrol: ! (void)sprintf(buff, "control:%d", cp->fd); break; case CTexploder: case CTfile: --- 281,311 ---- switch (cp->Type) { default: ! (void)snprintf(buff, sizeof(buff), ! "?%d(#%d@%d)?", cp->Type, cp->fd, cp - CHANtable); break; case CTany: ! (void)snprintf(buff, sizeof(buff), "any:%d", cp->fd); break; case CTfree: ! (void)snprintf(buff, sizeof(buff), "free:%d", cp->fd); break; case CTremconn: ! (void)snprintf(buff, sizeof(buff), "remconn:%d", cp->fd); break; case CTreject: ! (void)snprintf(buff, sizeof(buff), "%s rejected", RChostname(cp)); break; case CTnntp: ! (void)snprintf(buff, sizeof(buff), "%s:%d", cp->Address.s_addr == 0 ? "localhost" : RChostname(cp), cp->fd); break; case CTlocalconn: ! (void)snprintf(buff, sizeof(buff), "localconn:%d", cp->fd); break; case CTcontrol: ! (void)snprintf(buff, sizeof(buff), "control:%d", cp->fd); break; case CTexploder: case CTfile: *************** *** 318,328 **** break; } if (pid == 0) ! (void)sprintf(buff, "%s:%d:%s", MaxLength(p, p), cp->fd, cp->Type == CTfile ? "file" : "proc"); else ! (void)sprintf(buff, "%s:%d:%s:%ld", MaxLength(p, p), cp->fd, cp->Type == CTfile ? "file" : "proc", (long)pid); break; --- 319,329 ---- break; } if (pid == 0) ! (void)snprintf(buff, sizeof(buff), "%s:%d:%s", MaxLength(p, p), cp->fd, cp->Type == CTfile ? "file" : "proc"); else ! (void)snprintf(buff, sizeof(buff), "%s:%d:%s:%ld", MaxLength(p, p), cp->fd, cp->Type == CTfile ? "file" : "proc", (long)pid); break; diff -Ncr ../inn-1.5.1.dist/innd/icd.c ./innd/icd.c *** ../inn-1.5.1.dist/innd/icd.c Tue Dec 17 15:40:40 1996 --- ./innd/icd.c Thu Jul 24 23:08:02 1997 *************** *** 273,279 **** syslog(L_ERROR, "%s too_long %s", LogName, MaxLength(Name, Name)); return FALSE; } ! (void)sprintf(buff, "%s 0000000000 0000000001 %s\n", Name, Rest); ICDiovset(&iov[0], ICDactpointer, ICDactsize); ICDiovset(&iov[1], buff, strlen(buff)); --- 273,280 ---- syslog(L_ERROR, "%s too_long %s", LogName, MaxLength(Name, Name)); return FALSE; } ! (void)snprintf(buff, sizeof(buff), ! "%s 0000000000 0000000001 %s\n", Name, Rest); ICDiovset(&iov[0], ICDactpointer, ICDactsize); ICDiovset(&iov[1], buff, strlen(buff)); diff -Ncr ../inn-1.5.1.dist/innd/innd.c ./innd/innd.c *** ../inn-1.5.1.dist/innd/innd.c Tue Dec 17 15:40:40 1996 --- ./innd/innd.c Mon Jul 28 14:52:05 1997 *************** *** 92,108 **** /* ** Glue a string, a char, and a string together. Useful for making ** filenames. */ void ! FileGlue(p, n1, c, n2) register char *p; register char *n1; char c; register char *n2; { ! p += strlen(strcpy(p, n1)); *p++ = c; ! (void)strcpy(p, n2); } --- 92,127 ---- /* ** Glue a string, a char, and a string together. Useful for making ** filenames. + ** + ** If size == 0, we assume the buffer has enough space for the contents */ void ! FileGlue(p, n1, c, n2, size) register char *p; register char *n1; char c; register char *n2; + int size; { ! if (size == 0) { ! p += strlen(strcpy(p, n1)); /* safe -of */ *p++ = c; ! (void)strcpy(p, n2); /* safe -of */ ! return; ! } ! ! (void)strncpy(p, n1, size - 1); ! p[size - 1] = '\0'; ! size -= strlen(p); ! if (size <= 1) ! return; ! p += strlen(p); ! *p++ = c; ! size--; ! if (size <= 1) ! return; ! (void)strncpy(p, n2, size - 1); ! p[size -1] = '\0'; } *************** *** 143,162 **** /* Simple case of just want the begining? */ if (q - p < sizeof buff - 4) { (void)strncpy(buff, p, sizeof buff - 4); ! (void)strcpy(&buff[sizeof buff - 4], "..."); } /* Is getting last 10 characters good enough? */ else if ((p + i) - q < 10) { (void)strncpy(buff, p, sizeof buff - 14); ! (void)strcpy(&buff[sizeof buff - 14], "..."); ! (void)strcpy(&buff[sizeof buff - 11], &p[i - 10]); } else { /* Not in last 10 bytes, so use double elipses. */ (void)strncpy(buff, p, sizeof buff - 17); ! (void)strcpy(&buff[sizeof buff - 17], "..."); (void)strncpy(&buff[sizeof buff - 14], &q[-5], 10); ! (void)strcpy(&buff[sizeof buff - 4], "..."); } return Join(buff); } --- 162,181 ---- /* Simple case of just want the begining? */ if (q - p < sizeof buff - 4) { (void)strncpy(buff, p, sizeof buff - 4); ! (void)strcpy(&buff[sizeof buff - 4], "..."); /* safe -of */ } /* Is getting last 10 characters good enough? */ else if ((p + i) - q < 10) { (void)strncpy(buff, p, sizeof buff - 14); ! (void)strcpy(&buff[sizeof buff - 14], "..."); /* safe -of */ ! (void)strcpy(&buff[sizeof buff - 11], &p[i - 10]); /* safe -of */ } else { /* Not in last 10 bytes, so use double elipses. */ (void)strncpy(buff, p, sizeof buff - 17); ! (void)strcpy(&buff[sizeof buff - 17], "..."); /* safe -of */ (void)strncpy(&buff[sizeof buff - 14], &q[-5], 10); ! (void)strcpy(&buff[sizeof buff - 4], "..."); /* safe -of */ } return Join(buff); } *************** *** 422,428 **** Buffer = ErrlogBuffer; } ! FileGlue(buff, Name, '.', "old"); if (rename(Name, buff) < 0) syslog(L_ERROR, "%s cant rename %s to %s %m", LogName, Name, buff); mask = umask(033); --- 441,447 ---- Buffer = ErrlogBuffer; } ! FileGlue(buff, Name, '.', "old", sizeof(buff)); if (rename(Name, buff) < 0) syslog(L_ERROR, "%s cant rename %s to %s %m", LogName, Name, buff); mask = umask(033); *************** *** 470,476 **** DISPOSE(Reservation); Reservation = NULL; } ! (void)sprintf(buff, "%s writing %s file -- throttling", strerror(oerrno), when); if ((p = CCblock(OMthrottled, buff)) != NULL) syslog(L_ERROR, "%s cant throttle %s", LogName, p); --- 489,495 ---- DISPOSE(Reservation); Reservation = NULL; } ! (void)snprintf(buff, sizeof(buff), "%s writing %s file -- throttling", strerror(oerrno), when); if ((p = CCblock(OMthrottled, buff)) != NULL) syslog(L_ERROR, "%s cant throttle %s", LogName, p); *************** *** 679,685 **** case 't': Mode = OMthrottled; break; } if (Mode != OMrunning) { ! (void)sprintf(buff, "%sed from command line", Mode == OMpaused ? "Paus" : "Throttl"); ModeReason = COPY(buff); } --- 698,704 ---- case 't': Mode = OMthrottled; break; } if (Mode != OMrunning) { ! (void)snprintf(buff, sizeof(buff), "%sed from command line", Mode == OMpaused ? "Paus" : "Throttl"); ModeReason = COPY(buff); } *************** *** 764,777 **** LogName, _CONF_PATHHOST); exit(1); } ! Path.Used = strlen(path) + 1; ! Path.Data = NEW(char, Path.Used + 1); ! (void)sprintf(Path.Data, "%s!", path); /* Get the Xref prefix. */ Xref.Size = STRLEN("Xref: ") + strlen(path) + 1; Xref.Data = NEW(char, Xref.Size); ! FileGlue(Xref.Data, "Xref:", ' ', path); if ((p = strchr(Xref.Data, '!')) != NULL) *p = '\0'; Xref.Used = strlen(Xref.Data); --- 783,797 ---- LogName, _CONF_PATHHOST); exit(1); } ! Path.Used = strlen (path) + 1 ; ! Path.Size = Path.Used + 1 ; ! Path.Data = NEW(char, Path.Size); ! (void)snprintf(Path.Data, Path.Size, "%s!", path); /* Get the Xref prefix. */ Xref.Size = STRLEN("Xref: ") + strlen(path) + 1; Xref.Data = NEW(char, Xref.Size); ! FileGlue(Xref.Data, "Xref:", ' ', path, Xref.Size); if ((p = strchr(Xref.Data, '!')) != NULL) *p = '\0'; Xref.Used = strlen(Xref.Data); diff -Ncr ../inn-1.5.1.dist/innd/inndstart.c ./innd/inndstart.c *** ../inn-1.5.1.dist/innd/inndstart.c Tue Dec 17 15:40:40 1996 --- ./innd/inndstart.c Thu Jul 24 23:08:02 1997 *************** *** 105,111 **** syslog(L_FATAL, "inndstart cant bind %m"); exit(1); } ! (void)sprintf(pflag, "-p%d", i); /* Build the new argument vector. */ argv = NEW(STRING, 2 + ac + 1); --- 105,111 ---- syslog(L_FATAL, "inndstart cant bind %m"); exit(1); } ! (void)snprintf(pflag, sizeof(pflag), "-p%d", i); /* Build the new argument vector. */ argv = NEW(STRING, 2 + ac + 1); *************** *** 136,162 **** syslog(L_ERROR, "inndstart cant setuid to %d %m", NewsUID); /* Set up the environment. */ ! (void)sprintf(buff, "PATH=%s:%s:/bin:/usr/bin:/usr/ucb", _PATH_NEWSBIN, _PATH_NEWSLIB); env[0] = COPY(buff); ! (void)sprintf(buff, "TMPDIR=%s", _PATH_TMP); env[1] = COPY(buff); ! (void)sprintf(buff, "SHELL=%s", _PATH_SH); env[2] = COPY(buff); ! (void)sprintf(buff, "LOGNAME=%s", NEWSMASTER); env[3] = COPY(buff); ! (void)sprintf(buff, "USER=%s", NEWSMASTER); env[4] = COPY(buff); ! (void)sprintf(buff, "HOME=%s", _PATH_NEWSHOME); env[5] = COPY(buff); i = 6; /* linux uglyness */ if ((p = getenv("BIND_INADDR")) != NULL) { ! (void)sprintf(buff, "BIND_INADDR=%s", p); env[i++] = COPY(buff); } if ((p = getenv("TZ")) != NULL) { ! (void)sprintf(buff, "TZ=%s", p); env[i++] = COPY(buff); } env[i++] = NULL; --- 136,162 ---- syslog(L_ERROR, "inndstart cant setuid to %d %m", NewsUID); /* Set up the environment. */ ! (void)snprintf(buff, sizeof(buff), "PATH=%s:%s:/bin:/usr/bin:/usr/ucb", _PATH_NEWSBIN, _PATH_NEWSLIB); env[0] = COPY(buff); ! (void)snprintf(buff, sizeof(buff), "TMPDIR=%s", _PATH_TMP); env[1] = COPY(buff); ! (void)snprintf(buff, sizeof(buff), "SHELL=%s", _PATH_SH); env[2] = COPY(buff); ! (void)snprintf(buff, sizeof(buff), "LOGNAME=%s", NEWSMASTER); env[3] = COPY(buff); ! (void)snprintf(buff, sizeof(buff), "USER=%s", NEWSMASTER); env[4] = COPY(buff); ! (void)snprintf(buff, sizeof(buff), "HOME=%s", _PATH_NEWSHOME); env[5] = COPY(buff); i = 6; /* linux uglyness */ if ((p = getenv("BIND_INADDR")) != NULL) { ! (void)snprintf(buff, sizeof(buff), "BIND_INADDR=%s", p); env[i++] = COPY(buff); } if ((p = getenv("TZ")) != NULL) { ! (void)snprintf(buff, sizeof(buff), "TZ=%s", p); env[i++] = COPY(buff); } env[i++] = NULL; diff -Ncr ../inn-1.5.1.dist/innd/lc.c ./innd/lc.c *** ../inn-1.5.1.dist/innd/lc.c Tue Dec 17 15:40:40 1996 --- ./innd/lc.c Thu Jul 24 23:08:02 1997 *************** *** 77,83 **** } (void)memset((POINTER)&server, 0, sizeof server); server.sun_family = AF_UNIX; ! (void)strcpy(server.sun_path, LCpath); if (bind(i, (struct sockaddr *)&server, AF_UNIX_SOCKSIZE(server)) < 0) { syslog(L_FATAL, "%s cant bind %s %m", LogName, LCpath); exit(1); --- 77,84 ---- } (void)memset((POINTER)&server, 0, sizeof server); server.sun_family = AF_UNIX; ! (void)strncpy(server.sun_path, LCpath, sizeof(server.sun_path) - 1); ! server.sun_path[sizeof(server.sun_path) - 1] = '\0'; if (bind(i, (struct sockaddr *)&server, AF_UNIX_SOCKSIZE(server)) < 0) { syslog(L_FATAL, "%s cant bind %s %m", LogName, LCpath); exit(1); diff -Ncr ../inn-1.5.1.dist/innd/nc.c ./innd/nc.c *** ../inn-1.5.1.dist/innd/nc.c Tue Dec 17 15:40:40 1996 --- ./innd/nc.c Thu Jul 24 23:08:02 1997 *************** *** 237,243 **** cp->Received++; if (cp->Sendid.Size > 3) { /* We be streaming */ char buff[4]; ! (void)sprintf(buff, "%d", NNTP_OK_RECID_VAL); cp->Sendid.Data[0] = buff[0]; cp->Sendid.Data[1] = buff[1]; cp->Sendid.Data[2] = buff[2]; --- 237,243 ---- cp->Received++; if (cp->Sendid.Size > 3) { /* We be streaming */ char buff[4]; ! (void)snprintf(buff, sizeof(buff), "%d", NNTP_OK_RECID_VAL); cp->Sendid.Data[0] = buff[0]; cp->Sendid.Data[1] = buff[1]; cp->Sendid.Data[2] = buff[2]; *************** *** 402,408 **** } /* Write the message. */ ! (void)sprintf(buff, "%d 0 %s", NNTP_NOTHING_FOLLOWS_VAL, p); NCwritetext(cp, buff); } --- 402,408 ---- } /* Write the message. */ ! (void)snprintf(buff, sizeof(buff), "%d 0 %s", NNTP_NOTHING_FOLLOWS_VAL, p); NCwritetext(cp, buff); } *************** *** 493,499 **** if (i < 0) wp->MessageID = NEW(char, DBZMAXKEY + 3); } ! (void)strcpy(wp->MessageID, id); return FALSE; } --- 493,500 ---- if (i < 0) wp->MessageID = NEW(char, DBZMAXKEY + 3); } ! (void)strncpy(wp->MessageID, id, DBZMAXKEY + 3 - 1); ! wp->MessageID[DBZMAXKEY + 3 - 1] = '\0'; return FALSE; } *************** *** 731,737 **** else if (caseEQ(p, "stream") && (!StreamingOff || (StreamingOff && cp->Streaming))) { char buff[16]; ! (void)sprintf(buff, "%d StreamOK.", NNTP_OK_STREAM_VAL); NCwritetext(cp, buff); syslog(L_NOTICE, "%s NCmode \"mode stream\" received", CHANname(cp)); --- 732,738 ---- else if (caseEQ(p, "stream") && (!StreamingOff || (StreamingOff && cp->Streaming))) { char buff[16]; ! (void)snprintf(buff, sizeof(buff), "%d StreamOK.", NNTP_OK_STREAM_VAL); NCwritetext(cp, buff); syslog(L_NOTICE, "%s NCmode \"mode stream\" received", CHANname(cp)); *************** *** 805,811 **** Reply.Size = i; RENEW(Reply.Data, char, i + 1); } ! (void)sprintf(Reply.Data, "%d %s", NNTP_NOTHING_FOLLOWS_VAL, p); NCwritetext(cp, Reply.Data); } --- 806,813 ---- Reply.Size = i; RENEW(Reply.Data, char, i + 1); } ! (void)snprintf(Reply.Data, Reply.Size, ! "%d %s", NNTP_NOTHING_FOLLOWS_VAL, p); NCwritetext(cp, Reply.Data); } *************** *** 858,864 **** for (p = cp->In.Data; *p && !ISWHITE(*p); p++) continue; *p = '\0'; ! (void)sprintf(buff, "%d \"%s\" not implemented; try \"help\".", NNTP_BAD_COMMAND_VAL, MaxLength(cp->In.Data, cp->In.Data)); NCwritetext(cp, buff); } --- 860,867 ---- for (p = cp->In.Data; *p && !ISWHITE(*p); p++) continue; *p = '\0'; ! (void)snprintf(buff, sizeof(buff), ! "%d \"%s\" not implemented; try \"help\".", NNTP_BAD_COMMAND_VAL, MaxLength(cp->In.Data, cp->In.Data)); NCwritetext(cp, buff); } *************** *** 1024,1030 **** #endif if (cp->Sendid.Size > 3) { /* We be streaming */ char buff[4]; ! (void)sprintf(buff, "%d", NNTP_ERR_FAILID_VAL); cp->Sendid.Data[0] = buff[0]; cp->Sendid.Data[1] = buff[1]; cp->Sendid.Data[2] = buff[2]; --- 1027,1034 ---- #endif if (cp->Sendid.Size > 3) { /* We be streaming */ char buff[4]; ! (void)snprintf(buff, sizeof(buff), ! "%d", NNTP_ERR_FAILID_VAL); cp->Sendid.Data[0] = buff[0]; cp->Sendid.Data[1] = buff[1]; cp->Sendid.Data[2] = buff[2]; *************** *** 1114,1120 **** i = wp->Size + bp->Used; syslog(L_ERROR, "%s internal rejecting huge article %s (%d > %d)", CHANname(cp), p ? p : "(null)", i, LargestArticle); ! (void)sprintf(buff, "%d Article exceeds local limit of %ld bytes", NNTP_REJECTIT_VAL, LargestArticle); if (cp->Sendid.Size) NCwritetext(cp, cp->Sendid.Data); else NCwritetext(cp, buff); --- 1118,1125 ---- i = wp->Size + bp->Used; syslog(L_ERROR, "%s internal rejecting huge article %s (%d > %d)", CHANname(cp), p ? p : "(null)", i, LargestArticle); ! (void)snprintf(buff, sizeof(buff), ! "%d Article exceeds local limit of %ld bytes", NNTP_REJECTIT_VAL, LargestArticle); if (cp->Sendid.Size) NCwritetext(cp, cp->Sendid.Data); else NCwritetext(cp, buff); *************** *** 1182,1195 **** now = time(NULL); failed = 0; /* time+channel file descriptor should make an unique file name */ ! sprintf(buff, "%s/%ld%d.tmp", _PATH_XBATCHES, now, cp->fd); fd = open(buff, O_WRONLY|O_CREAT|O_EXCL, ARTFILE_MODE); if (fd < 0) { oerrno = errno; failed = 1; syslog(L_ERROR, "%s cannot open outfile %s for xbatch: %m", CHANname(cp), buff); ! sprintf(buff, "%s cant create file: %s", NNTP_RESENDIT_XBATCHERR, strerror(oerrno)); NCwritetext(cp, buff); } else { --- 1187,1201 ---- now = time(NULL); failed = 0; /* time+channel file descriptor should make an unique file name */ ! snprintf(buff, sizeof(buff), ! "%s/%ld%d.tmp", _PATH_XBATCHES, now, cp->fd); fd = open(buff, O_WRONLY|O_CREAT|O_EXCL, ARTFILE_MODE); if (fd < 0) { oerrno = errno; failed = 1; syslog(L_ERROR, "%s cannot open outfile %s for xbatch: %m", CHANname(cp), buff); ! snprintf(buff, sizeof(buff), "%s cant create file: %s", NNTP_RESENDIT_XBATCHERR, strerror(oerrno)); NCwritetext(cp, buff); } else { *************** *** 1197,1203 **** oerrno = errno; syslog(L_ERROR, "%s cant write batch to file %s: %m", CHANname(cp), buff); ! sprintf(buff, "%s cant write batch to file: %s", NNTP_RESENDIT_XBATCHERR, strerror(oerrno)); NCwritetext(cp, buff); failed = 1; --- 1203,1210 ---- oerrno = errno; syslog(L_ERROR, "%s cant write batch to file %s: %m", CHANname(cp), buff); ! snprintf(buff, sizeof(buff), ! "%s cant write batch to file: %s", NNTP_RESENDIT_XBATCHERR, strerror(oerrno)); NCwritetext(cp, buff); failed = 1; *************** *** 1207,1223 **** oerrno = errno; syslog(L_ERROR, "%s error closing batch file %s: %m", CHANname(cp), failed ? "" : buff); ! sprintf(buff, "%s error closing batch file: %s", NNTP_RESENDIT_XBATCHERR, strerror(oerrno)); NCwritetext(cp, buff); failed = 1; } ! sprintf(buff2, "%s/%ld%d.x", _PATH_XBATCHES, now, cp->fd); if (rename(buff, buff2)) { oerrno = errno; syslog(L_ERROR, "%s cant rename %s to %s: %m", CHANname(cp), failed ? "" : buff, buff2); ! sprintf(buff, "%s cant rename batch to %s: %s", NNTP_RESENDIT_XBATCHERR, buff2, strerror(oerrno)); NCwritetext(cp, buff); failed = 1; --- 1214,1233 ---- oerrno = errno; syslog(L_ERROR, "%s error closing batch file %s: %m", CHANname(cp), failed ? "" : buff); ! snprintf(buff, sizeof(buff), ! "%s error closing batch file: %s", NNTP_RESENDIT_XBATCHERR, strerror(oerrno)); NCwritetext(cp, buff); failed = 1; } ! snprintf(buff2, sizeof(buff2), ! "%s/%ld%d.x", _PATH_XBATCHES, now, cp->fd); if (rename(buff, buff2)) { oerrno = errno; syslog(L_ERROR, "%s cant rename %s to %s: %m", CHANname(cp), failed ? "" : buff, buff2); ! snprintf(buff, sizeof(buff), ! "%s cant rename batch to %s: %s", NNTP_RESENDIT_XBATCHERR, buff2, strerror(oerrno)); NCwritetext(cp, buff); failed = 1; *************** *** 1329,1335 **** if ((p = GetConfigValue(_CONF_PATHHOST)) == NULL) /* Worked in main, now it fails? Curious. */ p = Path.Data; ! (void)sprintf(buff, "%d %s InterNetNews server %s ready", NNTP_POSTOK_VAL, p, Version); NCgreeting = COPY(buff); --- 1339,1345 ---- if ((p = GetConfigValue(_CONF_PATHHOST)) == NULL) /* Worked in main, now it fails? Curious. */ p = Path.Data; ! (void)snprintf(buff, sizeof(buff), "%d %s InterNetNews server %s ready", NNTP_POSTOK_VAL, p, Version); NCgreeting = COPY(buff); *************** *** 1480,1486 **** cp->Sendid.Data = NEW(char, cp->Sendid.Size); } if (!ARTidok(p)) { ! (void)sprintf(cp->Sendid.Data, "%d %s", NNTP_ERR_GOTID_VAL, p); NCwritereply(cp, cp->Sendid.Data); syslog(L_NOTICE, "%s bad_messageid %s", CHANname(cp), MaxLength(p, p)); return; --- 1490,1497 ---- cp->Sendid.Data = NEW(char, cp->Sendid.Size); } if (!ARTidok(p)) { ! (void)snprintf(cp->Sendid.Data, cp->Sendid.Size, ! "%d %s", NNTP_ERR_GOTID_VAL, p); NCwritereply(cp, cp->Sendid.Data); syslog(L_NOTICE, "%s bad_messageid %s", CHANname(cp), MaxLength(p, p)); return; *************** *** 1488,1500 **** if (HIShavearticle(p)) { cp->Refused++; ! (void)sprintf(cp->Sendid.Data, "%d %s", NNTP_ERR_GOTID_VAL, p); NCwritereply(cp, cp->Sendid.Data); } else if (NCinprogress(cp, p, &who)) { ! (void)sprintf(cp->Sendid.Data, "%d %s", NNTP_RESENDID_VAL, p); NCwritereply(cp, cp->Sendid.Data); } else { ! (void)sprintf(cp->Sendid.Data, "%d %s", NNTP_OK_SENDID_VAL, p); NCwritereply(cp, cp->Sendid.Data); } /* stay in command mode */ --- 1499,1514 ---- if (HIShavearticle(p)) { cp->Refused++; ! (void)snprintf(cp->Sendid.Data, cp->Sendid.Size, ! "%d %s", NNTP_ERR_GOTID_VAL, p); NCwritereply(cp, cp->Sendid.Data); } else if (NCinprogress(cp, p, &who)) { ! (void)snprintf(cp->Sendid.Data, cp->Sendid.Size, ! "%d %s", NNTP_RESENDID_VAL, p); NCwritereply(cp, cp->Sendid.Data); } else { ! (void)snprintf(cp->Sendid.Data, cp->Sendid.Size, ! "%d %s", NNTP_OK_SENDID_VAL, p); NCwritereply(cp, cp->Sendid.Data); } /* stay in command mode */ *************** *** 1529,1535 **** cp->Sendid.Data = NEW(char, cp->Sendid.Size); } /* save ID for later NACK or ACK */ ! (void)sprintf(cp->Sendid.Data, "%d %s", NNTP_ERR_FAILID_VAL, p); cp->State = CSgetarticle; /* set wp->MessageID for benefit of later code in NCreader --- 1543,1550 ---- cp->Sendid.Data = NEW(char, cp->Sendid.Size); } /* save ID for later NACK or ACK */ ! (void)snprintf(cp->Sendid.Data, cp->Sendid.Size, ! "%d %s", NNTP_ERR_FAILID_VAL, p); cp->State = CSgetarticle; /* set wp->MessageID for benefit of later code in NCreader *************** *** 1546,1550 **** if (i < 0) wp->MessageID = NEW(char, DBZMAXKEY + 3); } ! (void)strcpy(wp->MessageID, p); } --- 1561,1566 ---- if (i < 0) wp->MessageID = NEW(char, DBZMAXKEY + 3); } ! (void)strncpy(wp->MessageID, p, DBZMAXKEY + 3 - 1); ! wp->MessageID[DBZMAXKEY + 3 - 1] = '\0'; } diff -Ncr ../inn-1.5.1.dist/innd/newsfeeds.c ./innd/newsfeeds.c *** ../inn-1.5.1.dist/innd/newsfeeds.c Tue Dec 17 15:40:40 1996 --- ./innd/newsfeeds.c Fri Jul 25 12:22:58 1997 *************** *** 278,284 **** sp->SpoolName = COPY(p); else { sp->SpoolName = NEW(char, STRLEN(BATCH) + 1 + strlen(p) + 1); ! FileGlue(sp->SpoolName, BATCH, '/', p); } break; case 'G': --- 278,285 ---- sp->SpoolName = COPY(p); else { sp->SpoolName = NEW(char, STRLEN(BATCH) + 1 + strlen(p) + 1); ! FileGlue(sp->SpoolName, BATCH, '/', p, ! STRLEN(BATCH) + 1 + strlen(p) + 1); } break; case 'G': *************** *** 379,396 **** if (sp->Type != FTfile && sp->Type != FTlogonly) return "empty field 4"; sp->Param = NEW(char, STRLEN(BATCH) + 1 + sp->NameLength + 1); ! FileGlue(sp->Param, BATCH, '/', sp->Name); } else if (sp->Type == FTfile && *f4 != '/') { sp->Param = NEW(char, STRLEN(BATCH) + 1 + strlen(f4) + 1); ! FileGlue(sp->Param, BATCH, '/', f4); } else sp->Param = COPY(f4); if (sp->SpoolName == NULL) { sp->SpoolName = NEW(char, STRLEN(BATCH) + 1 + strlen(sp->Name) + 1); ! FileGlue(sp->SpoolName, BATCH, '/', sp->Name); } /* Make sure there is only one %s, and only one *. */ --- 380,398 ---- if (sp->Type != FTfile && sp->Type != FTlogonly) return "empty field 4"; sp->Param = NEW(char, STRLEN(BATCH) + 1 + sp->NameLength + 1); ! FileGlue(sp->Param, BATCH, '/', sp->Name, ! STRLEN(BATCH) + 1 + sp->NameLength + 1); } else if (sp->Type == FTfile && *f4 != '/') { sp->Param = NEW(char, STRLEN(BATCH) + 1 + strlen(f4) + 1); ! FileGlue(sp->Param, BATCH, '/', f4, STRLEN(BATCH) + 1 + strlen(f4) + 1); } else sp->Param = COPY(f4); if (sp->SpoolName == NULL) { sp->SpoolName = NEW(char, STRLEN(BATCH) + 1 + strlen(sp->Name) + 1); ! FileGlue(sp->SpoolName, BATCH, '/', sp->Name,STRLEN(BATCH) + 1 + strlen(sp->Name) + 1); } /* Make sure there is only one %s, and only one *. */ diff -Ncr ../inn-1.5.1.dist/innd/rc.c ./innd/rc.c *** ../inn-1.5.1.dist/innd/rc.c Tue Dec 17 15:40:40 1996 --- ./innd/rc.c Thu Jul 24 23:08:02 1997 *************** *** 192,198 **** argv[1] = "-s "; i = 2; if (NNRPReason) { ! (void)sprintf(buff, "-r%s", NNRPReason); argv[i++] = buff; } if (NNRPTracing) --- 192,198 ---- argv[1] = "-s "; i = 2; if (NNRPReason) { ! (void)snprintf(buff, sizeof(buff), "-r%s", NNRPReason); argv[i++] = buff; } if (NNRPTracing) *************** *** 545,551 **** StreamingOff = FALSE ; RCreadfile(&RCpeerlist, &RCnpeerlist, INNDHOSTS); ! FileGlue(name, INNDHOSTS, '.', "nolimit"); if (stat(name, &Sb) >= 0) RCreadfile(&RCnolimitlist, &RCnnolimitlist, name); } --- 545,551 ---- StreamingOff = FALSE ; RCreadfile(&RCpeerlist, &RCnpeerlist, INNDHOSTS); ! FileGlue(name, INNDHOSTS, '.', "nolimit", sizeof(name)); if (stat(name, &Sb) >= 0) RCreadfile(&RCnolimitlist, &RCnnolimitlist, name); } *************** *** 567,573 **** /* SUPPRESS 112 *//* Retrieving long where char is stored */ if (cp->Address.s_addr == rp->Address.s_addr) return rp->Name; ! (void)strcpy(buff, inet_ntoa(cp->Address)); return buff; } --- 567,573 ---- /* SUPPRESS 112 *//* Retrieving long where char is stored */ if (cp->Address.s_addr == rp->Address.s_addr) return rp->Name; ! (void)strcpy(buff, inet_ntoa(cp->Address)); /* safe -of */ return buff; } *************** *** 691,697 **** } /* Set flag for nnrp. */ ! (void)sprintf(buff, "-S%s", master); RCslaveflag = COPY(buff); } } --- 691,697 ---- } /* Set flag for nnrp. */ ! (void)snprintf(buff, sizeof(buff), "-S%s", master); RCslaveflag = COPY(buff); } } diff -Ncr ../inn-1.5.1.dist/innd/site.c ./innd/site.c *** ../inn-1.5.1.dist/innd/site.c Tue Dec 17 15:40:40 1996 --- ./innd/site.c Fri Jul 25 18:57:00 1997 *************** *** 54,60 **** name = sp->SpoolName; i = open(name, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); if (i < 0 && errno == EISDIR) { ! FileGlue(buff, sp->SpoolName, '/', "togo"); name = buff; i = open(buff, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); } --- 54,60 ---- name = sp->SpoolName; i = open(name, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); if (i < 0 && errno == EISDIR) { ! FileGlue(buff, sp->SpoolName, '/', "togo", sizeof(buff)); name = buff; i = open(buff, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); } *************** *** 191,197 **** name = sp->SpoolName; fd = open(name, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); if (fd < 0 && errno == EISDIR) { ! FileGlue(buff, sp->SpoolName, '/', "togo"); name = buff; fd = open(buff, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); } --- 191,197 ---- name = sp->SpoolName; fd = open(name, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); if (fd < 0 && errno == EISDIR) { ! FileGlue(buff, sp->SpoolName, '/', "togo", sizeof(buff)); name = buff; fd = open(buff, O_APPEND | O_CREAT | O_WRONLY, BATCHFILE_MODE); } *************** *** 381,387 **** case FEED_TIMEPOSTED: if (Dirty) BUFFappend(bp, ITEMSEP, STRLEN(ITEMSEP)); ! sprintf(pbuff, "%ld", Data->Posted); BUFFappend(bp, pbuff, strlen(pbuff)); break; case FEED_MESSAGEID: --- 381,387 ---- case FEED_TIMEPOSTED: if (Dirty) BUFFappend(bp, ITEMSEP, STRLEN(ITEMSEP)); ! snprintf(pbuff, sizeof(pbuff), "%ld", Data->Posted); BUFFappend(bp, pbuff, strlen(pbuff)); break; case FEED_MESSAGEID: *************** *** 476,490 **** temp = NEW(char, i + 1); p = strchr(sp->Param, '*'); *p = '\0'; ! (void)strcpy(temp, sp->Param); ! (void)strcat(temp, sp->FNLnames.Data); ! (void)strcat(temp, &p[1]); *p = '*'; ! (void)sprintf(buff, temp, Data->Name); DISPOSE(temp); } else ! (void)sprintf(buff, sp->Param, Data->Name); if (NeedShell(buff, argv, ENDOF(argv))) { argv[0] = SITEshell; --- 476,491 ---- temp = NEW(char, i + 1); p = strchr(sp->Param, '*'); *p = '\0'; ! (void)strncpy(temp, sp->Param, i); ! temp[i] = '\0'; ! (void)strncat(temp, sp->FNLnames.Data, i - strlen(temp)); ! (void)strncat(temp, &p[1], i - strlen(temp)); *p = '*'; ! (void)snprintf(buff, sizeof(buff), temp, Data->Name); DISPOSE(temp); } else ! (void)snprintf(buff, sizeof(buff), sp->Param, Data->Name); if (NeedShell(buff, argv, ENDOF(argv))) { argv[0] = SITEshell; *************** *** 1080,1090 **** if (sp->Name == NULL || fsp->Name == NULL) return; if (fsp->Type == FTexploder) { ! (void)strcpy(buff, text); if (fsp != sp && fsp->FNLwantsnames) { p = buff + strlen(buff); *p++ = ' '; ! (void)strcpy(p, sp->Name); } SITEwrite(fsp, buff); } --- 1081,1093 ---- if (sp->Name == NULL || fsp->Name == NULL) return; if (fsp->Type == FTexploder) { ! (void)strncpy(buff, text, sizeof(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; if (fsp != sp && fsp->FNLwantsnames) { p = buff + strlen(buff); *p++ = ' '; ! (void)strncpy(p, sp->Name, sizeof(buff) - strlen(buff) - 2); ! buff[sizeof(buff) - 1] = '\0'; } SITEwrite(fsp, buff); } *************** *** 1125,1223 **** } p = buff; ! (void)sprintf(buff, "%s%s:\t", sp->Name, sp->IsMaster ? "(*)" : ""); p += strlen(p); if (sp->Type == FTfunnel) { sp = &Sites[sp->Funnel]; ! (void)sprintf(p, "funnel -> %s: ", sp->Name); p += strlen(p); } switch (sp->Type) { default: ! (void)sprintf(p, "unknown feed type %d", sp->Type); p += strlen(p); break; case FTerror: case FTfile: ! p += strlen(strcpy(p, "file")); if (sp->Buffered) { ! (void)sprintf(p, " buffered(%ld)", sp->Buffer.Left); p += strlen(p); } ! else if ((cp = sp->Channel) == NULL) ! p += strlen(strcpy(p, " no channel?")); ! else { ! (void)sprintf(p, " open fd=%d, in mem %ld", cp->fd, cp->Out.Left); p += strlen(p); } break; case FTchannel: ! p += strlen(strcpy(p, "channel")); goto Common; case FTexploder: ! p += strlen(strcpy(p, "exploder")); Common: if (sp->Process >= 0) { ! (void)sprintf(p, " pid=%ld", (long) sp->pid); p += strlen(p); } ! if (sp->Spooling) ! p += strlen(strcpy(p, " spooling")); ! if ((cp = sp->Channel) == NULL) ! p += strlen(strcpy(p, " no channel?")); ! else { ! (void)sprintf(p, " fd=%d, in mem %ld", cp->fd, cp->Out.Left); p += strlen(p); } break; case FTfunnel: ! p += strlen(strcpy(p, "recursive funnel")); break; case FTlogonly: ! p += strlen(strcpy(p, "log only")); break; case FTprogram: ! p += strlen(strcpy(p, "program")); ! if (sp->FNLwantsnames) ! p += strlen(strcpy(p, " with names")); break; } *p++ = '\n'; if (Verbose) { sep = "\t"; if (sp->Buffered && sp->Flushpoint) { ! (void)sprintf(p, "%sFlush @ %ld", sep, sp->Flushpoint); p += strlen(p); sep = "; "; } if (sp->StartWriting || sp->StopWriting) { ! (void)sprintf(p, "%sWrite [%ld..%ld]", sep, sp->StopWriting, sp->StartWriting); p += strlen(p); sep = "; "; } if (sp->StartSpooling) { ! (void)sprintf(p, "%sSpool @ %ld", sep, sp->StartSpooling); p += strlen(p); sep = "; "; } if (sep[0] != '\t') *p++ = '\n'; if (sp->Spooling && sp->SpoolName) { ! (void)sprintf(p, "\tSpooling to \"%s\"\n", sp->SpoolName); p += strlen(p); } if ((cp = sp->Channel) != NULL) { ! (void)sprintf(p, "\tChannel created %.12s", ctime(&cp->Started) + 4); p += strlen(p); ! (void)sprintf(p, ", last active %.12s\n", ctime(&cp->LastActive) + 4); p += strlen(p); if (cp->Waketime > Now.time) { ! (void)sprintf("\tSleeping until %.12s\n", ctime(&cp->Waketime) + 4); p += strlen(p); } --- 1128,1262 ---- } p = buff; ! (void)snprintf(buff, sizeof(buff), "%s%s:\t", sp->Name, ! sp->IsMaster ? "(*)" : ""); p += strlen(p); if (sp->Type == FTfunnel) { sp = &Sites[sp->Funnel]; ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "funnel -> %s: ", sp->Name); p += strlen(p); } switch (sp->Type) { default: ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "unknown feed type %d", sp->Type); p += strlen(p); break; case FTerror: case FTfile: ! strncpy(p, "file", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); if (sp->Buffered) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! " buffered(%ld)", sp->Buffer.Left); p += strlen(p); } ! else if ((cp = sp->Channel) == NULL) { ! strncpy(p, " no channel?",sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } else { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! " open fd=%d, in mem %ld", cp->fd, cp->Out.Left); p += strlen(p); } break; case FTchannel: ! strncpy(p, "channel", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); goto Common; case FTexploder: ! strncpy(p, "exploder", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); Common: if (sp->Process >= 0) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! " pid=%ld", (long) sp->pid); p += strlen(p); } ! if (sp->Spooling) { ! strncpy(p, " spooling", sizeof(buff)-strlen(buff)-1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } ! if ((cp = sp->Channel) == NULL) { ! strncpy(p, " no channel?",sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } else { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! " fd=%d, in mem %ld", cp->fd, cp->Out.Left); p += strlen(p); } break; case FTfunnel: ! strncpy(p,"recursive funnel",sizeof(buff)-strlen(buff)-1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); break; case FTlogonly: ! strncpy(p, "log only", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); break; case FTprogram: ! strncpy(p, "program", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! if (sp->FNLwantsnames) { ! strncpy(p, " with names", sizeof(buff) - strlen(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; ! p += strlen(p); ! } break; } *p++ = '\n'; if (Verbose) { sep = "\t"; if (sp->Buffered && sp->Flushpoint) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "%sFlush @ %ld", sep, sp->Flushpoint); p += strlen(p); sep = "; "; } if (sp->StartWriting || sp->StopWriting) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "%sWrite [%ld..%ld]", sep, sp->StopWriting, sp->StartWriting); p += strlen(p); sep = "; "; } if (sp->StartSpooling) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "%sSpool @ %ld", sep, sp->StartSpooling); p += strlen(p); sep = "; "; } if (sep[0] != '\t') *p++ = '\n'; if (sp->Spooling && sp->SpoolName) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "\tSpooling to \"%s\"\n", sp->SpoolName); p += strlen(p); } if ((cp = sp->Channel) != NULL) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "\tChannel created %.12s", ctime(&cp->Started) + 4); p += strlen(p); ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! ", last active %.12s\n", ctime(&cp->LastActive) + 4); p += strlen(p); if (cp->Waketime > Now.time) { ! (void)snprintf(p, sizeof(buff) - strlen(buff), ! "\tSleeping until %.12s\n", ctime(&cp->Waketime) + 4); p += strlen(p); } diff -Ncr ../inn-1.5.1.dist/innd/tcl.c ./innd/tcl.c *** ../inn-1.5.1.dist/innd/tcl.c Tue Dec 17 15:40:40 1996 --- ./innd/tcl.c Thu Jul 24 23:08:02 1997 *************** *** 162,168 **** { char buf[100]; ! sprintf(buf, "%08x", makechecksum(TCLCurrData->Body, &TCLCurrArticle->Data[TCLCurrArticle->Used] - TCLCurrData->Body)); --- 162,168 ---- { char buf[100]; ! snprintf(buf, sizeof(buff), "%08x", makechecksum(TCLCurrData->Body, &TCLCurrArticle->Data[TCLCurrArticle->Used] - TCLCurrData->Body)); diff -Ncr ../inn-1.5.1.dist/lib/Makefile ./lib/Makefile *** ../inn-1.5.1.dist/lib/Makefile Tue Dec 17 15:40:40 1996 --- ./lib/Makefile Fri Jul 25 16:50:45 1997 *************** *** 54,59 **** --- 54,60 ---- remopen.c resource.c sendarticle.c sendpass.c tempname.c \ waitnb.c wildmat.c \ xfopena.c xmalloc.c xmemerr.c xrealloc.c xwrite.c xwritev.c + OBJECTS = $(MISSING_OBJ) \ checkart.o cleanfrom.o clientactive.o clientlib.o closeonexec.o \ dbz.o defdist.o findheader.o genid.o getconfig.o getdtab.o \ *************** *** 62,67 **** --- 63,69 ---- remopen.o resource.o sendarticle.o sendpass.o tempname.o \ waitnb.o wildmat.o \ xfopena.o xmalloc.o xmemerr.o xrealloc.o xwrite.o xwritev.o + all: libinn.a diff -Ncr ../inn-1.5.1.dist/lib/clientactive.c ./lib/clientactive.c *** ../inn-1.5.1.dist/lib/clientactive.c Tue Dec 17 15:40:40 1996 --- ./lib/clientactive.c Fri Jul 25 11:49:38 1997 *************** *** 109,115 **** if (FromServer == NULL || ToServer == NULL) return NULL; ! (void)strcpy(CApathname, _PATH_TEMPACTIVE); (void)mktemp(CApathname); return CAfp = CA_listopen(CApathname, FromServer, ToServer, request); } --- 109,116 ---- if (FromServer == NULL || ToServer == NULL) return NULL; ! (void)strncpy(CApathname, _PATH_TEMPACTIVE, sizeof(CApathname) - 1); ! CApathname[sizeof(CApathname) - 1] = '\0'; (void)mktemp(CApathname); return CAfp = CA_listopen(CApathname, FromServer, ToServer, request); } diff -Ncr ../inn-1.5.1.dist/lib/clientlib.c ./lib/clientlib.c *** ../inn-1.5.1.dist/lib/clientlib.c Tue Dec 17 15:40:40 1996 --- ./lib/clientlib.c Thu Jul 24 23:12:35 1997 *************** *** 31,37 **** if ((p = GetConfigValue(_CONF_SERVER)) == NULL) return NULL; ! (void)strcpy(buff, p); return buff; } --- 31,38 ---- if ((p = GetConfigValue(_CONF_SERVER)) == NULL) return NULL; ! (void)strncpy(buff, p, sizeof(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; return buff; } *************** *** 59,66 **** put_server("mode reader"); if (get_server(line2, (int)sizeof line2) < 0) return -1; ! if (atoi(line2) != NNTP_BAD_COMMAND_VAL) ! (void)strcpy(ser_line, line2); /* Connected; return server's reply code. */ return atoi(ser_line); --- 60,69 ---- put_server("mode reader"); if (get_server(line2, (int)sizeof line2) < 0) return -1; ! if (atoi(line2) != NNTP_BAD_COMMAND_VAL) { ! (void)strncpy(ser_line, line2, sizeof(ser_line) - 1); ! ser_line[sizeof(ser_line) - 1] = '\0'; ! } /* Connected; return server's reply code. */ return atoi(ser_line); diff -Ncr ../inn-1.5.1.dist/lib/defdist.c ./lib/defdist.c *** ../inn-1.5.1.dist/lib/defdist.c Tue Dec 17 15:40:40 1996 --- ./lib/defdist.c Thu Jul 24 23:12:35 1997 *************** *** 51,57 **** /* We're probably nnrpd running on the server and the * file isn't installed. Oh well. */ return NULL; ! (void)strcpy(name, _PATH_TEMPACTIVE); (void)mktemp(name); if ((F = CA_listopen(name, FromServer, ToServer, "distrib.pats")) == NULL) --- 51,58 ---- /* We're probably nnrpd running on the server and the * file isn't installed. Oh well. */ return NULL; ! (void)strncpy(name, _PATH_TEMPACTIVE, sizeof(name) - 1); ! name[sizeof(name) - 1] = '\0'; (void)mktemp(name); if ((F = CA_listopen(name, FromServer, ToServer, "distrib.pats")) == NULL) diff -Ncr ../inn-1.5.1.dist/lib/genid.c ./lib/genid.c *** ../inn-1.5.1.dist/lib/genid.c Tue Dec 17 15:40:40 1996 --- ./lib/genid.c Thu Jul 24 23:12:35 1997 *************** *** 31,36 **** Radix32((unsigned long)getpid(), pid32); if ((p = GetFQDN()) == NULL) return NULL; ! (void)sprintf(buff, "<%s$%s$%d@%s>", sec32, pid32, ++count, p); return buff; } --- 31,37 ---- Radix32((unsigned long)getpid(), pid32); if ((p = GetFQDN()) == NULL) return NULL; ! (void)snprintf(buff, sizeof(buff), ! "<%s$%s$%d@%s>", sec32, pid32, ++count, p); return buff; } diff -Ncr ../inn-1.5.1.dist/lib/getfqdn.c ./lib/getfqdn.c *** ../inn-1.5.1.dist/lib/getfqdn.c Tue Dec 17 15:40:40 1996 --- ./lib/getfqdn.c Fri Jul 25 18:51:50 1997 *************** *** 46,53 **** * turn it on, but don't complain to me. */ if (strchr(hp->h_name, '.') == NULL) { /* Try to force DNS lookup if NIS/whatever gets in the way. */ ! (void)strncpy(temp, buff, sizeof buff); ! (void)strcat(temp, "."); hp = gethostbyname(temp); } #endif /* 0 */ --- 46,54 ---- * turn it on, but don't complain to me. */ if (strchr(hp->h_name, '.') == NULL) { /* Try to force DNS lookup if NIS/whatever gets in the way. */ ! (void)strncpy(temp, buff, sizeof(temp) - 1); ! temp[sizeof(temp) - 1] = '\0'; ! (void)strncat(temp, ".", sizeof(temp) - strlen(temp) - 1); hp = gethostbyname(temp); } #endif /* 0 */ *************** *** 55,61 **** /* First, see if the main name is a FQDN. It should be. */ if (hp != NULL && strchr(hp->h_name, '.') != NULL) { if (strlen(hp->h_name) < sizeof buff - 1) ! return strcpy(buff, hp->h_name); /* Doesn't fit; make sure we don't return bad data next time. */ buff[0] = '\0'; return hp->h_name; --- 56,62 ---- /* First, see if the main name is a FQDN. It should be. */ if (hp != NULL && strchr(hp->h_name, '.') != NULL) { if (strlen(hp->h_name) < sizeof buff - 1) ! return strcpy(buff, hp->h_name); /* safe -of */ /* Doesn't fit; make sure we don't return bad data next time. */ buff[0] = '\0'; return hp->h_name; *************** *** 67,73 **** if (strchr(p, '.') != NULL) { /* Deja-vous all over again. */ if (strlen(p) < sizeof buff - 1) ! return strcpy(buff, p); buff[0] = '\0'; return p ; } --- 68,74 ---- if (strchr(p, '.') != NULL) { /* Deja-vous all over again. */ if (strlen(p) < sizeof buff - 1) ! return strcpy(buff, p); /* safe -of */ buff[0] = '\0'; return p ; } *************** *** 78,84 **** if (strlen(buff) + 1 + strlen(p) > sizeof buff - 1) /* Doesn't fit. */ return NULL; ! (void)strcat(buff, "."); ! (void)strcat(buff, p); return buff; } --- 79,85 ---- if (strlen(buff) + 1 + strlen(p) > sizeof buff - 1) /* Doesn't fit. */ return NULL; ! (void)strncat(buff, ".", sizeof(buff) - strlen(buff) - 1); ! (void)strncat(buff, p, sizeof(buff) - strlen(buff) - 1); return buff; } diff -Ncr ../inn-1.5.1.dist/lib/getmodaddr.c ./lib/getmodaddr.c *** ../inn-1.5.1.dist/lib/getmodaddr.c Tue Dec 17 15:40:40 1996 --- ./lib/getmodaddr.c Fri Jul 25 11:20:07 1997 *************** *** 103,109 **** char buff[BUFSIZ]; char name[SMBUF]; ! (void)strcpy(name, group); address[0] = '\0'; if (FromServer==NULL || ToServer==NULL){ --- 103,110 ---- char buff[BUFSIZ]; char name[SMBUF]; ! (void)strncpy(name, group, sizeof(name) - 1); ! name[sizeof(name) - 1] = '\0'; address[0] = '\0'; if (FromServer==NULL || ToServer==NULL){ *************** *** 117,123 **** /* * Get a local copy of the moderators file from the server. */ ! (void)strcpy(GMApathname, _PATH_TEMPMODERATORS); (void)mktemp(GMApathname); GMAfp = GMA_listopen(GMApathname, FromServer, ToServer, "moderators"); } --- 118,125 ---- /* * Get a local copy of the moderators file from the server. */ ! (void)strncpy(GMApathname,_PATH_TEMPMODERATORS,sizeof(GMApathname) - 1); ! GMApathname[sizeof(GMApathname) - 1] = '\0'; (void)mktemp(GMApathname); GMAfp = GMA_listopen(GMApathname, FromServer, ToServer, "moderators"); } *************** *** 144,150 **** for (p = name; *p; p++) if (*p == '.') *p = '-'; ! (void)sprintf(address, save, name); break; } } --- 146,152 ---- for (p = name; *p; p++) if (*p == '.') *p = '-'; ! (void)snprintf(address, sizeof(address), save, name); break; } } *************** *** 161,166 **** for (p = name; *p; p++) if (*p == '.') *p = '-'; ! (void)sprintf(address, save, name); return address; } --- 163,168 ---- for (p = name; *p; p++) if (*p == '.') *p = '-'; ! (void)snprintf(address, sizeof(address), save, name); return address; } diff -Ncr ../inn-1.5.1.dist/lib/inndcomm.c ./lib/inndcomm.c *** ../inn-1.5.1.dist/lib/inndcomm.c Tue Dec 17 15:40:40 1996 --- ./lib/inndcomm.c Fri Jul 25 15:01:37 1997 *************** *** 59,65 **** int oerrno; /* Create a temporary name. */ ! (void)strcpy(ICCsockname, _PATH_TEMPSOCK); (void)mktemp(ICCsockname); if (unlink(ICCsockname) < 0 && errno != ENOENT) { ICCfailure = "unlink"; --- 59,66 ---- int oerrno; /* Create a temporary name. */ ! (void)strncpy(ICCsockname, _PATH_TEMPSOCK, sizeof(ICCsockname) - 1); ! ICCsockname[sizeof(ICCsockname) - 1] = '\0'; (void)mktemp(ICCsockname); if (unlink(ICCsockname) < 0 && errno != ENOENT) { ICCfailure = "unlink"; *************** *** 74,80 **** } (void)memset((POINTER)&ICCclient, 0, sizeof ICCclient); ICCclient.sun_family = AF_UNIX; ! (void)strcpy(ICCclient.sun_path, ICCsockname); mask = umask(0); if (bind(ICCfd, (struct sockaddr *)&ICCclient, AF_UNIX_SOCKSIZE(ICCclient)) < 0) { --- 75,82 ---- } (void)memset((POINTER)&ICCclient, 0, sizeof ICCclient); ICCclient.sun_family = AF_UNIX; ! (void)strncpy(ICCclient.sun_path,ICCsockname,sizeof(ICCclient.sun_path)-1); ! ICCclient.sun_path[sizeof(ICCclient.sun_path) - 1] = '\0'; mask = umask(0); if (bind(ICCfd, (struct sockaddr *)&ICCclient, AF_UNIX_SOCKSIZE(ICCclient)) < 0) { *************** *** 89,95 **** /* Name the server's socket. */ (void)memset((POINTER)&ICCserv, 0, sizeof ICCserv); ICCserv.sun_family = AF_UNIX; ! (void)strcpy(ICCserv.sun_path, _PATH_NEWSCONTROL); #else /* Make a named pipe and open it. */ mask = umask(0); --- 91,99 ---- /* Name the server's socket. */ (void)memset((POINTER)&ICCserv, 0, sizeof ICCserv); ICCserv.sun_family = AF_UNIX; ! (void)strncpy(ICCserv.sun_path, _PATH_NEWSCONTROL, ! sizeof(ICCserv.sun_path) - 1); ! ICCserv.sun_path[sizeof(ICCserv.sun_path) - 1] = '\0'; #else /* Make a named pipe and open it. */ mask = umask(0); *************** *** 184,190 **** char *argv[]; char **replyp; { ! char *buff; char *p; char *q; char save; --- 188,195 ---- char *argv[]; char **replyp; { ! char *buff ; ! char *ptr ; char *p; char *q; char save; *************** *** 222,253 **** if (replyp) *replyp = NULL; ! buff += HEADER_SIZE; /* Advance to leave space for length + protocol version info. */ /* Format the message. */ ! (void)sprintf(buff, "%s%c%c", ICCsockname, SC_SEP, cmd); ! for (p = buff + strlen(buff), i = 0; (q = argv[i]) != NULL; i++) { *p++ = SC_SEP; ! p += strlen(strcpy(p, q)); } /* Send message. */ ICCfailure = NULL; ! len = p - buff + HEADER_SIZE ; rlen = htons (len) ; /* now stick in the protocol version and the length. */ - buff -= HEADER_SIZE; protocol = ICC_PROTOCOL_1 ; ! memcpy (buff,&protocol,sizeof (protocol)) ; ! buff += sizeof (protocol) ; ! memcpy (buff,&rlen,sizeof (rlen)) ; ! buff += sizeof (rlen) ; ! ! buff -= HEADER_SIZE ; #if defined(DO_HAVE_UNIX_DOMAIN) if (sendto(ICCfd, buff, len, 0, --- 227,259 ---- if (replyp) *replyp = NULL; ! ptr = buff + HEADER_SIZE; /* Advance to leave space for length + protocol version info. */ /* Format the message. */ ! (void)sprintf(ptr, "%s%c%c", ICCsockname, SC_SEP, cmd); /* safe -of */ ! for (p = ptr + strlen(ptr), i = 0; (q = argv[i]) != NULL; i++) { *p++ = SC_SEP; ! *p = '\0'; /* make sure buff is null-terminated so strlen below will work! */ ! strncpy(p, q, bufsiz - strlen(ptr) - HEADER_SIZE - 1); ! buff[bufsiz - 1] = '\0'; ! p += strlen(p); } /* Send message. */ ICCfailure = NULL; ! len = p - buff ; rlen = htons (len) ; /* now stick in the protocol version and the length. */ + ptr = buff ; protocol = ICC_PROTOCOL_1 ; ! memcpy (ptr,&protocol,sizeof (protocol)) ; ! ptr += sizeof (protocol) ; ! memcpy (ptr,&rlen,sizeof (rlen)) ; ! ptr += sizeof (rlen) ; #if defined(DO_HAVE_UNIX_DOMAIN) if (sendto(ICCfd, buff, len, 0, diff -Ncr ../inn-1.5.1.dist/lib/innvers.c ./lib/innvers.c *** ../inn-1.5.1.dist/lib/innvers.c Tue Dec 17 15:40:40 1996 --- ./lib/innvers.c Thu Jul 24 23:12:35 1997 *************** *** 27,44 **** if (buff[0] == '\0') { p = buff; ! p += strlen(strcpy(p, "INN")); *p++ = ' '; ! p += strlen(strcpy(p, RELEASE)); *p++ = '.'; ! p += strlen(strcpy(p, PATCHLEVEL)); *p++ = ' '; ! p += strlen(strcpy(p, DATE)); q = LOCAL_STRING; if (*q) { *p++ = ' '; *p++ = '('; ! p += strlen(strcpy(p, q)); *p++ = ')'; } } --- 27,44 ---- if (buff[0] == '\0') { p = buff; ! p += strlen(strcpy(p, "INN")); /* safe -of */ *p++ = ' '; ! p += strlen(strcpy(p, RELEASE)); /* safe -of */ *p++ = '.'; ! p += strlen(strcpy(p, PATCHLEVEL)); /* safe -of */ *p++ = ' '; ! p += strlen(strcpy(p, DATE)); /* safe -of */ q = LOCAL_STRING; if (*q) { *p++ = ' '; *p++ = '('; ! p += strlen(strcpy(p, q)); /* safe -of */ *p++ = ')'; } } diff -Ncr ../inn-1.5.1.dist/lib/localopen.c ./lib/localopen.c *** ../inn-1.5.1.dist/lib/localopen.c Tue Dec 17 15:40:40 1996 --- ./lib/localopen.c Thu Jul 24 23:12:35 1997 *************** *** 44,50 **** /* Connect to the server. */ (void)memset((POINTER)&server, 0, sizeof server); server.sun_family = AF_UNIX; ! (void)strcpy(server.sun_path, _PATH_NNTPCONNECT); if (connect(i, (struct sockaddr *)&server, AF_UNIX_SOCKSIZE(server)) < 0) { oerrno = errno; (void)close(i); --- 44,51 ---- /* Connect to the server. */ (void)memset((POINTER)&server, 0, sizeof server); server.sun_family = AF_UNIX; ! (void)strncpy(server.sun_path,_PATH_NNTPCONNECT,sizeof(server.sun_path)-1); ! server.sun_path[sizeof(server.sun_path) - 1] = '\0'; if (connect(i, (struct sockaddr *)&server, AF_UNIX_SOCKSIZE(server)) < 0) { oerrno = errno; (void)close(i); diff -Ncr ../inn-1.5.1.dist/lib/lock.c ./lib/lock.c *** ../inn-1.5.1.dist/lib/lock.c Tue Dec 17 15:40:40 1996 --- ./lib/lock.c Thu Jul 24 23:12:35 1997 *************** *** 31,37 **** char buff[72]; int i; ! (void)sprintf(buff, COMMAND, "throttle", (long)getpid()); i = system(buff) >> 8; if (i) error("Can't lock"); --- 31,37 ---- char buff[72]; int i; ! (void)snprintf(buff, sizeof(buff), COMMAND, "throttle", (long)getpid()); i = system(buff) >> 8; if (i) error("Can't lock"); *************** *** 49,59 **** int i; if (IsLocked) { ! (void)sprintf(buff, COMMAND, "go", (long)getpid()); i = system(buff) >> 8; if (i) error("Can't reload"); ! (void)sprintf(buff, "ctlinnd go"); i = system(buff) >> 8; if (i) error("Can't unlock"); --- 49,59 ---- int i; if (IsLocked) { ! (void)snprintf(buff, sizeof(buff), COMMAND, "go", (long)getpid()); i = system(buff) >> 8; if (i) error("Can't reload"); ! (void)snprintf(buff, sizeof(buff), "ctlinnd go"); i = system(buff) >> 8; if (i) error("Can't unlock"); diff -Ncr ../inn-1.5.1.dist/lib/perl.c ./lib/perl.c *** ../inn-1.5.1.dist/lib/perl.c Tue Dec 17 15:40:40 1996 --- ./lib/perl.c Thu Jul 24 23:12:36 1997 *************** *** 180,187 **** /* If the reload failed we don't want the old definition hanging around. */ ! argv[0] = NEW (char,strlen (function) + strlen ("undef &%s")) ; ! sprintf (argv[0],"undef &%s",function) ; perl_call_argv ("_eval_",0,argv) ; if (SvTRUE(GvSV(errgv))) /* check $@ */ { --- 180,187 ---- /* If the reload failed we don't want the old definition hanging around. */ ! argv[0] = NEW (char,strlen (function) + strlen ("undef &%s") + 1) ; ! sprintf (argv[0],"undef &%s",function) ; /* safe -of */ perl_call_argv ("_eval_",0,argv) ; if (SvTRUE(GvSV(errgv))) /* check $@ */ { diff -Ncr ../inn-1.5.1.dist/lib/remopen.c ./lib/remopen.c *** ../inn-1.5.1.dist/lib/remopen.c Tue Dec 17 15:40:40 1996 --- ./lib/remopen.c Thu Jul 24 23:12:36 1997 *************** *** 154,160 **** if ((p = GetConfigValue(_CONF_SERVER)) == NULL) { if (errbuff) ! (void)strcpy(errbuff, "What server?"); return -1; } return NNTPconnect(p, FromServerp, ToServerp, errbuff); --- 154,160 ---- if ((p = GetConfigValue(_CONF_SERVER)) == NULL) { if (errbuff) ! (void)strcpy(errbuff, "What server?"); /* safe -of */ return -1; } return NNTPconnect(p, FromServerp, ToServerp, errbuff); *************** *** 186,192 **** int i; if (buff) ! (void)strcpy(buff, "Text unavailable"); if ((p = getserverbyfile(_PATH_SERVER)) == NULL) return -1; if ((i = server_init(p)) < 0) --- 186,192 ---- int i; if (buff) ! (void)strcpy(buff, "Text unavailable"); /* safe -of */ if ((p = getserverbyfile(_PATH_SERVER)) == NULL) return -1; if ((i = server_init(p)) < 0) diff -Ncr ../inn-1.5.1.dist/lib/snprintf.c ./lib/snprintf.c *** ../inn-1.5.1.dist/lib/snprintf.c Thu Jan 1 01:00:00 1970 --- ./lib/snprintf.c Thu Jul 24 23:14:59 1997 *************** *** 0 **** --- 1,319 ---- + #include + #include + #ifdef __STDC__ + # include + # define VA_LOCAL_DECL va_list ap; + # define VA_START(f) va_start(ap, f) + # define VA_END va_end(ap) + #else + # include + # define VA_LOCAL_DECL va_list ap; + # define VA_START(f) va_start(ap) + # define VA_END va_end(ap) + #endif + + /* + ** SNPRINTF, VSNPRINT -- counted versions of printf + ** + ** These versions have been grabbed off the net. They have been + ** cleaned up to compile properly and support for .precision and + ** %lx has been added. + */ + + #if !HASSNPRINTF + + /************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt (dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + **************************************************************/ + + /*static char _id[] = "$Id: snprintf.c,v 1.2 1995/10/09 11:19:47 roberto Exp $";*/ + static void dopr(); + static char *end; + static int SnprfOverflow; + + /* VARARGS3 */ + int + # ifdef __STDC__ + snprintf(char *str, size_t count, const char *fmt, ...) + # else + snprintf(str, count, fmt, va_alist) + char *str; + size_t count; + const char *fmt; + va_dcl + #endif + { + int len; + VA_LOCAL_DECL + + VA_START(fmt); + len = vsnprintf(str, count, fmt, ap); + VA_END; + return len; + } + + + # ifndef luna2 + int + vsnprintf(str, count, fmt, args) + char *str; + size_t count; + const char *fmt; + va_list args; + { + str[0] = 0; + end = str + count - 1; + SnprfOverflow = 0; + dopr( str, fmt, args ); + if (count > 0) + end[0] = 0; + return strlen(str); + } + + /* + * dopr(): poor man's version of doprintf + */ + + static void fmtstr __P((char *value, int ljust, int len, int zpad, int maxwidth)); + static void fmtnum __P((long value, int base, int dosign, int ljust, int len, int zpad)); + static void dostr __P(( char * , int )); + static char *output; + static void dopr_outch __P(( int c )); + + static void + dopr( buffer, format, args ) + char *buffer; + const char *format; + va_list args; + { + int ch; + long value; + int longflag = 0; + int pointflag = 0; + int maxwidth = 0; + char *strvalue; + int ljust; + int len; + int zpad; + + output = buffer; + while( (ch = *format++) ){ + switch( ch ){ + case '%': + ljust = len = zpad = maxwidth = 0; + longflag = pointflag = 0; + nextch: + ch = *format++; + switch( ch ){ + case 0: + dostr( "**end of format**" , 0); + return; + case '-': ljust = 1; goto nextch; + case '0': /* set zero padding if len not set */ + if(len==0 && !pointflag) zpad = '0'; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + if (pointflag) + maxwidth = maxwidth*10 + ch - '0'; + else + len = len*10 + ch - '0'; + goto nextch; + case '*': + if (pointflag) + maxwidth = va_arg( args, int ); + else + len = va_arg( args, int ); + goto nextch; + case '.': pointflag = 1; goto nextch; + case 'l': longflag = 1; goto nextch; + case 'u': case 'U': + /*fmtnum(value,base,dosign,ljust,len,zpad) */ + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 10,0, ljust, len, zpad ); break; + case 'o': case 'O': + /*fmtnum(value,base,dosign,ljust,len,zpad) */ + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 8,0, ljust, len, zpad ); break; + case 'd': case 'D': + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 10,1, ljust, len, zpad ); break; + case 'x': + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value, 16,0, ljust, len, zpad ); break; + case 'X': + if( longflag ){ + value = va_arg( args, long ); + } else { + value = va_arg( args, int ); + } + fmtnum( value,-16,0, ljust, len, zpad ); break; + case 's': + strvalue = va_arg( args, char *); + if (maxwidth > 0 || !pointflag) { + if (pointflag && len > maxwidth) + len = maxwidth; /* Adjust padding */ + fmtstr( strvalue,ljust,len,zpad, maxwidth); + } + break; + case 'c': + ch = va_arg( args, int ); + dopr_outch( ch ); break; + case '%': dopr_outch( ch ); continue; + default: + dostr( "???????" , 0); + } + break; + default: + dopr_outch( ch ); + break; + } + } + *output = 0; + } + + static void + fmtstr( value, ljust, len, zpad, maxwidth ) + char *value; + int ljust, len, zpad, maxwidth; + { + int padlen, strlen; /* amount to pad */ + + if( value == 0 ){ + value = ""; + } + for( strlen = 0; value[strlen]; ++ strlen ); /* strlen */ + if (strlen > maxwidth && maxwidth) + strlen = maxwidth; + padlen = len - strlen; + if( padlen < 0 ) padlen = 0; + if( ljust ) padlen = -padlen; + while( padlen > 0 ) { + dopr_outch( ' ' ); + --padlen; + } + dostr( value, maxwidth ); + while( padlen < 0 ) { + dopr_outch( ' ' ); + ++padlen; + } + } + + static void + fmtnum( value, base, dosign, ljust, len, zpad ) + long value; + int base, dosign, ljust, len, zpad; + { + int signvalue = 0; + unsigned long uvalue; + char convert[20]; + int place = 0; + int padlen = 0; /* amount to pad */ + int caps = 0; + + /* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n", + value, base, dosign, ljust, len, zpad )); */ + uvalue = value; + if( dosign ){ + if( value < 0 ) { + signvalue = '-'; + uvalue = -value; + } + } + if( base < 0 ){ + caps = 1; + base = -base; + } + do{ + convert[place++] = + (caps? "0123456789ABCDEF":"0123456789abcdef") + [uvalue % (unsigned)base ]; + uvalue = (uvalue / (unsigned)base ); + }while(uvalue); + convert[place] = 0; + padlen = len - place; + if( padlen < 0 ) padlen = 0; + if( ljust ) padlen = -padlen; + /* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n", + convert,place,signvalue,padlen)); */ + if( zpad && padlen > 0 ){ + if( signvalue ){ + dopr_outch( signvalue ); + --padlen; + signvalue = 0; + } + while( padlen > 0 ){ + dopr_outch( zpad ); + --padlen; + } + } + while( padlen > 0 ) { + dopr_outch( ' ' ); + --padlen; + } + if( signvalue ) dopr_outch( signvalue ); + while( place > 0 ) dopr_outch( convert[--place] ); + while( padlen < 0 ){ + dopr_outch( ' ' ); + ++padlen; + } + } + + static void + dostr( str , cut) + char *str; + int cut; + { + if (cut) { + while(*str && cut-- > 0) dopr_outch(*str++); + } else { + while(*str) dopr_outch(*str++); + } + } + + static void + dopr_outch( c ) + int c; + { + #if 0 + if( iscntrl(c) && c != '\n' && c != '\t' ){ + c = '@' + (c & 0x1F); + if( end == 0 || output < end ) + *output++ = '^'; + } + #endif + if( end == 0 || output < end ) + *output++ = c; + else + SnprfOverflow++; + } + + # endif /* !luna2 */ + + #endif /* !HASSNPRINTF */ diff -Ncr ../inn-1.5.1.dist/lib/strerror.c ./lib/strerror.c *** ../inn-1.5.1.dist/lib/strerror.c Tue Dec 17 15:40:40 1996 --- ./lib/strerror.c Thu Jul 24 23:12:36 1997 *************** *** 23,28 **** if (e >= 0 && e < sys_nerr) return sys_errlist[e]; ! (void)sprintf(buff, "Error code %d\n", e); return buff; } --- 23,28 ---- if (e >= 0 && e < sys_nerr) return sys_errlist[e]; ! (void)sprintf(buff, "Error code %d\n", e); /* safe -of */ return buff; } diff -Ncr ../inn-1.5.1.dist/lib/tempname.c ./lib/tempname.c *** ../inn-1.5.1.dist/lib/tempname.c Tue Dec 17 15:40:40 1996 --- ./lib/tempname.c Thu Jul 24 23:12:36 1997 *************** *** 56,62 **** (void)time(&now); now &= 0xFFFFFFFF; ! (void)sprintf(buff, "%s/%08lxXXXXXX", dir, (long)now); (void)mktemp(buff); } --- 56,65 ---- (void)time(&now); now &= 0xFFFFFFFF; ! /* ! * Every reference to TempName passes a buffer of size BUFSIZ ! */ ! (void)snprintf(buff, BUFSIZ, "%s/%08lxXXXXXX", dir, (long)now); (void)mktemp(buff); } diff -Ncr ../inn-1.5.1.dist/nnrpd/Makefile ./nnrpd/Makefile *** ../inn-1.5.1.dist/nnrpd/Makefile Tue Dec 17 15:40:40 1996 --- ./nnrpd/Makefile Sat Jul 26 01:13:18 1997 *************** *** 36,41 **** --- 36,43 ---- LIBS = -lutil LIBNEWS = ../libinn.a LINTLIB = ../llib-linn.ln + ## =()@>()= + LIBSNPRINTF = SOURCES = \ article.c group.c commands.c misc.c newnews.c nnrpd.c \ *************** *** 63,71 **** tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c nnrpd.h ../include/*.h ! nnrpd: $(P) $(OBJECTS) $(LIBNEWS) @rm -f $@ ! $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBNEWS) $(LIBS) $(PERLLIB) lint: $(ALL) @rm -f lint --- 65,73 ---- tags ctags: $(SOURCES) $(CTAGS) $(SOURCES) ../lib/*.c nnrpd.h ../include/*.h ! nnrpd: $(P) $(OBJECTS) $(LIBNEWS) $(LIBSNPRINTF) @rm -f $@ ! $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBNEWS) $(LIBSNPRINTF) $(LIBS) $(PERLLIB) lint: $(ALL) @rm -f lint *************** *** 75,80 **** --- 77,84 ---- (cd ../lib ; $(MAKE) ../include/dbz.h) $(LIBNEWS) $(LINTLIB): (cd ../lib ; $(MAKE) install ) + ../libsnprintf.a: + (cd ../snprintf ; $(MAKE) install) ## Profiling. The rules are a bit brute-force, but good enough. profiled: nnrpdp diff -Ncr ../inn-1.5.1.dist/nnrpd/article.c ./nnrpd/article.c *** ../inn-1.5.1.dist/nnrpd/article.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/article.c Thu Jul 24 23:13:29 1997 *************** *** 146,152 **** continue; *q++ = '\0'; if (caseEQ(p, "Message-ID:")) { ! (void)strcpy(id, q); break; } } --- 146,153 ---- continue; *q++ = '\0'; if (caseEQ(p, "Message-ID:")) { ! (void)strncpy(id, q, BIG_BUFFER - 1); ! id[BIG_BUFFER - 1] = '\0'; break; } } *************** *** 169,176 **** /* Re-use article if it's the same one. */ if (ARTqp != NULL) { if (save_artnum == atol(name) && QIOrewind(ARTqp) != -1) { ! if (id) ! (void)strcpy(id, save_artid); return TRUE; } QIOclose(ARTqp); --- 170,179 ---- /* Re-use article if it's the same one. */ if (ARTqp != NULL) { if (save_artnum == atol(name) && QIOrewind(ARTqp) != -1) { ! if (id) { ! (void)strncpy(id, save_artid, BIG_BUFFER - 1); ! id[BIG_BUFFER - 1] = '\0'; ! } return TRUE; } QIOclose(ARTqp); *************** *** 188,194 **** save_artnum = atol(name); ARTgetmsgid(ARTqp, save_artid); ! (void)strcpy(id, save_artid); return TRUE; } --- 191,198 ---- save_artnum = atol(name); ARTgetmsgid(ARTqp, save_artid); ! (void)strncpy(id, save_artid, BIG_BUFFER - 1); ! id[BIG_BUFFER - 1] = '\0'; return TRUE; } *************** *** 475,488 **** Reply("%s\r\n", ARTnocurrart); return; } ! (void)sprintf(buff, "%ld", ARTnumbers[ARTindex]); } else { if (strspn(av[1], "0123456789") != strlen(av[1])) { Reply("%s\r\n", ARTnoartingroup); return; } ! (void)strcpy(buff, av[1]); } /* Move forward until we can find one. */ --- 479,493 ---- Reply("%s\r\n", ARTnocurrart); return; } ! (void)snprintf(buff, sizeof(buff), "%ld", ARTnumbers[ARTindex]); } else { if (strspn(av[1], "0123456789") != strlen(av[1])) { Reply("%s\r\n", ARTnoartingroup); return; } ! (void)strncpy(buff, av[1], sizeof(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; } /* Move forward until we can find one. */ *************** *** 491,497 **** Reply("%s\r\n", ARTnoartingroup); return; } ! (void)sprintf(buff, "%ld", ARTnumbers[ARTindex]); } Reply("%d %s %s %s\r\n", what->ReplyCode, buff, idbuff, what->Item); --- 496,502 ---- Reply("%s\r\n", ARTnoartingroup); return; } ! (void)snprintf(buff, sizeof(buff), "%ld", ARTnumbers[ARTindex]); } Reply("%d %s %s %s\r\n", what->ReplyCode, buff, idbuff, what->Item); *************** *** 551,557 **** return; } ! (void)sprintf(buff, "%ld", ARTnumbers[ARTindex]); while (!ARTopen(buff, idbuff)) { ARTindex += delta; if (ARTindex < 0 || ARTindex >= ARTsize) { --- 556,562 ---- return; } ! (void)snprintf(buff, sizeof(buff), "%ld", ARTnumbers[ARTindex]); while (!ARTopen(buff, idbuff)) { ARTindex += delta; if (ARTindex < 0 || ARTindex >= ARTsize) { *************** *** 559,565 **** ARTindex = save; return; } ! (void)sprintf(buff, "%ld", ARTnumbers[ARTindex]); } Reply("%d %s %s Article retrieved; request text separately.\r\n", --- 564,570 ---- ARTindex = save; return; } ! (void)snprintf(buff, sizeof(buff), "%ld", ARTnumbers[ARTindex]); } Reply("%d %s %s Article retrieved; request text separately.\r\n", *************** *** 606,612 **** /* Lines estimation taken from Tor Lillqvist 's * posting in * news.sysadmin. */ ! (void)sprintf(buff, "%d", (int)(6.4e-8 * Sb.st_size * Sb.st_size + 0.023 * Sb.st_size - 12)); return buff; } --- 611,617 ---- /* Lines estimation taken from Tor Lillqvist 's * posting in * news.sysadmin. */ ! (void)snprintf(buff, sizeof(buff), "%d", (int)(6.4e-8 * Sb.st_size * Sb.st_size + 0.023 * Sb.st_size - 12)); return buff; } *************** *** 741,747 **** OVERline = NULL; OVERarticle = 0; ! (void)sprintf(name, "%s/%s/%s", _PATH_OVERVIEWDIR, GRPlast, _PATH_OVERVIEW); OVERqp = QIOopen(name, QIO_BUFFER); return OVERqp != NULL; } --- 746,753 ---- OVERline = NULL; OVERarticle = 0; ! (void)snprintf(name, sizeof(name), "%s/%s/%s", _PATH_OVERVIEWDIR, ! GRPlast, _PATH_OVERVIEW); OVERqp = QIOopen(name, QIO_BUFFER); return OVERqp != NULL; } *************** *** 855,861 **** /* Now append it. */ hp->Length += strlen(p); RENEW(hp->Header, char, hp->Length + 1); ! (void)strcat(hp->Header, p); for (p = hp->Header; *p; p++) if (*p == '\t' || *p == '\n') *p = ' '; --- 861,867 ---- /* Now append it. */ hp->Length += strlen(p); RENEW(hp->Header, char, hp->Length + 1); ! (void)strcat(hp->Header, p); /* safe -of */ for (p = hp->Header; *p; p++) if (*p == '\t' || *p == '\n') *p = ' '; *************** *** 889,895 **** hp->Length = size; RENEW(hp->Header, char, hp->Length + 1); } ! (void)strcpy(hp->Header, p); for (p = hp->Header; *p; p++) if (*p == '\t' || *p == '\n') *p = ' '; --- 895,901 ---- hp->Length = size; RENEW(hp->Header, char, hp->Length + 1); } ! (void)strcpy(hp->Header, p); /* safe -of */ for (p = hp->Header; *p; p++) if (*p == '\t' || *p == '\n') *p = ' '; *************** *** 919,925 **** else t = lines; ! (void)sprintf(value, "%ld", t); size = strlen(value); if (hp->Length == 0) { hp->Length = size; --- 925,931 ---- else t = lines; ! (void)snprintf(value, sizeof(value), "%ld", t); size = strlen(value); if (hp->Length == 0) { hp->Length = size; *************** *** 929,935 **** hp->Length = size; RENEW(hp->Header, char, hp->Length + 1); } ! (void)strcpy(hp->Header, value); hp->HasHeader = TRUE; } if (hp->HasHeader) --- 935,941 ---- hp->Length = size; RENEW(hp->Header, char, hp->Length + 1); } ! (void)strcpy(hp->Header, value); /* safe -of */ hp->HasHeader = TRUE; } if (hp->HasHeader) *************** *** 947,959 **** } /* Glue all the fields together. */ ! p = buff + strlen(strcpy(buff, name)); for (hp = Headers, i = ARTfieldsize; --i >= 0; hp++) { if (hp->NeedsHeader && !hp->HasHeader) continue; *p++ = '\t'; if (hp->HasHeader) ! p += strlen(strcpy(p, hp->Header)); } *p = '\0'; --- 953,965 ---- } /* Glue all the fields together. */ ! p = buff + strlen(strcpy(buff, name)); /* seems safe -of */ for (hp = Headers, i = ARTfieldsize; --i >= 0; hp++) { if (hp->NeedsHeader && !hp->HasHeader) continue; *p++ = '\t'; if (hp->HasHeader) ! p += strlen(strcpy(p, hp->Header)); /* seems safe -of */ } *p = '\0'; *************** *** 1032,1038 **** continue; } ! (void)sprintf(buff, "%ld", i); if ((qp = QIOopen(buff, QIO_BUFFER)) == NULL) continue; p = GetHeader(qp, av[1], IsLines); --- 1038,1044 ---- continue; } ! (void)snprintf(buff, sizeof(buff), "%ld", i); if ((qp = QIOopen(buff, QIO_BUFFER)) == NULL) continue; p = GetHeader(qp, av[1], IsLines); *************** *** 1083,1089 **** continue; } ! (void)sprintf(buff, "%ld", i); if ((p = OVERgen(buff)) != NULL) Printf("%s\r\n", p); } --- 1089,1095 ---- continue; } ! (void)snprintf(buff, sizeof(buff), "%ld", i); if ((p = OVERgen(buff)) != NULL) Printf("%s\r\n", p); } *************** *** 1165,1171 **** continue; } ! (void)sprintf(buff, "%ld", i); if ((qp = QIOopen(buff, QIO_BUFFER)) == NULL) continue; if ((p = GetHeader(qp, av[1], FALSE)) == NULL) --- 1171,1177 ---- continue; } ! (void)snprintf(buff, sizeof(buff), "%ld", i); if ((qp = QIOopen(buff, QIO_BUFFER)) == NULL) continue; if ((p = GetHeader(qp, av[1], FALSE)) == NULL) diff -Ncr ../inn-1.5.1.dist/nnrpd/commands.c ./nnrpd/commands.c *** ../inn-1.5.1.dist/nnrpd/commands.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/commands.c Fri Jul 25 12:37:22 1997 *************** *** 86,92 **** return(-1); } ! (void)sprintf(path, "%s/%s", _PATH_AUTHDIR, av[0]); #if !defined(S_IXUSR) && defined(_S_IXUSR) #define S_IXUSR _S_IXUSR --- 86,92 ---- return(-1); } ! (void)snprintf(path, sizeof(path), "%s/%s", _PATH_AUTHDIR, av[0]); #if !defined(S_IXUSR) && defined(_S_IXUSR) #define S_IXUSR _S_IXUSR *************** *** 156,162 **** PERMauthstring = malloc(strlen(path) + 1); if (PERMauthstring) ! strcpy(PERMauthstring, path); while( pid != waitnb(&status) ); --- 156,162 ---- PERMauthstring = malloc(strlen(path) + 1); if (PERMauthstring) ! strcpy(PERMauthstring, path); /* safe -of */ while( pid != waitnb(&status) ); *************** *** 170,178 **** PERMcanread = strchr(fields[1], 'R') != NULL; PERMcanpost = strchr(fields[1], 'P') != NULL; ! sprintf(PERMuser, "%s@%s", fields[2], fields[0]); ! (void)strcpy(PERMpass, fields[3]); ! (void)strcpy(accesslist, fields[4]); /*(void)strcpy(writeaccess, fields[5]); future work? */ /*for (i = 0; fields[i] && i < 6; i++) --- 170,180 ---- PERMcanread = strchr(fields[1], 'R') != NULL; PERMcanpost = strchr(fields[1], 'P') != NULL; ! snprintf(PERMuser, sizeof(PERMuser), "%s@%s", fields[2], fields[0]); ! (void)strncpy(PERMpass, fields[3], sizeof(PERMpass) - 1); ! PERMpass[sizeof(PERMpass) - 1] = '\0'; ! (void)strncpy(accesslist, fields[4], BIG_BUFFER - 1); ! accesslist[BIG_BUFFER - 1] = '\0'; /*(void)strcpy(writeaccess, fields[5]); future work? */ /*for (i = 0; fields[i] && i < 6; i++) *************** *** 194,200 **** if (caseEQ(av[1], "generic")) { char *logrec = Glom(av); ! strcpy(PERMuser, ""); switch (PERMgeneric(av, accesslist)) { case 1: --- 196,202 ---- if (caseEQ(av[1], "generic")) { char *logrec = Glom(av); ! strcpy(PERMuser, ""); /* safe -of */ switch (PERMgeneric(av, accesslist)) { case 1: diff -Ncr ../inn-1.5.1.dist/nnrpd/group.c ./nnrpd/group.c *** ../inn-1.5.1.dist/nnrpd/group.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/group.c Thu Jul 24 23:13:29 1997 *************** *** 279,285 **** Printf("%d No group specified\r\n", NNTP_XGTITLE_BAD); return; } ! (void)strcpy(buff, GRPlast); for (p = buff; *p; p++) if (*p == '/') *p = '.'; --- 279,286 ---- Printf("%d No group specified\r\n", NNTP_XGTITLE_BAD); return; } ! (void)strncpy(buff, GRPlast, sizeof(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; for (p = buff; *p; p++) if (*p == '/') *p = '.'; *************** *** 312,318 **** GRPreport(); /* Make the group name a directory name. */ ! (void)strcpy(buff, group); for (p = buff; *p; p++) if (*p == '.') *p = '/'; --- 313,320 ---- GRPreport(); /* Make the group name a directory name. */ ! (void)strncpy(buff, group, sizeof(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; for (p = buff; *p; p++) if (*p == '.') *p = '/'; *************** *** 321,327 **** (void)time(&now); if (!EQ(buff, GRPlast) || now > last_time + NNRP_RESCAN_DELAY) { GRPscandir(buff); ! (void)strcpy(GRPlast, buff); last_time = now; } --- 323,330 ---- (void)time(&now); if (!EQ(buff, GRPlast) || now > last_time + NNRP_RESCAN_DELAY) { GRPscandir(buff); ! (void)strncpy(GRPlast, buff, sizeof(GRPlast) - 1); ! GRPlast[sizeof(GRPlast) - 1] = '\0'; last_time = now; } *************** *** 357,363 **** char buff[SPOOLNAMEBUFF]; if (GRPlast[0] && GRParticles != 0) { ! (void)strcpy(buff, GRPlast); for (p = buff; *p; p++) if (*p == '/') *p = '.'; --- 360,367 ---- char buff[SPOOLNAMEBUFF]; if (GRPlast[0] && GRParticles != 0) { ! (void)strncpy(buff, GRPlast, sizeof(buff) - 1); ! buff[sizeof(buff) - 1] = '\0'; for (p = buff; *p; p++) if (*p == '/') *p = '.'; diff -Ncr ../inn-1.5.1.dist/nnrpd/misc.c ./nnrpd/misc.c *** ../inn-1.5.1.dist/nnrpd/misc.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/misc.c Thu Jul 24 23:13:29 1997 *************** *** 43,49 **** line++; i = strlen(line); p = NEW(char, i + 1); ! (void)strcpy(p, line); /* Allocate worst-case amount of space. */ for (*argvp = argv = NEW(char*, i + 2); *p; ) { --- 43,49 ---- line++; i = strlen(line); p = NEW(char, i + 1); ! (void)strcpy(p, line); /* safe -of */ /* Allocate worst-case amount of space. */ for (*argvp = argv = NEW(char*, i + 2); *p; ) { *************** *** 82,88 **** for (save = p = NEW(char, i + 1), v = av; *v; v++) { if (p > save) *p++ = ' '; ! p += strlen(strcpy(p, *v)); } return save; --- 82,88 ---- for (save = p = NEW(char, i + 1), v = av; *v; v++) { if (p > save) *p++ = ' '; ! p += strlen(strcpy(p, *v)); /* safe -of */ } return save; *************** *** 195,201 **** if (strlen(av1) != 6 || strlen(av2) != 6) return -1; ! (void)sprintf(buff, "%s%s", av1, av2); for (p = buff; *p; p++) if (!CTYPE(isdigit, *p)) return -1; --- 195,201 ---- if (strlen(av1) != 6 || strlen(av2) != 6) return -1; ! (void)snprintf(buff, sizeof(buff), "%s%s", av1, av2); for (p = buff; *p; p++) if (!CTYPE(isdigit, *p)) return -1; *************** *** 335,341 **** /* Want the full data? */ if (fulldata) { ! (void)strcpy(path, save); for (p = path; *p; p++) if (*p == '.') *p = '/'; --- 335,342 ---- /* Want the full data? */ if (fulldata) { ! (void)strncpy(path, save, sizeof(path) - 1); ! path[sizeof(path) - 1] = '\0'; for (p = path; *p; p++) if (*p == '.') *p = '/'; *************** *** 349,355 **** for (p = save; *p; p++) if (*p == '.') *p = '/'; ! (void)sprintf(path, "%s/%s", _PATH_SPOOL, save); if (stat(path, &Sb) >= 0) return path; if (q == NULL) --- 350,356 ---- for (p = save; *p; p++) if (*p == '.') *p = '/'; ! (void)snprintf(path, sizeof(path), "%s/%s", _PATH_SPOOL, save); if (stat(path, &Sb) >= 0) return path; if (q == NULL) diff -Ncr ../inn-1.5.1.dist/nnrpd/newnews.c ./nnrpd/newnews.c *** ../inn-1.5.1.dist/nnrpd/newnews.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/newnews.c Thu Jul 24 23:13:29 1997 *************** *** 44,50 **** /* Loop through the file list, trying to open one of them.. */ for (save = files[0]; *files; files++) { /* this next line makes me nervous--from unoff4... */ ! (void)sprintf(buff, "%s/%s/%s", _PATH_SPOOL, files[0], files[0] + strlen(files[0]) + 1); for (p = &buff[STRLEN(_PATH_SPOOL)]; *p; p++) if (*p == '.') --- 44,50 ---- /* Loop through the file list, trying to open one of them.. */ for (save = files[0]; *files; files++) { /* this next line makes me nervous--from unoff4... */ ! (void)snprintf(buff, sizeof(buff), "%s/%s/%s", _PATH_SPOOL, files[0], files[0] + strlen(files[0]) + 1); for (p = &buff[STRLEN(_PATH_SPOOL)]; *p; p++) if (*p == '.') *************** *** 203,209 **** return; } ! (void)sprintf(line, "%s %s %s %s %s", av[1], av[2], av[3], (ac >= 5 && *av[4] == 'G') ? "GMT" : "local", (ac >= 5 && *av[ac - 1] == '<') ? av[ac - 1] : "none"); --- 203,209 ---- return; } ! (void)snprintf(line, sizeof(line), "%s %s %s %s %s", av[1], av[2], av[3], (ac >= 5 && *av[4] == 'G') ? "GMT" : "local", (ac >= 5 && *av[ac - 1] == '<') ? av[ac - 1] : "none"); diff -Ncr ../inn-1.5.1.dist/nnrpd/nnrpd.c ./nnrpd/nnrpd.c *** ../inn-1.5.1.dist/nnrpd/nnrpd.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/nnrpd.c Fri Jul 25 18:54:45 1997 *************** *** 223,242 **** p = TITLEstart; *p++ = '-'; ! (void)sprintf(buff, "%s %s", ClientHost, what); i = strlen(buff); if (i > TITLEend - p - 2) { i = TITLEend - p - 2; buff[i] = '\0'; } ! (void)strcpy(p, buff); for (p += i; p < TITLEend; ) *p++ = ' '; #else char buff[BUFSIZ]; union pstun un; ! (void)sprintf(buff, "(nnrpd) %s %s", ClientHost, what); (void)pstat(PSTAT_SETCMD, un, strlen(buff), 0, 0); #endif /* defined(HPUX) */ #endif /* defined(DO_HAVE_SETPROCTITLE) */ --- 223,242 ---- p = TITLEstart; *p++ = '-'; ! (void)snprintf(buff, sizeof(buff), "%s %s", ClientHost, what); i = strlen(buff); if (i > TITLEend - p - 2) { i = TITLEend - p - 2; buff[i] = '\0'; } ! (void)strcpy(p, buff); /* safe -of */ for (p += i; p < TITLEend; ) *p++ = ' '; #else char buff[BUFSIZ]; union pstun un; ! (void)snprintf(buff, sizeof(buff), "(nnrpd) %s %s", ClientHost, what); (void)pstat(PSTAT_SETCMD, un, strlen(buff), 0, 0); #endif /* defined(HPUX) */ #endif /* defined(DO_HAVE_SETPROCTITLE) */ *************** *** 263,269 **** /* Get the official hostname, store it away. */ if ((hp = gethostbyaddr((char *)ap, sizeof *ap, AF_INET)) == NULL) return FALSE; ! (void)strncpy(hostname, hp->h_name, i); hostname[i - 1] = '\0'; /* Get addresses for this host. */ --- 263,269 ---- /* Get the official hostname, store it away. */ if ((hp = gethostbyaddr((char *)ap, sizeof *ap, AF_INET)) == NULL) return FALSE; ! (void)strncpy(hostname, hp->h_name, i - 1); hostname[i - 1] = '\0'; /* Get addresses for this host. */ *************** *** 289,296 **** /* Only needed for misconfigured YP/NIS systems. */ if (strchr(hostname, '.') == NULL && (p = GetConfigValue(_CONF_DOMAIN)) != NULL) { ! (void)strcat(hostname, "."); ! (void)strcat(hostname, p); } /* Make all lowercase, for wildmat. */ --- 289,296 ---- /* Only needed for misconfigured YP/NIS systems. */ if (strchr(hostname, '.') == NULL && (p = GetConfigValue(_CONF_DOMAIN)) != NULL) { ! (void)strncat(hostname, ".", i - strlen(hostname) - 1); ! (void)strncat(hostname, p, i - strlen(hostname) - 1); } /* Make all lowercase, for wildmat. */ *************** *** 365,373 **** PERMcanread = strchr(fields[1], 'R') != NULL; PERMcanpost = strchr(fields[1], 'P') != NULL; ! (void)strcpy(PERMuser, user ? user : fields[2]); ! (void)strcpy(PERMpass, pass ? pass : fields[3]); ! (void)strcpy(accesslist, fields[4]); found = TRUE; } (void)fclose(F); --- 365,376 ---- PERMcanread = strchr(fields[1], 'R') != NULL; PERMcanpost = strchr(fields[1], 'P') != NULL; ! (void)strncpy(PERMuser, user ? user : fields[2], sizeof(PERMuser) - 1); ! PERMuser[sizeof(PERMuser) - 1] = '\0'; ! (void)strncpy(PERMpass, pass ? pass : fields[3], sizeof(PERMpass) - 1); ! PERMpass[sizeof(PERMpass) - 1] = '\0'; ! (void)strncpy(accesslist, fields[4], BIG_BUFFER - 1); ! accesslist[BIG_BUFFER - 1] = '\0'; found = TRUE; } (void)fclose(F); *************** *** 397,415 **** Printf("%d I can't get your name. Goodbye.\r\n", NNTP_ACCESS_VAL); ExitWithStats(1); } ! (void)strcpy(ClientHost, "stdin"); } #if defined(AF_DECnet) else if (sin.sin_family == AF_DECnet) { char *p, *MyDECnetDomain; ! (void) strcpy(ClientHost, getenv("REMNODE")); for (p = ClientHost; *p; p++) if (CTYPE(isupper, *p)) *p = tolower(*p); #define _CONF_DECNETDOMAIN "decnetdomain" if ((MyDECnetDomain = GetConfigValue(_CONF_DECNETDOMAIN)) != NULL) { ! (void)strcat(ClientHost, "."); ! (void)strcat(ClientHost, MyDECnetDomain); } } #endif --- 400,421 ---- Printf("%d I can't get your name. Goodbye.\r\n", NNTP_ACCESS_VAL); ExitWithStats(1); } ! (void)strcpy(ClientHost, "stdin"); /* safe -of */ } #if defined(AF_DECnet) else if (sin.sin_family == AF_DECnet) { char *p, *MyDECnetDomain; ! (void) strncpy(ClientHost, getenv("REMNODE"), sizeof(ClientHost) - 1); ! ClientHost[sizeof(ClientHost) - 1] = '\0'; for (p = ClientHost; *p; p++) if (CTYPE(isupper, *p)) *p = tolower(*p); #define _CONF_DECNETDOMAIN "decnetdomain" if ((MyDECnetDomain = GetConfigValue(_CONF_DECNETDOMAIN)) != NULL) { ! (void)strncat(ClientHost, ".", sizeof(ClientHost) - ! strlen(ClientHost) - 1); ! (void)strncat(ClientHost, MyDECnetDomain, sizeof(ClientHost) - ! strlen(ClientHost) - 1); } } #endif *************** *** 424,444 **** /* Get client's name. */ #if defined(DO_NNRP_GETHOSTBYADDR) if (!Address2Name(&sin.sin_addr, ClientHost, sizeof ClientHost)) { ! (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr)); syslog(L_NOTICE, "? cant gethostbyaddr %s %m -- using IP address for access", ClientHost); } else { ClientAddr = buff; ! (void)strcpy(buff, inet_ntoa(sin.sin_addr)); } #else ! (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr)); #endif /* defined(DO_NNRP_GETHOSTBYADDR) */ } ! strncpy (LogName,ClientHost,sizeof(LogName)-1) ; syslog(L_NOTICE, "%s connect", ClientHost); if (!PERMinfile(ClientHost, ClientAddr, (char *)NULL, (char *)NULL, --- 430,451 ---- /* Get client's name. */ #if defined(DO_NNRP_GETHOSTBYADDR) if (!Address2Name(&sin.sin_addr, ClientHost, sizeof ClientHost)) { ! (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr)); /* safe -of */ syslog(L_NOTICE, "? cant gethostbyaddr %s %m -- using IP address for access", ClientHost); } else { ClientAddr = buff; ! (void)strcpy(buff, inet_ntoa(sin.sin_addr)); /* safe -of */ } #else ! (void)strcpy(ClientHost, inet_ntoa(sin.sin_addr)); /* safe -of */ #endif /* defined(DO_NNRP_GETHOSTBYADDR) */ } ! strncpy (LogName,ClientHost,sizeof(LogName) - 1) ; ! LogName[sizeof(LogName) - 1] = '\0'; syslog(L_NOTICE, "%s connect", ClientHost); if (!PERMinfile(ClientHost, ClientAddr, (char *)NULL, (char *)NULL, *************** *** 494,500 **** START_VARARG(fmt, vp, char*); /* Copy output, but strip trailing CR-LF. */ ! (void)vsprintf(buff, fmt, vp); p = buff + strlen(buff) - 1; while (p >= buff && (*p == '\n' || *p == '\r')) *p-- = '\0'; --- 501,507 ---- START_VARARG(fmt, vp, char*); /* Copy output, but strip trailing CR-LF. */ ! (void)vsnprintf(buff, sizeof(buff), fmt, vp); p = buff + strlen(buff) - 1; while (p >= buff && (*p == '\n' || *p == '\r')) *p-- = '\0'; *************** *** 606,612 **** } #endif /* NNRP_LOADLIMIT > 0 */ ! strcpy (LogName,"?") ; /* Ignore SIGPIPE, since we'll see closed connections with read. */ (void)signal(SIGPIPE, SIG_IGN); --- 613,619 ---- } #endif /* NNRP_LOADLIMIT > 0 */ ! strcpy (LogName,"?") ; /* safe -of */ /* Ignore SIGPIPE, since we'll see closed connections with read. */ (void)signal(SIGPIPE, SIG_IGN); diff -Ncr ../inn-1.5.1.dist/nnrpd/post.c ./nnrpd/post.c *** ../inn-1.5.1.dist/nnrpd/post.c Tue Dec 17 15:40:40 1996 --- ./nnrpd/post.c Fri Jul 25 12:35:10 1997 *************** *** 143,153 **** && p[hp->Size] == ':' && caseEQn(p, hp->Name, hp->Size)) { if (hp->Type == HTobs) { ! (void)sprintf(Error, "Obsolete \"%s\" header", hp->Name); return NULL; } if (hp->Value) { ! (void)sprintf(Error, "Duplicate \"%s\" header", hp->Name); return NULL; } for (q = &p[hp->Size + 1]; ISWHITE(*q); q++) --- 143,155 ---- && p[hp->Size] == ':' && caseEQn(p, hp->Name, hp->Size)) { if (hp->Type == HTobs) { ! (void)snprintf(Error, sizeof(Error), ! "Obsolete \"%s\" header", hp->Name); return NULL; } if (hp->Value) { ! (void)snprintf(Error, sizeof(Error), ! "Duplicate \"%s\" header", hp->Name); return NULL; } for (q = &p[hp->Size + 1]; ISWHITE(*q); q++) *************** *** 168,174 **** /* Get start of next header; if it's a blank line, we hit the end. */ if ((p = NextHeader(p)) == NULL) { (void)strcpy(Error, "Article has no body -- just headers"); ! return NULL; } if (*p == '\n') break; --- 170,176 ---- /* Get start of next header; if it's a blank line, we hit the end. */ if ((p = NextHeader(p)) == NULL) { (void)strcpy(Error, "Article has no body -- just headers"); ! return NULL; /* safe -of */ } if (*p == '\n') break; *************** *** 214,221 **** /* SUPPRESS 530 *//* Empty body for statement */ ; else { ! (void)sprintf(Error, "\"%s\" is not a valid control message", ! ctrl); return Error; } *p = save; --- 216,223 ---- /* SUPPRESS 530 *//* Empty body for statement */ ; else { ! (void)snprintf(Error, sizeof(Error), ! "\"%s\" is not a valid control message", ctrl); return Error; } *p = save; *************** *** 238,244 **** do { for (dp = BadDistribs; *dp; dp++) if (wildmat(p, *dp)) { ! (void)sprintf(Error, "Illegal distribution \"%s\"", p); return Error; } } while ((p = strtok((char *)NULL, SEPS)) != NULL); --- 240,247 ---- do { for (dp = BadDistribs; *dp; dp++) if (wildmat(p, *dp)) { ! (void)snprintf(Error, sizeof(Error), ! "Illegal distribution \"%s\"", p); return Error; } } while ((p = strtok((char *)NULL, SEPS)) != NULL); *************** *** 272,278 **** /* Do some preliminary fix-ups. */ for (hp = Table; hp < ENDOF(Table); hp++) { if (!hp->CanSet && hp->Value) { ! (void)sprintf(Error, "Can't set system \"%s\" header", hp->Name); return Error; } if (hp->Value) { --- 275,282 ---- /* Do some preliminary fix-ups. */ for (hp = Table; hp < ENDOF(Table); hp++) { if (!hp->CanSet && hp->Value) { ! (void)snprintf(Error, sizeof(Error), ! "Can't set system \"%s\" header", hp->Name); return Error; } if (hp->Value) { *************** *** 287,293 **** * our info. If not authorized, zap the Sender so we don't put out * unauthenticated data. */ if (PERMauthorized && HDR(_sender) == NULL) { ! (void)sprintf(sendbuff, "%s@%s", PERMuser ? PERMuser : "UNKNOWN", ClientHost); HDR(_sender) = sendbuff; } --- 291,297 ---- * our info. If not authorized, zap the Sender so we don't put out * unauthenticated data. */ if (PERMauthorized && HDR(_sender) == NULL) { ! (void)snprintf(sendbuff, sizeof(sendbuff), "%s@%s", PERMuser ? PERMuser : "UNKNOWN", ClientHost); HDR(_sender) = sendbuff; } *************** *** 297,310 **** /* Set Date. */ if (GetTimeInfo(&Now) < 0) { ! (void)sprintf(Error, "Can't get the time, %s", strerror(errno)); return Error; } if (HDR(_date) == NULL) { if ((gmt = gmtime(&Now.time)) == NULL) return "Can't get the time"; ! (void)sprintf(datebuff, "%d %3.3s %d %02d:%02d:%02d GMT", gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); HDR(_date) = datebuff; --- 301,316 ---- /* Set Date. */ if (GetTimeInfo(&Now) < 0) { ! (void)snprintf(Error, sizeof(Error), ! "Can't get the time, %s", strerror(errno)); return Error; } if (HDR(_date) == NULL) { if ((gmt = gmtime(&Now.time)) == NULL) return "Can't get the time"; ! (void)snprintf(datebuff, sizeof(datebuff), ! "%d %3.3s %d %02d:%02d:%02d GMT",/* safe -of */ gmt->tm_mday, &MONTHS[3 * gmt->tm_mon], 1900 + gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); HDR(_date) = datebuff; *************** *** 340,347 **** /* Set Message-ID */ if (HDR(_messageid) == NULL) { if ((p = GenerateMessageID()) == NULL) { ! (void)sprintf(Error, "Can't generate Message-ID, %s", ! strerror(errno)); return Error; } HDR(_messageid) = p; --- 346,353 ---- /* Set Message-ID */ if (HDR(_messageid) == NULL) { if ((p = GenerateMessageID()) == NULL) { ! (void)snprintf(Error, sizeof(Error), ! "Can't generate Message-ID, %s", strerror(errno)); return Error; } HDR(_messageid) = p; *************** *** 389,395 **** /* Set Organization */ if (HDR(_organization) == NULL && (p = GetConfigValue(_CONF_ORGANIZATION)) != NULL) { ! (void)strcpy(orgbuff, p); HDR(_organization) = orgbuff; } --- 395,402 ---- /* Set Organization */ if (HDR(_organization) == NULL && (p = GetConfigValue(_CONF_ORGANIZATION)) != NULL) { ! (void)strncpy(orgbuff, p, sizeof(orgbuff) - 1); ! orgbuff[sizeof(orgbuff) - 1] = '\0'; HDR(_organization) = orgbuff; } *************** *** 400,413 **** /* MIME headers. */ if (HDR(_mimeversion) == NULL && (p = GetConfigValue(_CONF_MIMEVERSION)) != NULL) { ! (void)strcpy(mimeversion, p); HDR(_mimeversion) = mimeversion; /* Set Content-Type */ if (HDR(_contenttype) == NULL) { if ((p = GetConfigValue(_CONF_CONTENTTYPE)) == NULL) return "Can't get \"Content-Type\" header"; ! (void)strcpy(mimetype, p); HDR(_contenttype) = mimetype; } --- 407,422 ---- /* MIME headers. */ if (HDR(_mimeversion) == NULL && (p = GetConfigValue(_CONF_MIMEVERSION)) != NULL) { ! (void)strncpy(mimeversion, p, sizeof(mimeversion) - 1); ! mimeversion[sizeof(mimeversion) - 1] = '\0'; HDR(_mimeversion) = mimeversion; /* Set Content-Type */ if (HDR(_contenttype) == NULL) { if ((p = GetConfigValue(_CONF_CONTENTTYPE)) == NULL) return "Can't get \"Content-Type\" header"; ! (void)strncpy(mimetype, p, sizeof(mimetype) - 1); ! mimetype[sizeof(mimetype) - 1] = '\0'; HDR(_contenttype) = mimetype; } *************** *** 415,427 **** if (HDR(_contenttransferencoding) == NULL) { if ((p = GetConfigValue(_CONF_ENCODING)) == NULL) return "Can't get \"Content-Transfer-Encoding\" header"; ! (void)strcpy(mimeencoding, p); HDR(_contenttransferencoding) = mimeencoding; } } /* Set Lines */ ! (void)sprintf(linebuff, "%d", linecount); HDR(_lines) = linebuff; /* Supersedes; left alone. */ --- 424,437 ---- if (HDR(_contenttransferencoding) == NULL) { if ((p = GetConfigValue(_CONF_ENCODING)) == NULL) return "Can't get \"Content-Transfer-Encoding\" header"; ! (void)strncpy(mimeencoding, p, sizeof(mimeencoding) - 1); ! mimeencoding[sizeof(mimeencoding) - 1] = '\0'; HDR(_contenttransferencoding) = mimeencoding; } } /* Set Lines */ ! (void)snprintf(linebuff, sizeof(linebuff), "%d", linecount); HDR(_lines) = linebuff; /* Supersedes; left alone. */ *************** *** 432,439 **** /* Now make sure everything is there. */ for (hp = Table; hp < ENDOF(Table); hp++) if (hp->Type == HTreq && hp->Value == NULL) { ! (void)sprintf(Error, "Required \"%s\" header is missing", ! hp->Name); return Error; } --- 442,449 ---- /* Now make sure everything is there. */ for (hp = Table; hp < ENDOF(Table); hp++) if (hp->Type == HTreq && hp->Value == NULL) { ! (void)snprintf(Error, sizeof(Error), ! "Required \"%s\" header is missing", hp->Name); return Error; } *************** *** 498,511 **** /* Try to get the address first. */ if ((address = GetModeratorAddress(NULL, NULL, group)) == NULL) { ! (void)sprintf(Error, "No mailing address for \"%s\" -- %s", group, "ask your news administrator to fix this"); return Error; } /* Now build up the command (ignore format/argument mismatch errors, * in case %s isn't in _PATH_SENDMAIL) and send the headers. */ ! (void)sprintf(buff, _PATH_SENDMAIL, address); if ((F = popen(buff, "w")) == NULL) return "Can't start mailer"; (void)fprintf(F, "To: %s\n", address); --- 508,522 ---- /* Try to get the address first. */ if ((address = GetModeratorAddress(NULL, NULL, group)) == NULL) { ! (void)snprintf(Error, sizeof(Error), ! "No mailing address for \"%s\" -- %s", group, "ask your news administrator to fix this"); return Error; } /* Now build up the command (ignore format/argument mismatch errors, * in case %s isn't in _PATH_SENDMAIL) and send the headers. */ ! (void)snprintf(buff, sizeof(buff), _PATH_SENDMAIL, address); if ((F = popen(buff, "w")) == NULL) return "Can't start mailer"; (void)fprintf(F, "To: %s\n", address); *************** *** 540,546 **** } i = pclose(F); if (i) { ! (void)sprintf(Error, "Mailer exited with status %d -- %s", i, "Article might not have been mailed"); return Error; } --- 551,558 ---- } i = pclose(F); if (i) { ! (void)snprintf(Error, sizeof(Error), ! "Mailer exited with status %d -- %s", i, "Article might not have been mailed"); return Error; } *************** *** 601,614 **** break; case NF_FLAG_IGNORE: case NF_FLAG_NOLOCAL: ! (void)sprintf(Error, "Postings to \"%s\" are not allowed here.", ! gp->Name); break; case NF_FLAG_EXCLUDED: /* Do NOT return an error. */ break; case NF_FLAG_ALIAS: ! (void)sprintf(Error, "The newsgroup \"%s\" has been renamed to \"%s\".\n", p, gp->Alias); break; --- 613,626 ---- break; case NF_FLAG_IGNORE: case NF_FLAG_NOLOCAL: ! (void)snprintf(Error, sizeof(Error), ! "Postings to \"%s\" are not allowed here.", gp->Name); break; case NF_FLAG_EXCLUDED: /* Do NOT return an error. */ break; case NF_FLAG_ALIAS: ! (void)snprintf(Error, sizeof(Error), "The newsgroup \"%s\" has been renamed to \"%s\".\n", p, gp->Alias); break; *************** *** 617,630 **** grplist[0] = p; grplist[1] = NULL; if (!PERMmatch(PERMdefault, PERMlist, grplist)) { ! sprintf(Error,"%s: %s\r\n", NNTP_NOSUCHGROUP,p); } } } while ((p = strtok((char *)NULL, NGSEPS)) != NULL); DISPOSE(groups); if (!FoundOne && !IsNewgroup) ! (void)sprintf(Error, "No valid newsgroups in \"%s\"", hdr); if (Error[0]) { DISPOSE(DDend(h)); return Error; --- 629,644 ---- grplist[0] = p; grplist[1] = NULL; if (!PERMmatch(PERMdefault, PERMlist, grplist)) { ! snprintf(Error, sizeof(Error), ! "%s: %s\r\n", NNTP_NOSUCHGROUP,p); } } } while ((p = strtok((char *)NULL, NGSEPS)) != NULL); DISPOSE(groups); if (!FoundOne && !IsNewgroup) ! (void)snprintf(Error, sizeof(Error), ! "No valid newsgroups in \"%s\"", hdr); if (Error[0]) { DISPOSE(DDend(h)); return Error; *************** *** 632,638 **** p = DDend(h); if (HDR(_distribution) == NULL && *p) { ! (void)strcpy(distbuff, p); HDR(_distribution) = distbuff; } DISPOSE(p); --- 646,653 ---- p = DDend(h); if (HDR(_distribution) == NULL && *p) { ! (void)strncpy(distbuff, p, sizeof(distbuff) - 1); ! distbuff[sizeof(distbuff) - 1] = '\0'; HDR(_distribution) = distbuff; } DISPOSE(p); *************** *** 673,679 **** (void)fprintf(ToServer, "ihave %s\r\n", HDR(_messageid)); if (FLUSH_ERROR(ToServer) || fgets(buff, buffsize, FromServer) == NULL) { ! (void)sprintf(buff, CANTSEND, "IHAVE", strerror(errno)); return -1; } return atoi(buff); --- 688,694 ---- (void)fprintf(ToServer, "ihave %s\r\n", HDR(_messageid)); if (FLUSH_ERROR(ToServer) || fgets(buff, buffsize, FromServer) == NULL) { ! (void)snprintf(buff, buffsize, CANTSEND, "IHAVE", strerror(errno)); return -1; } return atoi(buff); *************** *** 697,703 **** struct stat Sb; /* Initialize the returned error message */ ! sprintf(CANTSPOOL, "%s and can't write text to local spool file", Error); /* Try to write it to the spool dir. */ TempName(_PATH_SPOOLNEWS, temp); --- 712,719 ---- struct stat Sb; /* Initialize the returned error message */ ! snprintf(CANTSPOOL, sizeof(CANTSPOOL), ! "%s and can't write text to local spool file", Error); /* Try to write it to the spool dir. */ TempName(_PATH_SPOOLNEWS, temp); *************** *** 791,808 **** return "Article is empty"; if (idbuff != NULL) ! strcpy (idbuff,"(mailed to moderator)") ; if ((error = ValidNewsgroups(HDR(_newsgroups), article)) != NULL || WasMailed) return error; if (idbuff != NULL) idbuff [0] = '\0' ; ! strcpy(frombuf, HDR(_from)); HeaderCleanFrom(frombuf); p = strchr(frombuf, '@'); if (p) { ! strcpy(frombuf, p+1); p = strrchr(frombuf, '.'); if (!p) return "From: address not in Internet syntax"; --- 807,826 ---- return "Article is empty"; if (idbuff != NULL) ! strcpy (idbuff,"(mailed to moderator)") ; /* safe -of */ if ((error = ValidNewsgroups(HDR(_newsgroups), article)) != NULL || WasMailed) return error; if (idbuff != NULL) idbuff [0] = '\0' ; ! strncpy(frombuf, HDR(_from), sizeof(frombuf) - 1); ! frombuf[sizeof(frombuf) - 1] = '\0'; HeaderCleanFrom(frombuf); p = strchr(frombuf, '@'); if (p) { ! strncpy(frombuf, p+1, sizeof(frombuf) - 1); ! frombuf[sizeof(frombuf) - 1] = '\0'; p = strrchr(frombuf, '.'); if (!p) return "From: address not in Internet syntax"; *************** *** 815,821 **** return error; #if LOCAL_MAX_ARTSIZE > 0 if (strlen(article) > LOCAL_MAX_ARTSIZE) { ! (void)sprintf(Error, "Article is bigger then local limit of %ld bytes\n", LOCAL_MAX_ARTSIZE); return Error; --- 833,839 ---- return error; #if LOCAL_MAX_ARTSIZE > 0 if (strlen(article) > LOCAL_MAX_ARTSIZE) { ! (void)snprintf(Error, sizeof(Error), "Article is bigger then local limit of %ld bytes\n", LOCAL_MAX_ARTSIZE); return Error; *************** *** 842,851 **** /* If we cannot open the connection, initialize the error message and * attempt to recover from this by spooling it locally */ if (i < 0) { ! if (buff[0]) ! (void)strcpy(Error, buff); ! else ! (void)sprintf(Error, CANTSEND, "connect request", strerror(errno)); return Spoolit(article,Error); } if (Tracing) --- 860,871 ---- /* If we cannot open the connection, initialize the error message and * attempt to recover from this by spooling it locally */ if (i < 0) { ! if (buff[0]) { ! (void)strncpy(Error, buff, sizeof(Error) - 1); ! Error[sizeof(Error) - 1] = '\0'; ! } else ! (void)snprintf(Error, sizeof(Error), ! CANTSEND, "connect request", strerror(errno)); return Spoolit(article,Error); } if (Tracing) *************** *** 861,874 **** if (i == NNTP_AUTH_NEEDED_VAL) { /* Send authorization. */ if (NNTPsendpassword(RemoteMaster, FromServer, ToServer) < 0) { ! (void)sprintf(Error, "Can't authorize with %s", RemoteMaster ? RemoteMaster : "innd"); return Spoolit(article,Error); } i = OfferArticle(buff, sizeof buff, FromServer, ToServer); } if (i != NNTP_SENDIT_VAL) { ! (void)strcpy(Error, buff); SendQuit(FromServer, ToServer); return (i != NNTP_HAVEIT_VAL ? Spoolit(article, Error) : Error) ; } --- 881,895 ---- if (i == NNTP_AUTH_NEEDED_VAL) { /* Send authorization. */ if (NNTPsendpassword(RemoteMaster, FromServer, ToServer) < 0) { ! (void)snprintf(Error, sizeof(Error), "Can't authorize with %s", RemoteMaster ? RemoteMaster : "innd"); return Spoolit(article,Error); } i = OfferArticle(buff, sizeof buff, FromServer, ToServer); } if (i != NNTP_SENDIT_VAL) { ! (void)strncpy(Error, buff, sizeof(Error) - 1); ! Error[sizeof(Error) - 1] = '\0'; SendQuit(FromServer, ToServer); return (i != NNTP_HAVEIT_VAL ? Spoolit(article, Error) : Error) ; } *************** *** 883,889 **** (void)fprintf(ToServer, "%s\r\n", OtherHeaders[i]); (void)fprintf(ToServer, "\r\n"); if (FLUSH_ERROR(ToServer)) { ! (void)sprintf(Error, CANTSEND, "headers", strerror(errno)); (void)fclose(FromServer); (void)fclose(ToServer); return Spoolit(article, Error); --- 904,911 ---- (void)fprintf(ToServer, "%s\r\n", OtherHeaders[i]); (void)fprintf(ToServer, "\r\n"); if (FLUSH_ERROR(ToServer)) { ! (void)snprintf(Error, sizeof(Error), CANTSEND, ! "headers", strerror(errno)); (void)fclose(FromServer); (void)fclose(ToServer); return Spoolit(article, Error); *************** *** 892,898 **** /* Send the article, get the server's reply. */ if (NNTPsendarticle(article, ToServer, TRUE) < 0 || fgets(buff, sizeof buff, FromServer) == NULL) { ! (void)sprintf(Error, CANTSEND, "article", strerror(errno)); (void)fclose(FromServer); (void)fclose(ToServer); return Spoolit(article, Error); --- 914,921 ---- /* Send the article, get the server's reply. */ if (NNTPsendarticle(article, ToServer, TRUE) < 0 || fgets(buff, sizeof buff, FromServer) == NULL) { ! (void)snprintf(Error, sizeof(Error), CANTSEND, "article", ! strerror(errno)); (void)fclose(FromServer); (void)fclose(ToServer); return Spoolit(article, Error); *************** *** 900,913 **** /* Did the server want the article? */ if ((i = atoi(buff)) != NNTP_TOOKIT_VAL) { ! (void)strcpy(Error, buff); SendQuit(FromServer, ToServer); return (i != NNTP_REJECTIT_VAL ? Spoolit(article, Error) : Error) ; } /* Send a quit and close down */ SendQuit(FromServer, ToServer); ! if (idbuff) ! (void)strcpy(idbuff, HDR(_messageid)); return NULL; } --- 923,939 ---- /* Did the server want the article? */ if ((i = atoi(buff)) != NNTP_TOOKIT_VAL) { ! (void)strncpy(Error, buff, sizeof(Error) - 1); ! Error[sizeof(Error) - 1] = '\0'; SendQuit(FromServer, ToServer); return (i != NNTP_REJECTIT_VAL ? Spoolit(article, Error) : Error) ; } /* Send a quit and close down */ SendQuit(FromServer, ToServer); ! if (idbuff) { ! (void)strncpy(idbuff, HDR(_messageid), SMBUF - 1); ! idbuff[BIG_BUFFER - 1] = '\0'; ! } return NULL; } diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-DU4.0 ./sample-configs/config.data-DU4.0 *** ../inn-1.5.1.dist/sample-configs/config.data-DU4.0 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-DU4.0 Tue Jul 29 16:56:44 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-FreeBSD-2.0 ./sample-configs/config.data-FreeBSD-2.0 *** ../inn-1.5.1.dist/sample-configs/config.data-FreeBSD-2.0 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-FreeBSD-2.0 Tue Jul 29 16:56:45 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-OSF1.3a ./sample-configs/config.data-OSF1.3a *** ../inn-1.5.1.dist/sample-configs/config.data-OSF1.3a Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-OSF1.3a Tue Jul 29 16:56:45 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL volatile void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-OSF3.0 ./sample-configs/config.data-OSF3.0 *** ../inn-1.5.1.dist/sample-configs/config.data-OSF3.0 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-OSF3.0 Tue Jul 29 16:56:46 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL volatile void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-aix-4.1.4 ./sample-configs/config.data-aix-4.1.4 *** ../inn-1.5.1.dist/sample-configs/config.data-aix-4.1.4 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-aix-4.1.4 Tue Jul 29 16:56:47 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-aux3.1 ./sample-configs/config.data-aux3.1 *** ../inn-1.5.1.dist/sample-configs/config.data-aux3.1 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-aux3.1 Tue Jul 29 16:56:47 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL volatile void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-dynixptx2.1 ./sample-configs/config.data-dynixptx2.1 *** ../inn-1.5.1.dist/sample-configs/config.data-dynixptx2.1 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-dynixptx2.1 Tue Jul 29 16:56:48 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL int + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-irix-5.2 ./sample-configs/config.data-irix-5.2 *** ../inn-1.5.1.dist/sample-configs/config.data-irix-5.2 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-irix-5.2 Tue Jul 29 16:56:49 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-linux-2.0.18 ./sample-configs/config.data-linux-2.0.18 *** ../inn-1.5.1.dist/sample-configs/config.data-linux-2.0.18 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-linux-2.0.18 Tue Jul 29 16:56:50 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-newsos-4.2.1 ./sample-configs/config.data-newsos-4.2.1 *** ../inn-1.5.1.dist/sample-configs/config.data-newsos-4.2.1 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-newsos-4.2.1 Tue Jul 29 16:56:51 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-next3.2 ./sample-configs/config.data-next3.2 *** ../inn-1.5.1.dist/sample-configs/config.data-next3.2 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-next3.2 Tue Jul 29 16:56:51 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-solaris2.3-4 ./sample-configs/config.data-solaris2.3-4 *** ../inn-1.5.1.dist/sample-configs/config.data-solaris2.3-4 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-solaris2.3-4 Tue Jul 29 17:11:20 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS -Xc -Dsun -D__svr4__ -DBad_float_h ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-sunos-4.1.x ./sample-configs/config.data-sunos-4.1.x *** ../inn-1.5.1.dist/sample-configs/config.data-sunos-4.1.x Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-sunos-4.1.x Tue Jul 29 16:56:53 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-ultrix4.3 ./sample-configs/config.data-ultrix4.3 *** ../inn-1.5.1.dist/sample-configs/config.data-ultrix4.3 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-ultrix4.3 Tue Jul 29 16:56:54 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-ux4800 ./sample-configs/config.data-ux4800 *** ../inn-1.5.1.dist/sample-configs/config.data-ux4800 Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-ux4800 Tue Jul 29 16:56:54 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/sample-configs/config.data-uxpds ./sample-configs/config.data-uxpds *** ../inn-1.5.1.dist/sample-configs/config.data-uxpds Tue Dec 17 15:40:40 1996 --- ./sample-configs/config.data-uxpds Tue Jul 29 16:56:55 1997 *************** *** 32,37 **** --- 32,54 ---- ## If you use the standard NNTP way of connecting, where is the library? #### =()@>()= NNTPLIB + ## If you DONT have snprintf in your clibrary then set LIBSNPRINTF + ## to ``../libsnprintf.a''. i.e. + ## + ## LIBSNPRINTF ../libsnprintf.a + ## + ## Also see HAVE_SNPRINTF down below. + #### =()@>()= + LIBSNPRINTF ../libsnprintf.a + ## What compiler flags do you need to build the snprintf library. + ## + ## On Solaris 2.5 and 2.5.1 (and maybe higher) with the Sun C compiler. + ## you want + ## -Xc -Dsun -D__svr4__ -DBad_float_h + ## + ## + #### =()@>()= + SNPRINTF_CFLAGS ## If you need to link in other libraries, add them here. ## On NetBSD and FreeBSD, you must add the -lcrypt directive here ## -lutil on BSD/OS gives you setproctitle() see HAVE_SETPROCTITLE. *************** *** 285,290 **** --- 302,311 ---- ## What's the return type of _exit? Usually int or void. #### =()<_EXITVAL @<_EXITVAL>@>()= _EXITVAL void + ## Do you have snprintf() in your c library. Pick DO or DONT. See + ## LIBSNPRINTF above. + #### =()@>()= + HAVE_SNPRINTF DONT ## diff -Ncr ../inn-1.5.1.dist/samples/parsecontrol ./samples/parsecontrol *** ../inn-1.5.1.dist/samples/parsecontrol Tue Dec 17 15:40:40 1996 --- ./samples/parsecontrol Fri Jul 25 23:41:03 1997 *************** *** 21,27 **** ZN=0123456789 # Attempt to sanitize the address FROM="`echo \"$1\" | tr ${AZ} ${az} | tr -dc \\\055${az}${ZN}+_.@%`" ! REPLYTO="$2" case "$3" in "") ARTICLE=/dev/null --- 21,27 ---- ZN=0123456789 # Attempt to sanitize the address FROM="`echo \"$1\" | tr ${AZ} ${az} | tr -dc \\\055${az}${ZN}+_.@%`" ! REPLYTO="`echo \"$2\" | tr ${AZ} ${az} | tr -dc \\\055${az}${ZN}+_.@%`" case "$3" in "") ARTICLE=/dev/null *************** *** 34,39 **** --- 34,64 ---- ;; esac PATHHOST="$4" + + # Catch an address left with a leading '-' + case "X$FROM" in + X-*) + if $MAILFAILURES; then + ${SED} -e 's/^~/~~/' < ${ARTICLE} \ + | ${MAILCMD} -s "Bad FROM address" ${NEWSMASTER} + fi + cat ${ARTICLE} | + writelog $MOST_LOGS/badcontrol.log "`date` Bad FROM address" + exit + ;; + esac + + case "X$REPLYTO" in + X-*) + if $MAILFAILURES; then + ${SED} -e 's/^~/~~/' < ${ARTICLE} \ + | ${MAILCMD} -s "Bad REPLY-TO address" ${NEWSMASTER} + fi + cat ${ARTICLE} | + writelog $MOST_LOGS/badcontrol.log "`date` Bad REPLY-TO address" + exit + ;; + esac umask 002 TEMP=${TMPDIR}/ctl$$ diff -Ncr ../inn-1.5.1.dist/samples/version ./samples/version *** ../inn-1.5.1.dist/samples/version Tue Dec 17 15:40:40 1996 --- ./samples/version Fri Jul 25 17:01:06 1997 *************** *** 7,13 **** ## =()<. @<_PATH_PARSECTL>@ "$@">()= . /var/news/etc/parsecontrol "$@" ! VERSION="INN 1.5.1" WHERE=`innconfval pathhost` --- 7,13 ---- ## =()<. @<_PATH_PARSECTL>@ "$@">()= . /var/news/etc/parsecontrol "$@" ! VERSION="INN 1.5.1sec" WHERE=`innconfval pathhost` diff -Ncr ../inn-1.5.1.dist/snprintf/Makefile ./snprintf/Makefile *** ../inn-1.5.1.dist/snprintf/Makefile Thu Jan 1 01:00:00 1970 --- ./snprintf/Makefile Sat Jul 26 02:00:36 1997 *************** *** 0 **** --- 1,58 ---- + ## $Revision$ + + SHELL = /bin/sh + MAKE = make + LINT = lint + IFTRUE = @$(SHELL) ../iftrue.sh + + ## =()

@>()= + P = + + ## =()@>()= + CC = gcc + ## =()@>()= + DEFS = -I../include + ## =()@>()= + PERLINC = + ## =()@ $(SNPRINTF_CFLAGS)>()= + CFLAGS = $(DEFS) -g $(SNPRINTF_CFLAGS) + ## =()@>()= + DBZCFLAGS = $(CFLAGS) + ## =()@>()= + LDFLAGS = + ## =()@>()= + CTAGS = ctags -t -w + ## =()@>()= + PROF = -pg + ## =()@>()= + SNPRINTF_CFLAGS = + + ## =()@>()= + RANLIB = ranlib + + DESTLIB=/usr/local/lib + DESTINC=/usr/local/include + PERM=644 + INSTALL=install + + SRCS = snprintf.c vsnprintf.c fvwrite.c strtod.c vfprintf.c + + OBJ = $(SRCS:.c=.o) + + all: libsnprintf.a + + install: ../libsnprintf.a + + ../libsnprintf.a: libsnprintf.a + @rm -f $@ + cp libsnprintf.a $@ + $(RANLIB) $@ + + libsnprintf.a: $(P) $(OBJ) + ar r $@ $(OBJ) + $(RANLIB) libsnprintf.a + + clean: + rm -f core *~ *.a *.o + + diff -Ncr ../inn-1.5.1.dist/snprintf/floatio.h ./snprintf/floatio.h *** ../inn-1.5.1.dist/snprintf/floatio.h Thu Jan 1 01:00:00 1970 --- ./snprintf/floatio.h Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,46 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)floatio.h 8.1 (Berkeley) 6/4/93 + */ + + /* + * Floating point scanf/printf (input/output) definitions. + */ + + /* 11-bit exponent (VAX G floating point) is 308 decimal digits */ + #define MAXEXP 308 + /* 128 bit fraction takes up 39 decimal digits; max reasonable precision */ + #define MAXFRACT 39 diff -Ncr ../inn-1.5.1.dist/snprintf/fvwrite.c ./snprintf/fvwrite.c *** ../inn-1.5.1.dist/snprintf/fvwrite.c Thu Jan 1 01:00:00 1970 --- ./snprintf/fvwrite.c Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,186 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #if defined(LIBC_SCCS) && !defined(lint) + static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93"; + #endif /* LIBC_SCCS and not lint */ + + #include "xstdio.h" + #include + #include "local.h" + #include "fvwrite.h" + + /* + * Write some memory regions. Return zero on success, EOF on error. + * + * This routine is large and unsightly, but most of the ugliness due + * to the three different kinds of output buffering is handled here. + */ + BSD__sfvwrite(fp, uio) + register FILE *fp; + register struct __suio *uio; + { + register size_t len; + register char *p; + register struct __siov *iov; + register int w, s; + char *nl; + int nlknown, nldist; + + if ((len = uio->uio_resid) == 0) + return (0); + + #define MIN(a, b) ((a) < (b) ? (a) : (b)) + #define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n)) + + iov = uio->uio_iov; + p = iov->iov_base; + len = iov->iov_len; + iov++; + #define GETIOV(extra_work) \ + while (len == 0) { \ + extra_work; \ + p = iov->iov_base; \ + len = iov->iov_len; \ + iov++; \ + } + if (fp->_flags & __SNBF) { + /* + * Unbuffered: write up to BUFSIZ bytes at a time. + */ + do { + GETIOV(;); + w = (*fp->_write)(fp->_cookie, p, MIN(len, BUFSIZ)); + if (w <= 0) + goto err; + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + } else if ((fp->_flags & __SLBF) == 0) { + /* + * Fully buffered: fill partially full buffer, if any, + * and then flush. If there is no partial buffer, write + * one _bf._size byte chunk directly (without copying). + * + * String output is a special case: write as many bytes + * as fit, but pretend we wrote everything. This makes + * snprintf() return the number of bytes needed, rather + * than the number used, and avoids its write function + * (so that the write function can be invalid). + */ + do { + GETIOV(;); + w = fp->_w; + if (fp->_flags & __SSTR) { + if (len < w) + w = len; + COPY(w); /* copy MIN(fp->_w,len), */ + fp->_w -= w; + fp->_p += w; + w = len; /* but pretend copied all */ + } else if (fp->_p > fp->_bf._base && len > w) { + /* fill and flush */ + COPY(w); + /* fp->_w -= w; */ /* unneeded */ + fp->_p += w; + if (fflush(fp)) + goto err; + } else if (len >= (w = fp->_bf._size)) { + /* write directly */ + w = (*fp->_write)(fp->_cookie, p, w); + if (w <= 0) + goto err; + } else { + /* fill and done */ + w = len; + COPY(w); + fp->_w -= w; + fp->_p += w; + } + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + } else { + /* + * Line buffered: like fully buffered, but we + * must check for newlines. Compute the distance + * to the first newline (including the newline), + * or `infinity' if there is none, then pretend + * that the amount to write is MIN(len,nldist). + */ + nlknown = 0; + nldist = 0; /* XXX just to keep gcc happy */ + do { + GETIOV(nlknown = 0); + if (!nlknown) { + nl = (char *)memchr((void *)p, '\n', len); + nldist = nl ? nl + 1 - p : len + 1; + nlknown = 1; + } + s = MIN(len, nldist); + w = fp->_w + fp->_bf._size; + if (fp->_p > fp->_bf._base && s > w) { + COPY(w); + /* fp->_w -= w; */ + fp->_p += w; + if (fflush(fp)) + goto err; + } else if (s >= (w = fp->_bf._size)) { + w = (*fp->_write)(fp->_cookie, p, w); + if (w <= 0) + goto err; + } else { + w = s; + COPY(w); + fp->_w -= w; + fp->_p += w; + } + if ((nldist -= w) == 0) { + /* copied the newline: flush and forget */ + if (fflush(fp)) + goto err; + nlknown = 0; + } + p += w; + len -= w; + } while ((uio->uio_resid -= w) != 0); + } + return (0); + + err: + fp->_flags |= __SERR; + return (EOF); + } diff -Ncr ../inn-1.5.1.dist/snprintf/fvwrite.h ./snprintf/fvwrite.h *** ../inn-1.5.1.dist/snprintf/fvwrite.h Thu Jan 1 01:00:00 1970 --- ./snprintf/fvwrite.h Fri Jul 25 16:32:29 1997 *************** *** 0 **** --- 1,56 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fvwrite.h 8.1 (Berkeley) 6/4/93 + */ + + /* + * I/O descriptors for __sfvwrite(). + */ + struct __siov { + void *iov_base; + size_t iov_len; + }; + struct __suio { + struct __siov *uio_iov; + int uio_iovcnt; + int uio_resid; + }; + + #if __STDC__ || c_plusplus + extern int __sfvwrite(FILE *, struct __suio *); + #else + extern int __sfvwrite(); + #endif diff -Ncr ../inn-1.5.1.dist/snprintf/local.h ./snprintf/local.h *** ../inn-1.5.1.dist/snprintf/local.h Thu Jan 1 01:00:00 1970 --- ./snprintf/local.h Fri Jul 25 16:32:29 1997 *************** *** 0 **** --- 1,92 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)local.h 8.2 (Berkeley) 1/2/94 + */ + + /* + * Information local to this implementation of stdio, + * in particular, macros and private variables. + */ + + int __sflush __P((FILE *)); + FILE *__sfp __P((void)); + int __srefill __P((FILE *)); + int __sread __P((void *, char *, int)); + int __swrite __P((void *, char const *, int)); + fpos_t __sseek __P((void *, fpos_t, int)); + int __sclose __P((void *)); + void __sinit __P((void)); + void _cleanup __P((void)); + void (*__cleanup) __P((void)); + void __smakebuf __P((FILE *)); + int __swhatbuf __P((FILE *, size_t *, int *)); + int _fwalk __P((int (*)(FILE *))); + int BSD__swsetup __P((FILE *)); + int __sflags __P((const char *, int *)); + + extern int __sdidinit; + + /* + * Test whether the given stdio file has an active ungetc buffer; + * release such a buffer, without restoring ordinary unread data. + */ + #define HASUB(fp) ((fp)->_ub._base != NULL) + #define FREEUB(fp) { \ + if ((fp)->_ub._base != (fp)->_ubuf) \ + free((char *)(fp)->_ub._base); \ + (fp)->_ub._base = NULL; \ + } + + /* + * test for an fgetln() buffer. + */ + #define HASLB(fp) ((fp)->_lb._base != NULL) + #define FREELB(fp) { \ + free((char *)(fp)->_lb._base); \ + (fp)->_lb._base = NULL; \ + } + + + /* + * Assume 4 byte alignment + */ + #define ALIGNBYTES 3 + #define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES) + #define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) + + #if defined(sgi) || (defined(sun) && defined(__svr4__)) + #define isinf(x) (!finite(x) && !isnan(x)) + #endif /* sgi */ diff -Ncr ../inn-1.5.1.dist/snprintf/snprintf.c ./snprintf/snprintf.c *** ../inn-1.5.1.dist/snprintf/snprintf.c Thu Jan 1 01:00:00 1970 --- ./snprintf/snprintf.c Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,76 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #if defined(LIBC_SCCS) && !defined(lint) + static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93"; + #endif /* LIBC_SCCS and not lint */ + + #include "xstdio.h" + #if defined(__STDC__) + # include + #else + # include + #endif + + #if defined(__STDC__) + xsnprintf(char *str, size_t n, char const *fmt, ...) + #else + xsnprintf(str, n, fmt, va_alist) + char *str, *fmt; + size_t n; + va_dcl + #endif + { + int ret; + va_list ap; + FILE f; + + if ((int)n < 1) + return (EOF); + + #if defined(__STDC__) + va_start(ap, fmt); + #else + va_start(ap); + #endif + f._flags = __SWR | __SSTR; + f._bf._base = f._p = (unsigned char *)str; + f._bf._size = f._w = n - 1; + ret = BSD_vfprintf(&f, fmt, ap); + *f._p = 0; + va_end(ap); + return (ret); + } diff -Ncr ../inn-1.5.1.dist/snprintf/strtod.c ./snprintf/strtod.c *** ../inn-1.5.1.dist/snprintf/strtod.c Thu Jan 1 01:00:00 1970 --- ./snprintf/strtod.c Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,1750 ---- + /*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #if defined(LIBC_SCCS) && !defined(lint) + static char sccsid[] = "@(#)strtod.c 8.1 (Berkeley) 6/4/93"; + #endif /* LIBC_SCCS and not lint */ + + /**************************************************************** + * + * The author of this software is David M. Gay. + * + * Copyright (c) 1991 by AT&T. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * + ***************************************************************/ + + /* Please send bug reports to + David M. Gay + AT&T Bell Laboratories, Room 2C-463 + 600 Mountain Avenue + Murray Hill, NJ 07974-2070 + U.S.A. + dmg@research.att.com or research!dmg + */ + + /* strtod for IEEE-, VAX-, and IBM-arithmetic machines. + * + * This strtod returns a nearest machine number to the input decimal + * string (or sets errno to ERANGE). With IEEE arithmetic, ties are + * broken by the IEEE round-even rule. Otherwise ties are broken by + * biased rounding (add half and chop). + * + * Inspired loosely by William D. Clinger's paper "How to Read Floating + * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. + * + * Modifications: + * + * 1. We only require IEEE, IBM, or VAX double-precision + * arithmetic (not IEEE double-extended). + * 2. We get by with floating-point arithmetic in a case that + * Clinger missed -- when we're computing d * 10^n + * for a small integer d and the integer n is not too + * much larger than 22 (the maximum integer k for which + * we can represent 10^k exactly), we may be able to + * compute (d*10^k) * 10^(e-k) with just one roundoff. + * 3. Rather than a bit-at-a-time adjustment of the binary + * result in the hard case, we use floating-point + * arithmetic to determine the adjustment to within + * one bit; only in really hard cases do we need to + * compute a second residual. + * 4. Because of 3., we don't need a large table of powers of 10 + * for ten-to-e (just some small tables, e.g. of 10^k + * for 0 <= k <= 22). + */ + + /* + * #define IEEE_8087 for IEEE-arithmetic machines where the least + * significant byte has the lowest address. + * #define IEEE_MC68k for IEEE-arithmetic machines where the most + * significant byte has the lowest address. + * #define Sudden_Underflow for IEEE-format machines without gradual + * underflow (i.e., that flush to zero on underflow). + * #define IBM for IBM mainframe-style floating-point arithmetic. + * #define VAX for VAX-style floating-point arithmetic. + * #define Unsigned_Shifts if >> does treats its left operand as unsigned. + * #define No_leftright to omit left-right logic in fast floating-point + * computation of dtoa. + * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3. + * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines + * that use extended-precision instructions to compute rounded + * products and quotients) with IBM. + * #define ROUND_BIASED for IEEE-format with biased rounding. + * #define Inaccurate_Divide for IEEE-format with correctly rounded + * products but inaccurate quotients, e.g., for Intel i860. + * #define Just_16 to store 16 bits per 32-bit long when doing high-precision + * integer arithmetic. Whether this speeds things up or slows things + * down depends on the machine and the number being converted. + * #define KR_headers for old-style C function headers. + * #define Bad_float_h if your system lacks a float.h or if it does not + * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, + * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. + */ + + #if !defined(__STDC_) && !defined(__GNUC__) + # define KR_headers 1 + #endif + + #if defined(i386) || defined(mips) && defined(MIPSEL) + #define IEEE_8087 + #else + #define IEEE_MC68k + #endif + + #ifdef DEBUG + #include "stdio.h" + #define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} + #endif + + #ifdef __cplusplus + #include "malloc.h" + #include "memory.h" + #else + #ifndef KR_headers + #include "stdlib.h" + #include "string.h" + #else + #include "malloc.h" + #include "memory.h" + #endif + #endif + + #include "errno.h" + #ifdef Bad_float_h + #undef __STDC__ + #ifdef IEEE_MC68k + #define IEEE_ARITHMETIC + #endif + #ifdef IEEE_8087 + #define IEEE_ARITHMETIC + #endif + #ifdef IEEE_ARITHMETIC + #define DBL_DIG 15 + #define DBL_MAX_10_EXP 308 + #define DBL_MAX_EXP 1024 + #define FLT_RADIX 2 + #define FLT_ROUNDS 1 + #define DBL_MAX 1.7976931348623157e+308 + #endif + + #ifdef IBM + #define DBL_DIG 16 + #define DBL_MAX_10_EXP 75 + #define DBL_MAX_EXP 63 + #define FLT_RADIX 16 + #define FLT_ROUNDS 0 + #define DBL_MAX 7.2370055773322621e+75 + #endif + + #ifdef VAX + #define DBL_DIG 16 + #define DBL_MAX_10_EXP 38 + #define DBL_MAX_EXP 127 + #define FLT_RADIX 2 + #define FLT_ROUNDS 1 + #define DBL_MAX 1.7014118346046923e+38 + #endif + + #ifndef LONG_MAX + #define LONG_MAX 2147483647 + #endif + #else + #include "float.h" + #endif + #ifndef __MATH_H__ + #include "math.h" + #endif + + /* XXX - Define _IEEE_HUGE_VAL so we don't need __infinity() */ + #define _IEEE_HUGE_VAL 1e500 + + #ifdef __cplusplus + extern "C" { + #endif + + #ifndef CONST + #ifdef KR_headers + #define CONST /* blank */ + #else + #define CONST const + #endif + #endif + + #ifdef Unsigned_Shifts + #define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; + #else + #define Sign_Extend(a,b) /*no-op*/ + #endif + + #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 + Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. + #endif + + #ifdef IEEE_8087 + #define word0(x) ((unsigned long *)&x)[1] + #define word1(x) ((unsigned long *)&x)[0] + #else + #define word0(x) ((unsigned long *)&x)[0] + #define word1(x) ((unsigned long *)&x)[1] + #endif + + /* The following definition of Storeinc is appropriate for MIPS processors. + * An alternative that might be better on some machines is + * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) + */ + #if defined(IEEE_8087) + defined(VAX) + #define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ + ((unsigned short *)a)[0] = (unsigned short)c, a++) + #else + #define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ + ((unsigned short *)a)[1] = (unsigned short)c, a++) + #endif + + /* #define P DBL_MANT_DIG */ + /* Ten_pmax = floor(P*log(2)/log(5)) */ + /* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ + /* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ + /* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ + + #if defined(IEEE_8087) + defined(IEEE_MC68k) + #define Exp_shift 20 + #define Exp_shift1 20 + #define Exp_msk1 0x100000 + #define Exp_msk11 0x100000 + #define Exp_mask 0x7ff00000 + #define P 53 + #define Bias 1023 + #define IEEE_Arith + #define Emin (-1022) + #define Exp_1 0x3ff00000 + #define Exp_11 0x3ff00000 + #define Ebits 11 + #define Frac_mask 0xfffff + #define Frac_mask1 0xfffff + #define Ten_pmax 22 + #define Bletch 0x10 + #define Bndry_mask 0xfffff + #define Bndry_mask1 0xfffff + #define LSB 1 + #define Sign_bit 0x80000000 + #define Log2P 1 + #define Tiny0 0 + #define Tiny1 1 + #define Quick_max 14 + #define Int_max 14 + #define Infinite(x) (word0(x) == 0x7ff00000) /* sufficient test for here */ + #else + #undef Sudden_Underflow + #define Sudden_Underflow + #ifdef IBM + #define Exp_shift 24 + #define Exp_shift1 24 + #define Exp_msk1 0x1000000 + #define Exp_msk11 0x1000000 + #define Exp_mask 0x7f000000 + #define P 14 + #define Bias 65 + #define Exp_1 0x41000000 + #define Exp_11 0x41000000 + #define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ + #define Frac_mask 0xffffff + #define Frac_mask1 0xffffff + #define Bletch 4 + #define Ten_pmax 22 + #define Bndry_mask 0xefffff + #define Bndry_mask1 0xffffff + #define LSB 1 + #define Sign_bit 0x80000000 + #define Log2P 4 + #define Tiny0 0x100000 + #define Tiny1 0 + #define Quick_max 14 + #define Int_max 15 + #else /* VAX */ + #define Exp_shift 23 + #define Exp_shift1 7 + #define Exp_msk1 0x80 + #define Exp_msk11 0x800000 + #define Exp_mask 0x7f80 + #define P 56 + #define Bias 129 + #define Exp_1 0x40800000 + #define Exp_11 0x4080 + #define Ebits 8 + #define Frac_mask 0x7fffff + #define Frac_mask1 0xffff007f + #define Ten_pmax 24 + #define Bletch 2 + #define Bndry_mask 0xffff007f + #define Bndry_mask1 0xffff007f + #define LSB 0x10000 + #define Sign_bit 0x8000 + #define Log2P 1 + #define Tiny0 0x80 + #define Tiny1 0 + #define Quick_max 15 + #define Int_max 15 + #endif + #endif + + #ifndef IEEE_Arith + #define ROUND_BIASED + #endif + + #ifdef RND_PRODQUOT + #define rounded_product(a,b) a = rnd_prod(a, b) + #define rounded_quotient(a,b) a = rnd_quot(a, b) + #ifdef KR_headers + extern double rnd_prod(), rnd_quot(); + #else + extern double rnd_prod(double, double), rnd_quot(double, double); + #endif + #else + #define rounded_product(a,b) a *= b + #define rounded_quotient(a,b) a /= b + #endif + + #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) + #define Big1 0xffffffff + + #ifndef Just_16 + /* When Pack_32 is not defined, we store 16 bits per 32-bit long. + * This makes some inner loops simpler and sometimes saves work + * during multiplications, but it often seems to make things slightly + * slower. Hence the default is now to store 32 bits per long. + */ + #ifndef Pack_32 + #define Pack_32 + #endif + #endif + + #define Kmax 15 + + #ifdef __cplusplus + extern "C" double strtod(const char *s00, char **se); + extern "C" char *dtoa(double d, int mode, int ndigits, + int *decpt, int *sign, char **rve); + #endif + + struct + Bigint { + struct Bigint *next; + int k, maxwds, sign, wds; + unsigned long x[1]; + }; + + typedef struct Bigint Bigint; + + static Bigint *freelist[Kmax+1]; + + static Bigint * + Balloc + #ifdef KR_headers + (k) int k; + #else + (int k) + #endif + { + int x; + Bigint *rv; + + if (rv = freelist[k]) { + freelist[k] = rv->next; + } else { + x = 1 << k; + rv = (Bigint *)malloc(sizeof(Bigint) + (x-1)*sizeof(long)); + rv->k = k; + rv->maxwds = x; + } + rv->sign = rv->wds = 0; + return rv; + } + + static void + Bfree + #ifdef KR_headers + (v) Bigint *v; + #else + (Bigint *v) + #endif + { + if (v) { + v->next = freelist[v->k]; + freelist[v->k] = v; + } + } + + #define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ + y->wds*sizeof(long) + 2*sizeof(int)) + + static Bigint * + multadd + #ifdef KR_headers + (b, m, a) Bigint *b; int m, a; + #else + (Bigint *b, int m, int a) /* multiply by m and add a */ + #endif + { + int i, wds; + unsigned long *x, y; + #ifdef Pack_32 + unsigned long xi, z; + #endif + Bigint *b1; + + wds = b->wds; + x = b->x; + i = 0; + do { + #ifdef Pack_32 + xi = *x; + y = (xi & 0xffff) * m + a; + z = (xi >> 16) * m + (y >> 16); + a = (int)(z >> 16); + *x++ = (z << 16) + (y & 0xffff); + #else + y = *x * m + a; + a = (int)(y >> 16); + *x++ = y & 0xffff; + #endif + } while (++i < wds); + if (a) { + if (wds >= b->maxwds) { + b1 = Balloc(b->k+1); + Bcopy(b1, b); + Bfree(b); + b = b1; + } + b->x[wds++] = a; + b->wds = wds; + } + return b; + } + + static int + hi0bits + #ifdef KR_headers + (x) register unsigned long x; + #else + (register unsigned long x) + #endif + { + register int k = 0; + + if (!(x & 0xffff0000)) { + k = 16; + x <<= 16; + } + if (!(x & 0xff000000)) { + k += 8; + x <<= 8; + } + if (!(x & 0xf0000000)) { + k += 4; + x <<= 4; + } + if (!(x & 0xc0000000)) { + k += 2; + x <<= 2; + } + if (!(x & 0x80000000)) { + k++; + if (!(x & 0x40000000)) + return 32; + } + return k; + } + + static int + lo0bits + #ifdef KR_headers + (y) unsigned long *y; + #else + (unsigned long *y) + #endif + { + register int k; + register unsigned long x = *y; + + if (x & 7) { + if (x & 1) + return 0; + if (x & 2) { + *y = x >> 1; + return 1; + } + *y = x >> 2; + return 2; + } + k = 0; + if (!(x & 0xffff)) { + k = 16; + x >>= 16; + } + if (!(x & 0xff)) { + k += 8; + x >>= 8; + } + if (!(x & 0xf)) { + k += 4; + x >>= 4; + } + if (!(x & 0x3)) { + k += 2; + x >>= 2; + } + if (!(x & 1)) { + k++; + x >>= 1; + if (!x & 1) + return 32; + } + *y = x; + return k; + } + + static Bigint * + i2b + #ifdef KR_headers + (i) int i; + #else + (int i) + #endif + { + Bigint *b; + + b = Balloc(1); + b->x[0] = i; + b->wds = 1; + return b; + } + + static Bigint * + mult + #ifdef KR_headers + (a, b) Bigint *a, *b; + #else + (Bigint *a, Bigint *b) + #endif + { + Bigint *c; + int k, wa, wb, wc; + unsigned long carry, y, z; + unsigned long *x, *xa, *xae, *xb, *xbe, *xc, *xc0; + #ifdef Pack_32 + unsigned long z2; + #endif + + if (a->wds < b->wds) { + c = a; + a = b; + b = c; + } + k = a->k; + wa = a->wds; + wb = b->wds; + wc = wa + wb; + if (wc > a->maxwds) + k++; + c = Balloc(k); + for (x = c->x, xa = x + wc; x < xa; x++) + *x = 0; + xa = a->x; + xae = xa + wa; + xb = b->x; + xbe = xb + wb; + xc0 = c->x; + #ifdef Pack_32 + for (; xb < xbe; xb++, xc0++) { + if (y = *xb & 0xffff) { + x = xa; + xc = xc0; + carry = 0; + do { + z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; + carry = z >> 16; + z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; + carry = z2 >> 16; + Storeinc(xc, z2, z); + } while (x < xae); + *xc = carry; + } + if (y = *xb >> 16) { + x = xa; + xc = xc0; + carry = 0; + z2 = *xc; + do { + z = (*x & 0xffff) * y + (*xc >> 16) + carry; + carry = z >> 16; + Storeinc(xc, z, z2); + z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; + carry = z2 >> 16; + } while (x < xae); + *xc = z2; + } + } + #else + for (; xb < xbe; xc0++) { + if (y = *xb++) { + x = xa; + xc = xc0; + carry = 0; + do { + z = *x++ * y + *xc + carry; + carry = z >> 16; + *xc++ = z & 0xffff; + } while (x < xae); + *xc = carry; + } + } + #endif + for (xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; + c->wds = wc; + return c; + } + + static Bigint *p5s; + + static Bigint * + pow5mult + #ifdef KR_headers + (b, k) Bigint *b; int k; + #else + (Bigint *b, int k) + #endif + { + Bigint *b1, *p5, *p51; + int i; + static int p05[3] = { 5, 25, 125 }; + + if (i = k & 3) + b = multadd(b, p05[i-1], 0); + + if (!(k >>= 2)) + return b; + if (!(p5 = p5s)) { + /* first time */ + p5 = p5s = i2b(625); + p5->next = 0; + } + for (;;) { + if (k & 1) { + b1 = mult(b, p5); + Bfree(b); + b = b1; + } + if (!(k >>= 1)) + break; + if (!(p51 = p5->next)) { + p51 = p5->next = mult(p5,p5); + p51->next = 0; + } + p5 = p51; + } + return b; + } + + static Bigint * + lshift + #ifdef KR_headers + (b, k) Bigint *b; int k; + #else + (Bigint *b, int k) + #endif + { + int i, k1, n, n1; + Bigint *b1; + unsigned long *x, *x1, *xe, z; + + #ifdef Pack_32 + n = k >> 5; + #else + n = k >> 4; + #endif + k1 = b->k; + n1 = n + b->wds + 1; + for (i = b->maxwds; n1 > i; i <<= 1) + k1++; + b1 = Balloc(k1); + x1 = b1->x; + for (i = 0; i < n; i++) + *x1++ = 0; + x = b->x; + xe = x + b->wds; + #ifdef Pack_32 + if (k &= 0x1f) { + k1 = 32 - k; + z = 0; + do { + *x1++ = *x << k | z; + z = *x++ >> k1; + } while (x < xe); + if (*x1 = z) + ++n1; + } + #else + if (k &= 0xf) { + k1 = 16 - k; + z = 0; + do { + *x1++ = *x << k & 0xffff | z; + z = *x++ >> k1; + } while (x < xe); + if (*x1 = z) + ++n1; + } + #endif + else + do + *x1++ = *x++; + while (x < xe); + b1->wds = n1 - 1; + Bfree(b); + return b1; + } + + static int + cmp + #ifdef KR_headers + (a, b) Bigint *a, *b; + #else + (Bigint *a, Bigint *b) + #endif + { + unsigned long *xa, *xa0, *xb, *xb0; + int i, j; + + i = a->wds; + j = b->wds; + #ifdef DEBUG + if (i > 1 && !a->x[i-1]) + Bug("cmp called with a->x[a->wds-1] == 0"); + if (j > 1 && !b->x[j-1]) + Bug("cmp called with b->x[b->wds-1] == 0"); + #endif + if (i -= j) + return i; + xa0 = a->x; + xa = xa0 + j; + xb0 = b->x; + xb = xb0 + j; + for (;;) { + if (*--xa != *--xb) + return *xa < *xb ? -1 : 1; + if (xa <= xa0) + break; + } + return 0; + } + + static Bigint * + diff + #ifdef KR_headers + (a, b) Bigint *a, *b; + #else + (Bigint *a, Bigint *b) + #endif + { + Bigint *c; + int i, wa, wb; + long borrow, y; /* We need signed shifts here. */ + unsigned long *xa, *xae, *xb, *xbe, *xc; + #ifdef Pack_32 + long z; + #endif + + i = cmp(a,b); + if (!i) { + c = Balloc(0); + c->wds = 1; + c->x[0] = 0; + return c; + } + if (i < 0) { + c = a; + a = b; + b = c; + i = 1; + } else + i = 0; + c = Balloc(a->k); + c->sign = i; + wa = a->wds; + xa = a->x; + xae = xa + wa; + wb = b->wds; + xb = b->x; + xbe = xb + wb; + xc = c->x; + borrow = 0; + #ifdef Pack_32 + do { + y = (*xa & 0xffff) - (*xb & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*xa++ >> 16) - (*xb++ >> 16) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(xc, z, y); + } while (xb < xbe); + while (xa < xae) { + y = (*xa & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*xa++ >> 16) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(xc, z, y); + } + #else + do { + y = *xa++ - *xb++ + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *xc++ = y & 0xffff; + } while (xb < xbe); + while (xa < xae) { + y = *xa++ + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *xc++ = y & 0xffff; + } + #endif + while (!*--xc) + wa--; + c->wds = wa; + return c; + } + + static Bigint * + d2b + #ifdef KR_headers + (d, e, bits) double d; int *e, *bits; + #else + (double d, int *e, int *bits) + #endif + { + Bigint *b; + int de, i, k; + unsigned long *x, y, z; + #ifdef VAX + unsigned long d0, d1; + d0 = word0(d) >> 16 | word0(d) << 16; + d1 = word1(d) >> 16 | word1(d) << 16; + #else + #define d0 word0(d) + #define d1 word1(d) + #endif + + #ifdef Pack_32 + b = Balloc(1); + #else + b = Balloc(2); + #endif + x = b->x; + + z = d0 & Frac_mask; + d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ + #ifdef Sudden_Underflow + de = (int)(d0 >> Exp_shift); + #ifndef IBM + z |= Exp_msk11; + #endif + #else + if (de = (int)(d0 >> Exp_shift)) + z |= Exp_msk1; + #endif + #ifdef Pack_32 + if (y = d1) { + if (k = lo0bits(&y)) { + x[0] = y | z << 32 - k; + z >>= k; + } + else + x[0] = y; + i = b->wds = (x[1] = z) ? 2 : 1; + } else { + #ifdef DEBUG + if (!z) + Bug("Zero passed to d2b"); + #endif + k = lo0bits(&z); + x[0] = z; + i = b->wds = 1; + k += 32; + } + #else + if (y = d1) { + if (k = lo0bits(&y)) + if (k >= 16) { + x[0] = y | z << 32 - k & 0xffff; + x[1] = z >> k - 16 & 0xffff; + x[2] = z >> k; + i = 2; + } else { + x[0] = y & 0xffff; + x[1] = y >> 16 | z << 16 - k & 0xffff; + x[2] = z >> k & 0xffff; + x[3] = z >> k+16; + i = 3; + } + else { + x[0] = y & 0xffff; + x[1] = y >> 16; + x[2] = z & 0xffff; + x[3] = z >> 16; + i = 3; + } + } else { + #ifdef DEBUG + if (!z) + Bug("Zero passed to d2b"); + #endif + k = lo0bits(&z); + if (k >= 16) { + x[0] = z; + i = 0; + } else { + x[0] = z & 0xffff; + x[1] = z >> 16; + i = 1; + } + k += 32; + } + while (!x[i]) + --i; + b->wds = i + 1; + #endif + #ifndef Sudden_Underflow + if (de) { + #endif + #ifdef IBM + *e = (de - Bias - (P-1) << 2) + k; + *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); + #else + *e = de - Bias - (P-1) + k; + *bits = P - k; + #endif + #ifndef Sudden_Underflow + } else { + *e = de - Bias - (P-1) + 1 + k; + #ifdef Pack_32 + *bits = 32*i - hi0bits(x[i-1]); + #else + *bits = (i+2)*16 - hi0bits(x[i]); + #endif + } + #endif + return b; + } + #undef d0 + #undef d1 + + static double + tens[] = { + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22 + #ifdef VAX + , 1e23, 1e24 + #endif + }; + + static double + #ifdef IEEE_Arith + bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; + #define n_bigtens 5 + #else + #ifdef IBM + bigtens[] = { 1e16, 1e32, 1e64 }; + #define n_bigtens 3 + #else + bigtens[] = { 1e16, 1e32 }; + #define n_bigtens 2 + #endif + #endif + + static int + quorem + #ifdef KR_headers + (b, S) Bigint *b, *S; + #else + (Bigint *b, Bigint *S) + #endif + { + int n; + long borrow, y; + unsigned long carry, q, ys; + unsigned long *bx, *bxe, *sx, *sxe; + #ifdef Pack_32 + long z; + unsigned long si, zs; + #endif + + n = S->wds; + #ifdef DEBUG + /*debug*/ if (b->wds > n) + /*debug*/ Bug("oversize b in quorem"); + #endif + if (b->wds < n) + return 0; + sx = S->x; + sxe = sx + --n; + bx = b->x; + bxe = bx + n; + q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ + #ifdef DEBUG + /*debug*/ if (q > 9) + /*debug*/ Bug("oversized quotient in quorem"); + #endif + if (q) { + borrow = 0; + carry = 0; + do { + #ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) * q + carry; + zs = (si >> 16) * q + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*bx >> 16) - (zs & 0xffff) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(bx, z, y); + #else + ys = *sx++ * q + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *bx++ = y & 0xffff; + #endif + } while (sx <= sxe); + if (!*bxe) { + bx = b->x; + while (--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + if (cmp(b, S) >= 0) { + q++; + borrow = 0; + carry = 0; + bx = b->x; + sx = S->x; + do { + #ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) + carry; + zs = (si >> 16) + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*bx >> 16) - (zs & 0xffff) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(bx, z, y); + #else + ys = *sx++ + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *bx++ = y & 0xffff; + #endif + } while (sx <= sxe); + bx = b->x; + bxe = bx + n; + if (!*bxe) { + while (--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + return q; + } + + /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. + * + * Inspired by "How to Print Floating-Point Numbers Accurately" by + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. + * + * Modifications: + * 1. Rather than iterating, we use a simple numeric overestimate + * to determine k = floor(log10(d)). We scale relevant + * quantities using O(log2(k)) rather than O(k) multiplications. + * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't + * try to generate digits strictly left to right. Instead, we + * compute with fewer bits and propagate the carry if necessary + * when rounding the final digit up. This is often faster. + * 3. Under the assumption that input will be rounded nearest, + * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. + * That is, we allow equality in stopping tests when the + * round-nearest rule will give the same floating-point value + * as would satisfaction of the stopping test with strict + * inequality. + * 4. We remove common factors of powers of 2 from relevant + * quantities. + * 5. When converting floating-point integers less than 1e16, + * we use floating-point arithmetic rather than resorting + * to multiple-precision integers. + * 6. When asked to produce fewer than 15 digits, we first try + * to get by with floating-point arithmetic; we resort to + * multiple-precision integer arithmetic only if we cannot + * guarantee that the floating-point calculation has given + * the correctly rounded result. For k requested digits and + * "uniformly" distributed input, the probability is + * something like 10^(k-15) that we must resort to the long + * calculation. + */ + + char * + BSD__dtoa + #ifdef KR_headers + (d, mode, ndigits, decpt, sign, rve) + double d; int mode, ndigits, *decpt, *sign; char **rve; + #else + (double d, int mode, int ndigits, int *decpt, int *sign, char **rve) + #endif + { + /* Arguments ndigits, decpt, sign are similar to those + of ecvt and fcvt; trailing zeros are suppressed from + the returned string. If not null, *rve is set to point + to the end of the return value. If d is +-Infinity or NaN, + then *decpt is set to 9999. + + mode: + 0 ==> shortest string that yields d when read in + and rounded to nearest. + 1 ==> like 0, but with Steele & White stopping rule; + e.g. with IEEE P754 arithmetic , mode 0 gives + 1e23 whereas mode 1 gives 9.999999999999999e22. + 2 ==> max(1,ndigits) significant digits. This gives a + return value similar to that of ecvt, except + that trailing zeros are suppressed. + 3 ==> through ndigits past the decimal point. This + gives a return value similar to that from fcvt, + except that trailing zeros are suppressed, and + ndigits can be negative. + 4-9 should give the same return values as 2-3, i.e., + 4 <= mode <= 9 ==> same return as mode + 2 + (mode & 1). These modes are mainly for + debugging; often they run slower but sometimes + faster than modes 2-3. + 4,5,8,9 ==> left-to-right digit generation. + 6-9 ==> don't try fast floating-point estimate + (if applicable). + + Values of mode other than 0-9 are treated as mode 0. + + Sufficient space is allocated to the return value + to hold the suppressed trailing zeros. + */ + + int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, + j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, + spec_case, try_quick; + long L; + #ifndef Sudden_Underflow + int denorm; + unsigned long x; + #endif + Bigint *b, *b1, *delta, *mlo, *mhi, *S; + double d2, ds, eps; + char *s, *s0; + static Bigint *result; + static int result_k; + + if (result) { + result->k = result_k; + result->maxwds = 1 << result_k; + Bfree(result); + result = 0; + } + + if (word0(d) & Sign_bit) { + /* set sign for everything, including 0's and NaNs */ + *sign = 1; + word0(d) &= ~Sign_bit; /* clear sign bit */ + } + else + *sign = 0; + + #if defined(IEEE_Arith) + defined(VAX) + #ifdef IEEE_Arith + if ((word0(d) & Exp_mask) == Exp_mask) + #else + if (word0(d) == 0x8000) + #endif + { + /* Infinity or NaN */ + *decpt = 9999; + s = + #ifdef IEEE_Arith + !word1(d) && !(word0(d) & 0xfffff) ? "Infinity" : + #endif + "NaN"; + if (rve) + *rve = + #ifdef IEEE_Arith + s[3] ? s + 8 : + #endif + s + 3; + return s; + } + #endif + #ifdef IBM + d += 0; /* normalize */ + #endif + if (!d) { + *decpt = 1; + s = "0"; + if (rve) + *rve = s + 1; + return s; + } + + b = d2b(d, &be, &bbits); + #ifdef Sudden_Underflow + i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); + #else + if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) { + #endif + d2 = d; + word0(d2) &= Frac_mask1; + word0(d2) |= Exp_11; + #ifdef IBM + if (j = 11 - hi0bits(word0(d2) & Frac_mask)) + d2 /= 1 << j; + #endif + + /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 + * log10(x) = log(x) / log(10) + * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) + * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) + * + * This suggests computing an approximation k to log10(d) by + * + * k = (i - Bias)*0.301029995663981 + * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); + * + * We want k to be too large rather than too small. + * The error in the first-order Taylor series approximation + * is in our favor, so we just round up the constant enough + * to compensate for any error in the multiplication of + * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, + * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, + * adding 1e-13 to the constant term more than suffices. + * Hence we adjust the constant term to 0.1760912590558. + * (We could get a more accurate k by invoking log10, + * but this is probably not worthwhile.) + */ + + i -= Bias; + #ifdef IBM + i <<= 2; + i += j; + #endif + #ifndef Sudden_Underflow + denorm = 0; + } else { + /* d is denormalized */ + + i = bbits + be + (Bias + (P-1) - 1); + x = i > 32 ? word0(d) << 64 - i | word1(d) >> i - 32 + : word1(d) << 32 - i; + d2 = x; + word0(d2) -= 31*Exp_msk1; /* adjust exponent */ + i -= (Bias + (P-1) - 1) + 1; + denorm = 1; + } + #endif + ds = (d2-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + k = (int)ds; + if (ds < 0. && ds != k) + k--; /* want k = floor(ds) */ + k_check = 1; + if (k >= 0 && k <= Ten_pmax) { + if (d < tens[k]) + k--; + k_check = 0; + } + j = bbits - i - 1; + if (j >= 0) { + b2 = 0; + s2 = j; + } else { + b2 = -j; + s2 = 0; + } + if (k >= 0) { + b5 = 0; + s5 = k; + s2 += k; + } else { + b2 -= k; + b5 = -k; + s5 = 0; + } + if (mode < 0 || mode > 9) + mode = 0; + try_quick = 1; + if (mode > 5) { + mode -= 4; + try_quick = 0; + } + leftright = 1; + switch(mode) { + case 0: + case 1: + ilim = ilim1 = -1; + i = 18; + ndigits = 0; + break; + case 2: + leftright = 0; + /* no break */ + case 4: + if (ndigits <= 0) + ndigits = 1; + ilim = ilim1 = i = ndigits; + break; + case 3: + leftright = 0; + /* no break */ + case 5: + i = ndigits + k + 1; + ilim = i; + ilim1 = i - 1; + if (i <= 0) + i = 1; + } + j = sizeof(unsigned long); + for (result_k = 0; sizeof(Bigint) - sizeof(unsigned long) + j < i; + j <<= 1) result_k++; + result = Balloc(result_k); + s = s0 = (char *)result; + + if (ilim >= 0 && ilim <= Quick_max && try_quick) { + + /* Try to get by with floating-point arithmetic. */ + + i = 0; + d2 = d; + k0 = k; + ilim0 = ilim; + ieps = 2; /* conservative */ + if (k > 0) { + ds = tens[k&0xf]; + j = k >> 4; + if (j & Bletch) { + /* prevent overflows */ + j &= Bletch - 1; + d /= bigtens[n_bigtens-1]; + ieps++; + } + for (; j; j >>= 1, i++) + if (j & 1) { + ieps++; + ds *= bigtens[i]; + } + d /= ds; + } else if (j1 = -k) { + d *= tens[j1 & 0xf]; + for (j = j1 >> 4; j; j >>= 1, i++) + if (j & 1) { + ieps++; + d *= bigtens[i]; + } + } + if (k_check && d < 1. && ilim > 0) { + if (ilim1 <= 0) + goto fast_failed; + ilim = ilim1; + k--; + d *= 10.; + ieps++; + } + eps = ieps*d + 7.; + word0(eps) -= (P-1)*Exp_msk1; + if (ilim == 0) { + S = mhi = 0; + d -= 5.; + if (d > eps) + goto one_digit; + if (d < -eps) + goto no_digits; + goto fast_failed; + } + #ifndef No_leftright + if (leftright) { + /* Use Steele & White method of only + * generating digits needed. + */ + eps = 0.5/tens[ilim-1] - eps; + for (i = 0;;) { + L = d; + d -= L; + *s++ = '0' + (int)L; + if (d < eps) + goto ret1; + if (1. - d < eps) + goto bump_up; + if (++i >= ilim) + break; + eps *= 10.; + d *= 10.; + } + } else { + #endif + /* Generate ilim digits, then fix them up. */ + eps *= tens[ilim-1]; + for (i = 1;; i++, d *= 10.) { + L = d; + d -= L; + *s++ = '0' + (int)L; + if (i == ilim) { + if (d > 0.5 + eps) + goto bump_up; + else if (d < 0.5 - eps) { + while (*--s == '0'); + s++; + goto ret1; + } + break; + } + } + #ifndef No_leftright + } + #endif + fast_failed: + s = s0; + d = d2; + k = k0; + ilim = ilim0; + } + + /* Do we have a "small" integer? */ + + if (be >= 0 && k <= Int_max) { + /* Yes. */ + ds = tens[k]; + if (ndigits < 0 && ilim <= 0) { + S = mhi = 0; + if (ilim < 0 || d <= 5*ds) + goto no_digits; + goto one_digit; + } + for (i = 1;; i++) { + L = d / ds; + d -= L*ds; + #ifdef Check_FLT_ROUNDS + /* If FLT_ROUNDS == 2, L will usually be high by 1 */ + if (d < 0) { + L--; + d += ds; + } + #endif + *s++ = '0' + (int)L; + if (i == ilim) { + d += d; + if (d > ds || d == ds && L & 1) { + bump_up: + while (*--s == '9') + if (s == s0) { + k++; + *s = '0'; + break; + } + ++*s++; + } + break; + } + if (!(d *= 10.)) + break; + } + goto ret1; + } + + m2 = b2; + m5 = b5; + mhi = mlo = 0; + if (leftright) { + if (mode < 2) { + i = + #ifndef Sudden_Underflow + denorm ? be + (Bias + (P-1) - 1 + 1) : + #endif + #ifdef IBM + 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); + #else + 1 + P - bbits; + #endif + } else { + j = ilim - 1; + if (m5 >= j) + m5 -= j; + else { + s5 += j -= m5; + b5 += j; + m5 = 0; + } + if ((i = ilim) < 0) { + m2 -= i; + i = 0; + } + } + b2 += i; + s2 += i; + mhi = i2b(1); + } + if (m2 > 0 && s2 > 0) { + i = m2 < s2 ? m2 : s2; + b2 -= i; + m2 -= i; + s2 -= i; + } + if (b5 > 0) { + if (leftright) { + if (m5 > 0) { + mhi = pow5mult(mhi, m5); + b1 = mult(mhi, b); + Bfree(b); + b = b1; + } + if (j = b5 - m5) + b = pow5mult(b, j); + } else + b = pow5mult(b, b5); + } + S = i2b(1); + if (s5 > 0) + S = pow5mult(S, s5); + + /* Check for special case that d is a normalized power of 2. */ + + if (mode < 2) { + if (!word1(d) && !(word0(d) & Bndry_mask) + #ifndef Sudden_Underflow + && word0(d) & Exp_mask + #endif + ) { + /* The special case */ + b2 += Log2P; + s2 += Log2P; + spec_case = 1; + } else + spec_case = 0; + } + + /* Arrange for convenient computation of quotients: + * shift left if necessary so divisor has 4 leading 0 bits. + * + * Perhaps we should just compute leading 28 bits of S once + * and for all and pass them and a shift to quorem, so it + * can do shifts and ors to compute the numerator for q. + */ + #ifdef Pack_32 + if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) + i = 32 - i; + #else + if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf) + i = 16 - i; + #endif + if (i > 4) { + i -= 4; + b2 += i; + m2 += i; + s2 += i; + } else if (i < 4) { + i += 28; + b2 += i; + m2 += i; + s2 += i; + } + if (b2 > 0) + b = lshift(b, b2); + if (s2 > 0) + S = lshift(S, s2); + if (k_check) { + if (cmp(b,S) < 0) { + k--; + b = multadd(b, 10, 0); /* we botched the k estimate */ + if (leftright) + mhi = multadd(mhi, 10, 0); + ilim = ilim1; + } + } + if (ilim <= 0 && mode > 2) { + if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { + /* no digits, fcvt style */ + no_digits: + k = -1 - ndigits; + goto ret; + } + one_digit: + *s++ = '1'; + k++; + goto ret; + } + if (leftright) { + if (m2 > 0) + mhi = lshift(mhi, m2); + + /* Compute mlo -- check for special case + * that d is a normalized power of 2. + */ + + mlo = mhi; + if (spec_case) { + mhi = Balloc(mhi->k); + Bcopy(mhi, mlo); + mhi = lshift(mhi, Log2P); + } + + for (i = 1;;i++) { + dig = quorem(b,S) + '0'; + /* Do we yet have the shortest decimal string + * that will round to d? + */ + j = cmp(b, mlo); + delta = diff(S, mhi); + j1 = delta->sign ? 1 : cmp(b, delta); + Bfree(delta); + #ifndef ROUND_BIASED + if (j1 == 0 && !mode && !(word1(d) & 1)) { + if (dig == '9') + goto round_9_up; + if (j > 0) + dig++; + *s++ = dig; + goto ret; + } + #endif + if (j < 0 || j == 0 && !mode + #ifndef ROUND_BIASED + && !(word1(d) & 1) + #endif + ) { + if (j1 > 0) { + b = lshift(b, 1); + j1 = cmp(b, S); + if ((j1 > 0 || j1 == 0 && dig & 1) + && dig++ == '9') + goto round_9_up; + } + *s++ = dig; + goto ret; + } + if (j1 > 0) { + if (dig == '9') { /* possible if i == 1 */ + round_9_up: + *s++ = '9'; + goto roundoff; + } + *s++ = dig + 1; + goto ret; + } + *s++ = dig; + if (i == ilim) + break; + b = multadd(b, 10, 0); + if (mlo == mhi) + mlo = mhi = multadd(mhi, 10, 0); + else { + mlo = multadd(mlo, 10, 0); + mhi = multadd(mhi, 10, 0); + } + } + } else + for (i = 1;; i++) { + *s++ = dig = quorem(b,S) + '0'; + if (i >= ilim) + break; + b = multadd(b, 10, 0); + } + + /* Round off last digit */ + + b = lshift(b, 1); + j = cmp(b, S); + if (j > 0 || j == 0 && dig & 1) { + roundoff: + while (*--s == '9') + if (s == s0) { + k++; + *s++ = '1'; + goto ret; + } + ++*s++; + } else { + while (*--s == '0'); + s++; + } + ret: + Bfree(S); + if (mhi) { + if (mlo && mlo != mhi) + Bfree(mlo); + Bfree(mhi); + } + ret1: + Bfree(b); + if (s == s0) { /* don't return empty string */ + *s++ = '0'; + k = 0; + } + *s = 0; + *decpt = k + 1; + if (rve) + *rve = s; + return s0; + } + #ifdef __cplusplus + } + #endif diff -Ncr ../inn-1.5.1.dist/snprintf/vfprintf.c ./snprintf/vfprintf.c *** ../inn-1.5.1.dist/snprintf/vfprintf.c Thu Jan 1 01:00:00 1970 --- ./snprintf/vfprintf.c Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,838 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #if defined(LIBC_SCCS) && !defined(lint) + static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; + #endif /* LIBC_SCCS and not lint */ + + /* + * Actual printf innards. + * + * This code is large and complicated... + */ + + #include + + #include + #include "xstdio.h" + #include + #include + + #if defined(__STDC__) + # include + #else + # include + # undef __P + # define __P(x) () + #endif + + #include "local.h" + #include "fvwrite.h" + + /* Define FLOATING_POINT to get floating point. */ + #define FLOATING_POINT + + /* + * Flush out all the vectors defined by the given uio, + * then reset it so that it can be reused. + */ + static int + BSD__sprint(fp, uio) + FILE *fp; + register struct __suio *uio; + { + register int err; + + if (uio->uio_resid == 0) { + uio->uio_iovcnt = 0; + return (0); + } + err = BSD__sfvwrite(fp, uio); + uio->uio_resid = 0; + uio->uio_iovcnt = 0; + return (err); + } + + /* + * Helper function for `fprintf to unbuffered unix file': creates a + * temporary buffer. We only work on write-only files; this avoids + * worries about ungetc buffers and so forth. + */ + static int + BSD__sbprintf(fp, fmt, ap) + register FILE *fp; + const char *fmt; + va_list ap; + { + int ret; + FILE fake; + unsigned char buf[BUFSIZ]; + + /* copy the important variables */ + fake._flags = fp->_flags & ~__SNBF; + fake._file = fp->_file; + fake._cookie = fp->_cookie; + fake._write = fp->_write; + + /* set up the buffer */ + fake._bf._base = fake._p = buf; + fake._bf._size = fake._w = sizeof(buf); + fake._lbfsize = 0; /* not actually used, but Just In Case */ + + /* do the work, then copy any error status */ + ret = BSD_vfprintf(&fake, fmt, ap); + if (ret >= 0 && fflush(&fake)) + ret = EOF; + if (fake._flags & __SERR) + fp->_flags |= __SERR; + return (ret); + } + + /* + * Macros for converting digits to letters and vice versa + */ + #define to_digit(c) ((c) - '0') + #define is_digit(c) ((unsigned)to_digit(c) <= 9) + #define to_char(n) ((n) + '0') + + /* + * Convert an unsigned long to ASCII for printf purposes, returning + * a pointer to the first character of the string representation. + * Octal numbers can be forced to have a leading zero; hex numbers + * use the given digits. + */ + static char * + BSD__ultoa(val, endp, base, octzero, xdigs) + register u_long val; + char *endp; + int base, octzero; + char *xdigs; + { + register char *cp = endp; + register long sval; + + /* + * Handle the three cases separately, in the hope of getting + * better/faster code. + */ + switch (base) { + case 10: + if (val < 10) { /* many numbers are 1 digit */ + *--cp = to_char(val); + return (cp); + } + /* + * On many machines, unsigned arithmetic is harder than + * signed arithmetic, so we do at most one unsigned mod and + * divide; this is sufficient to reduce the range of + * the incoming value to where signed arithmetic works. + */ + if (val > LONG_MAX) { + *--cp = to_char(val % 10); + sval = val / 10; + } else + sval = val; + do { + *--cp = to_char(sval % 10); + sval /= 10; + } while (sval != 0); + break; + + case 8: + do { + *--cp = to_char(val & 7); + val >>= 3; + } while (val); + if (octzero && *cp != '0') + *--cp = '0'; + break; + + case 16: + do { + *--cp = xdigs[val & 15]; + val >>= 4; + } while (val); + break; + + default: /* oops */ + abort(); + } + return (cp); + } + + #ifdef FLOATING_POINT + #include + #include "floatio.h" + + #define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */ + #define DEFPREC 6 + + static char *cvt __P((double, int, int, char *, int *, int, int *)); + static int exponent __P((char *, int, int)); + + #else /* no FLOATING_POINT */ + + #define BUF 68 + + #endif /* FLOATING_POINT */ + + + /* + * Flags used during conversion. + */ + #define ALT 0x001 /* alternate form */ + #define HEXPREFIX 0x002 /* add 0x or 0X prefix */ + #define LADJUST 0x004 /* left adjustment */ + #define LONGDBL 0x008 /* long double; unimplemented */ + #define LONGINT 0x010 /* long integer */ + + #ifdef _HAVE_SANE_QUAD_ + #define QUADINT 0x020 /* quad integer */ + #endif /* _HAVE_SANE_QUAD_ */ + + #define SHORTINT 0x040 /* short integer */ + #define ZEROPAD 0x080 /* zero (as opposed to blank) pad */ + #define FPT 0x100 /* Floating point number */ + int + BSD_vfprintf(fp, fmt0, ap) + FILE *fp; + const char *fmt0; + va_list ap; + { + register char *fmt; /* format string */ + register int ch; /* character from fmt */ + register int n; /* handy integer (short term usage) */ + register char *cp; /* handy char pointer (short term usage) */ + register struct __siov *iovp;/* for PRINT macro */ + register int flags; /* flags as above */ + int ret; /* return value accumulator */ + int width; /* width from format (%8d), or 0 */ + int prec; /* precision from format (%.3d), or -1 */ + char sign; /* sign prefix (' ', '+', '-', or \0) */ + #ifdef FLOATING_POINT + char softsign; /* temporary negative sign for floats */ + double _double; /* double precision arguments %[eEfgG] */ + int expt; /* integer value of exponent */ + int expsize; /* character count for expstr */ + int ndig; /* actual number of digits returned by cvt */ + char expstr[7]; /* buffer for exponent string */ + #endif + u_long ulval; /* integer arguments %[diouxX] */ + #ifdef _HAVE_SANE_QUAD_ + u_quad_t uqval; /* %q integers */ + #endif /* _HAVE_SANE_QUAD_ */ + int base; /* base for [diouxX] conversion */ + int dprec; /* a copy of prec if [diouxX], 0 otherwise */ + int fieldsz; /* field size expanded by sign, etc */ + int realsz; /* field size expanded by dprec */ + int size; /* size of converted field or string */ + char *xdigs; /* digits for [xX] conversion */ + #define NIOV 8 + struct __suio uio; /* output information: summary */ + struct __siov iov[NIOV];/* ... and individual io vectors */ + char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ + char ox[2]; /* space for 0x hex-prefix */ + + /* + * Choose PADSIZE to trade efficiency vs. size. If larger printf + * fields occur frequently, increase PADSIZE and make the initialisers + * below longer. + */ + #define PADSIZE 16 /* pad chunk size */ + static char blanks[PADSIZE] = + {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; + static char zeroes[PADSIZE] = + {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; + + /* + * BEWARE, these `goto error' on error, and PAD uses `n'. + */ + #define PRINT(ptr, len) { \ + iovp->iov_base = (ptr); \ + iovp->iov_len = (len); \ + uio.uio_resid += (len); \ + iovp++; \ + if (++uio.uio_iovcnt >= NIOV) { \ + if (BSD__sprint(fp, &uio)) \ + goto error; \ + iovp = iov; \ + } \ + } + #define PAD(howmany, with) { \ + if ((n = (howmany)) > 0) { \ + while (n > PADSIZE) { \ + PRINT(with, PADSIZE); \ + n -= PADSIZE; \ + } \ + PRINT(with, n); \ + } \ + } + #define FLUSH() { \ + if (uio.uio_resid && BSD__sprint(fp, &uio)) \ + goto error; \ + uio.uio_iovcnt = 0; \ + iovp = iov; \ + } + + /* + * To extend shorts properly, we need both signed and unsigned + * argument extraction methods. + */ + #define SARG() \ + (flags&LONGINT ? va_arg(ap, long) : \ + flags&SHORTINT ? (long)(short)va_arg(ap, int) : \ + (long)va_arg(ap, int)) + #define UARG() \ + (flags&LONGINT ? va_arg(ap, u_long) : \ + flags&SHORTINT ? (u_long)(u_short)va_arg(ap, int) : \ + (u_long)va_arg(ap, u_int)) + + /* optimise fprintf(stderr) (and other unbuffered Unix files) */ + if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && + fp->_file >= 0) + return (BSD__sbprintf(fp, fmt0, ap)); + + fmt = (char *)fmt0; + uio.uio_iov = iovp = iov; + uio.uio_resid = 0; + uio.uio_iovcnt = 0; + ret = 0; + + /* + * Scan the format for conversions (`%' character). + */ + for (;;) { + for (cp = fmt; (ch = *fmt) != '\0' && ch != '%'; fmt++) + /* void */; + if ((n = fmt - cp) != 0) { + PRINT(cp, n); + ret += n; + } + if (ch == '\0') + goto done; + fmt++; /* skip over '%' */ + + flags = 0; + dprec = 0; + width = 0; + prec = -1; + sign = '\0'; + + rflag: ch = *fmt++; + reswitch: switch (ch) { + case ' ': + /* + * ``If the space and + flags both appear, the space + * flag will be ignored.'' + * -- ANSI X3J11 + */ + if (!sign) + sign = ' '; + goto rflag; + case '#': + flags |= ALT; + goto rflag; + case '*': + /* + * ``A negative field width argument is taken as a + * - flag followed by a positive field width.'' + * -- ANSI X3J11 + * They don't exclude field widths read from args. + */ + if ((width = va_arg(ap, int)) >= 0) + goto rflag; + width = -width; + /* FALLTHROUGH */ + case '-': + flags |= LADJUST; + goto rflag; + case '+': + sign = '+'; + goto rflag; + case '.': + if ((ch = *fmt++) == '*') { + n = va_arg(ap, int); + prec = n < 0 ? -1 : n; + goto rflag; + } + n = 0; + while (is_digit(ch)) { + n = 10 * n + to_digit(ch); + ch = *fmt++; + } + prec = n < 0 ? -1 : n; + goto reswitch; + case '0': + /* + * ``Note that 0 is taken as a flag, not as the + * beginning of a field width.'' + * -- ANSI X3J11 + */ + flags |= ZEROPAD; + goto rflag; + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + n = 0; + do { + n = 10 * n + to_digit(ch); + ch = *fmt++; + } while (is_digit(ch)); + width = n; + goto reswitch; + #ifdef FLOATING_POINT + case 'L': + flags |= LONGDBL; + goto rflag; + #endif + case 'h': + flags |= SHORTINT; + goto rflag; + case 'l': + flags |= LONGINT; + goto rflag; + #ifdef _HAVE_SANE_QUAD_ + case 'q': + flags |= QUADINT; + goto rflag; + #endif /* _HAVE_SANE_QUAD_ */ + case 'c': + *(cp = buf) = va_arg(ap, int); + size = 1; + sign = '\0'; + break; + case 'D': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'd': + case 'i': + #ifdef _HAVE_SANE_QUAD_ + if (flags & QUADINT) { + uqval = va_arg(ap, quad_t); + if ((quad_t)uqval < 0) { + uqval = -uqval; + sign = '-'; + } + } else { + #else /* _HAVE_SANE_QUAD_ */ + { + #endif /* _HAVE_SANE_QUAD_ */ + ulval = SARG(); + if ((long)ulval < 0) { + ulval = -ulval; + sign = '-'; + } + } + base = 10; + goto number; + #ifdef FLOATING_POINT + case 'e': /* anomalous precision */ + case 'E': + prec = (prec == -1) ? + DEFPREC + 1 : prec + 1; + /* FALLTHROUGH */ + goto fp_begin; + case 'f': /* always print trailing zeroes */ + if (prec != 0) + flags |= ALT; + case 'g': + case 'G': + if (prec == -1) + prec = DEFPREC; + fp_begin: _double = va_arg(ap, double); + /* do this before tricky precision changes */ + if (isinf(_double)) { + if (_double < 0) + sign = '-'; + cp = "Inf"; + size = 3; + break; + } + if (isnan(_double)) { + cp = "NaN"; + size = 3; + break; + } + flags |= FPT; + cp = cvt(_double, prec, flags, &softsign, + &expt, ch, &ndig); + if (ch == 'g' || ch == 'G') { + if (expt <= -4 || expt > prec) + ch = (ch == 'g') ? 'e' : 'E'; + else + ch = 'g'; + } + if (ch <= 'e') { /* 'e' or 'E' fmt */ + --expt; + expsize = exponent(expstr, expt, ch); + size = expsize + ndig; + if (ndig > 1 || flags & ALT) + ++size; + } else if (ch == 'f') { /* f fmt */ + if (expt > 0) { + size = expt; + if (prec || flags & ALT) + size += prec + 1; + } else /* "0.X" */ + size = prec + 2; + } else if (expt >= ndig) { /* fixed g fmt */ + size = expt; + if (flags & ALT) + ++size; + } else + size = ndig + (expt > 0 ? + 1 : 2 - expt); + + if (softsign) + sign = '-'; + break; + #endif /* FLOATING_POINT */ + case 'n': + #ifdef _HAVE_SANE_QUAD_ + if (flags & QUADINT) + *va_arg(ap, quad_t *) = ret; + else if (flags & LONGINT) + #else /* _HAVE_SANE_QUAD_ */ + if (flags & LONGINT) + #endif /* _HAVE_SANE_QUAD_ */ + *va_arg(ap, long *) = ret; + else if (flags & SHORTINT) + *va_arg(ap, short *) = ret; + else + *va_arg(ap, int *) = ret; + continue; /* no output */ + case 'O': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'o': + #ifdef _HAVE_SANE_QUAD_ + if (flags & QUADINT) + uqval = va_arg(ap, u_quad_t); + else + #endif /* _HAVE_SANE_QUAD_ */ + ulval = UARG(); + base = 8; + goto nosign; + case 'p': + /* + * ``The argument shall be a pointer to void. The + * value of the pointer is converted to a sequence + * of printable characters, in an implementation- + * defined manner.'' + * -- ANSI X3J11 + */ + ulval = (u_long)va_arg(ap, void *); + base = 16; + xdigs = "0123456789abcdef"; + #ifdef _HAVE_SANE_QUAD_ + flags = (flags & ~QUADINT) | HEXPREFIX; + #else /* _HAVE_SANE_QUAD_ */ + flags = (flags) | HEXPREFIX; + #endif /* _HAVE_SANE_QUAD_ */ + ch = 'x'; + goto nosign; + case 's': + if ((cp = va_arg(ap, char *)) == NULL) + cp = "(null)"; + if (prec >= 0) { + /* + * can't use strlen; can only look for the + * NUL in the first `prec' characters, and + * strlen() will go further. + */ + char *p = (char *)memchr(cp, 0, prec); + + if (p != NULL) { + size = p - cp; + if (size > prec) + size = prec; + } else + size = prec; + } else + size = strlen(cp); + sign = '\0'; + break; + case 'U': + flags |= LONGINT; + /*FALLTHROUGH*/ + case 'u': + #ifdef _HAVE_SANE_QUAD_ + if (flags & QUADINT) + uqval = va_arg(ap, u_quad_t); + else + #endif /* _HAVE_SANE_QUAD_ */ + ulval = UARG(); + base = 10; + goto nosign; + case 'X': + xdigs = "0123456789ABCDEF"; + goto hex; + case 'x': + xdigs = "0123456789abcdef"; + hex: + #ifdef _HAVE_SANE_QUAD_ + if (flags & QUADINT) + uqval = va_arg(ap, u_quad_t); + else + #endif /* _HAVE_SANE_QUAD_ */ + ulval = UARG(); + base = 16; + /* leading 0x/X only if non-zero */ + if (flags & ALT && + #ifdef _HAVE_SANE_QUAD_ + (flags & QUADINT ? uqval != 0 : ulval != 0)) + #else /* _HAVE_SANE_QUAD_ */ + ulval != 0) + #endif /* _HAVE_SANE_QUAD_ */ + flags |= HEXPREFIX; + + /* unsigned conversions */ + nosign: sign = '\0'; + /* + * ``... diouXx conversions ... if a precision is + * specified, the 0 flag will be ignored.'' + * -- ANSI X3J11 + */ + number: if ((dprec = prec) >= 0) + flags &= ~ZEROPAD; + + /* + * ``The result of converting a zero value with an + * explicit precision of zero is no characters.'' + * -- ANSI X3J11 + */ + cp = buf + BUF; + #ifdef _HAVE_SANE_QUAD_ + if (flags & QUADINT) { + if (uqval != 0 || prec != 0) + cp = __uqtoa(uqval, cp, base, + flags & ALT, xdigs); + } else { + #else /* _HAVE_SANE_QUAD_ */ + { + #endif /* _HAVE_SANE_QUAD_ */ + if (ulval != 0 || prec != 0) + cp = BSD__ultoa(ulval, cp, base, + flags & ALT, xdigs); + } + size = buf + BUF - cp; + break; + default: /* "%?" prints ?, unless ? is NUL */ + if (ch == '\0') + goto done; + /* pretend it was %c with argument ch */ + cp = buf; + *cp = ch; + size = 1; + sign = '\0'; + break; + } + + /* + * All reasonable formats wind up here. At this point, `cp' + * points to a string which (if not flags&LADJUST) should be + * padded out to `width' places. If flags&ZEROPAD, it should + * first be prefixed by any sign or other prefix; otherwise, + * it should be blank padded before the prefix is emitted. + * After any left-hand padding and prefixing, emit zeroes + * required by a decimal [diouxX] precision, then print the + * string proper, then emit zeroes required by any leftover + * floating precision; finally, if LADJUST, pad with blanks. + * + * Compute actual size, so we know how much to pad. + * fieldsz excludes decimal prec; realsz includes it. + */ + fieldsz = size; + if (sign) + fieldsz++; + else if (flags & HEXPREFIX) + fieldsz += 2; + realsz = dprec > fieldsz ? dprec : fieldsz; + + /* right-adjusting blank padding */ + if ((flags & (LADJUST|ZEROPAD)) == 0) + PAD(width - realsz, blanks); + + /* prefix */ + if (sign) { + PRINT(&sign, 1); + } else if (flags & HEXPREFIX) { + ox[0] = '0'; + ox[1] = ch; + PRINT(ox, 2); + } + + /* right-adjusting zero padding */ + if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) + PAD(width - realsz, zeroes); + + /* leading zeroes from decimal precision */ + PAD(dprec - fieldsz, zeroes); + + /* the string or number proper */ + #ifdef FLOATING_POINT + if ((flags & FPT) == 0) { + PRINT(cp, size); + } else { /* glue together f_p fragments */ + if (ch >= 'f') { /* 'f' or 'g' */ + if (_double == 0) { + /* kludge for __dtoa irregularity */ + if (prec == 0 || + (flags & ALT) == 0) { + PRINT("0", 1); + } else { + PRINT("0.", 2); + PAD(ndig - 1, zeroes); + } + } else if (expt <= 0) { + PRINT("0.", 2); + PAD(-expt, zeroes); + PRINT(cp, ndig); + } else if (expt >= ndig) { + PRINT(cp, ndig); + PAD(expt - ndig, zeroes); + if (flags & ALT) + PRINT(".", 1); + } else { + PRINT(cp, expt); + cp += expt; + PRINT(".", 1); + PRINT(cp, ndig-expt); + } + } else { /* 'e' or 'E' */ + if (ndig > 1 || flags & ALT) { + ox[0] = *cp++; + ox[1] = '.'; + PRINT(ox, 2); + if (_double || flags & ALT == 0) { + PRINT(cp, ndig-1); + } else /* 0.[0..] */ + /* __dtoa irregularity */ + PAD(ndig - 1, zeroes); + } else /* XeYYY */ + PRINT(cp, 1); + PRINT(expstr, expsize); + } + } + #else + PRINT(cp, size); + #endif + /* left-adjusting padding (always blank) */ + if (flags & LADJUST) + PAD(width - realsz, blanks); + + /* finally, adjust ret */ + ret += width > realsz ? width : realsz; + + FLUSH(); /* copy out the I/O vectors */ + } + done: + FLUSH(); + error: + return (__sferror(fp) ? EOF : ret); + /* NOTREACHED */ + } + + #ifdef FLOATING_POINT + + extern char *BSD__dtoa __P((double, int, int, int *, int *, char **)); + + static char * + cvt(value, ndigits, flags, sign, decpt, ch, length) + double value; + int ndigits, flags, *decpt, ch, *length; + char *sign; + { + int mode, dsgn; + char *digits, *bp, *rve; + + if (ch == 'f') + mode = 3; + else { + mode = 2; + } + if (value < 0) { + value = -value; + *sign = '-'; + } else + *sign = '\000'; + digits = BSD__dtoa(value, mode, ndigits, decpt, &dsgn, &rve); + if (flags & ALT) { /* Print trailing zeros */ + bp = digits + ndigits; + if (ch == 'f') { + if (*digits == '0' && value) + *decpt = -ndigits + 1; + bp += *decpt; + } + if (value == 0) /* kludge for __dtoa irregularity */ + rve = bp; + while (rve < bp) + *rve++ = '0'; + } + *length = rve - digits; + return (digits); + } + + static int + exponent(p0, exp, fmtch) + char *p0; + int exp, fmtch; + { + register char *p, *t; + char expbuf[MAXEXP]; + + p = p0; + *p++ = fmtch; + if (exp < 0) { + exp = -exp; + *p++ = '-'; + } + else + *p++ = '+'; + t = expbuf + MAXEXP; + if (exp > 9) { + do { + *--t = to_char(exp % 10); + } while ((exp /= 10) > 9); + *--t = to_char(exp); + for (; t < expbuf + MAXEXP; *p++ = *t++); + } + else { + *p++ = '0'; + *p++ = to_char(exp); + } + return (p - p0); + } + #endif /* FLOATING_POINT */ diff -Ncr ../inn-1.5.1.dist/snprintf/vsnprintf.c ./snprintf/vsnprintf.c *** ../inn-1.5.1.dist/snprintf/vsnprintf.c Thu Jan 1 01:00:00 1970 --- ./snprintf/vsnprintf.c Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,60 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #if defined(LIBC_SCCS) && !defined(lint) + static char sccsid[] = "@(#)vsnprintf.c 8.1 (Berkeley) 6/4/93"; + #endif /* LIBC_SCCS and not lint */ + + #include "xstdio.h" + + xvsnprintf(str, n, fmt, ap) + char *str; + size_t n; + const char *fmt; + _BSD_VA_LIST_ ap; + { + int ret; + FILE f; + + if ((int)n < 1) + return (EOF); + f._flags = __SWR | __SSTR; + f._bf._base = f._p = (unsigned char *)str; + f._bf._size = f._w = n - 1; + ret = BSD_vfprintf(&f, fmt, ap); + *f._p = 0; + return (ret); + } diff -Ncr ../inn-1.5.1.dist/snprintf/xcdefs.h ./snprintf/xcdefs.h *** ../inn-1.5.1.dist/snprintf/xcdefs.h Thu Jan 1 01:00:00 1970 --- ./snprintf/xcdefs.h Fri Jul 25 16:32:28 1997 *************** *** 0 **** --- 1,148 ---- + /* + * ++Copyright++ 1991, 1993 + * - + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + + /* + * @(#)cdefs.h 8.1 (Berkeley) 6/2/93 + * $Id: cdefs.h,v 1.1 1995/09/13 14:52:41 seth Exp $ + */ + + #ifndef _CDEFS_H_ + #define _CDEFS_H_ + + #if defined(__cplusplus) + #define __BEGIN_DECLS extern "C" { + #define __END_DECLS }; + #else + #define __BEGIN_DECLS + #define __END_DECLS + #endif + + /* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + */ + #if defined(__STDC__) || defined(__cplusplus) + #ifndef __P + #define __P(protos) protos /* full-blown ANSI C */ + #endif /* __P */ + #define __CONCAT(x,y) x ## y + #define __STRING(x) #x + + #define __const const /* define reserved names to standard */ + #define __signed signed + #define __volatile volatile + #if defined(__cplusplus) + #define __inline inline /* convert to C++ keyword */ + #else + #ifndef __GNUC__ + #define __inline /* delete GCC keyword */ + #endif /* !__GNUC__ */ + #endif /* !__cplusplus */ + + #else /* !(__STDC__ || __cplusplus) */ + #ifdef __P + #define __P(protos) () /* traditional C preprocessor */ + #endif /* __P */ + #define __CONCAT(x,y) x/**/y + #define __STRING(x) "x" + + #ifndef __GNUC__ + #define __const /* delete pseudo-ANSI C keywords */ + #define __inline + #define __signed + #define __volatile + /* + * In non-ANSI C environments, new programs will want ANSI-only C keywords + * deleted from the program and old programs will want them left alone. + * When using a compiler other than gcc, programs using the ANSI C keywords + * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. + * When using "gcc -traditional", we assume that this is the intent; if + * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. + */ + #ifndef NO_ANSI_KEYWORDS + #define const /* delete ANSI C keywords */ + #define inline + #define signed + #define volatile + #endif + #endif /* !__GNUC__ */ + #endif /* !(__STDC__ || __cplusplus) */ + + /* + * GCC1 and some versions of GCC2 declare dead (non-returning) and + * pure (no side effects) functions using "volatile" and "const"; + * unfortunately, these then cause warnings under "-ansi -pedantic". + * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of + * these work for GNU C++ (modulo a slight glitch in the C++ grammar + * in the distribution version of 2.5.5). + */ + #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5 + #define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ + #if defined(__GNUC__) && !defined(__STRICT_ANSI__) + #define __dead __volatile + #define __pure __const + #endif + #endif + + /* Delete pseudo-keywords wherever they are not available or needed. */ + #ifndef __dead + #define __dead + #define __pure + #endif + + #endif /* !_CDEFS_H_ */ diff -Ncr ../inn-1.5.1.dist/snprintf/xstdio.h ./snprintf/xstdio.h *** ../inn-1.5.1.dist/snprintf/xstdio.h Thu Jan 1 01:00:00 1970 --- ./snprintf/xstdio.h Fri Jul 25 16:32:29 1997 *************** *** 0 **** --- 1,400 ---- + /*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdio.h 8.4 (Berkeley) 1/4/94 + */ + + #ifndef _STDIO_H_ + #define _STDIO_H_ + + #if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__) + #include + #endif + + #include "xcdefs.h" + + #if defined(__STDC__) + # include + #else + # undef __P + # define __P(x) () + # include + #endif + #ifndef _BSD_VA_LIST_ + #define _BSD_VA_LIST_ va_list + #endif + + #if defined(sgi) + #undef __const + #define __const + #endif /* People who don't like const sys_error */ + + + #ifndef NULL + #define NULL 0 + #endif + + /* + * This is fairly grotesque, but pure ANSI code must not inspect the + * innards of an fpos_t anyway. The library internally uses off_t, + * which we assume is exactly as big as eight chars. (When we switch + * to gcc 2.4 we will use __attribute__ here.) + * + * WARNING: the alignment constraints on an off_t and the struct below + * differ on (e.g.) the SPARC. Hence, the placement of an fpos_t object + * in a structure will change if fpos_t's are not aligned on 8-byte + * boundaries. THIS IS A CROCK, but for now there is no way around it. + */ + #if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__) + typedef off_t fpos_t; + #else + typedef struct __sfpos { + char _pos[8]; + } fpos_t; + #endif + + #define _FSTDIO /* Define for new stdio with functions. */ + + /* + * NB: to fit things in six character monocase externals, the stdio + * code uses the prefix `__s' for stdio objects, typically followed + * by a three-character attempt at a mnemonic. + */ + + /* stdio buffers */ + struct __sbuf { + unsigned char *_base; + int _size; + }; + + /* + * stdio state variables. + * + * The following always hold: + * + * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + * _lbfsize is -_bf._size, else _lbfsize is 0 + * if _flags&__SRD, _w is 0 + * if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf. When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + * + * NB: see WARNING above before changing the layout of this structure! + */ + typedef struct __sFILE { + unsigned char *_p; /* current position in (some) buffer */ + int _r; /* read space left for getc() */ + int _w; /* write space left for putc() */ + short _flags; /* flags, below; this FILE is free if 0 */ + short _file; /* fileno, if Unix descriptor, else -1 */ + struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ + int _lbfsize; /* 0 or -_bf._size, for inline putc */ + + /* operations */ + void *_cookie; /* cookie passed to io functions */ + int (*_close) __P((void *)); + int (*_read) __P((void *, char *, int)); + fpos_t (*_seek) __P((void *, fpos_t, int)); + int (*_write) __P((void *, const char *, int)); + + /* separate buffer for long sequences of ungetc() */ + struct __sbuf _ub; /* ungetc buffer */ + unsigned char *_up; /* saved _p when _p is doing ungetc data */ + int _ur; /* saved _r when _r is counting ungetc data */ + + /* tricks to meet minimum requirements even when malloc() fails */ + unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ + unsigned char _nbuf[1]; /* guarantee a getc() buffer */ + + /* separate buffer for fgetln() when line crosses buffer boundary */ + struct __sbuf _lb; /* buffer for fgetln() */ + + /* Unix stdio files get aligned to block boundaries on fseek() */ + int _blksize; /* stat.st_blksize (may be != _bf._size) */ + fpos_t _offset; /* current lseek offset (see WARNING) */ + } FILE; + + __BEGIN_DECLS + extern FILE __sF[]; + __END_DECLS + + #define __SLBF 0x0001 /* line buffered */ + #define __SNBF 0x0002 /* unbuffered */ + #define __SRD 0x0004 /* OK to read */ + #define __SWR 0x0008 /* OK to write */ + /* RD and WR are never simultaneously asserted */ + #define __SRW 0x0010 /* open for reading & writing */ + #define __SEOF 0x0020 /* found EOF */ + #define __SERR 0x0040 /* found error */ + #define __SMBF 0x0080 /* _buf is from malloc */ + #define __SAPP 0x0100 /* fdopen()ed in append mode */ + #define __SSTR 0x0200 /* this is an sprintf/snprintf string */ + #define __SOPT 0x0400 /* do fseek() optimisation */ + #define __SNPT 0x0800 /* do not do fseek() optimisation */ + #define __SOFF 0x1000 /* set iff _offset is in fact correct */ + #define __SMOD 0x2000 /* true => fgetln modified _p text */ + + /* + * The following three definitions are for ANSI C, which took them + * from System V, which brilliantly took internal interface macros and + * made them official arguments to setvbuf(), without renaming them. + * Hence, these ugly _IOxxx names are *supposed* to appear in user code. + * + * Although numbered as their counterparts above, the implementation + * does not rely on this. + */ + #define _IOFBF 0 /* setvbuf should set fully buffered */ + #define _IOLBF 1 /* setvbuf should set line buffered */ + #define _IONBF 2 /* setvbuf should set unbuffered */ + + #define BUFSIZ 1024 /* size of buffer used by setbuf */ + #define EOF (-1) + + /* + * FOPEN_MAX is a minimum maximum, and is the number of streams that + * stdio can provide without attempting to allocate further resources + * (which could fail). Do not use this for anything. + */ + /* must be == _POSIX_STREAM_MAX */ + #define FOPEN_MAX 20 /* must be <= OPEN_MAX */ + #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ + + /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ + #ifndef _ANSI_SOURCE + #define P_tmpdir "/var/tmp/" + #endif + #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ + #if !defined(TMP_MAX) + # define TMP_MAX 308915776 + #endif + + #ifndef SEEK_SET + #define SEEK_SET 0 /* set file offset to offset */ + #endif + #ifndef SEEK_CUR + #define SEEK_CUR 1 /* set file offset to current plus offset */ + #endif + #ifndef SEEK_END + #define SEEK_END 2 /* set file offset to EOF plus offset */ + #endif + + #define stdin (&__sF[0]) + #define stdout (&__sF[1]) + #define stderr (&__sF[2]) + + /* + * Functions defined in ANSI C standard. + */ + __BEGIN_DECLS + void clearerr __P((FILE *)); + int fclose __P((FILE *)); + int feof __P((FILE *)); + int ferror __P((FILE *)); + int fflush __P((FILE *)); + int fgetc __P((FILE *)); + int fgetpos __P((FILE *, fpos_t *)); + char *fgets __P((char *, size_t, FILE *)); + FILE *fopen __P((const char *, const char *)); + int fprintf __P((FILE *, const char *, ...)); + int fputc __P((int, FILE *)); + int fputs __P((const char *, FILE *)); + size_t fread __P((void *, size_t, size_t, FILE *)); + FILE *freopen __P((const char *, const char *, FILE *)); + int fscanf __P((FILE *, const char *, ...)); + int fseek __P((FILE *, long, int)); + int fsetpos __P((FILE *, const fpos_t *)); + long ftell __P((const FILE *)); + size_t fwrite __P((const void *, size_t, size_t, FILE *)); + int getc __P((FILE *)); + int getchar __P((void)); + char *gets __P((char *)); + #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) + extern int sys_nerr; /* perror(3) external variables */ + #if !defined(__NeXT__) + extern __const char *__const sys_errlist[]; + #endif /* !NeXT */ + #endif + void perror __P((const char *)); + int printf __P((const char *, ...)); + int putc __P((int, FILE *)); + int putchar __P((int)); + int puts __P((const char *)); + int remove __P((const char *)); + int rename __P((const char *, const char *)); + void rewind __P((FILE *)); + int scanf __P((const char *, ...)); + void setbuf __P((FILE *, char *)); + int setvbuf __P((FILE *, char *, int, size_t)); + int sprintf __P((char *, const char *, ...)); + int sscanf __P((const char *, const char *, ...)); + FILE *tmpfile __P((void)); + char *tmpnam __P((char *)); + int ungetc __P((int, FILE *)); + int vfprintf __P((FILE *, const char *, _BSD_VA_LIST_)); + int vprintf __P((const char *, _BSD_VA_LIST_)); + int vsprintf __P((char *, const char *, _BSD_VA_LIST_)); + __END_DECLS + + /* + * Functions defined in POSIX 1003.1. + */ + #ifndef _ANSI_SOURCE + #define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ + #define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ + + __BEGIN_DECLS + char *ctermid __P((char *)); + FILE *fdopen __P((int, const char *)); + int fileno __P((FILE *)); + __END_DECLS + #endif /* not ANSI */ + + /* + * Routines that are purely local. + */ + #if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE) + __BEGIN_DECLS + char *fgetln __P((FILE *, size_t *)); + int fpurge __P((FILE *)); + int getw __P((FILE *)); + int pclose __P((FILE *)); + FILE *popen __P((const char *, const char *)); + int putw __P((int, FILE *)); + void setbuffer __P((FILE *, char *, int)); + int setlinebuf __P((FILE *)); + char *tempnam __P((const char *, const char *)); + int snprintf __P((char *, size_t, const char *, ...)); + int vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_)); + int vscanf __P((const char *, _BSD_VA_LIST_)); + int vsscanf __P((const char *, const char *, _BSD_VA_LIST_)); + FILE *zopen __P((const char *, const char *, int)); + __END_DECLS + + /* + * This is a #define because the function is used internally and + * (unlike vfscanf) the name __svfscanf is guaranteed not to collide + * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. + */ + #define vfscanf __svfscanf + + /* + * Stdio function-access interface. + */ + __BEGIN_DECLS + FILE *funopen __P((const void *, + int (*)(void *, char *, int), + int (*)(void *, const char *, int), + fpos_t (*)(void *, fpos_t, int), + int (*)(void *))); + __END_DECLS + #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) + #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) + #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ + + /* + * Functions internal to the implementation. + */ + __BEGIN_DECLS + int __srget __P((FILE *)); + int __svfscanf __P((FILE *, const char *, _BSD_VA_LIST_)); + int __swbuf __P((int, FILE *)); + __END_DECLS + + /* + * The __sfoo macros are here so that we can + * define function versions in the C library. + */ + #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) + #if defined(__GNUC__) && defined(__STDC__) + static __inline int __sputc(int _c, FILE *_p) { + if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) + return (*_p->_p++ = _c); + else + return (__swbuf(_c, _p)); + } + #else + /* + * This has been tuned to generate reasonable code on the vax using pcc. + */ + #define __sputc(c, p) \ + (--(p)->_w < 0 ? \ + (p)->_w >= (p)->_lbfsize ? \ + (*(p)->_p = (c)), *(p)->_p != '\n' ? \ + (int)*(p)->_p++ : \ + __swbuf('\n', p) : \ + __swbuf((int)(c), p) : \ + (*(p)->_p = (c), (int)*(p)->_p++)) + #endif + + #define __sfeof(p) (((p)->_flags & __SEOF) != 0) + #define __sferror(p) (((p)->_flags & __SERR) != 0) + #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) + #define __sfileno(p) ((p)->_file) + + #define feof(p) __sfeof(p) + #define ferror(p) __sferror(p) + #define clearerr(p) __sclearerr(p) + + #ifndef _ANSI_SOURCE + #define fileno(p) __sfileno(p) + #endif + + #ifndef lint + #define getc(fp) __sgetc(fp) + #define putc(x, fp) __sputc(x, fp) + #endif /* lint */ + + #define getchar() getc(stdin) + #define putchar(x) putc(x, stdout) + + /* XXX - Does not belong here, but we need to exerpt this routine */ + long strtol __P((const char *, char **, int)); + unsigned long strtoul __P((const char *, char **, int)); + double strtod __P((const char *, char **)); + + + #endif /* _STDIO_H_ */