[comp.sources.misc] v08i081: libhoward portability library, part 3 of 9

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (10/01/89)

Posting-number: Volume 8, Issue 81
Submitted-by: howard@dahlbeck.ericsson.se (Howard Gayle)
Archive-name: libhoward/part03

#! /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 3 (of 9)."
# Contents:  FREEZE Makefile a2l.c getlic.c malf.3 mk-smp.c new-Make.b
#   strspn.c
# Wrapped by howard@hasse on Mon Sep 25 07:08:06 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'FREEZE' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'FREEZE'\"
else
echo shar: Extracting \"'FREEZE'\" \(5524 characters\)
sed "s/^X//" >'FREEZE' <<'END_OF_FILE'
X$Header: FREEZE,v 1.7 89/09/25 07:03:19 howard Exp $
X$Log:	FREEZE,v $
X# Revision 1.7  89/09/25  07:03:19  howard
X# *** empty log message ***
X# 
X# Revision 1.6  89/09/23  14:24:24  howard
X# *** empty log message ***
X# 
X# Revision 1.5  89/09/19  09:09:46  howard
X# *** empty log message ***
X# 
X# Revision 1.4  89/08/29  17:19:00  howard
X# *** empty log message ***
X# 
X# Revision 1.3  89/08/11  14:52:36  howard
X# *** empty log message ***
X# 
X========================================
XFREEZE.c     1.1     1989-08-05 08:46:25
XMakeCommon   1.3     1989-09-22 13:46:45
XMakefile     1.24    1989-09-23 15:23:28
XREADME       1.3     1989-09-23 15:25:11
Xa2.3         1.2     1989-08-10 13:53:23
Xa2.h         1.4     1989-06-22 15:11:58
Xa2d.c        1.7     1989-08-09 18:13:20
Xa2i.c        1.7     1989-08-10 13:02:15
Xa2l.c        1.12    1989-08-11 13:07:15
Xa2smp.c      1.11    1989-08-15 13:33:10
Xa2u.c        1.6     1989-08-11 14:08:33
Xa2ul.c       1.7     1989-08-11 14:17:25
Xb.bib        1.1     1989-09-20 12:35:29
Xcat-path.1   1.1     1989-09-21 10:52:02
Xcat-path.b   1.1     1989-09-21 08:01:10
Xcia.1        1.1     1989-09-23 14:11:22
Xcia.b        1.3     1989-09-23 14:06:03
Xcopy-self.1  1.2     1989-09-20 13:58:12
Xcopy-self.b  1.5     1989-09-21 07:18:17
Xfreeze.1     1.1     1989-09-23 14:22:28
Xfreeze.b     1.8     1989-09-21 19:21:19
Xfreeze0.b    1.6     1989-09-21 19:21:28
XfreezePch.1  1.2     1989-09-25 07:01:32
XfreezePch.b  1.2     1989-09-25 07:01:13
XfreezePch0.b 1.1     1989-09-23 10:39:47
Xgetlic.c     1.5     1989-08-09 09:46:01
Xgetlin.3     1.7     1989-07-05 07:31:35
Xgetlin.c     1.7     1989-08-09 09:46:03
Xgetopt.c     1.1     1989-08-29 17:16:53
Xgetpwf.3     1.2     1989-08-21 08:43:59
Xgetpwf.c     1.2     1989-08-20 11:05:20
Xgold-lt.tex  1.2     1989-08-28 19:02:50
Xhetero.tex   1.2     1989-09-20 13:03:18
Xlatin-lt.tex 1.3     1989-09-19 12:04:12
XlnR.1        1.2     1989-09-15 11:45:47
XlnR.b        1.3     1989-09-21 19:22:13
XlnR0.b       1.4     1989-09-21 19:22:16
Xma2d.c       1.6     1989-08-12 08:58:22
Xma2i.c       1.6     1989-08-12 09:10:44
Xma2l.c       1.3     1989-08-12 09:22:39
Xma2u.c       1.4     1989-08-12 09:37:32
Xma2ul.c      1.3     1989-08-12 09:56:17
Xmalf.3       1.11    1989-08-14 09:06:30
Xmalf.c       1.10    1989-08-21 17:50:36
Xmalf.h       1.18    1989-08-20 10:45:05
Xmalf0.c      1.11    1989-08-21 17:50:47
Xmalf1.c      1.8     1989-08-21 17:50:50
Xmcalloc.c    1.5     1989-08-13 10:19:24
Xmcpstr.3     1.2     1989-05-18 10:56:17
Xmcpstr.c     1.4     1989-08-13 15:27:43
Xmemcmp.c     1.1     1989-08-15 18:17:12
Xmfclose.c    1.3     1989-08-13 14:53:25
Xmfcopy.3     1.1     1989-08-13 15:45:31
Xmfcopy.c     1.4     1989-08-13 15:37:56
Xmfflush.c    1.4     1989-08-13 14:59:43
Xmfopen.c     1.5     1989-08-13 15:07:38
Xmfseek.c     1.4     1989-08-13 15:18:44
Xmk-cc-lims.b 1.6     1989-09-21 19:22:19
Xmk-reg.b     1.4     1989-09-20 12:21:49
Xmk-smp.c     1.5     1989-08-15 14:25:55
XmkAr.b       1.1     1989-09-22 13:37:21
XmkCIncl.b    1.3     1989-09-21 19:22:21
XmkDistI.b    1.4     1989-09-21 19:22:24
XmkDistO.b    1.3     1989-09-21 19:22:26
XmkFreeze.b   1.3     1989-09-20 13:40:05
XmkInstF.b    1.3     1989-09-21 19:22:29
XmkInstX.b    1.3     1989-09-21 19:22:32
XmkLaTeXPS.b  1.3     1989-09-20 12:22:10
XmkLibIncl.b  1.3     1989-09-21 19:22:34
XmkLibcLims.b 1.8     1989-09-21 19:22:37
XmkManPS.b    1.3     1989-09-21 19:22:39
XmkSpellLT.b  1.2     1989-09-20 12:22:20
XmkUncmprs.b  1.3     1989-09-21 19:22:42
Xmopenp.3     1.1     1989-08-13 16:20:15
Xmopenp.c     1.6     1989-09-21 07:43:04
Xmra2d.c      1.5     1989-08-12 10:43:12
Xmra2i.c      1.5     1989-08-13 07:35:40
Xmra2l.c      1.2     1989-08-13 08:05:51
Xmra2u.c      1.4     1989-08-13 07:46:02
Xmra2ul.c     1.2     1989-08-13 08:20:50
Xmsgfn.3      1.2     1989-08-21 08:37:19
Xmsgfn.c      1.2     1989-08-19 10:19:10
Xnew-1.b      1.2     1989-09-21 12:39:49
Xnew-3.b      1.1     1989-09-21 12:44:29
Xnew-Make.b   1.2     1989-09-23 15:24:04
Xnew-MakeC.b  1.1     1989-09-21 12:48:58
Xnew-b.b      1.2     1989-09-23 13:49:12
Xnew-bib.b    1.1     1989-09-21 11:03:58
Xnew-c.b      1.1     1989-09-21 18:32:17
Xnew-el.b     1.1     1989-09-21 18:19:01
Xnew-h.b      1.1     1989-09-21 18:25:40
Xnew-uMake.b  1.1     1989-09-21 18:14:52
Xnew.1        1.2     1989-09-22 07:24:33
Xnew.b        1.1     1989-09-21 08:00:39
Xport.h       1.30    1989-08-29 08:52:40
Xprefix.3     1.4     1989-08-19 10:38:38
Xprefix.c     1.5     1989-08-13 16:55:44
Xprefxi.c     1.1     1989-08-19 10:31:17
Xputspn.3     1.9     1989-08-14 09:07:40
Xputspn.c     1.10    1989-08-13 16:31:09
Xqrndu.3      1.1     1989-08-14 10:46:02
Xqrndu.c      1.7     1989-08-14 10:41:31
Xsmp.3        1.3     1989-08-15 14:53:10
Xsmp.h        1.2     1989-08-15 14:31:10
Xsmp2l.c      1.9     1989-08-14 18:20:04
Xsmp2u.c      1.2     1989-08-14 18:29:32
Xsmp2ul.c     1.7     1989-08-15 11:14:04
Xsmpdig.c     1.6     1989-08-14 17:52:43
Xsmpdtl.c     1.6     1989-08-14 17:37:31
Xstrend.3     1.6     1989-08-14 09:31:24
Xstrend.c     1.6     1989-08-14 09:27:31
Xstrspn.c     1.1     1989-08-29 08:34:07
XuMakefile    1.12    1989-09-22 13:46:53
Xunix-lt.tex  1.1     1989-08-28 19:15:46
Xusage.3      1.5     1989-08-14 09:23:24
Xusage.c      1.6     1989-08-14 09:18:44
Xusage.h      1.1     1988-08-21 09:02:44
Xuserfn.3     1.1     1989-08-20 11:39:55
Xuserfn.c     1.2     1989-08-20 11:30:07
Xversion.h    1.3     1989-03-17 15:33:37
Xyear.h       1.2     1989-08-14 09:54:12
Xyrwk.3       1.2     1989-08-14 10:09:58
Xyrwk.c       1.5     1989-08-14 10:01:11
END_OF_FILE
if test 5524 -ne `wc -c <'FREEZE'`; then
    echo shar: \"'FREEZE'\" unpacked with wrong size!
