Newsgroups: comp.sources.misc
From: tim@deakin.edu.au (Tim Cook)
Subject: v35i014:  describe - File Descriptions, Part03/03
Message-ID: <1993Feb2.061638.20545@sparky.imd.sterling.com>
X-Md4-Signature: c5f489ec70b36f945ef42cd0628c0f84
Date: Tue, 2 Feb 1993 06:16:38 GMT
Approved: kent@sparky.imd.sterling.com

Submitted-by: tim@deakin.edu.au (Tim Cook)
Posting-number: Volume 35, Issue 14
Archive-name: describe/part03
Environment: UNIX, DBM

#! /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".
# Contents:  allocate.c list.h pathname.c strpbrk.c version.h
# Wrapped by kent@sparky on Mon Feb  1 10:15:04 1993
PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
echo If this archive is complete, you will see the following message:
echo '          "shar: End of archive 3 (of 3)."'
if test -f 'allocate.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'allocate.c'\"
else
  echo shar: Extracting \"'allocate.c'\" \(1000 characters\)
  sed "s/^X//" >'allocate.c' <<'END_OF_FILE'
X/* allocate.c -	Interface to malloc/realloc
X *
X * DESCRIPTION
X *	These routines, allocate and re_allocate call malloc(3) and
X *	realloc(3) respectively.  If malloc or realloc returns NULL,
X *	an error message is printed and execution is terminated,
X *	otherwise, the value returned by malloc/realloc is returned.
X *
X * Copyright (c) 1991,1992 Tim Cook.
X * Non-profit distribution allowed.  See README for details.
X */
X
Xstatic char rcsid[] = "$Id: allocate.c,v 1.1 1992/10/30 06:19:34 tim Exp $";
X
X#include "config.h"
X
Xextern VOID_PTR malloc () ;
Xextern VOID_PTR realloc () ;
X
X
XVOID_PTR allocate (length)
X   size_t length ;
X{
X   VOID_PTR tmp ;
X
X   if ((tmp = malloc (length)) == (VOID_PTR) NULL) {
X      perror ("malloc") ;
X      exit (1) ; }
X   else
X      return tmp ;
X   }
X
X
XVOID_PTR re_allocate (p, length)
X   VOID_PTR p ;
X   size_t length ;
X{
X   VOID_PTR tmp ;
X
X   if ((tmp = realloc (p, length)) == (VOID_PTR) NULL) {
X      perror ("realloc") ;
X      exit (1) ; }
X   else
X      return tmp ;
X   }
END_OF_FILE
  if test 1000 -ne `wc -c <'allocate.c'`; then
    echo shar: \"'allocate.c'\" unpacked with wrong size!
  fi
  # end of 'allocate.c'
fi
if test -f 'list.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'list.h'\"
else
  echo shar: Extracting \"'list.h'\" \(1288 characters\)
  sed "s/^X//" >'list.h' <<'END_OF_FILE'
X/* list.h -	Definitions for list manipulation
X *
X * Copyright (c) 1991, 1992 Tim Cook.
X * Non-profit distribution allowed.  See README for details.
X *
X * $Id: list.h,v 1.5 1992/12/02 03:54:10 tim Exp $
X */
X
X#ifndef _LIST_H_
X#define _LIST_H_
X
X#include "config.h"
X
Xstruct list {
X   VOID_PTR_PTR start ;		/* First element (NULL if empty) */
X   VOID_PTR_PTR end ;		/* Last element */
X   VOID_PTR_PTR s_start ;	/* Beginning of storage */
X   VOID_PTR_PTR s_end ;		/* Just past end of storage */
X   VOID_PTR_PTR data ;		/* List of pointers to blocks of storage to
X				   hold data pointed to by list items. */
X   } ;
X
X#define list_init(l)	((l)->start = (l)->data = (VOID_PTR_PTR) 0)
X
X/*
X * NOTE:  For list_elements to work, we must be able to cast
X * VOID_PTR_PTR to "unsigned long" without losing anything.
X */
X
X#define list_elements(l) \
X	   ((l)->start ? ((unsigned long) (l)->end - (unsigned long) \
X	      (l)->start) / sizeof (VOID_PTR_PTR) : 0)
X#define list_element(l,n) \
X	   ((l)->start ? (l)->start[n] : (VOID_PTR) 0)
X#define list_empty(l) \
X	   ((l)->start == (VOID_PTR_PTR) 0)
X
X#ifndef _LIST_C_
Xextern VOID list_push () ;
Xextern VOID_PTR list_pop () ;
Xextern VOID_PTR list_shift () ;
Xextern VOID list_sort () ;
Xextern VOID list_free () ;
X#endif	/* _LIST_C_ */
X
X#endif	/* _LIST_H_ */
END_OF_FILE
  if test 1288 -ne `wc -c <'list.h'`; then
    echo shar: \"'list.h'\" unpacked with wrong size!
  fi
  # end of 'list.h'
