summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xidtest67
-rw-r--r--lib/alloc.h40
-rw-r--r--lib/bitops.c115
-rw-r--r--lib/bitops.h30
-rw-r--r--lib/filenames.c375
-rw-r--r--lib/filenames.h37
-rw-r--r--lib/idarg.h32
-rw-r--r--lib/language.map88
-rw-r--r--lib/misc.c72
-rw-r--r--lib/misc.h37
-rw-r--r--lib/strxtra.h40
-rw-r--r--lib/system.h45
-rw-r--r--lib/token.c49
-rw-r--r--lib/token.h39
-rwxr-xr-xmkdirhier61
-rw-r--r--src/idx.c167
-rw-r--r--src/pid3
-rw-r--r--strerror.c31
18 files changed, 0 insertions, 1328 deletions
diff --git a/idtest b/idtest
deleted file mode 100755
index b513e2a..0000000
--- a/idtest
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-
-export LANG; LANG=C
-
-case $# in
-0) exec make idtest-real;;
-esac
-
-srcdir=$1
-buildir=$2
-PATH=$buildir/src:$PATH
-
-f_ID="-f $buildir/ID"
-
-files="`find $srcdir -name \*.h;
- find $srcdir -name \*.c |egrep -v 'lib/ansi2knr\.c$'`"
-
-cmd="mkid $f_ID -m $srcdir/lib/language.map $files"
-echo $cmd
-eval $cmd
-
-errors=
-
-if idx $files |sort -u >ID.idx &&
- lid $idfile_arg |sed -e 's/[ ].*//' |sort -u >ID.lid &&
- cmp -s ID.idx ID.lid
-then
- rm -f ID.idx ID.lid
- echo "Good. idx and lid agree."
-else
- mv ID.idx ID.bad-idx
- mv ID.fid ID.bad-fid
- 1>&2 echo "Oops! idx and lid disagree--look in ID.bad-{idx,lid}"
- errors=t
-fi
-
-idx_file=$$.idx
-fid_file=$$.fid
-
-for file in $files
-do
- case x$file in
- x-*) scan_args="$scan_args $file"
- continue;;
- esac
- if fid $idfile_arg $file >$fid_file &&
- idx $scan_args $file |sort -u >$idx_file &&
- cmp -s $idx_file $fid_file;
- then
- echo "Good. idx and fid agree for $file"
- else
- 1>&2 echo "Oops! idx and fid disagree for $file--look in $file.bad-{idx,fid}"
- mv $idx_file $file.bad-idx
- mv $fid_file $file.bad-fid
- errors=t
- fi
-done
-rm -f $idx_file $fid_file
-
-case x$errors in
-xt) echo "Some checks failed."
- echo "mkid and friends are broken--boo hoo!"
- exit 1;;
-*) echo "All checks successful."
- echo "mkid and friends are happy!"
- exit 0;;
-esac
diff --git a/lib/alloc.h b/lib/alloc.h
deleted file mode 100644
index bdcbf07..0000000
--- a/lib/alloc.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* alloc.h -- convenient interface macros for malloc(3) & friends
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _alloc_h_
-#define _alloc_h_
-
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#else /* not HAVE_STDLIB_H */
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif /* HAVE_MALLOC_H */
-#endif /* not HAVE_STDLIB_H */
-#include <xmalloc.h>
-#include <obstack.h>
-
-#define CALLOC(t, n) ((t *) calloc (sizeof (t), (n)))
-#define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n)))
-#define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n)))
-#define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n)))
-
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-#define OBSTACK_ALLOC(obs, t, n) ((t *)obstack_alloc ((obs), (n)*sizeof(t)))
-
-#endif /* not _alloc_h_ */
diff --git a/lib/bitops.c b/lib/bitops.c
deleted file mode 100644
index 5e96e26..0000000
--- a/lib/bitops.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* bitops.c -- Bit-vector manipulation for mkid
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <config.h>
-#include "bitops.h"
-
-static int str_to_int __P((char *bufp, int size));
-static char *int_to_str __P((int i, int size));
-
-int
-vec_to_bits (char *bit_array, char *vec, int size)
-{
- int i;
- int count;
-
- for (count = 0; (*vec & 0xff) != 0xff; count++)
- {
- i = str_to_int (vec, size);
- BITSET (bit_array, i);
- vec += size;
- }
- return count;
-}
-
-int
-bits_to_vec (char *vec, char *bit_array, int bit_count, int size)
-{
- char *element;
- int i;
- int count;
-
- for (count = i = 0; i < bit_count; i++)
- {
- if (!BITTST (bit_array, i))
- continue;
- element = int_to_str (i, size);
- switch (size)
- {
- case 4:
- *vec++ = *element++;
- case 3:
- *vec++ = *element++;
- case 2:
- *vec++ = *element++;
- case 1:
- *vec++ = *element++;
- }
- count++;
- }
- *vec++ = 0xff;
-
- return count;
-}
-
-/* NEEDSWORK: ENDIAN */
-
-static char *
-int_to_str (int i, int size)
-{
- static char buf0[4];
- char *bufp = &buf0[size];
-
- switch (size)
- {
- case 4:
- *--bufp = (i & 0xff);
- i >>= 8;
- case 3:
- *--bufp = (i & 0xff);
- i >>= 8;
- case 2:
- *--bufp = (i & 0xff);
- i >>= 8;
- case 1:
- *--bufp = (i & 0xff);
- }
- return buf0;
-}
-
-static int
-str_to_int (char *bufp, int size)
-{
- int i = 0;
-
- bufp--;
- switch (size)
- {
- case 4:
- i |= (*++bufp & 0xff);
- i <<= 8;
- case 3:
- i |= (*++bufp & 0xff);
- i <<= 8;
- case 2:
- i |= (*++bufp & 0xff);
- i <<= 8;
- case 1:
- i |= (*++bufp & 0xff);
- }
- return i;
-}
diff --git a/lib/bitops.h b/lib/bitops.h
deleted file mode 100644
index 187fa91..0000000
--- a/lib/bitops.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* bitops.h -- defs for interface to bitops.c, plus bit-vector macros
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _bitops_h_
-#define _bitops_h_
-
-#define BITTST(ba, bn) ((ba)[(bn) >> 3] & (1 << ((bn) & 0x07)))
-#define BITSET(ba, bn) ((ba)[(bn) >> 3] |= (1 << ((bn) & 0x07)))
-#define BITCLR(ba, bn) ((ba)[(bn) >> 3] &=~(1 << ((bn) & 0x07)))
-#define BITAND(ba, bn) ((ba)[(bn) >> 3] &= (1 << ((bn) & 0x07)))
-#define BITXOR(ba, bn) ((ba)[(bn) >> 3] ^= (1 << ((bn) & 0x07)))
-
-int vec_to_bits __P((char *bit_array, char *vec, int size));
-int bits_to_vec __P((char *vec, char *bit_array, int bit_count, int size));
-
-#endif /* not _bitops_h_ */
diff --git a/lib/filenames.c b/lib/filenames.c
deleted file mode 100644
index fc154a7..0000000
--- a/lib/filenames.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* filenames.c -- file & directory name manipulations
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <config.h>
-#include "system.h"
-#include "strxtra.h"
-#include "filenames.h"
-#include "misc.h"
-#include "error.h"
-
-extern char *xgetcwd __P((void));
-
-/* root_name returns the base name of the file with any leading
- * directory information or trailing suffix stripped off. Examples:
- *
- * /usr/include/stdio.h -> stdio
- * fred -> fred
- * barney.c -> barney
- * bill/bob -> bob
- * / -> < null string >
- */
-char const *
-root_name (char const *path)
-{
- static char file_name_buffer[BUFSIZ];
- char const *root;
- char const *dot;
-
- root = strrchr (path, '/');
- if (root == NULL)
- root = path;
- else
- root++;
-
- dot = strrchr (root, '.');
- if (dot == NULL)
- strcpy (file_name_buffer, root);
- else
- {
- strncpy (file_name_buffer, root, dot - root);
- file_name_buffer[dot - root] = '\0';
- }
- return file_name_buffer;
-}
-
-/* suff_name returns the suffix (including the dot) or a null string
- * if there is no suffix. Examples:
- *
- * /usr/include/stdio.h -> .h
- * fred -> < null string >
- * barney.c -> .c
- * bill/bob -> < null string >
- * / -> < null string >
- */
-char const *
-suff_name (char const *path)
-{
- char const *dot;
-
- dot = strrchr (path, '.');
- if (dot == NULL)
- return "";
- return dot;
-}
-
-int
-can_crunch (char const *path1, char const *path2)
-{
- char const *slash1;
- char const *slash2;
-
- slash1 = strrchr (path1, '/');
- slash2 = strrchr (path2, '/');
-
- if (slash1 == NULL && slash2 == NULL)
- return strequ (suff_name (path1), suff_name (path2));
- if ((slash1 - path1) != (slash2 - path2))
- return 0;
- if (!strnequ (path1, path2, slash1 - path1))
- return 0;
- return strequ (suff_name (slash1), suff_name (slash2));
-}
-
-/* look_up adds ../s to the beginning of a file name until it finds
- * the one that really exists. Returns NULL if it gets all the way
- * to / and never finds it.
- *
- * If the file name starts with /, just return it as is.
- *
- * This routine is used to locate the ID database file.
- */
-char const *
-look_up (char const *arg)
-{
- static char file_name_buffer[BUFSIZ];
- char *buf = file_name_buffer;
- char *id_path = 0;
- struct stat rootb;
- struct stat statb;
-
- if (arg == 0)
- {
- id_path = getenv ("IDPATH");
- if (id_path)
- {
- id_path = strdup (id_path);
- arg = strtok (id_path, ":");
- /* FIXME: handle multiple ID file names */
- }
- }
- if (arg == 0)
- arg = ID_FILE_NAME;
-
- /* if we got absolute name, just use it. */
- if (arg[0] == '/')
- return arg;
- /* if the name we were give exists, don't bother searching */
- if (stat (arg, &statb) == 0)
- return arg;
- /* search up the tree until we find a directory where this
- * relative file name is visible.
- * (or we run out of tree to search by hitting root).
- */
-
- if (stat ("/", &rootb) != 0)
- return NULL;
- do
- {
- strcpy (buf, "../");
- buf += 3;
- strcpy (buf, arg);
- if (stat (file_name_buffer, &statb) == 0)
- return file_name_buffer;
- *buf = '\0';
- if (stat (file_name_buffer, &statb) != 0)
- return NULL;
- }
- while (!((statb.st_ino == rootb.st_ino) ||
- (statb.st_dev == rootb.st_dev)));
- return NULL;
-}
-
-/* define special name components */
-
-static char slash[] = "/";
-static char dot[] = ".";
-static char dotdot[] = "..";
-
-/* nextc points to the next character to look at in the string or is
- * null if the end of string was reached.
- *
- * namep points to buffer that holds the components.
- */
-static char const *nextc = NULL;
-static char *namep;
-
-/* lexname - Return next name component. Uses global variables initialized
- * by canonize_file_name to figure out what it is scanning.
- */
-static char const *
-lexname (void)
-{
- char c;
- char const *d;
-
- if (nextc)
- {
- c = *nextc++;
- if (c == '\0')
- {
- nextc = NULL;
- return NULL;
- }
- if (c == '/')
- {
- return &slash[0];
- }
- if (c == '.')
- {
- if ((*nextc == '/') || (*nextc == '\0'))
- return &dot[0];
- if (*nextc == '.' && (*(nextc + 1) == '/' || *(nextc + 1) == '\0'))
- {
- ++nextc;
- return &dotdot[0];
- }
- }
- d = namep;
- *namep++ = c;
- while ((c = *nextc) != '/')
- {
- *namep++ = c;
- if (c == '\0')
- {
- nextc = NULL;
- return d;
- }
- ++nextc;
- }
- *namep++ = '\0';
- return d;
- }
- else
- {
- return NULL;
- }
-}
-
-/* canonize_file_name - Put a file name in cannonical form. Looks for all the
- * whacky wonderful things a demented *ni* programmer might put
- * in a file name and reduces the name to cannonical form.
- */
-void
-canonize_file_name (char *n)
-{
- char const *components[1024];
- char const **cap = &components[0];
- char const **cad;
- char const *cp;
- char namebuf[2048];
- char const *s;
-
- /* initialize scanner */
- nextc = n;
- namep = &namebuf[0];
-
- /* break the file name into individual components */
- while ((cp = lexname ()))
- {
- *cap++ = cp;
- }
-
- /* If name is empty, leave it that way */
- if (cap == &components[0])
- return;
-
- /* flag end of component list */
- *cap = NULL;
-
- /* remove all trailing slashes and dots */
- while ((--cap != &components[0]) &&
- ((*cap == &slash[0]) || (*cap == &dot[0])))
- *cap = NULL;
-
- /* squeeze out all . / component sequences */
- cap = &components[0];
- cad = cap;
- while (*cap)
- {
- if ((*cap == &dot[0]) && (*(cap + 1) == &slash[0]))
- {
- cap += 2;
- }
- else
- {
- *cad++ = *cap++;
- }
- }
- *cad++ = NULL;
-
- /* find multiple // and use last slash as root, except on apollo which
- * apparently actually uses // in real file names (don't ask me why).
- */
-#ifndef apollo
- s = NULL;
- cap = &components[0];
- cad = cap;
- while (*cap)
- {
- if ((s == &slash[0]) && (*cap == &slash[0]))
- {
- cad = &components[0];
- }
- s = *cap++;
- *cad++ = s;
- }
- *cad = NULL;
-#endif
-
- /* if this is absolute name get rid of any /.. at beginning */
- if ((components[0] == &slash[0]) && (components[1] == &dotdot[0]))
- {
- cap = &components[1];
- cad = cap;
- while (*cap == &dotdot[0])
- {
- ++cap;
- if (*cap == NULL)
- break;
- if (*cap == &slash[0])
- ++cap;
- }
- while (*cap)
- *cad++ = *cap++;
- *cad = NULL;
- }
-
- /* squeeze out any name/.. sequences (but leave leading ../..) */
- cap = &components[0];
- cad = cap;
- while (*cap)
- {
- if ((*cap == &dotdot[0]) &&
- ((cad - 2) >= &components[0]) &&
- ((*(cad - 2)) != &dotdot[0]))
- {
- cad -= 2;
- ++cap;
- if (*cap)
- ++cap;
- }
- else
- {
- *cad++ = *cap++;
- }
- }
- /* squeezing out a trailing /.. can leave unsightly trailing /s */
- if ((cad >= &components[2]) && ((*(cad - 1)) == &slash[0]))
- --cad;
- *cad = NULL;
- /* if it was just name/.. it now becomes . */
- if (components[0] == NULL)
- {
- components[0] = &dot[0];
- components[1] = NULL;
- }
-
- /* re-assemble components */
- cap = &components[0];
- while ((s = *cap++))
- {
- while (*s)
- *n++ = *s++;
- }
- *n++ = '\0';
-}
-
-FILE *
-open_source_FILE (char *file_name)
-{
- FILE *source_FILE;
-
- source_FILE = fopen (file_name, "r");
- if (source_FILE == NULL)
- error (0, errno, _("can't open `%s'"), file_name);
- return source_FILE;
-}
-
-void
-close_source_FILE (FILE *fp)
-{
- fclose (fp);
-}
diff --git a/lib/filenames.h b/lib/filenames.h
deleted file mode 100644
index eb5969f..0000000
--- a/lib/filenames.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* filenames.h -- defs for interface to filenames.c
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _filenames_h_
-#define _filenames_h_
-
-#define ID_FILE_NAME "ID"
-
-char const *relative_file_name __P((char const *dir, char const *arg));
-char const *span_file_name __P((char const *dir, char const *arg));
-char const *root_name __P((char const *path));
-char const *suff_name __P((char const *path));
-int can_crunch __P((char const *path1, char const *path2));
-char const *look_up __P((char const *arg));
-void cannoname __P((char *n));
-char const *kshgetwd __P((char *pathname));
-char const *unsymlink __P((char *n));
-FILE *open_source_FILE __P((char *file_name));
-void close_source_FILE __P((FILE *fp));
-char const *get_sccs __P((char const *dir, char const *base, char const *sccs_dir));
-char const *co_rcs __P((char const *dir, char const *base, char const *rcs_dir));
-
-#endif /* not _filenames_h_ */
diff --git a/lib/idarg.h b/lib/idarg.h
deleted file mode 100644
index 28c820c..0000000
--- a/lib/idarg.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* idarg.h -- defs for internal form of command-line arguments
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _idarg_h_
-#define _idarg_h_
-
-struct idarg
-{
- struct idarg *ida_next;
- char *ida_arg;
- int ida_index;
- char ida_flags;
-#define IDA_RELATIVE 0x01 /* file name is now relative (lid) */
-#define IDA_SCAN_ME 0x01 /* file should be scanned (mkid) */
-#define IDA_PREFIX_US 0x02 /* file has names with prefixed underscores */
-};
-
-#endif /* not _idarg_h_ */
diff --git a/lib/language.map b/lib/language.map
deleted file mode 100644
index e230cb6..0000000
--- a/lib/language.map
+++ /dev/null
@@ -1,88 +0,0 @@
-# Welcome to the mkid language mapper.
-#
-# The format of each line is:
-#
-# <pattern> <language> [options]
-#
-# Filenames are matched top-to-bottom against the patterns, and the
-# first match is chosen. The special language `IGNORE' means that
-# this file should be ignored by mkid. The options are
-# language-specific command-line options to mkid.
-#
-# If a file name doesn't match any pattern, it is assigned the default
-# language. The default language may be specified here with the
-# special pattern `**', or overridden from the mkid command-line with
-# the `--default-lang=LANG' option.
-#
-# The special pattern `***' means to include the named file that
-# immediately follows. If no file is named, then the default system
-# language mapper file (i.e., this file) is included.
-
-# Default language
-** IGNORE # Although this is listed first,
- # the default language pattern is
- # logically matched last.
-
-# Backup files
-*~ IGNORE
-*.bak IGNORE
-*.bk[0-9] IGNORE
-
-# SCCS files
-[sp].* IGNORE
-
-# C dependencies created by automake
-*/.deps/* IGNORE
-
-*.h C
-*.h.in C
-*.H C++
-*.hh C++
-*.hpp C++
-*.hxx C++
-
-*.l C
-*.lex C
-*.y C
-*.yacc C
-
-*.c C
-*.C C++
-*.cc C++
-*.cpp C++
-*.cxx C++
-
-ChangeLog* Cdoc
-
-*.[sS] asm --comment=;
-*.asm asm --comment=;
-
-# [nt]roff
-*.[0-9] roff
-*.ms roff
-*.me roff
-*.mm roff
-
-*.tex TeX
-*.ltx TeX
-*.texi texinfo
-*.texinfo texinfo
-
-# portable object (i18n)
-*.po po
-
-*.el elisp
-
-*.am make
-Makefile make
-Makefile.* make
-
-*.doc text
-*.txt text
-
-*.m4 m4
-
-*.pl perl
-
-*.gz FILTER gzip -d <%s
-*.Z FILTER gzip -d <%s
diff --git a/lib/misc.c b/lib/misc.c
deleted file mode 100644
index 8b7849a..0000000
--- a/lib/misc.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* misc.c -- miscellaneous common functions
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-
-#include <config.h>
-#include "system.h"
-#include "strxtra.h"
-#include "misc.h"
-
-int
-tree8_count_levels (unsigned int cardinality)
-{
- int levels = 1;
- cardinality--;
- while (cardinality >>= 3)
- ++levels;
- return levels;
-}
-
-int
-gets_past_00 (char *tok, FILE *input_FILE)
-{
- int got = 0;
- int c;
- do
- {
- do
- {
- got++;
- c = getc (input_FILE);
- *tok++ = c;
- }
- while (c > 0);
- got++;
- c = getc (input_FILE);
- *tok++ = c;
- }
- while (c > 0);
- return got - 2;
-}
-
-int
-skip_past_00 (FILE *input_FILE)
-{
- int skipped = 0;
- do
- {
- do
- skipped++;
- while (getc (input_FILE) > 0);
- skipped++;
- }
- while (getc (input_FILE) > 0);
- return skipped;
-}
diff --git a/lib/misc.h b/lib/misc.h
deleted file mode 100644
index 4f8d707..0000000
--- a/lib/misc.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* misc.c -- defs for interface to misc.c
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _misc_h_
-#define _misc_h_
-
-#if HAVE_BASENAME
-char *basename ();
-#else
-char *basename __P((char const *path));
-#endif
-
-#if HAVE_DIRNAME
-char *dirname ();
-#else
-char *dirname __P((char const *path));
-#endif
-
-int tree8_count_levels __P((unsigned int cardinality));
-int gets_past_00 __P((char *tok, FILE *input_FILE));
-int skip_past_00 __P((FILE *input_FILE));
-
-#endif /* not _misc_h_ */
diff --git a/lib/strxtra.h b/lib/strxtra.h
deleted file mode 100644
index 75efa5e..0000000
--- a/lib/strxtra.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* strxtra.h -- convenient string manipulation macros
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _strxtra_h_
-#define _strxtra_h_
-
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#else /* not HAVE_STDLIB_H */
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif /* HAVE_MALLOC_H */
-#endif /* not HAVE_STDLIB_H */
-
-#define strequ(s1, s2) (strcmp ((s1), (s2)) == 0)
-#define strnequ(s1, s2, n) (strncmp ((s1), (s2), (n)) == 0)
-#define strcaseequ(s1, s2) (strcasecmp ((s1), (s2)) == 0)
-#define strncaseequ(s1, s2, n) (strncasecmp ((s1), (s2), (n)) == 0)
-#ifdef HAVE_STRDUP
-extern char *strdup ();
-#else
-#define strdup(s) (strcpy (calloc (1, strlen (s) + 1), (s)))
-#endif
-#define strndup(s, n) (strncpy (calloc (1, (n)+1), (s), (n)))
-
-#endif /* not _strxtra_h_ */
diff --git a/lib/system.h b/lib/system.h
deleted file mode 100644
index 11d26e8..0000000
--- a/lib/system.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* system-dependent definitions for id-utils programs.
- Copyright (C) 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-/* Include sys/types.h before this file. */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#define cardinalityof(a) (sizeof (a) / sizeof ((a)[0]))
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
-/* Take care of NLS matters. */
-
-#if HAVE_LOCALE_H
-# include <locale.h>
-#endif
-#if !HAVE_SETLOCALE
-# define setlocale(Category, Locale) /* empty */
-#endif
-
-#if ENABLE_NLS
-# include <libintl.h>
-# define _(Text) gettext (Text)
-#else
-# define bindtextdomain(Domain, Directory) /* empty */
-# define textdomain(Domain) /* empty */
-# define _(Text) Text
-#endif
diff --git a/lib/token.c b/lib/token.c
deleted file mode 100644
index b89f1fa..0000000
--- a/lib/token.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* token.c -- misc. access functions for mkid database tokens
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <config.h>
-#include "token.h"
-
-unsigned int
-tok_flags (char const *buf)
-{
- return *(unsigned char const *)&buf[strlen (buf) + 1];
-}
-
-#define TOK_COUNT_ADDR(buf) ((unsigned char const *)(TOK_FLAGS_ADDR (buf) + 1))
-#define TOK_HITS_ADDR(buf) ((unsigned char const *)(TOK_COUNT_ADDR (buf) + 2))
-
-unsigned short
-tok_count (char const *buf)
-{
- unsigned char const *flags = (unsigned char const *)&buf[strlen (buf) + 1];
- unsigned char const *addr = flags + 1;
- unsigned short count = *addr;
- if (*flags & TOK_SHORT_COUNT)
- count += (*++addr << 8);
- return count;
-}
-
-unsigned char const *
-tok_hits_addr (char const *buf)
-{
- unsigned char const *flags = (unsigned char const *)&buf[strlen (buf) + 1];
- unsigned char const *addr = flags + 2;
- if (*flags & TOK_SHORT_COUNT)
- addr++;
- return addr;
-}
diff --git a/lib/token.h b/lib/token.h
deleted file mode 100644
index 41c8e28..0000000
--- a/lib/token.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* token.h -- defs for interface to token.c
- Copyright (C) 1986, 1995, 1996 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#ifndef _token_h_
-#define _token_h_
-
-/* token flags (struct token is in mkid.c) */
-#define TOK_VECTOR 0x01 /* 1 = hits are stored as a vector
- 0 = hits are stored as a 8-way tree of bits
- mkid chooses whichever is more compact.
- vector is more compact for tokens with few hits */
-#define TOK_NUMBER 0x02 /* occurs as a number */
-#define TOK_NAME 0x04 /* occurs as a name */
-#define TOK_STRING 0x08 /* occurs in a string */
-#define TOK_LITERAL 0x10 /* occurs as a literal */
-#define TOK_COMMENT 0x20 /* occurs in a comment */
-#define TOK_UNUSED_1 0x40
-#define TOK_SHORT_COUNT 0x80 /* count is two bytes */
-
-#define tok_string(buf) (buf)
-unsigned int tok_flags __P((char const *buf));
-unsigned short tok_count __P((char const *buf));
-unsigned char const *tok_hits_addr __P((char const *buf));
-
-#endif /* not _token_h_ */
diff --git a/mkdirhier b/mkdirhier
deleted file mode 100755
index c835c95..0000000
--- a/mkdirhier
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/sh
-# $XConsortium: mkdirhier.sh,v 1.6 91/08/13 18:13:04 rws Exp $
-# Courtesy of Paul Eggert
-
-newline='
-'
-IFS=$newline
-
-case ${1--} in
--*) echo >&2 "mkdirhier: usage: mkdirhier directory ..."; exit 1
-esac
-
-status=
-
-for directory
-do
- case $directory in
- '')
- echo >&2 "mkdirhier: empty directory name"
- status=1
- continue;;
- *"$newline"*)
- echo >&2 "mkdirhier: directory name contains a newline: \`\`$directory''"
- status=1
- continue;;
- ///*) prefix=/;; # See Posix 2.3 "path".
- //*) prefix=//;;
- /*) prefix=/;;
- -*) prefix=./;;
- *) prefix=
- esac
-
- IFS=/
- set x $directory
- IFS=$newline
- shift
-
- for filename
- do
- path=$prefix$filename
- prefix=$path/
- shift
-
- test -d "$path" || {
- paths=$path
- for filename
- do
- if [ "$filename" != "." ]; then
- path=$path/$filename
- paths=$paths$newline$path
- fi
- done
-
- mkdir $paths || status=$?
-
- break
- }
- done
- done
-
-exit $status
diff --git a/src/idx.c b/src/idx.c
deleted file mode 100644
index 0da0d18..0000000
--- a/src/idx.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* idx.c -- simple interface for testing scanners scanners
- Copyright (C) 1986, 1995, 1996, 1999 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-
-#include <stdio.h>
-#include <string.h>
-#include <getopt.h>
-
-#include <config.h>
-#include "alloc.h"
-#include "system.h"
-#include "misc.h"
-#include "filenames.h"
-#include "scanners.h"
-#include "idfile.h"
-#include "pathmax.h"
-
-void scan_files __P((struct idhead *idhp));
-void scan_member_file __P((struct member_file const *member));
-
-char const *program_name;
-char *lang_map_file_name = 0;
-int show_version = 0;
-int show_help = 0;
-struct idhead idh;
-
-void
-usage (void)
-{
- fprintf (stderr, _("Try `%s --help' for more information.\n"),
- program_name);
- exit (1);
-}
-
-static struct option const long_options[] =
-{
- { "lang-map", required_argument, 0, 'm' },
- { "help", no_argument, &show_help, 1 },
- { "version", no_argument, &show_version, 1 },
- { 0 }
-};
-
-static void
-help_me (void)
-{
- printf (_("\
-Usage: %s [OPTION]... [FILE]...\n"),
- program_name);
-
- printf (_("\
-Print all tokens found in a source file.\n\
- -m, --lang-map=FILE use FILE to file names onto source language\n\
- --help display this help and exit\n\
- --version output version information and exit\n\
-\n\
-The following arguments apply to the language-specific scanners:\n\
-"));
- language_help_me ();
- exit (0);
-}
-
-int
-main (int argc, char **argv)
-{
- char *arg;
-
- program_name = argv[0];
- for (;;)
- {
- int optc = getopt_long (argc, argv, "o:f:i:x:l:m:uvs",
- long_options, (int *) 0);
- if (optc < 0)
- break;
- switch (optc)
- {
- case 0:
- break;
-
- case 'm':
- lang_map_file_name = optarg;
- break;
-
- default:
- usage ();
- }
- }
-
- if (show_version)
- {
- printf ("%s - %s\n", program_name, PACKAGE_VERSION);
- exit (0);
- }
-
- if (show_help)
- help_me ();
-
- argc -= optind;
- argv += optind;
-
- init_idh_obstacks (&idh);
- init_idh_tables (&idh);
- parse_language_map (lang_map_file_name);
- {
- struct file_link *cwd_link = get_current_dir_link ();
- while (argc--)
- walk_flink (parse_file_name (*argv++, cwd_link), 0);
- mark_member_file_links (&idh);
- obstack_init (&tokens_obstack);
- scan_files (&idh);
- }
-
- return 0;
-}
-
-void
-scan_files (struct idhead *idhp)
-{
- struct member_file **members_0
- = (struct member_file **) hash_dump (&idhp->idh_member_file_table,
- 0, member_file_qsort_compare);
- struct member_file **end = &members_0[idhp->idh_member_file_table.ht_fill];
- struct member_file **members;
-
- for (members = members_0; members < end; members++)
- scan_member_file (*members);
- free (members_0);
-}
-
-void
-scan_member_file (struct member_file const *member)
-{
- struct lang_args const *lang_args = member->mf_lang_args;
- struct language const *lang = lang_args->la_language;
- get_token_func_t get_token = lang->lg_get_token;
- struct file_link *flink = member->mf_link;
- FILE *source_FILE;
- size_t bytes;
-
- chdir_to_link (flink->fl_parent);
- source_FILE = open_source_FILE (flink->fl_name);
- if (source_FILE)
- {
- void const *args = lang_args->la_args_digested;
- int flags;
- struct token *token;
-
- while ((token = (*get_token) (source_FILE, args, &flags)) != NULL)
- {
- puts (TOKEN_NAME (token));
- obstack_free (&tokens_obstack, token);
- }
- close_source_FILE (source_FILE);
- }
-}
diff --git a/src/pid b/src/pid
deleted file mode 100644
index 7d2c79c..0000000
--- a/src/pid
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-lid -E "$@"
diff --git a/strerror.c b/strerror.c
deleted file mode 100644
index dcdd010..0000000
--- a/strerror.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* strerror.c -- convert errno value into a string
- Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-char *
-strerror __P((int errnum))
-{
- extern char *sys_errlist[];
- extern int sys_nerr;
-
- if (errnum > 0 && errnum < sys_nerr)
- return sys_errlist[errnum];
- return "Unknown system error";
-}