From decwrl!ucbvax!ucsd!swrinde!cs.utexas.edu!uunet!allbery Sun Oct 1 15:40:02 PDT 1989 Article 1129 of comp.sources.misc: Path: decwrl!ucbvax!ucsd!swrinde!cs.utexas.edu!uunet!allbery From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Newsgroups: comp.sources.misc Subject: v08i085: libhoward portability library, part 7 of 9 Message-ID: <68943@uunet.UU.NET> Date: 1 Oct 89 14:45:51 GMT Sender: allbery@uunet.UU.NET Reply-To: howard@dahlbeck.ericsson.se (Howard Gayle) Lines: 1816 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Posting-number: Volume 8, Issue 85 Submitted-by: howard@dahlbeck.ericsson.se (Howard Gayle) Archive-name: libhoward/part07 #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # If this archive is complete, you will see the following message at the end: # "End of archive 7 (of 9)." # Contents: copy-self.1 freezePch.1 mcalloc.c mcpstr.c mfcopy.3 # mfcopy.c mfflush.c mfseek.c msgfn.3 new-c.b new-uMake.b prefix.3 # prefix.c putspn.3 putspn.c qrndu.3 smpdig.c uMakefile yrwk.3 # Wrapped by howard@hasse on Mon Sep 25 07:08:13 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'copy-self.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'copy-self.1'\" else echo shar: Extracting \"'copy-self.1'\" \(1991 characters\) sed "s/^X//" >'copy-self.1' <<'END_OF_FILE' X.\" $Header: copy-self.1,v 1.2 89/09/20 13:58:12 howard Exp $ X.TH COPY-SELF 1 "$Revision: 1.2 $" X.SH NAME Xcopy-self \- copy files to files with same names X.SH SYNOPSIS X.B copy-self X.RB [ " \-r " ] X.I filename \&.\|.\|. X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I copy-self Xcopies each given file to a temporary file in the same directory. XIt then renames the temporary file to the old file name. XThis breaks any links, and results in a file owned by the caller. XUnless the X.B \-r Xoption is used, the file is made writeable by the caller. XThe caller must have write permission in the directory in which Xthe file resides. XIf this directory is group-writeable, then the file is also made Xgroup-writeable. X.SH EXAMPLE X.nf X % ls -l t1 t2 t3 X -r--r--r-- 2 foobar 33 Sep 6 09:34 t1 X -r--r--r-- 2 foobar 33 Sep 6 09:34 t2 X lrwxrwxrwx 1 foobar 2 Sep 6 09:35 t3 -> t1 X % copy-self t2 t3 X % ls -l t1 t2 t3 X -rw-r--r-- 1 howard 33 Sep 6 09:34 t1 X -rw-r--r-- 1 howard 33 Sep 6 09:35 t2 X -rw-r--r-- 1 howard 33 Sep 6 09:37 t3 X.fi X.SH FILES X.DT X.nf X\&.copy-self$$ \- temporary file X.fi X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 1991 -ne `wc -c <'copy-self.1'`; then echo shar: \"'copy-self.1'\" unpacked with wrong size! fi # end of 'copy-self.1' fi if test -f 'freezePch.1' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'freezePch.1'\" else echo shar: Extracting \"'freezePch.1'\" \(2189 characters\) sed "s/^X//" >'freezePch.1' <<'END_OF_FILE' X.\" $Header: freezePch.1,v 1.2 89/09/25 07:01:32 howard Exp $ X.TH FREEZEPCH 1 "$Revision: 1.2 $" X.SH NAME XfreezePch \- make a patch file from one revision to another X.SH SYNOPSIS X.B freezePch X.I old-revision X.I new-revision X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I freezePch Xwrites on standard output a Bourne shell script that, when Xexecuted, updates all the source files in a software system Xfrom those that were in revision X.I old-revision Xof the FREEZE file to those that were in revision X.I new-revision Xof the FREEZE file. XIt first checks out revision X.I new-revision Xof FREEZE. XIt then writes commands to remove any files in X.I old-revision Xbut not in X.IR new-revision . XThe old FREEZE file is always removed. XNext, X.I freezePch Xcalls shar to write a shar file for any files in X.I new-revision Xbut not in X.IR old-revision . XA complete copy of the new FREEZE is always sent as a shar file. XFinally, X.I freezePch Xwrites a patch command for every file that changed from X.I old-revision Xto X.IR new-revision . X.SH EXAMPLE X.nf X % freezePch 1.7 2.4 > patchfile X.fi X.SH FILES X.DT X.nf XFREEZE \- freeze file XRCS/FREEZE,v \- RCS master freeze file X/tmp/frzpch$$? \- temporary files X.fi X.SH "SEE ALSO" X.IR freeze (1), X.IR patch (1), X.IR rcsdiff (1), X.IR shar (1). X.SH BUGS XIf the output is too big, you have to split it into mulitple Xparts by hand. X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 2189 -ne `wc -c <'freezePch.1'`; then echo shar: \"'freezePch.1'\" unpacked with wrong size! fi # end of 'freezePch.1' fi if test -f 'mcalloc.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mcalloc.c'\" else echo shar: Extracting \"'mcalloc.c'\" \(2098 characters\) sed "s/^X//" >'mcalloc.c' <<'END_OF_FILE' X/* X * mcalloc - calloc() + malf1() X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: mcalloc.c,v 1.5 89/08/13 10:19:24 howard Exp $"); X X#include X#include X XPUBLIC voidPT mcalloc (n, s, es) Xunsigned n; /* Number of elements.*/ Xunsigned s; /* Size of each element.*/ XbStrT es; /* String for error message.*/ X X/* Function: X * X * Algorithm: X * Call calloc(). Call malf1() if not space. X * Returns: X * X * Notes: X * X */ X{ Xextern cStrT calloc(); /* malloc(3) */ XR1 voidPT r = (voidPT) calloc (n, s); /* Return.*/ X Xif (((voidPT) NULL) == r) X malf1 ("Can not allocate %u * %u = %u bytes for %s", n, s, n * s, es); Xreturn (r); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: mcalloc.c,v 1.5 89/08/13 10:19:24 howard Exp $"); XUSAGE ("nelem elsize"); X X#include X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X{ Xif (3 != argc) usage(); X(void) mcalloc ( X ma2u (argv[1], NULBSTR, FALSE, S("Number of elements"), (bStrT *) NULL), X ma2u (argv[2], NULBSTR, FALSE, S("Element size"), (bStrT *) NULL), X S("test")); X(void) puts ("Success"); Xmfflush (stdout, "Standard Output"); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 2098 -ne `wc -c <'mcalloc.c'`; then echo shar: \"'mcalloc.c'\" unpacked with wrong size! fi # end of 'mcalloc.c' fi if test -f 'mcpstr.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mcpstr.c'\" else echo shar: Extracting \"'mcpstr.c'\" \(2063 characters\) sed "s/^X//" >'mcpstr.c' <<'END_OF_FILE' X/* X * mcpstr - make a new copy of a string and check for errors X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: mcpstr.c,v 1.4 89/08/13 15:27:43 howard Exp $"); X X#include X#include X#include X XPUBLIC bStrT mcpstr (s) XR2 bStrT s; /* Old string.*/ X X/* Function: X * Allocate memory for string s and X * copy it into the newly allocated memory. X * If the memory allocation fails, output an error message and exit. X * Algorithm: X * Call malloc(), then strcpy(). X * Returns: X * A pointer to the newly allocated memory. X * No return if allocation fails. X * Notes: X * X */ X{ XR1 bStrT n; /* New string.*/ Xextern cStrT malloc(); /* (3).*/ X Xn = (bStrT) malloc (1 + (unsigned) strlen ((cStrT) s)); Xif (NULBSTR == n) X malf1 ("mcpstr: Can not allocate memory to copy string %s", s); XSTRCPY (n, s); Xreturn (n); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: mcpstr.c,v 1.4 89/08/13 15:27:43 howard Exp $"); XUSAGE ("string"); X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X{ Xif (2 != argc) usage(); XPUTS (mcpstr (argv[1])); Xmfflush (stdout, S("Standard Output")); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 2063 -ne `wc -c <'mcpstr.c'`; then echo shar: \"'mcpstr.c'\" unpacked with wrong size! fi # end of 'mcpstr.c' fi if test -f 'mfcopy.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mfcopy.3'\" else echo shar: Extracting \"'mfcopy.3'\" \(2128 characters\) sed "s/^X//" >'mfcopy.3' <<'END_OF_FILE' X.\" $Header: mfcopy.3,v 1.1 89/08/13 15:45:31 howard Exp $ X.TH MFCOPY "3 -lhoward" "$Revision: 1.1 $" "Howard\'s C library" "Howard\'s C library" X.SH NAME Xmfcopy \- copy bytes from one stream to another X.SH SYNOPSIS X.nf X.BR "#include <" stdio.h ">" X.BR "#include <" howard/port.h ">" X.BR "#include <" howard/malf.h ">" X.fi X.LP X.BR "void " "mfcopy (" X.IR fromStream , X.IR fromExit , X.IR fromName , X.IR toStream , X.IR toExit , X.IR toName ) X.nf X.RI "streamT " fromStream ; X.BI "int " fromExit; X.RI "bStrT " fromName ; X.RI "streamT " toStream ; X.BI "int " toExit; X.RI "bStrT " toName ; X.fi X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I mfcopy Xcopies bytes from X.I fromStream Xto X.I toStream Xuntil end of file on X.IR fromStream . XIn case of error on X.IR fromStream , Xit calls X.I malf Xwith X.I fromExit Xas exit code and with an error message including X.IR fromName . XIn case of error on X.IR toStream , Xit calls X.I malf Xwith X.I toExit Xas exit code and with an error message including X.IR toName . X.SH EXAMPLE XTo copy from standard input to standard output and exit with exit Xcode 1 on error: X.nf X mfcopy (stdin, 1, S("Standard Input"), stdout, 1, S("Standard Output")); X.fi X.SH "SEE ALSO" X.IR malf "(3 -lhoward)." X.SH BUGS XIt should work in big blocks, but right now it copies one byte at a time. X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 2128 -ne `wc -c <'mfcopy.3'`; then echo shar: \"'mfcopy.3'\" unpacked with wrong size! fi # end of 'mfcopy.3' fi if test -f 'mfcopy.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mfcopy.c'\" else echo shar: Extracting \"'mfcopy.c'\" \(2099 characters\) sed "s/^X//" >'mfcopy.c' <<'END_OF_FILE' X/* X * mfcopy - copy stream and handle errors X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: mfcopy.c,v 1.4 89/08/13 15:37:56 howard Exp $"); X X#include X#include X XPUBLIC void mfcopy (fs, fx, fn, ts, tx, tn) XR2 streamT fs; /* From stream.*/ X int fx; /* From exit code (0 = no exit).*/ X bStrT fn; /* From file name.*/ XR3 streamT ts; /* To stream.*/ X int tx; /* To exit code (0 = no exit).*/ X bStrT tn; /* To file name.*/ X X/* Function: X * X * Algorithm: X * Copy byte-by-byte. Check for errors. X * Returns: X * X * Notes: X * 1) Copying in big blocks would be faster. X */ X{ XR1 rcharT c; /* Current character.*/ Xstatic char eRead [] = "%s: Read error"; Xstatic char eWrite [] = "%s: Write error"; X Xwhile (EOF != (c = getc (fs))) X PUTC (c, ts); Xif (ferror (fs)) malf (fx, eRead, fn); XFFLUSH (ts); Xif (ferror (ts)) malf (tx, eWrite, tn); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: mfcopy.c,v 1.4 89/08/13 15:37:56 howard Exp $"); XUSAGE (""); X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X{ Xif (1 != argc) usage(); Xmfcopy (stdin, 0, S("Standard Input"), stdout, 0, S("Standard Output")); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 2099 -ne `wc -c <'mfcopy.c'`; then echo shar: \"'mfcopy.c'\" unpacked with wrong size! fi # end of 'mfcopy.c' fi if test -f 'mfflush.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mfflush.c'\" else echo shar: Extracting \"'mfflush.c'\" \(1574 characters\) sed "s/^X//" >'mfflush.c' <<'END_OF_FILE' X/* X * mfflush - flush stream and call malf1 on error X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: mfflush.c,v 1.4 89/08/13 14:59:43 howard Exp $"); X X#include X#include X XPUBLIC void mfflush (s, n) XR1 streamT s; /* Stream to flush.*/ X bStrT n; /* File name, for possible error message.*/ X X/* Function: X * Flush s. On write error call malf1(). X * Algorithm: X * X * Notes: X * X */ X{ XFFLUSH (s); Xif (ferror (s)) malf1 ("%s: Write error", n); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: mfflush.c,v 1.4 89/08/13 14:59:43 howard Exp $"); XUSAGE (""); X X#include X XPUBLIC int main () X{ XPUTS ("mfflush() works!"); Xmfflush (stdout, S("Standard Output")); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 1574 -ne `wc -c <'mfflush.c'`; then echo shar: \"'mfflush.c'\" unpacked with wrong size! fi # end of 'mfflush.c' fi if test -f 'mfseek.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'mfseek.c'\" else echo shar: Extracting \"'mfseek.c'\" \(1905 characters\) sed "s/^X//" >'mfseek.c' <<'END_OF_FILE' X/* X * mfseek - fseek() + malf1() X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: mfseek.c,v 1.4 89/08/13 15:18:44 howard Exp $"); X X#include X#include X XPUBLIC void mfseek (s, o, p, n) XstreamT s; /* Stream to seek on.*/ Xlong o; /* Offset.*/ Xint p; /* Type of seek.*/ XbStrT n; /* File name.*/ X X/* Function: X * X * Algorithm: X * Call fseek(). Call malf1() on error. X * Returns: X * X * Notes: X * X */ X{ Xif (fseek (s, o, p)) malf1 ("%s: Seek error, offset %ld, ptrname %d", n, o, p); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: mfseek.c,v 1.4 89/08/13 15:18:44 howard Exp $"); XUSAGE ("file offset"); X X#include X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X{ XstreamT f; /* Input stream.*/ X Xif (3 != argc) usage(); Xf = mfopen (argv[1], "r"); Xmfseek (f, X ma2l (argv[2], NULBSTR, FALSE, S("Offset"), (bStrT *) NULL), X 0, argv[1]); Xmfcopy (f, 0, argv[1], stdout, 1, S("Standard Output")); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 1905 -ne `wc -c <'mfseek.c'`; then echo shar: \"'mfseek.c'\" unpacked with wrong size! fi # end of 'mfseek.c' fi if test -f 'msgfn.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'msgfn.3'\" else echo shar: Extracting \"'msgfn.3'\" \(1920 characters\) sed "s/^X//" >'msgfn.3' <<'END_OF_FILE' X.\" $Header: msgfn.3,v 1.2 89/08/21 08:37:19 howard Exp $ X.TH MSGFN "3 -lhoward" "$Revision: 1.2 $" "Howard\'s C library" "Howard\'s C library" X.SH NAME Xmsgfn \- extract full name from mail message or news article header X.SH SYNOPSIS X.nf X.BR "#include <" stdio.h ">" X.BR "#include <" howard/port.h ">" X.BR "#include <" howard/malf.h ">" X.fi X.LP XboolT msgfn ( X.IR address , X.IR buffer ) X.nf X.RI "bStrT " address ; X.RI "bStrT " buffer ; X.fi X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I address Xis the value of an address header X.RI ( "e.g." XFrom:) Xin a mail message or news article. X.I msgfn Xtries to find a full name in this, and copies it into X.I buffer. XIf X.I address Xcontains a nonempty string in double quotes, that is taken as the full name. XOtherwise, a nonempty string in parentheses is taken. XOtherwise, a nonempty string is angle brackets is removed, including the angle Xbrackets, and the remaining string is taken, less any leading and trailing Xspaces. X.SH RETURNS XTRUE if a full name was copied, otherwise FALSE. X.SH BUGS XDouble-quoted strings are not always full names. X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 1920 -ne `wc -c <'msgfn.3'`; then echo shar: \"'msgfn.3'\" unpacked with wrong size! fi # end of 'msgfn.3' fi if test -f 'new-c.b' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'new-c.b'\" else echo shar: Extracting \"'new-c.b'\" \(2256 characters\) sed "s/^X//" >'new-c.b' <<'END_OF_FILE' X X# new-c.b - create a new C program source file from a prototype X# X# $Header: new-c.b,v 1.1 89/09/21 18:32:17 howard Exp $ X# X# Copyright 1989 Howard Lee Gayle X# This file is written in the ISO 8859/1 character set. X# X# This program is free software; you can redistribute it and/or modify X# it under the terms of the GNU General Public License version 1, X# as published by the Free Software Foundation. X# X# This program is distributed in the hope that it will be useful, X# but WITHOUT ANY WARRANTY; without even the implied warranty of X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X# GNU General Public License for more details. X# X# You should have received a copy of the GNU General Public License X# along with this program; if not, write to the Free Software X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X# X# Shell variables: X# c - ' *' X# d - '$' X# f - steps through files to create X# u - usage string X XCMDNAME=new-c Xexport CMDNAME Xu="Usage: $CMDNAME file..." Xif [ $# -eq 0 ] Xthen X echo "$u" 1>&2 X exit 1 Xfi Xc=' *' Xd='$' Xfor f Xdo X cat << EOF > "$f" X/* X$c $f - X */ X XEOF X if [ "$NEWTEXTPATH" ] X then X cat-path "$NEWTEXTPATH" new-c.txt >> "$f" X fi X cat << 'EOF' >> "$f" X#include X#include X#include X#include X XMAINVER ("@(#)$Header: new-c.b,v 1.1 89/09/21 18:32:17 howard Exp $"); XUSAGE (""); X X#include X#include X XPRIVATE char eIntern[] = "Internal error %s"; X X/* main - main function */ X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X X/* Function: X * X * Algorithm: X * X * Notes: X * X */ X X{ XrcharT c; /* Option letter.*/ XbStrT cp; /* Steps through args.*/ Xextern int optind; /* See getopt (3).*/ Xextern cStrT optarg; /* See getopt (3).*/ X Xwhile (EOF != (c = getopt (argc, (cStrT *) argv, ""))) X { X switch (c) X { X case '?': X usage(); X break; X default: X malf1 (eIntern, "main 1"); X break; X } X } Xargv += optind; Xcp = *argv++; Xif (NULBSTR == cp) usage(); X Xmfflush (stdout, S("Standard Output")); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} XEOF Xdone END_OF_FILE if test 2256 -ne `wc -c <'new-c.b'`; then echo shar: \"'new-c.b'\" unpacked with wrong size! fi # end of 'new-c.b' fi if test -f 'new-uMake.b' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'new-uMake.b'\" else echo shar: Extracting \"'new-uMake.b'\" \(1911 characters\) sed "s/^X//" >'new-uMake.b' <<'END_OF_FILE' X X# new-uMake.b - create a new uMakefile from a prototype X# X# $Header: new-uMake.b,v 1.1 89/09/21 18:14:52 howard Exp $ X# X# Copyright 1989 Howard Lee Gayle X# This file is written in the ISO 8859/1 character set. X# X# This program is free software; you can redistribute it and/or modify X# it under the terms of the GNU General Public License version 1, X# as published by the Free Software Foundation. X# X# This program is distributed in the hope that it will be useful, X# but WITHOUT ANY WARRANTY; without even the implied warranty of X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X# GNU General Public License for more details. X# X# You should have received a copy of the GNU General Public License X# along with this program; if not, write to the Free Software X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X# X# Shell variables: X# c - '#' X# d - '$' X# f - steps through files to create X# u - usage string X XCMDNAME=new-uMake Xexport CMDNAME Xu="Usage: $CMDNAME file..." Xif [ $# -eq 0 ] Xthen X echo "$u" 1>&2 X exit 1 Xfi Xc='#' Xd='$' Xfor f Xdo X cat << EOF > "$f" X$c $f - micro GNU makefile for ~ X$c X$c ${d}Header$d X$c XEOF X if [ "$NEWTEXTPATH" ] X then X cat-path "$NEWTEXTPATH" new.txt | sed -e "s;^;$c ;" >> "$f" X fi X cat << 'EOF' >> "$f" X Xinclude MakeCommon X X# Commands: X X# Make depend file that shows include files that C programs use. XDEPEND=mkCIncl X X# Make FREEZE.*. XMKFREEZE=mkFreeze X X# Sources: XCS := $(filter %.c,$(SRCS)) XHS := $(filter %.h,$(SRCS)) X X# Targets: Xit = FREEZE.i X Xtargets := $(it) Makefile depend X Xifdef WORK X.DEFAULT: X $(UNCMPRS) $@ Xelse # WORK X.DEFAULT: X $(DISTI) $@ $(DISTDIR) Xendif # WORK X X.SUFFIXES: X.PHONY: default X Xdefault: $(targets) X Xifndef WORK XMakefile: $(DD)/Makefile X $(DISTI) $@ $(DD) Xendif # WORK X Xdepend: $(CS) $(HS) $(it) X $(DEPEND) "$(INCLUDES)" $(CS) > $@ X XFREEZE.i: FREEZE X $(RM) FREEZE.* X $(MKFREEZE) X $(CHMOD) a=r FREEZE.* XEOF Xdone END_OF_FILE if test 1911 -ne `wc -c <'new-uMake.b'`; then echo shar: \"'new-uMake.b'\" unpacked with wrong size! fi # end of 'new-uMake.b' fi if test -f 'prefix.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'prefix.3'\" else echo shar: Extracting \"'prefix.3'\" \(1986 characters\) sed "s/^X//" >'prefix.3' <<'END_OF_FILE' X.\" $Header: prefix.3,v 1.4 89/08/19 10:38:38 howard Exp $ X.TH PREFIX "3 -lhoward" "$Revision: 1.4 $" "Howard\'s C library" "Howard\'s C library" X.SH NAME Xprefix, prefxi \- test if one string is prefix of another X.SH SYNOPSIS X.nf X.BR "#include <" stdio.h ">" X.BR "#include <" howard/port.h ">" X.BR "#include <" howard/malf.h ">" X.fi X.LP X.RI "bStrT prefix (" "pfx" ", " str ")" X.nf X.RI "bStrT " pfx ";" X.RI "bStrT " str ";" X.fi X.LP X.RI "bStrT prefxi (" "pfx" ", " str ")" X.nf X.RI "bStrT " pfx ";" X.RI "bStrT " str ";" X.fi X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I prefix Xtests if string X.I pfx Xis a prefix of string X.IR str . XIf so, it returns a pointer to the byte in X.I str Xjust after the byte matching the last byte of X.IR pfx . XIf X.I pfx Xis not a prefix of string, then X.I prefix Xreturns NULL. X.PP X.I prefxi Xis like X.IR prefix , Xexcept that it ignores case (upper or lower). X.SH EXAMPLE XThe following code fragment stupidifies string X.IR s . XFor example, if X.I s Xis "smart toaster" then it will print "toaster", but if X.I s Xis already stupid then it is printed unchanged. X.nf X r = prefix ("smart ", s); X puts (NULBSTR == r ? s : r); X.fi X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 1986 -ne `wc -c <'prefix.3'`; then echo shar: \"'prefix.3'\" unpacked with wrong size! fi # end of 'prefix.3' fi if test -f 'prefix.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'prefix.c'\" else echo shar: Extracting \"'prefix.c'\" \(2122 characters\) sed "s/^X//" >'prefix.c' <<'END_OF_FILE' X/* X * prefix - test if one string is prefix of another X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: prefix.c,v 1.5 89/08/13 16:55:44 howard Exp $"); X X#include X#include X XPUBLIC bStrT prefix (p, s) XR1 bStrT p; /* The candidate prefix.*/ XR2 bStrT s; /* The string to test.*/ X X/* Function: X * Test if p is a prefix of s. X * Algorithm: X * Compare the strings character by character. X * Returns: X * If p is a prefix of s, a pointer to the character in s X * just after the last character of the prefix. X * If p is not a prefix of s, NULBSTR. X * Notes: X * X */ X{ Xif (NULBSTR == p) malf1 ("prefix: NULL prefix"); Xif (NULBSTR == s) malf1 ("prefix: NULL string"); Xwhile ((EOS != B (*p)) && (*p == *s)) X { X ++p; X ++s; X } Xreturn ((EOS == B (*p)) ? s : NULBSTR); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: prefix.c,v 1.5 89/08/13 16:55:44 howard Exp $"); XUSAGE ("prefix string"); X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X{ XbStrT r; /* Returned by prefix().*/ X Xif (3 != argc) usage(); Xr = prefix (argv[1], argv[2]); Xif (NULBSTR != r) PUTS (r); XFFLUSH (stdout); Xif (ferror (stdout)) malf1 ("Write error on Standard Output"); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 2122 -ne `wc -c <'prefix.c'`; then echo shar: \"'prefix.c'\" unpacked with wrong size! fi # end of 'prefix.c' fi if test -f 'putspn.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'putspn.3'\" else echo shar: Extracting \"'putspn.3'\" \(1957 characters\) sed "s/^X//" >'putspn.3' <<'END_OF_FILE' X.\" @(#)$Header: putspn.3,v 1.9 89/08/14 09:07:40 howard Exp $ X.TH PUTSPN "3 -lhoward" "$Revision: 1.9 $" "Howard\'s C library" "Howard\'s C library" X.SH NAME Xputspn \- write program name on standard error X.SH SYNOPSIS X.nf X.BR "#include <" stdio.h ">" X.BR "#include <" howard/port.h ">" X.BR "#include <" howard/version.h ">" X.PP X.RI "MAINVER (" version ");" X.fi X.LP X.BR "void " " putspn()" X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I Putspn Xwrites the name of the executing program on standard error. XIt takes the program name from the X.I version Xstring. XThis string is expected to have the format X.RI "[" x " ]" p "." y Xwhere X.I x Xis an optional string without spaces, X.I p Xis the name of the program, Xand X.I y Xis any string. X.SH ENVIRONMENT XIf the environment variable XCMDNAME Xis set and its value is not the empty string, then its value is Xwritten first, followed by a colon. XThis allows shell files to get their names into error messages Xwritten by the C programs they call. X.SH "SEE ALSO" X.IR malf "(3 \-lhoward)," X.IR usage "(3 \-lhoward)." X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S X.PP XThe idea for CMDNAME comes from C news, but all code is original. END_OF_FILE if test 1957 -ne `wc -c <'putspn.3'`; then echo shar: \"'putspn.3'\" unpacked with wrong size! fi # end of 'putspn.3' fi if test -f 'putspn.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'putspn.c'\" else echo shar: Extracting \"'putspn.c'\" \(2284 characters\) sed "s/^X//" >'putspn.c' <<'END_OF_FILE' X/* X * putspn - write short version of program name on standard error X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: putspn.c,v 1.10 89/08/13 16:31:09 howard Exp $"); X X#include X#include X XPUBLIC void putspn() X X/* Function: X * Write on the diagnostic output the name of the program. X * Algorithm: X * The global variable _progn must be set up to the version X * string of the main program. It has the format "x p.y z" where X * p is the program name. The function skips x and any spaces X * after it, then prints p up to the terminal dot. X * Notes: X * 1) This function is called from malf() and usage(). X */ X{ XR1 bStrT cp; /* Steps through program name.*/ Xextern bStrT _progn; /* Version string.*/ Xextern cStrT getenv(); /* (3).*/ X Xcp = (bStrT) getenv ("CMDNAME"); Xif ((NULBSTR != cp) && (EOS != B(*cp))) X FPRINTF (stderr, "%s:", cp); Xcp = _progn; Xif (NULBSTR != cp) X { X cp = (bStrT) strchr ((cStrT) cp, ' '); X if (NULBSTR == cp) cp = _progn; X else X { X while (' ' == B(*cp)) X ++cp; X } X for (; (EOS != B(*cp)) && ('.' != B(*cp)); ++cp) X PUTC (B(*cp), stderr); X FPUTS (": ", stderr); X } X} X X#ifdef TEST X#include X XMAINVER ("@(#)Header: test-putspn.c,v"); XUSAGE (""); X XPUBLIC int main (argc, argv) Xint argc; /* Number of arguments.*/ XbStrT *argv; /* Points to array of argument strings.*/ X{ Xif (1 != argc) usage(); Xputspn(); Xexit (SUCCESS); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 2284 -ne `wc -c <'putspn.c'`; then echo shar: \"'putspn.c'\" unpacked with wrong size! fi # end of 'putspn.c' fi if test -f 'qrndu.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'qrndu.3'\" else echo shar: Extracting \"'qrndu.3'\" \(2212 characters\) sed "s/^X//" >'qrndu.3' <<'END_OF_FILE' X.\" $Header: qrndu.3,v 1.1 89/08/14 10:46:02 howard Exp $ X.TH QRNDU "3 -lhoward" "$Revision: 1.1 $" "Howard\'s C library" "Howard\'s C library" X.SH NAME Xqrndr, qrnds, qrndu \- uniformly distributed quasi-random numbers in given range X.SH SYNOPSIS X.nf X.BR "#include <" stdio.h ">" X.BR "#include <" howard/port.h ">" X.BR "#include <" howard/malf.h ">" X.fi X.LP X.BR "void " "qrndr()" X.LP X.BR "void " "qrnds (" X.IR seed ) X.nf X.BI "unsigned " seed; X.fi X.LP X.BR "long " "qrndu (" X.IR low , X.IR high ) X.nf X.BI "long " low; X.BI "long " high; X.fi X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I qrndu Xreturns a uniformly distributed quasi-random number in the range X.RI [ low ", " high ]. XBefore X.I qrndu Xis called, either X.I qrndr Xor X.I qrnds Xmust be called once for initialization. X.I qrndr Xinitializes to some value that is generally different for each process, Xwhereas X.I qrnds Xis given an explicit X.I seed Xvalue. X.PP X.I qrndu Xuses X.IR random (3) Xif it is available, otherwise X.IR drand48 (3). XIf neither are available, it uses X.IR rand (3) Xin desperation. X.SH RETURNS XA quasi-random number in the given range. XOn error, X.IR malf1 (3) Xis called, so there is no return. X.SH EXAMPLE XThis code simulates a pair of dice: X.nf X long pair; X qrndr(); X pair = qrndu (1L, 6L) + qrndu (1L, 6L); X.fi X.SH "SEE ALSO" X.IR drand48 (3), X.IR malf "(3 \-lhoward)," X.IR rand (3), X.IR random (3). X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 2212 -ne `wc -c <'qrndu.3'`; then echo shar: \"'qrndu.3'\" unpacked with wrong size! fi # end of 'qrndu.3' fi if test -f 'smpdig.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'smpdig.c'\" else echo shar: Extracting \"'smpdig.c'\" \(1909 characters\) sed "s/^X//" >'smpdig.c' <<'END_OF_FILE' X/* X * smpdig - add one digit to SMP X */ X X#ifndef lint Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle"; X#endif lint X X/* X * This program is free software; you can redistribute it and/or modify X * it under the terms of the GNU General Public License version 1, X * as published by the Free Software Foundation. X * X * This program is distributed in the hope that it will be useful, X * but WITHOUT ANY WARRANTY; without even the implied warranty of X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X * GNU General Public License for more details. X * X * You should have received a copy of the GNU General Public License X * along with this program; if not, write to the Free Software X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X */ X X#include X#include X#include X XMODVER ("@(#)$Header: smpdig.c,v 1.6 89/08/14 17:52:43 howard Exp $"); X X#include X#include X#include X#include X XPUBLIC boolT smpdig (d, rad, res) X int d; /* Digit to add.*/ XR3 unsigned rad; /* Radix.*/ XR4 smpT *res; /* Points to result.*/ X X/* Function: X * res <- res * rad + d X * Algorithm: X * Straightforward multiple precision with carry. X * Returns: X * TRUE on success and FALSE on overflow. X * Notes: X * X */ X{ XR1 smpElT *p1; /* Steps through res->smp_el[].*/ XR2 smpElT *p2; /* Points to last element in res->smp_el[].*/ X Xp1 = res->smp_el; X*p1 = (*p1 * rad) + d; Xfor (p2 = &res->smp_el[SMPNEL - 1]; p1 != p2; ++p1) X { X p1[1] = (p1[1] * rad) + (*p1 >> SMPEB); X *p1 &= SMPMASK; X } Xreturn (0 == (*p1 >> SMPMHB)); X} X X#ifdef TEST X#include X XMAINVER ("@(#)$Header: smpdig.c,v 1.6 89/08/14 17:52:43 howard Exp $"); XUSAGE (""); X X#include X XPUBLIC int main () X{ Xmalf1 ("Testing done in a2smp"); X X#ifdef lint Xreturn (SUCCESS); X#endif X} X#endif END_OF_FILE if test 1909 -ne `wc -c <'smpdig.c'`; then echo shar: \"'smpdig.c'\" unpacked with wrong size! fi # end of 'smpdig.c' fi if test -f 'uMakefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'uMakefile'\" else echo shar: Extracting \"'uMakefile'\" \(2218 characters\) sed "s/^X//" >'uMakefile' <<'END_OF_FILE' X# uMakefile - micro GNU make file for howard X# X# $Header: uMakefile,v 1.12 89/09/22 13:46:53 howard Exp $ X# X# Copyright 1989 Howard Lee Gayle X# This file is written in the ISO 8859/1 character set. X# X# This program is free software; you can redistribute it and/or modify X# it under the terms of the GNU General Public License version 1, X# as published by the Free Software Foundation. X# X# This program is distributed in the hope that it will be useful, X# but WITHOUT ANY WARRANTY; without even the implied warranty of X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the X# GNU General Public License for more details. X# X# You should have received a copy of the GNU General Public License X# along with this program; if not, write to the Free Software X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X Xinclude MakeCommon X X# Commands: X X# Copy stdin to stdout. XCAT=cat X X# Make depend file that shows include files that C functions use. XDEPEND=mkLibIncl X X X# Max radix for simple multiple precision system. MUST be at least 16. XSMPRDX=256 X X X# Sources: X X# Bourne shell. XBS := $(filter %.b,$(SRCS)) X X# C library functions. XCS :=$(shell $(SETS) $(filter %.c,$(SRCS)) -d $(SCS)) X X# C include files. XHS := $(filter %.h,$(SRCS)) X X X# Targets: X X# Bourne shell Xbt := $(subst .b,,$(BS)) X X# Special C programs. Xsct := $(subst .c,,$(SCS)) X Xtargets := $(bt) $(sct) $(it) FREEZE.i Makefile depend X Xifdef WORK X.DEFAULT: X $(UNCMPRS) $@ Xelse # WORK X.DEFAULT: X $(DISTI) $@ $(DD) Xendif # WORK X X.SUFFIXES: X.PHONY: default X Xdefault: $(targets) X Xifndef WORK XMakefile: $(DD)/Makefile X $(DISTI) $@ $(DD) Xendif # WORK X X$(bt): %: %.b X $(RM) $@ Xifdef BDEFS X $(ECHO) ' $(BDEFS)' > $@ Xendif X $(CAT) $< >> $@ X $(CHMOD) +x $@ X Xcc-lims.i: mk-cc-lims X $(RM) $@ X ./mk-cc-lims $(CC) $@ X $(CHMOD) a=r $@ X Xdepend: $(CS) $(HS) $(bt) $(it) FREEZE.i X $(DEPEND) "$(INCLUDES)" $(CS) > $@ X XFREEZE.i: FREEZE mkFreeze X $(RM) FREEZE.* X ./mkFreeze X $(CHMOD) a=r FREEZE.* X Xlibc-lims.i: mkLibcLims X $(RM) $@ X ./mkLibcLims $@ X $(CHMOD) a=r $@ X Xmk-smp: mk-smp.c X $(CC) -o $@ $(CFLAGS) -DSMPRDX=$(SMPRDX) $(INCLUDES) $< X Xregisters.i: mk-reg X $(RM) $@ X ./mk-reg $(CC) $@ X $(CHMOD) a=r $@ X Xsimultipre.i: mk-smp X $(RM) $@ X ./mk-smp > $@ X $(CHMOD) a=r $@ X END_OF_FILE if test 2218 -ne `wc -c <'uMakefile'`; then echo shar: \"'uMakefile'\" unpacked with wrong size! fi # end of 'uMakefile' fi if test -f 'yrwk.3' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'yrwk.3'\" else echo shar: Extracting \"'yrwk.3'\" \(2226 characters\) sed "s/^X//" >'yrwk.3' <<'END_OF_FILE' X.\" $Header: yrwk.3,v 1.2 89/08/14 10:09:58 howard Exp $ X.TH YRWK "3 -lhoward" "$Revision: 1.2 $" "Howard\'s C library" "Howard\'s C library" X.SH NAME Xyrwk \- compute year and ISO week from struct tm X.SH SYNOPSIS X.nf X.BR "#include <" stdio.h ">" X.BR "#include <" time.h ">" X.BR "#include <" howard/port.h ">" X.BR "#include <" howard/malf.h ">" X.fi X.LP X.BR "unsigned " "yrwk (" X.IR tmPtr , X.IR yearPtr ) X.nf X.BI "struct tm *" tmPtr; X.BI "unsigned *" yearPtr; X.fi X.SH COPYRIGHT XCopyright \(co 1989 Howard Lee Gayle X.SH DESCRIPTION X.I yrwk Xuses the tm_year, tm_yday, and tm_wday fields in the struct tm Xto which X.I tmPtr Xpoints. XIt computes the ISO week number corresponding to the given day, Xand the year in which the week occurs. XISO week number 1 is the first week in a year containing four Xor more days in that year. X.SH RETURNS X.I yrwk Xreturns the ISO week number. XIf X.I yearPtr Xis not NULL, it also stores the year in which the ISO week Xoccurs in the area to which X.I yearPtr Xpoints. XThis is the complete year number; it is not biased by 1900 as Xis tm_year. X.SH EXAMPLE XThis code writes the current ISO year and week. X.nf X time_t ut; /* Current system time.*/ X unsigned w; /* Week.*/ X unsigned y; /* Year.*/ X extern time_t time(); /* (3).*/ X X ut = time ((time_t *) NULL); X w = yrwk (localtime (&ut), &y); X PRINTF ("%u-%02u\en", y, w); X.fi X.SH "SEE ALSO" X.IR ctime (3), X.IR malf "(3 \-lhoward)." X.SH LICENSE XThis program is free software; you can redistribute it and/or modify Xit under the terms of the GNU General Public License version 1, Xas published by the Free Software Foundation. X.PP XThis program is distributed in the hope that it will be useful, Xbut WITHOUT ANY WARRANTY; without even the implied warranty of XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the XGNU General Public License for more details. X.PP XYou should have received a copy of the GNU General Public License Xalong with this program; if not, write to the Free Software XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X.SH AUTHOR XHoward Gayle, XTN/ETX/T/BG, XEricsson Telecom AB, XS-126 25 Stockholm, XSweden, Xhoward@ericsson.se, Xuunet!ericsson.se!howard, XPhone: +46 8 719 5565, XFAX: +46 8 719 9598, XTelex: 14910 ERIC S END_OF_FILE if test 2226 -ne `wc -c <'yrwk.3'`; then echo shar: \"'yrwk.3'\" unpacked with wrong size! fi # end of 'yrwk.3' fi echo shar: End of archive 7 \(of 9\). cp /dev/null ark7isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 9 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0