fi
if test -f 'pathname.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'pathname.c'\"
else
  echo shar: Extracting \"'pathname.c'\" \(867 characters\)
  sed "s/^X//" >'pathname.c' <<'END_OF_FILE'
X/* pathname.c -	Construct a pathname from a directory and basename
X *
X * SYNOPSIS
X *	char *pathname (char *directory, char *name)
X *
X * RETURNS
X *	Returns "directory" + "/" + "name" (copied into static
X *	storage), or a pointer to "name" if "directory" is null.
X *
X * Copyright (c) 1991, 1992 Tim Cook.
X * Non-profit distribution allowed.  See README for details.
X */
X
Xstatic char rcsid[] = "$Id: pathname.c,v 1.1 1992/12/02 03:48:38 tim Exp $";
X
X#include "config.h"
X#include <sys/param.h>
X
X#ifndef MAXPATHLEN
X#define MAXPATHLEN	1024
X#endif
X
X
Xchar *pathname (directory, name)
X   char *directory, *name ;
X{
X   static char return_value[MAXPATHLEN+1] ;
X
X   if (directory && *directory != EOS) {
X      strcpy (return_value, directory) ;
X      strcat (return_value, "/") ;
X      strcat (return_value, name) ;
X      return return_value ; }
X   else
X      return name ;
X   }
END_OF_FILE
  if test 867 -ne `wc -c <'pathname.c'`; then
    echo shar: \"'pathname.c'\" unpacked with wrong size!
  fi
  # end of 'pathname.c'
fi
if test -f 'strpbrk.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'strpbrk.c'\"
else
  echo shar: Extracting \"'strpbrk.c'\" \(1162 characters\)
  sed "s/^X//" >'strpbrk.c' <<'END_OF_FILE'
X/*
X * Copyright (c) 1985 Regents of the University of California.
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by the University of California, Berkeley.  The name of the
X * University may not be used to endorse or promote products derived
X * from this software without specific prior written permission.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X */
X
X#if defined(LIBC_SCCS) && !defined(lint)
Xstatic char sccsid[] = "@(#)strpbrk.c	5.5 (Berkeley) 5/10/89";
X#endif /* LIBC_SCCS and not lint */
X
Xchar *
Xstrpbrk(s1, s2)
X	register char *s1, *s2;
X{
X	register int c, sc;
X	register char *scanp;
X
X	for (; c = *s1; ++s1)
X		for (scanp = s2; sc = *scanp++;)
X			if (sc == c)
X				return(s1);
X	return(0);
X}
END_OF_FILE
  if test 1162 -ne `wc -c <'strpbrk.c'`; then
    echo shar: \"'strpbrk.c'\" unpacked with wrong size!
  fi
  # end of 'strpbrk.c'
fi
if test -f 'version.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'version.h'\"
else
  echo shar: Extracting \"'version.h'\" \(223 characters\)
  sed "s/^X//" >'version.h' <<'END_OF_FILE'
X/* version.h -	Describe version
X *
X * This version definition is fairly arbitrary at the moment
X */
X
X#ifndef PACKAGE_NAME
X#define PACKAGE_NAME	"describe"
X#endif
X
X#ifndef PACKAGE_VERSION
X#define PACKAGE_VERSION	"2.0"
X#endif
END_OF_FILE
  if test 223 -ne `wc -c <'version.h'`; then
    echo shar: \"'version.h'\" unpacked with wrong size!
  fi
  # end of 'version.h'
fi
echo shar: End of archive 3 \(of 3\).
cp /dev/null ark3isdone
MISSING=""
for I in 1 2 3 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 3 archives.
    rm -f ark[1-9]isdone
else
    echo You still must unpack the following archives:
    echo "        " ${MISSING}
fi
exit 0
exit 0 # Just in case...