fi
# end of 'FREEZE'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(6702 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X# Makefile - main GNU make file for -lhoward and include/howard
X#
X# $Header: Makefile,v 1.24 89/09/23 15:23:28 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# Make library.
XAR=mkAr
X
X# Put a file into the distribution directory.
XDISTO=mkDistO
X
X# Install a non-executable file.
XINSTF=mkInstF
X
X# Make a shared library.
XLD=ld
X
X# Lint command.
XLINT=lint
X
X# shar command
XSHAR=makekit
X
X
X# Command options:
X
X# CC: max optimization
XCFLAGS=-O4
X
X# LINT: check everything
XLINTFLAGS=-abchux
X
X# CC: for testing, use -g option and static linking.
XTESTCFLAGS=-g -Bstatic
X
X# CC: for testing, compile with this library.
XLIBES=-lhoward
X
X# CC: library search path for testing.
XLIBPATH=-L/usr/local/free-dist/howard/1/work
X
X# Directories:
X
X# Install library here.
XAID=/usr/local/free/howard/1
X
X# Install Bourne shell files here.
XBID=../bin
X
X# Install include files here.
XHID=../include/howard
X
X# Install lint library here.
XLNID=/usr/local/free/howard/1
X
X# Install man entries here.
XMID=../man
X
X# Install shared library here.
XSLID=/usr/local/free/howard/1
X
X# Install TeX and LaTeX macro files here.
XTEXID=../tex
X
X
X# Sources:
X
X# Bourne shell files.
XBS := $(filter %.b,$(SRCS))
X
X# BibTeX bibliography file.
XBIBS := $(filter %.bib,$(SRCS))
X
X# BibTeX bibliography file.
XBIBS := $(filter %.bib,$(SRCS))
X
X# C programs.
XCS := $(shell $(SETS) $(filter %.c,$(SRCS)) -d $(SCS))
X
X# C include files.
XHS := $(filter %.h,$(SRCS))
X
X# LaTeX source.
XLATEXS := hetero.tex
X
X# Manuals.
XM1S := $(filter %.1,$(SRCS))
XM3S := $(filter %.3,$(SRCS))
Xms  := $(M1S) $(M3S)
X
X# TeX and LaTeX macro files.
XTEXS := $(shell $(SETS) $(filter %.tex,$(SRCS)) -d $(LATEXS))
X
X# All ordinary source files.  Removed by make clobber.
Xsrc := $(SBS) $(BS) $(BIBS) $(SCS) $(CS) $(HS) $(LATEXS) $(ms) $(TEXS)
X
X# Absolutely all source files.
Xallsrc := README LICENSE FREEZE MakeCommon Makefile uMakefile $(src)
X
X
X# Targets:
X
X# Library.
XAT = libhoward.a
X
X# Bourne shell files.
Xbt := $(subst .b,,$(BS))
X
X# LaTeX.
Xifdef FMTLATEX
Xlatext := $(subst .tex,.texf,$(LATEXS))
Xspellt := $(patsubst %.tex,%-s,$(LATEXS))#Phony targets for spelling checking.
Xendif
X
X# Lint library.
XLNT = llib-lhoward.ln
X
X# Phony lint targets for C functions.
Xlt := $(patsubst %.c,%-l,$(SCS) $(CS))
X
X# C function object files.
Xot := $(subst .c,.o,$(CS))
X
X# Assembler targets for C functions.
Xst :=$(subst .c,.s,$(CS))
X
X# Test drivers for C functions.
Xtt :=$(patsubst %.c,%-t,$(CS))
X
X# Formatted manual entries.
Xifdef FMTMAN
Xft := $(patsubst %,%.f,$(ms))
Xendif
X
X# Default targets.
Xtargets := $(LNT) $(ot) $(AT) $(SLT) $(ft) $(TEXS)
X
X# Distribution:
Xdist := $(patsubst %,$(DD)/%,$(allsrc) $(ft))
X
X
X# Installs:
X
X# Library.
Xai := $(AID)/$(AT)
X
X# Bourne shell files.
Xbi := $(patsubst %,$(BID)/%,$(bt))
X
X# On-line manual entries.
Xcati := $(patsubst %,$(MID)/cat1/%,$(M1S)) $(patsubst %,$(MID)/cat3/%,$(M3S))
X
X# Include files.
Xhi := $(patsubst %,$(HID)/%,$(HS))
X
X# Generated include files.
Xii := $(patsubst %,$(HID)/%,$(it))
X
X# Lint library.
Xlni := $(LNID)/$(LNT)
X
X# Manual entries.
Xm1i := $(patsubst %,$(MID)/man1/%,$(M1S))
Xm3i := $(patsubst %,$(MID)/man3/%,$(M3S))
Xmi  := $(m1i) $(m3i)
X
X# Shared library.
Xsli := $(SLID)/$(SLT)
X
X# TeX and LaTeX macro files.
Xtexi := $(patsubst %,$(TEXID)/%,$(TEXS))
X
X# If making a shared library then compile with -pic option for 
X# position-independent code.
Xifdef SLT
XPIC = -pic
Xendif
X
X# Don't use built-in rules.
X.SUFFIXES:
X.PHONY: clean clobber default dist install install-include \
X	shar test vars $(lt)
X
Xdefault: $(targets)
X
X# Display values of various variables.  Mostly for debugging.
Xvars:
X	@$(ECHO) 'SRCS:' $(SRCS)
X	@$(ECHO) 'INCLUDES:' $(INCLUDES)
X	@$(ECHO) 'BS:' $(BS)
X	@$(ECHO) 'CS:' $(CS)
X	@$(ECHO) 'HS:' $(HS)
X	@$(ECHO) 'M1S:' $(M1S)
X	@$(ECHO) 'M3S:' $(M3S)
X	@$(ECHO) 'SCS:' $(SCS)
X	@$(ECHO) 'allsrc:' $(allsrc)
X	@$(ECHO) 'AT:' $(AT)
X	@$(ECHO) 'bt:' $(bt)
X	@$(ECHO) 'ft:' $(ft)
X	@$(ECHO) 'HT:' $(HT)
X	@$(ECHO) 'LNT:' $(LNT)
X	@$(ECHO) 'lt:' $(lt)
X	@$(ECHO) 'ot:' $(ot)
X	@$(ECHO) 'SLT:' $(SLT)
X	@$(ECHO) 'st:' $(st)
X	@$(ECHO) 'tt:' $(tt)
X	@$(ECHO) 'cflags:' $(cflags)
X	@$(ECHO) 'dist:' $(dist)
X	@$(ECHO) 'ai:' $(ai)
X	@$(ECHO) 'bi:' $(bi)
X	@$(ECHO) 'cati:' $(cati)
X	@$(ECHO) 'hi:' $(hi)
Xifdef FMTLATEX
X	@$(ECHO) 'LATEXS:' $(LATEXS)
X	@$(ECHO) 'BIBS:' $(BIBS)
X	@$(ECHO) 'latext:' $(latext)
X	@$(ECHO) 'spellt:' $(spellt)
Xendif
X	@$(ECHO) 'm1i:' $(m1i)
X	@$(ECHO) 'm3i:' $(m3i)
X	@$(ECHO) 'sli:' $(sli)
X
Xclean:
X	$(RM) depend $(ot) $(st) $(tt)
X
Xclobber: clean
X	$(RM) $(src) $(targets) $(it) FREEZE FREEZE.*
X
X$(lt): %-l: %.c $(LNT)
X	$(LINT) $(LINTFLAGS) -DTEST $(DEFS) $(INCLUDES) $< $(LNT)
X
X$(AT): $(ot)
X	$(RM) $@
X	$(AR) $@ $(ot)
X
Xifdef FMTMAN
X$(ft): %.f: %
X	$(RM) $@
X	$(FMTMAN) $< > $@
Xendif
X
Xifdef FMTLATEX
X$(latext): %.texf: %.tex $(BIBS)
X	$(FMTLATEX) $* $@
X
X$(spellt): %-s: %.tex
X	$(SPELL_LATEX) $<
Xendif
X
X$(LNT): $(CS) $(HS) $(it)
X	$(LINT) -Choward $(INCLUDES) $(CS)
X
X$(ot): %.o: %.c
X	$(CC) -c $(CFLAGS) $(PIC) $(DEFS) $(INCLUDES) $*.c
X
Xifdef SLT
X$(SLT): $(ot)
X	$(RM) $@
X	$(LD) -o $@ $(ot)
X	$(CHMOD) a=r $@
Xendif
X
Xshar: $(allsrc)
X	$(RM) Part[0-9][0-9]
X	$(SHAR) $(allsrc)
X
Xtest: $(tt)
X
X$(tt): %-t: %.c $(AT) $(SLT)
X	$(CC) -o $@ $(TESTCFLAGS) -DTEST $(DEFS) $(INCLUDES) $(LIBPATH) \
X	$*.c $(LIBES)
X
X$(st): %.s: %.c
X	$(CC) -S $(DEFS) $(INCLUDES) $<
X
Xifdef WORK
X
Xdist: $(dist)
X
X$(dist): $(DD)/%: %
X	$(DISTO) $< $(DD)
X
X.DEFAULT:
X	$(UNCMPRS) $@
X
Xelse # WORK
X
Xinstall: install-include $(ai) $(bi) $(cati) \
X         $(lni) $(mi) $(sli) $(texi)
X
Xinstall-include: $(hi) $(ii)
X
X$(ai): $(AT)
X	$(INSTF) $(AT) $(AID)
X
X$(bi): $(BID)/%: %
X	$(INSTF) $< $(BID)
X
Xifdef SLT
X$(sli): $(SLT)
X	$(INSTF) $(SLT) $(SLID)
Xendif
X
X$(lni): $(LNT)
X	$(INSTF) $(LNT) $(LNID)
X
Xifdef CATMAN
X$(cati): $(m1i) $(m3i)
X	$(CATMAN) -M $(MID) 13
Xendif # CATMAN
X
X$(hi): $(HID)/%: %
X	$(INSTF) $< $(HID)
X
X$(ii): $(HID)/%: %
X	$(INSTF) $< $(HID)
X
X$(m1i): $(MID)/man1/%: %
X	$(INSTF) $< $(MID)/man1
X
X$(m3i): $(MID)/man3/%: %
X	$(INSTF) $< $(MID)/man3
X
X$(texi): $(TEXID)/%: %
X	$(INSTF) $< $(TEXID)
X
X$(allsrc): %: $(DD)/%
X	$(DISTI) $@ $(DD)
X
X.DEFAULT:
X	$(DISTI) $@ $(DD)
X
Xendif # WORK
X
Xinclude depend
END_OF_FILE
if test 6702 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'a2l.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'a2l.c'\"
else
echo shar: Extracting \"'a2l.c'\" \(4667 characters\)
sed "s/^X//" >'a2l.c' <<'END_OF_FILE'
X/*
X * a2l - convert Ada-syntax integer literal to long
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 <stdio.h>
X#include <howard/port.h>
X#include <howard/version.h>
X
XMODVER ("@(#)$Header: a2l.c,v 1.12 89/08/11 13:07:15 howard Exp $");
X
X#include <howard/a2.h>
X#include <howard/registers.i>
X#include <howard/simultipre.i>
X#include <howard/smp.h>
X
XPUBLIC int a2l (str, lim, synok, res, end)
XbStrT  str;   /* Input string.*/
XbStrT  lim;   /* Don't pass this.*/
XboolT  synok; /* Accept non-fatal syntax errors.*/
Xlong  *res;   /* Points to where to store result.*/
XbStrT *end;   /* End pointer stored here.*/
X
X/* Function:
X *    
X * Algorithm:
X *    a2smp() then smp2l()
X * Returns:
X *    
X * Notes:
X *    
X */
X{
XR1 int  s;   /* Return code.*/
X   smpT smp; /* a2smp() stores its result here.*/
X
Xs = a2smp (str, lim, synok, &smp, end);
Xif (SUCCESS == s) s = smp2l (&smp, res);
Xreturn (s);
X}
X
X#ifdef TEST
X#include <howard/usage.h>
X
XMAINVER ("@(#)$Header: a2l.c,v 1.12 89/08/11 13:07:15 howard Exp $");
XUSAGE ("integer-numeric-literal");
X
X#include <errno.h>
X#include <limits.h>
X#include <string.h>
X#include <howard/malf.h>
X
XPRIVATE void t (num, str, limoff, synok, xrc, xres, xendoff)
Xint num; /* Test number.*/
XbStrT str; /* str argument.*/
Xint limoff; /* Limit offset, -1 for none.*/
XboolT synok; /* synok argument.*/
Xint xrc; /* Expected return code.*/
Xlong xres; /* Expected result.*/
Xint xendoff; /* Expected end offset.*/
X{
Xint rc; /* Return code.*/
Xlong res; /* Result stored here.*/
XbStrT end; /* End string stored here.*/
X
Xrc = a2l (str, (limoff < 0) ? NULBSTR : str + limoff, synok, &res, &end);
Xif (rc != xrc) PRINTF ("%d: rc %d expected %d\n", num, rc, xrc);
Xif ((0 == rc) && (0 == xrc) && (res != xres))
X   PRINTF ("%d: res %ld expected %ld\n", num, res, xres);
Xif (xendoff < 0) xendoff = strlen (str);
Xif ((end - str) != xendoff)
X   PRINTF ("%d: end %s expected %s\n", num, end, str + xendoff);
X}
X
XPUBLIC int main (argc, argv)
Xint    argc; /* Number of arguments.*/
XbStrT *argv; /* Points to array of argument strings.*/
X{
XbStrT end; /* End of string.*/
Xlong res; /* a2l() stores its result here.*/
X#define L LONG_MIN
X#define H LONG_MAX
X
X/*num str           limoff syn rc res  end */
Xt(__LINE__,"12",              -1, 0, 0,           12L, -1);
Xt(__LINE__,"0",               -1, 0, 0,            0L, -1);
Xt(__LINE__,"1E6",             -1, 0, 0,      1000000L, -1);
Xt(__LINE__,"2#1111_1111#",    -1, 0, 0,          255L, -1);
Xt(__LINE__,"16#FF#",          -1, 0, 0,          255L, -1);
Xt(__LINE__,"016#0FF#",        -1, 0, 0,          255L, -1);
Xt(__LINE__,"16#E#E1",         -1, 0, 0,          224L, -1);
Xt(__LINE__,"2#1110_0000#",    -1, 0, 0,          224L, -1);
Xt(__LINE__,NULBSTR,            0, 0, EINVAL,       0L,  0);
Xt(__LINE__,"0",                0, 0, EDOM,         0L,  0);
Xt(__LINE__,"012",              1, 0, 0,            0L,  1);
Xt(__LINE__,"_0123",            4, 0, EDOM,        12L,  0);
Xt(__LINE__,"-2_147_483_648",  -1, 0, 0,(long)LONG_MIN, -1);
Xt(__LINE__," \t2_147_483_647",-1, 1, 0,(long)LONG_MAX, -1);
Xt(__LINE__,"1#1111_1111#",    -1, 0, EDOM,         0L,  1);
Xt(__LINE__,"17#1#",           -1, 0, EDOM,         0L,  2);
Xt(__LINE__,"12B",             -1, 1, 0,           12L,  2);
Xt(__LINE__,"16#abcdef#e_0",   -1, 0, EDOM,  0xABCDEFL, 11);
Xt(__LINE__,"16#abcdef#.",     -1, 1, 0,     0xABCDEFL, 10);
Xt(__LINE__,"-2_147_483_649",  -1, 0, ERANGE,       0L, -1);
Xt(__LINE__,"2_147_483_648",   -1, 1, ERANGE,       0L, -1);
X
Xif (2 != argc) usage();
Xswitch (a2l (argv[1], NULBSTR, FALSE, &res, &end))
X   {
X   case SUCCESS:
X      PRINTF ("8#%lo#\t10#%ld#\t16#%lX#\n", res, res, res);
X      break;
X   case EINVAL:
X      PRINTF ("EINVAL %s\n", end);
X      break;
X   case EDOM:
X      PRINTF ("EDOM %s\n", end);
X      break;
X   case ERANGE:
X      PRINTF ("ERANGE %s\n", end);
X      break;
X   default:
X      PUTS ("Unexpected return");
X      break;
X   }
Xmfflush (stdout, "Standard Output");
Xexit (SUCCESS);
X
X#ifdef lint
Xreturn (SUCCESS);
X#endif
X}
X#endif
END_OF_FILE
if test 4667 -ne `wc -c <'a2l.c'`; then
    echo shar: \"'a2l.c'\" unpacked with wrong size!
