Path: utzoo!attcan!uunet!allbery From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Newsgroups: comp.sources.misc Subject: v08i081: libhoward portability library, part 3 of 9 Message-ID: <68939@uunet.UU.NET> Date: 1 Oct 89 14:42:54 GMT Sender: allbery@uunet.UU.NET Reply-To: howard@dahlbeck.ericsson.se (Howard Gayle) Lines: 1858 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) 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 X#include X#include X XMODVER ("@(#)$Header: a2l.c,v 1.12 89/08/11 13:07:15 howard Exp $"); X X#include X#include X#include X#include 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 X XMAINVER ("@(#)$Header: a2l.c,v 1.12 89/08/11 13:07:15 howard Exp $"); XUSAGE ("integer-numeric-literal"); X X#include X#include X#include X#include 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 X#include X#include X XMODVER ("@(#)$Header: getlic.c,v 1.5 89/08/09 09:46:01 howard Exp $"); X X#include X#include 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 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 message at