fi
# end of 'a2l.c'
fi
if test -f 'getlic.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'getlic.c'\"
else
echo shar: Extracting \"'getlic.c'\" \(5666 characters\)
sed "s/^X//" >'getlic.c' <<'END_OF_FILE'
X/*
X * getlic - read next line from a file, stripping comments & blank lines
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 <stdio.h>
X#include <howard/port.h>
X#include <howard/version.h>
X
XMODVER ("@(#)$Header: getlic.c,v 1.5 89/08/09 09:46:01 howard Exp $");
X
X#include <howard/registers.i>
X#include <howard/malf.h>
X
XPUBLIC bStrT getlic (l, ls, f, fn, ln, tw, com)
XbStrT     l;    /* Points to buffer provided by caller where line
X		 * will be stored.*/
Xunsigned  ls;   /* Number of bytes in buffer, including terminal
X		 * NUL.  (No space needs to be provided for the
X		 * newline since getlin removes it.)*/
XstreamT   f;    /* Input stream.*/
XbStrT     fn;   /* Input file name, for possible error messages.*/
Xunsigned *ln;   /* Points to where current line number is stored.
X		 * getlin increments it after a successful read, and
X		 * uses it for error messages.*/
XR5 unsigned tw; /* Expand tabs into this many spaces.  0 = no expand.*/
XR4 rcharT com;  /* Character that starts comments to end of line.*/
X
X/* Function:
X *    Read one nonblank line.  Strip comments.  Handle errors.
X * Algorithm:
X *    Read one character at a time until
X *       1) a non-empty line is received,
X *	 2) an EOF is received, or
X *	 3) the buffer becomes full.
X * Returns:
X *    On success, a pointer to the NUL terminator in l[].
X *    On normal EOF, NULBSTR.
X *    No return on error.
X */
X
X{
XR1 rcharT c;             /* Current input character.*/
XbStrT     bp    = l;     /* Current position in line buffer.*/
Xunsigned  col   = 0;     /* Current column number (leftmost 0).*/
XR3 boolT  incom = FALSE; /* Set inside comments.*/
XR2 boolT  more  = TRUE;  /* Set when more to do.*/
X
Xif ((NULBSTR == fn) || (EOS == B(*fn))) malf1 ("getlin: No file name");
Xif (NULBSTR == l) malf1 ("getlin %s: No line buffer", fn);
Xif (ls < 2) malf1 ("getlin %s: Line buffer too small", fn);
Xif (NULSTRM == f) malf1 ("getlin %s: No FILE", fn);
Xif (((unsigned *) NULL) == ln) malf1 ("getlin %s: No line number pointer", fn);
Xdo
X   {
X   c = getc (f);
X   if (incom)
X      {
X      switch (c)
X         {
X         case '\n':
X            if (bp == l)
X               incom = FALSE;
X            else
X               more = FALSE;
X            ++(*ln);
X            break;
X         case EOF:
X            if (ferror (f)) malf1 ("%s: %u: Read error", fn, 1 + *ln);
X            if (bp != l)
X               malf1 ("%s: %u: End of file in middle of line", fn, 1 + *ln);
X            *bp = EOS;
X            bp = NULBSTR;
X            more = FALSE;
X            break;
X         case EOS:  /* NUL.*/
X            malf1 ("%s: %u: NUL in line", fn, 1 + *ln);
X            break;
X         default:
X            break;
X         }
X      }
X   else
X      {
X      switch (c)
X         {
X         case '\t':
X            if (0 == tw)
X               {
X               *bp++ = c;
X               ++col;
X               }
X            else
X               {
X               c = tw - (col % tw);
X               col += c;
X               if (col < ls)
X                  while (c--)
X                     *bp++ = ' ';
X               }
X            break;
X         case '\n':
X            if (bp != l)
X               {
X               --bp;
X               while ((bp >= l) && ((' ' == B(*bp)) || ('\t' == B(*bp))))
X                  --bp;
X               ++bp;
X               *bp = EOS;
X               }
X            ++(*ln);
X            if (bp != l) more = FALSE;
X            break;
X         case EOF:
X            if (ferror (f)) malf1 ("%s: %u: Read error", fn, 1 + *ln);
X            if (bp != l)
X               malf1 ("%s: %u: End of file in middle of line", fn, 1 + *ln);
X            *bp = EOS;
X            bp = NULBSTR;
X            more = FALSE;
X            break;
X         case EOS:  /* NUL.*/
X            malf1 ("%s: %u: NUL in line", fn, 1 + *ln);
X            break;
X         default:
X            if (c == com)
X               {
X               if (bp != l)
X                  {
X                  --bp;
X                  while ((bp >= l) && ((' ' == B(*bp)) || ('\t' == B(*bp))))
X                     --bp;
X                  ++bp;
X                  *bp = EOS;
X                  }
X               ++incom;
X               }
X            else
X               {
X               *bp++ = c;
X               ++col;
X               }
X            break;
X         }
X      }
X   if (col >= ls) malf1 ("%s: %u: Line too long, %u max", fn, 1 + *ln, ls - 1);
X   }
Xwhile (more);
Xreturn (bp);
X}
X
X
X#ifdef TEST
X/* This test driver copies stdin to stdout, stripping comments starting
X * with the given argument.*/
X#include <howard/usage.h>
X
XMAINVER ("@(#)$Header: getlic.c,v 1.5 89/08/09 09:46:01 howard Exp $");
XUSAGE ("comment-character");
X
XPUBLIC int main (argc, argv)
Xint    argc; /* Number of arguments.*/
XbStrT *argv; /* Points to array of argument strings.*/
X{
Xunsigned     ln = 0;
Xstatic byteT l[1024];
X
Xif ((2 != argc) || (EOS != argv[1][1])) usage();
Xwhile (NULBSTR != getlic (l, 1024, stdin, "Standard Input", &ln, 8,
X                          argv[1][0]))
X   PUTS (l);
X}
X#endif
END_OF_FILE
if test 5666 -ne `wc -c <'getlic.c'`; then
    echo shar: \"'getlic.c'\" unpacked with wrong size!
fi
# end of 'getlic.c'
fi
if test -f 'malf.3' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'malf.3'\"
else
echo shar: Extracting \"'malf.3'\" \(4916 characters\)
sed "s/^X//" >'malf.3' <<'END_OF_FILE'
X.\" @(#)$Header: malf.3,v 1.11 89/08/14 09:06:30 howard Exp $
X.TH MALF "3 -lhoward" "$Revision: 1.11 $" "Howard\'s C library" "Howard\'s C library"
X.SH NAME
Xmalf, malf0, malf1, mcalloc, mfclose, mfflush, mfopen, mfseek \- write error message
X.SH SYNOPSIS
X.nf
X.BR "#include <" stdio.h ">"
X.BR "#include <" howard/port.h ">"
X.BR "#include <" howard/version.h ">"
X.LP
X.RI "MAINVER (" version ");"
X.LP
X.BR "#include <" howard/malf.h ">"
X.fi
X.LP
X.BR "void " "malf ("
X.IR exitcode ", " format "[, " arg ".\|.\|.])"
X.nf
X.BI "int " exitcode ";"
X.RI "cStrT " format ";"
X.fi
X.LP
X.BR "void " "malf0 ("
X.IR format "[, " arg ".\|.\|.])"
X.nf
X.RI "cStrT " format ";"
X.fi
X.LP
X.BR "void " "malf1 ("
X.IR format "[, " arg ".\|.\|.])"
X.nf
X.RI "cStrT " format ";"
X.fi
X.LP
XvoidPT mcalloc (
X.IR nelem ,
X.IR elsize ,
X.IR what )
X.nf
X.BI "unsigned " nelem;
X.BI "unsigned " elsize;
X.RI "bStrT " what;
X.fi
X.LP
X.BR "void " "mfclose ("
X.IR stream ", " filename ")"
X.nf
X.RI "streamT " stream ";"
X.RI "bStrT " filename ";"
X.fi
X.LP
X.BR "void " "mfflush ("
X.IR stream ", " filename ")"
X.nf
X.RI "streamT " stream ";"
X.RI "bStrT " filename ";"
X.fi
X.LP
X.RI "streamT mfopen (" filename ", " type ")"
X.nf
X.RI "bStrT " filename ";"
X.RI "bStrT " type ";"
X.fi
X.LP
X.BR "void " "mfseek ("
X.IR stream ,
X.IR offset ,
X.IR ptrname ,
X.IR filename )
X.nf
X.RI "streamT " stream ";"
X.BI "long " offset;
X.BI "int " ptrname;
X.RI "bStrT " filename ";"
X.fi
X.SH COPYRIGHT
XCopyright \(co 1989 Howard Lee Gayle
X.SH DESCRIPTION
X.I Malf
Xwrites on standard error a message with the syntax:
X.nf
X   <type> message at <time>
X      from: <program>
X      <message>
X      System message <error number>: <error text>
X.fi
XIf standard error is a terminal,
Xthen the first three lines of the message are abridged to:
X.nf
X   <type>: <program>: <message>
X.fi
XThe message fields are:
X.nr xx (\w'error number'u+2n)/1n
X.TP \n(xx
X.I type
X"Warning" if
X.I exitcode
Xis zero, otherwise "Error."
X.TP
X.I time
XThe date and time
X.I malf
Xis called.
X.TP
X.I program
XThe name of the program,
Xwritten by
X.IR putspn (3).
X.TP
X.P message
XThe result of passing the format string and any arguments
Xto
X.I [v]fprintf.
X.TP
X.I "error number"
XThe decimal value of the system global
X.IR errno ";"
Xthe
X"System message" line is printed only when
X.I errno
Xis nonzero.
X.TP
X.I "error text"
XThe text corresponding to errno, if it exists.
X.PP
X.I malf0
Xis identical to
X.I malf
Xwith a first argument of zero.
X.I malf1
Xis identical to
X.I malf
Xwith a first argument of one.
X.PP
X.I mcalloc
X.RI ( nelem ,
X.IR elsize ,
X.IR what )
Xcalls
X.I calloc
X.RI ( nelem ,
X.IR elsize ).
XOn error, it calls
X.I malf1
Xusing
X.I what
Xin the error message to identify what could not be allocated.
X.PP
X.I mfclose
X.RI ( stream ", " filename ")"
Xcalls
X.I fclose
X.RI ( stream ).
XOn error, it calls
X.I malf1
Xusing
X.I filename
Xin the error message.
X.PP
X.I mfflush
X.RI ( stream ", " filename ")"
Xcalls
X.I fflush
X.RI ( stream ).
XOn error, it calls
X.I malf1
Xusing
X.I filename
Xin the error message.
X.PP
X.I mfopen
Xis equivalent to
X.IR fopen (3),
Xexcept that it calls
X.I malf1
Xon error.
X.PP
X.I mfseek
X.RI ( stream ,
X.IR offset ,
X.IR ptrname ,
X.IR filename )
Xcalls
X.I fseek
X.RI ( stream ,
X.IR offset ,
X.IR ptrname ).
XOn error, it calls
X.I malf1
Xusing
X.I filename
Xin the error message.
X.SH RETURNS
XIf
X.I exitcode
Xis nonzero, then
X.I malf
Xdoes not return but terminates the program.
XIf the global Boolean variable _debug is TRUE,
X.I malf
Xterminates by calling
X.IR abort (2),
Xwhich causes a core dump.
XOtherwise,
X.I malf
Xpasses
X.I exitcode
Xto
X.IR exit (2).
X.PP
XIf
X.I exitcode
Xis zero, then
X.I malf
Xzeros
X.I errno
Xbefore it returns.
X.SH EXAMPLE
X.nf
X   if (unlink (f)) malf (2, "%s: Can not unlink", f);
X.fi
X.SH "SEE ALSO"
X.IR rcs (1),
X.IR sccs (1),
X.IR intro (2),
X.IR abort (2),
X.IR exit (2),
X.IR fclose (3S),
X.IR fflush (3S),
X.IR fopen (3S),
X.IR fseek (3S),
X.IR malloc (3),
X.IR perror (3),
X.IR printf (3S),
X.IR putspn "(3 \-lhoward),"
X.IR syslog (3),
X.IR vfprintf (3S).
X.SH ETYMOLOGY
XThe word "malf,"
Xpresumably short for malfunction,
Xoccurs in Gregory Benford's book
X.I Across the sea of suns
X.RI ( e.g.
Xon page 319).
XIt can be used as a noun or a verb.
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 4916 -ne `wc -c <'malf.3'`; then
    echo shar: \"'malf.3'\" unpacked with wrong size!
fi
# end of 'malf.3'
fi
if test -f 'mk-smp.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mk-smp.c'\"
else
echo shar: Extracting \"'mk-smp.c'\" \(6522 characters\)
sed "s/^X//" >'mk-smp.c' <<'END_OF_FILE'
X/*
X * mk-smp - make simultipre.i include file for 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 <stdio.h>
X#include <limits.h>
X#include <string.h>
X
X/* clbs - compute bits needed to hold octal representation of integer */
X
Xint clbs (s)
Xchar *s; /* String holding octal representation of number.*/
X
X/* Function:
X *    Compute ceiling (log2 (n)), where log2 is log to base 2, and n
X *    is a non-negative integer whose octal string representation is in s.
X * Algorithm:
X *    Count the digits.  The first requires a switch to see if it's
X *    1, 2, or 3 bits.
X * Returns:
X *    Number of bits to hold n.
X * Notes:
X *    1) Assumes no leading digits.
X *    2) s would normally be the result of a sprintf().
X *    3) What a hack!  But it really works.
X */
X{
Xint i = 3 * strlen (s);
X
Xswitch (*s)
X   {
X   case '1':
X      return (i - 2);
X   case '2':
X   case '3':
X      return (i - 1);
X   case '4':
X   case '5':
X   case '6':
X   case '7':
X      return (i);
X   default:
X      fprintf (stderr, "mk-smp: clbs: impossible input %s", s);
X      exit (1);
X   }
X/*NOTREACHED*/
X}
X
X/* main - main function							*/
X
Xint main ()
X
X/* Function:
X *	
X * Algorithm:
X *    Compute the bits needed to repesent the maximum long (clbl),
X *    unsigned (clbu), and unsigned long (clbul).  Each SMP element
X *    is an unsigned.  The number of useable bits in an element (eb) is
X *    thus clbu minus the number of bits for SMPRDX minus one guard
X *    bit.  The number of elements to hold a long is ceiling (clbl/eb).
X *    SMPLMIN is the SMP representation of the most negative long.
X *    On a two's complement machine, this is just 1 followed by the
X *    right number of zeros.  Otherwise, it is generated by breaking
X *    apart LONG_MAX.
X * Notes:
X *    1) The Makefile should define SMPRDX to be the maximum radix
X *       argument to smpdig().
X *    2) If the number of elements for all types is 2, and clbu is even,
X *       then eb is special-cased to half of clbu for esthetic reasons.
X *    3) This code should even work on a sign-magnitude machine, if there
X *       are any.
X */
X
X{
Xint      clbl;             /* ceil (log2 (LONG_MAX)).*/
Xint      clbr;             /* ceil (log2 (SMPRDX^%)).*/
Xint      clbu;             /* ceil (log2 (UINT_MAX)).*/
Xint      clbul;            /* ceil (log2 (ULONG_MAX)).*/
Xint      eb;               /* SMPEB, the number of bits used in each element.*/
Xint      i;                /* Counter.*/
Xlong     l;                /* Used to generate SMPLMIN.*/
Xint      lhb;              /* SMPLHB.*/
Xunsigned mask = 1;         /* SMPMASK.*/
Xint      mhb;              /* SMPMHB.*/
Xint      nel;              /* SMPNEL.*/
Xint      nl;               /* SMPNL.*/
Xint      nul;              /* SMPNUL.*/
Xint      ulhb;             /* SMPULHB.*/
Xint      nu;               /* SMPNU.*/
Xint      uhb;              /* SMPUHB.*/
Xchar     b[(256 / 3) + 2]; /* Output buffer for sprintf (3).*/
X
Xsprintf (b, "%o", UINT_MAX);
Xclbu = clbs (b);
Xif (clbu < 3)
X   {
X   fprintf (stderr, "Unsigned ints are only %d bits!", clbu);
X   exit (1);
X   }
Xif (SMPRDX < 10)
X   {
X   fprintf (stderr, "SMPRDX is only %d!", SMPRDX);
X   exit (1);
X   }
Xsprintf (b, "%o", SMPRDX);
Xclbr = clbs (b);
Xsprintf (b, "%lo", LONG_MAX);
Xclbl = 1 + clbs (b); /* Add 1 bit for sign bit.*/
Xsprintf (b, "%lo", ULONG_MAX);
Xclbul = clbs (b);
Xeb = clbu - clbr - 1;
Xif (eb < 1)
X   {
X   fprintf (stderr,
X            "Unsigned ints are only %d bits, so SMPRDX can be at most %d\n",
X            clbu, 1 << (clbu - 2));
X   exit (1);
X   }
Xnl = (clbl + eb - 1) / eb;
Xnu = 2;
Xnul = (clbul + eb - 1) / eb;
Xnel = ((nl > nul) ? nl : nul);
Xif ((2 == nl) && (2 == nu) && (2 == nul) &&
X    (0 == (clbu % 2)) && ((clbu / 2) >= (clbr + 1)))
X   eb = clbu / 2;
Xmask = (mask << eb) - 1;
Xlhb = clbl - 1 - (nel - 1) * eb;
Xuhb = clbu - (nel - 1) * eb;
Xulhb = clbul - (nel - 1) * eb;
Xmhb = ((lhb > ulhb) ? lhb : ulhb);
Xputs ("/*");
Xputs (" * simultipre.i - Macros for simple multiple precision (SMP) system");
Xputs (" *");
Xputs (" * This file was generated automatically by:");
Xputs (" *\t$Header: mk-smp.c,v 1.5 89/08/15 14:25:55 howard Exp $");
Xputs (" *");
Xprintf (" * Longs need %d bits.\n", clbl);
Xprintf (" * Unsigned longs need %d bits.\n", clbul);
Xprintf (" * Unsigned ints need %d bits.\n", clbu);
Xprintf (" * This is %sa two's complement machine.\n",
X        ((- LONG_MAX) == LONG_MIN) ? "not " : "");
Xputs (" */");
Xputchar ('\n');
Xprintf (
X   "#define SMPRDX  %6d /* Maximum radix of number to convert to SMP.*/\n",
X   SMPRDX);
Xprintf ("#define SMPEB   %6d /* Number of bits in one SMP element.*/\n", eb);
Xprintf ("#define SMPMASK 0x%X /* Mask off SMPEB bits.*/\n", mask);
Xprintf ("#define SMPMHB  %6d /* Number of bits in high order SMP element.*/\n",
X        mhb);
Xprintf ("#define SMPNEL  %6d /* Number of SMP elements to make one SMP.*/\n",
X        nel);
Xprintf ("#define SMPNL   %6d /* Number of SMP elements for a long.*/\n", nl);
Xprintf (
X       "#define SMPLHB  %6d /* Number of bits in high order long element.*/\n",
X       lhb);
Xprintf ("#define SMPLMIN {");
X 
Xif ((- LONG_MAX) == LONG_MIN)
X   { /* Not two's complement.*/
X   l = LONG_MAX;
X   for (i = nel; 0 != i; --i)
X      {
X      printf ("0x%lX, ", l & mask);
X      l >>= eb;
X      }
X   }
Xelse
X   { /* Two's complement.*/
X   for (i = nel - 1; 0 != i; --i)
X      printf ("0, ");
X   printf ("0x%X, ", 1 << lhb);
X   }
Xputs ("1} /* SMP for LONG_MIN.*/");
Xprintf ("#define SMPNU   %6d /* Number of SMP elements for unsigned int.*/\n",
X        nu);
Xprintf (
X"#define SMPUHB  %6d /* Number of bits in high order unsigned int element.*/\n",
X        uhb);
Xprintf ("#define SMPNUL  %6d /* Number of SMP elements for unsigned long.*/\n",
X        nul);
Xprintf (
X"#define SMPULHB %6d /* Number of bits in high order unsigned long element.*/\n",
X        ulhb);
X
Xfflush (stdout);
Xexit (0);
X
X#ifdef lint
Xreturn (0);
X#endif
X}
END_OF_FILE
if test 6522 -ne `wc -c <'mk-smp.c'`; then
    echo shar: \"'mk-smp.c'\" unpacked with wrong size!
fi
# end of 'mk-smp.c'
fi
if test -f 'new-Make.b' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'new-Make.b'\"
else
echo shar: Extracting \"'new-Make.b'\" \(6860 characters\)
sed "s/^X//" >'new-Make.b' <<'END_OF_FILE'
X  
X# new-Make.b - create a new Makefile from a prototype
X#
X# $Header: new-Make.b,v 1.2 89/09/23 15:24:04 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-Make
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 - main 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# Copy stdin to stdout.
XCAT=cat
X
X# Put a file into the distribution directory.
XDISTO=mkDistO
X
X# Echo arguments.
XECHO=echo
X
X# Elisp compiler.
XELCMP=emacs -batch -q -f batch-byte-compile
X
X# Install a non-executable file.
XINSTF=mkInstF
X
X# Install an executable file.
XINSTX=mkInstX
X
X# Lint command.
XLINT=lint
X
X# Make shar files.
XSHAR=trshar shar
X
X
X# Command options:
X
X# Set commands at start of Bourne shell files, usually absolute paths.
XBDEFS=
X
X# C compiler options.
XCFLAGS=-O4
X
X# C library search path.
XLIBPATH=-L/usr/local/free/howard/0
X
X# C libraries to link in.
XLIBES=-lhoward
X
X# Options to lint.
XLINTFLAGS=-abchux
X
X# Lint libraries.
XLL=/usr/local/free/howard/0/llib-howard.ln
X
X
X# Directories:
X
X# Install Bourne shell files here.
XBID=../bin
X
X# Install C executables here.
XCID=../bin
X
X# Install compiled elisp here.
XELID=../el
X
X# Install man entries here.
XMID=../man
X
X
X# Sources.  Comment out all that don't apply.
X
X# Bourne shell files.
XBS := $(filter %.b,$(SRCS))
X
X# BibTeX bibliography file.
XBIBS := $(filter %.bib,$(SRCS))
X
X# C programs.
XCS := $(filter %.c,$(SRCS))
X
X# Elisp source.
XELS := $(filter %.el,$(SRCS))
X
X# C include files.
XHS := $(filter %.h,$(SRCS))
X
X# LaTeX source.
XLATEXS := $(filter %.tex,$(SRCS))
X
X# Manuals.
XM1S := $(filter %.1,$(SRCS))# Section 1.
XM5S := $(filter %.5,$(SRCS))# Section 5.
XM8S := $(filter %.8,$(SRCS))# Section 8.
Xms  := $(M1S) $(M5S) $(M8S)# All sections.
X
X# All ordinary source files.  Removed by make clobber.
Xsrc := $(BS) $(BIBS) $(CS) $(ELS) $(HS) $(LATEXS) $(ms)
X
X# Absolutely all source files.
Xallsrc := README LICENSE FREEZE MakeCommon Makefile uMakefile $(src)
X
X
X# Targets and installs:
X
X# Bourne shell files.
Xifdef BS
Xbt := $(subst .b,,$(BS))
Xbi := $(patsubst %,$(BID)/%,$(bt))
Xendif
X
X# C programs.
Xifdef CS
Xct := $(subst .c,,$(CS))
Xci := $(patsubst %,$(CID)/%,$(ct))
Xlt := $(patsubst %.c,%-l,$(CS))# Phony lint targets for C programs.
Xst := $(subst .c,.s,$(CS))# Assembler targets for C programs.
Xendif
X
X# Compiled elisp.
Xifdef ELS
Xelt := $(subst .el,.elc,$(ELS))
Xeli := $(patsubst %,$(ELID)/%,$(elt))
Xendif
X
X# LaTeX.
Xifdef FMTLATEX
Xlatext := $(subst .tex,.texf,$(LATEXS))
Xspellt := $(patsubst %.tex,%-s,$(LATEXS))#Phony targets for spelling checking.
Xendif
X
X# Manual entries.
Xifdef M1S
Xcat1i := $(patsubst %,$(MID)/cat1/%,$(M1S))
Xm1i   := $(patsubst %,$(MID)/man1/%,$(M1S))
Xendif
Xifdef M5S
Xcat5i := $(patsubst %,$(MID)/cat5/%,$(M5S))
Xm5i   := $(patsubst %,$(MID)/man5/%,$(M5S))
Xendif
Xifdef M8S
Xcat8i := $(patsubst %,$(MID)/cat8/%,$(M8S))
Xm8i   := $(patsubst %,$(MID)/man8/%,$(M8S))
Xendif
Xcati := $(cat1i) $(cat5i) $(cat8i)
Xmi   := $(m1i) $(m5i) $(m8i)
X
Xifdef FMTMAN
Xft := $(patsubst %,%.f,$(ms))#Formatted manual entries, e.g. PostScript.
Xendif
X
Xtargets := $(bt) $(ct) $(elt) $(ft) $(latext)
X
X# Distribution:
Xdist := $(patsubst %,$(DD)/%,$(allsrc) $(ft) $(latext))
X
X# Don't use built-in rules.
X.SUFFIXES:
X.PHONY: clean clobber default dist install shar vars $(lt) $(spellt)
X
Xdefault: $(targets)
X
X# Display values of various variables.  Mostly for debugging.
Xvars:
X	@$(ECHO) 'SRCS:' $(SRCS)
Xifdef BS
X	@$(ECHO) 'BS:' $(BS)
X	@$(ECHO) 'bt:' $(bt)
X	@$(ECHO) 'bi:' $(bi)
Xendif
Xifdef CS
X	@$(ECHO) 'CS:' $(CS)
X	@$(ECHO) 'ct:' $(ct)
X	@$(ECHO) 'ci:' $(ci)
X	@$(ECHO) 'lt:' $(lt)
X	@$(ECHO) 'st:' $(st)
X	@$(ECHO) 'CC:' $(CC)
X	@$(ECHO) 'CFLAGS:' $(CFLAGS)
X	@$(ECHO) 'DEFS:' $(DEFS)
X	@$(ECHO) 'LIBPATH:' $(LIBPATH)
X	@$(ECHO) 'LIBES:' $(LIBES)
Xendif
Xifdef ELS
X	@$(ECHO) 'ELS:' $(ELS)
X	@$(ECHO) 'elt:' $(elt)
X	@$(ECHO) 'eli:' $(eli)
Xendif
Xifdef HS
X	@$(ECHO) 'HS:' $(HS)
Xendif
Xifdef FMTLATEX
X	@$(ECHO) 'LATEXS:' $(LATEXS)
X	@$(ECHO) 'BIBS:' $(BIBS)
X	@$(ECHO) 'latext:' $(latext)
X	@$(ECHO) 'spellt:' $(spellt)
Xendif
Xifdef M1S
X	@$(ECHO) 'M1S:' $(M1S)
X	@$(ECHO) 'cat1i:' $(cat1i)
X	@$(ECHO) 'm1i:' $(m1i)
Xendif
Xifdef M5S
X	@$(ECHO) 'M5S:' $(M5S)
X	@$(ECHO) 'cat5i:' $(cat5i)
X	@$(ECHO) 'm5i:' $(m5i)
Xendif
Xifdef M8S
X	@$(ECHO) 'M8S:' $(M8S)
X	@$(ECHO) 'cat8i:' $(cat8i)
X	@$(ECHO) 'm8i:' $(m8i)
Xendif
X	@$(ECHO) 'mi:' $(mi)
Xifdef FMTMAN
X	@$(ECHO) 'ft:' $(ft)
Xendif
X	@$(ECHO) 'allsrc:' $(allsrc)
X	@$(ECHO) 'dist:' $(dist)
X
Xclean:
X	-$(RM) depend $(st)
X
Xclobber: clean
X	-$(RM) $(src) $(targets) FREEZE FREEZE.*
X
Xifdef BS
X$(bt): %: %.b
X	$(RM) $@
X	$(ECHO) '  $(BDEFS)' > $@
X	$(CAT) $< >> $@
X	$(CHMOD) +x $@
Xendif
X
Xifdef CS
X$(ct): %: %.c
X	$(CC) -o $@ $(CFLAGS) $(DEFS) $(INCLUDES) $(LIBPATH) $*.c $(LIBES)
X
X$(lt): %-l: %.c $(LL)
X	$(LINT) $(LINTFLAGS) $(DEFS) $(INCLUDES) $< $(LL)
Xendif
X
Xifdef ELS
X$(elt): %.elc: %.el
X	$(ELCMP) $<
Xendif
X
Xifdef FMTMAN
X$(ft): %.f: %
X	$(RM) $@
X	$(FMTMAN) $< > $@
Xendif
X
Xifdef FMTLATEX
X$(latext): %.texf: %.tex $(BIBS)
X	$(FMTLATEX) $* $@
X
X$(spellt): %-s: %.tex
X	$(SPELL_LATEX) $<
Xendif
X
Xshar: $(allsrc)
X	$(SHAR) $(allsrc)
X
Xifdef CS
X$(st): %.s: %.c
X	$(CC) -S $(DEFS) $(INCLUDES) $<
Xendif
X
Xifdef WORK
X
Xdist: $(dist)
X
X$(dist): $(DD)/%: %
X	$(DISTO) $< $(DD)
X
X.DEFAULT:
X	$(UNCMPRS) $@
X
Xelse # WORK
X
Xinstall: $(bi) $(ci) $(cati) $(eli) $(mi)
X
Xifdef BS
X$(bi): $(BID)/%: %
X	$(INSTF) $< $(BID)
Xendif
X
Xifdef CS
X$(ci): $(CID)/%: %
X	$(INSTX) $< $(CID)
Xendif
X
Xifdef ELS
X$(eli): $(ELID)/%: %
X	$(INSTF) $< $(ELID)
Xendif
X
Xifdef M1S
X$(m1i): $(MID)/man1/%: %
X	$(INSTF) $< $(MID)/man1
X
Xifdef CATMAN
X$(cat1i): $(m1i)
X	$(CATMAN) -M $(MID) 1
Xendif
Xendif
X
Xifdef M5S
X$(m5i): $(MID)/man5/%: %
X	$(INSTF) $< $(MID)/man5
X
Xifdef CATMAN
X$(cat5i): $(m5i)
X	$(CATMAN) -M $(MID) 5
Xendif
Xendif
X
Xifdef M8S
X$(m8i): $(MID)/man8/%: %
X	$(INSTF) $< $(MID)/man8
X
Xifdef CATMAN
X$(cat8i): $(m8i)
X	$(CATMAN) -M $(MID) 8
Xendif
Xendif
X
X$(allsrc): %: $(DD)/%
X	$(DISTI) $@ $(DD)
X
X.DEFAULT:
X	$(DISTI) $@ $(DD)
X
Xendif # WORK
X
Xifdef CS
Xinclude depend
Xendif
XEOF
Xdone
END_OF_FILE
if test 6860 -ne `wc -c <'new-Make.b'`; then
    echo shar: \"'new-Make.b'\" unpacked with wrong size!
fi
# end of 'new-Make.b'
fi
if test -f 'strspn.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'strspn.c'\"
else
echo shar: Extracting \"'strspn.c'\" \(656 characters\)
sed "s/^X//" >'strspn.c' <<'END_OF_FILE'
X/*
X * strspn - find length of initial segment of s consisting entirely
X * of characters from accept
X *
X * Public domain code by Henry Spencer.
X */
X
X#include <stdio.h>
X#include <howard/port.h>
X#include <howard/version.h>
X
XMODVER ("@(#)$Header: strspn.c,v 1.1 89/08/29 08:34:07 howard Exp $");
X
X#ifdef NOSTRSPN
Xint
Xstrspn(s, accept)
X char *s;
X char *accept;
X{
X	register  char *sscan;
X	register  char *ascan;
X	register int count;
X
X	count = 0;
X	for (sscan = s; *sscan != '\0'; sscan++) {
X		for (ascan = accept; *ascan != '\0'; ascan++)
X			if (*sscan == *ascan)
X				break;
X		if (*ascan == '\0')
X			return(count);
X		count++;
X	}
X	return(count);
X}
X#endif NOSTRSPN
END_OF_FILE
if test 656 -ne `wc -c <'strspn.c'`; then
    echo shar: \"'strspn.c'\" unpacked with wrong size!
fi
# end of 'strspn.c'
fi
echo shar: End of archive 3 \(of 9\).
cp /dev/null ark3isdone
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