summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog23
-rw-r--r--Makefile.in2
-rw-r--r--README.alpha-test15
-rw-r--r--acconfig.h26
-rw-r--r--config.h.in45
-rwxr-xr-xconfigure209
-rw-r--r--configure.in11
-rw-r--r--filenames.c7
-rw-r--r--idfile.c41
-rw-r--r--idfile.h27
-rw-r--r--iid.c6
-rw-r--r--iid.y6
-rw-r--r--lid.c8
-rw-r--r--mkid.c3
-rw-r--r--stamp-h.in2
15 files changed, 360 insertions, 71 deletions
diff --git a/ChangeLog b/ChangeLog
index cf4f72d..e186f18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,18 +1,33 @@
-Thu Feb 16 18:32:44 EST 1995 Greg McGary <gkm@magilla.cichlid.com>
+Thu Feb 16 23:55:44 EST 1995 Greg McGary <gkm@magilla.cichlid.com>
- * Version 3.0.3 released.
+ * Version 3.0.5 released.
+
+ * iid.y (main): Eliminate useless Do1 variable.
+
+ * filenames.c (kshgetwd): Conditionally getcwd or getwd.
+
+ * acconfig.h: Added typedefs of uint8_t, uint16_t, uint32_t,
+ int32_t.
+
+ * idfile.c (io_read, io_write): Use uint8_t, uint16_t, uint32_t,
+ int32_t.
+
+ * idfile.h (struct idhead): Use uint8_t, uint16_t, uint32_t,
+ int32_t.
* README.alpha-test: Added.
* TODO: Updated.
* lid.c (savetty, restoretty, linetty, chartty): Handle POSIX
- termios properly.
+ termios properly. (HAVE_SYS_IOCTL_H): #include <sys/ioctl.h> if
+ !HAVE_TERMIOS_H.
* README: Updated.
* configure.in (OLD_PATCH_LEVEL, MAJOR_VERSION, MINOR_VERSION,
- FULL_VERSION): Added.
+ FULL_VERSION, AC_CHECK_SIZEOF(int, long, short, char),
+ AC_CHECK_HEADERS(regex.h), AC_CHECK_FUNCS(regcomp regcmp): Added.
* mkdirhier: Added.
diff --git a/Makefile.in b/Makefile.in
index 55f99b6..6777086 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -238,7 +238,7 @@ $(DIST_TGZ): $(DIST_DIR)
dist-dir: $(DIST_DIR)
dist-dir-links: $(OLD_DIST_DIR) $(DIST_DIR)
- cd $(DIST_DIR); \
+ @cd $(DIST_DIR); \
for file in $(DIST_FILES); do \
if cmp -s $$file ../$(OLD_DIST_DIR)/$$file; then \
rm -f $$file; \
diff --git a/README.alpha-test b/README.alpha-test
index 1f9bd31..d91ee9d 100644
--- a/README.alpha-test
+++ b/README.alpha-test
@@ -20,12 +20,21 @@ Special instructions for alpha testers:
# put things in /usr/{bin,lib,info}
./configure --prefix /usr; make install
- The ID file format is incompatible with mkid2, so you'll have to rebuild
- your ID files. You should notice that the new mkid is faster.
+ If you have the time, patience and software, please build using both your
+ vendor-supplied compiler and gcc. By default, configure will use gcc if
+ it is available. You can override this by doing this:
+
+ rm config.cache
+ CC=vendor-supplied-cc ./configure # bourne-shell syntax
+ -or-
+ setenv CC vendor-supplied-cc; ./configure # csh syntax
+
* If you run into build problems, please help by emailing me the following:
* A brilliant, elegant patch to fix it. ;-)
-- or, if you don't have time for that... --
+ * The version of mkid you're trying to build
+ (type ./mkid to get the usage banner which includes the version)
* The output of "make -k all", to show me where it's dying.
* The output of "uname -a"
* The output of "nm" on your system's libc.
@@ -36,6 +45,8 @@ Special instructions for alpha testers:
* Be aware that this is still work in progress. See TODO for a list of
things yet undone.
+* Note that ID file format is incompatible with mkid2, so you'll have to
+ rebuild your ID files. You should notice that the new mkid is faster.
Local Variables:
mode: text
diff --git a/acconfig.h b/acconfig.h
index acd8947..c7e989e 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -28,3 +28,29 @@
/* Define to filename of iid help text. */
#undef IID_HELP_FILE
+
+@BOTTOM@
+
+#if SIZEOF_LONG == 4
+typedef unsigned long uint32_t;
+typedef long int32_t;
+#else /* SIZEOF_LONG != 4 */
+#if SIZEOF_INT == 4
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#else /* SIZEOF_INT != 4 */
+#error "Your system is weird. What integer has sizeof () == 4 ???"
+#endif /* SIZEOF_INT != 4 */
+#endif /* SIZEOF_LONG != 4 */
+
+#if SIZEOF_SHORT == 2
+typedef unsigned short uint16_t;
+#else
+#error "Your system is weird. sizeof (short) != 2"
+#endif
+
+#if SIZEOF_CHAR == 1
+typedef unsigned char uint8_t;
+#else
+#error "Your system is weird. sizeof (char) != 1"
+#endif
diff --git a/config.h.in b/config.h.in
index 60d663a..84e4b65 100644
--- a/config.h.in
+++ b/config.h.in
@@ -64,6 +64,18 @@
/* Define to filename of iid help text. */
#undef IID_HELP_FILE
+/* The number of bytes in a char. */
+#undef SIZEOF_CHAR
+
+/* The number of bytes in a int. */
+#undef SIZEOF_INT
+
+/* The number of bytes in a long. */
+#undef SIZEOF_LONG
+
+/* The number of bytes in a short. */
+#undef SIZEOF_SHORT
+
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
@@ -88,6 +100,12 @@
/* Define if you have the re_comp function. */
#undef HAVE_RE_COMP
+/* Define if you have the regcmp function. */
+#undef HAVE_REGCMP
+
+/* Define if you have the regcomp function. */
+#undef HAVE_REGCOMP
+
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
@@ -121,6 +139,9 @@
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
/* Define if you have the <sgttyb.h> header file. */
#undef HAVE_SGTTYB_H
@@ -153,3 +174,27 @@
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+
+#if SIZEOF_LONG == 4
+typedef unsigned long uint32_t;
+typedef long int32_t;
+#else /* SIZEOF_LONG != 4 */
+#if SIZEOF_INT == 4
+typedef unsigned int uint32_t;
+typedef int int32_t;
+#else /* SIZEOF_INT != 4 */
+#error "Your system is weird. What integer has sizeof () == 4 ???"
+#endif /* SIZEOF_INT != 4 */
+#endif /* SIZEOF_LONG != 4 */
+
+#if SIZEOF_SHORT == 2
+typedef unsigned short uint16_t;
+#else
+#error "Your system is weird. sizeof (short) != 2"
+#endif
+
+#if SIZEOF_CHAR == 1
+typedef unsigned char uint8_t;
+#else
+#error "Your system is weird. sizeof (char) != 1"
+#endif
diff --git a/configure b/configure
index 37555b9..b86b7a2 100755
--- a/configure
+++ b/configure
@@ -402,7 +402,7 @@ fi
PRODUCT=mkid
MAJOR_VERSION=3
MINOR_VERSION=0
-PATCH_LEVEL=4
+PATCH_LEVEL=5
OLD_PATCH_LEVEL=`expr $PATCH_LEVEL - 1`
VERSION=$MAJOR_VERSION.$MINOR_VERSION
FULL_VERSION=$VERSION.$PATCH_LEVEL
@@ -525,7 +525,7 @@ if eval "test \"`echo '${'ac_cv_prog_gcc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+if test -z "`${CC-cc} -g -c conftest.c 2>&1 |grep -v warning:`"; then
ac_cv_prog_gcc_g=yes
else
ac_cv_prog_gcc_g=no
@@ -947,7 +947,7 @@ else
fi
done
-for ac_hdr in sys/ioctl.h termios.h termio.h sgttyb.h
+for ac_hdr in sys/ioctl.h termios.h termio.h sgttyb.h regex.h
do
ac_safe=`echo "$ac_hdr" | tr './\055' '___'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&4
@@ -1214,6 +1214,134 @@ EOF
fi
+echo $ac_n "checking size of int""... $ac_c" 1>&4
+if eval "test \"`echo '${'ac_cv_sizeof_int'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&4
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1226 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(int));
+ exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ ac_cv_sizeof_int=`cat conftestval`
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_int" 1>&4
+cat >> confdefs.h <<EOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+EOF
+
+
+echo $ac_n "checking size of long""... $ac_c" 1>&4
+if eval "test \"`echo '${'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&4
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1258 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long));
+ exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ ac_cv_sizeof_long=`cat conftestval`
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&4
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+echo $ac_n "checking size of short""... $ac_c" 1>&4
+if eval "test \"`echo '${'ac_cv_sizeof_short'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&4
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1290 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(short));
+ exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ ac_cv_sizeof_short=`cat conftestval`
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_short" 1>&4
+cat >> confdefs.h <<EOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+EOF
+
+
+echo $ac_n "checking size of char""... $ac_c" 1>&4
+if eval "test \"`echo '${'ac_cv_sizeof_char'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&4
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+cat > conftest.$ac_ext <<EOF
+#line 1322 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(char));
+ exit(0);
+}
+EOF
+eval $ac_link
+if test -s conftest && (./conftest; exit) 2>/dev/null; then
+ ac_cv_sizeof_char=`cat conftestval`
+fi
+fi
+rm -fr conftest*
+fi
+echo "$ac_t""$ac_cv_sizeof_char" 1>&4
+cat >> confdefs.h <<EOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+EOF
+
+
CFLAGS=${CFLAGS--g}
LDFLAGS=${LDFLAGS--g}
@@ -1227,7 +1355,7 @@ if eval "test \"`echo '${'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 1231 "configure"
+#line 1359 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -1245,7 +1373,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 1249 "configure"
+#line 1377 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -1265,14 +1393,14 @@ fi
fi
fi
-for ac_func in getwd getcwd getopt_long re_comp
+for ac_func in getwd getcwd getopt_long
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1276 "configure"
+#line 1404 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1321,7 +1449,7 @@ if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1325 "configure"
+#line 1453 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1370,7 +1498,56 @@ if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1374 "configure"
+#line 1502 "configure"
+#include "confdefs.h"
+#include <ctype.h> /* Arbitrary system header to define __stub macros. */
+/* Override any gcc2 internal prototype to avoid an error. */
+char $ac_func();
+
+int main() { return 0; }
+int t() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if eval $ac_link; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+
+fi
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&4
+ ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&4
+fi
+done
+
+for ac_func in regcomp regcmp re_comp
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&4
+if eval "test \"`echo '${'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&4
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1551 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1419,7 +1596,7 @@ if eval "test \"`echo '${'ac_cv_header_alloca_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1423 "configure"
+#line 1600 "configure"
#include "confdefs.h"
#include <alloca.h>
int main() { return 0; }
@@ -1450,7 +1627,7 @@ if eval "test \"`echo '${'ac_cv_func_alloca'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1454 "configure"
+#line 1631 "configure"
#include "confdefs.h"
#ifdef __GNUC__
@@ -1508,7 +1685,7 @@ if eval "test \"`echo '${'ac_cv_os_cray'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1512 "configure"
+#line 1689 "configure"
#include "confdefs.h"
#if defined(CRAY) && ! defined(CRAY2)
webecray
@@ -1535,7 +1712,7 @@ if eval "test \"`echo '${'ac_cv_func__getb67'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1539 "configure"
+#line 1716 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1578,7 +1755,7 @@ if eval "test \"`echo '${'ac_cv_func_GETB67'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1582 "configure"
+#line 1759 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1621,7 +1798,7 @@ if eval "test \"`echo '${'ac_cv_func_getb67'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&4
else
cat > conftest.$ac_ext <<EOF
-#line 1625 "configure"
+#line 1802 "configure"
#include "confdefs.h"
#include <ctype.h> /* Arbitrary system header to define __stub macros. */
/* Override any gcc2 internal prototype to avoid an error. */
@@ -1675,7 +1852,7 @@ else
ac_cv_c_stack_direction=0
else
cat > conftest.$ac_ext <<EOF
-#line 1679 "configure"
+#line 1856 "configure"
#include "confdefs.h"
find_stack_direction ()
{
diff --git a/configure.in b/configure.in
index c353487..f563f09 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,7 @@ AC_CONFIG_HEADER(config.h)
PRODUCT=mkid
MAJOR_VERSION=3
MINOR_VERSION=0
-PATCH_LEVEL=4
+PATCH_LEVEL=5
OLD_PATCH_LEVEL=`expr $PATCH_LEVEL - 1`
VERSION=$MAJOR_VERSION.$MINOR_VERSION
FULL_VERSION=$VERSION.$PATCH_LEVEL
@@ -39,7 +39,7 @@ AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h stddef.h sys/types.h sys/stat.h sys/param.h)
AC_CHECK_HEADERS(stdlib.h unistd.h string.h malloc.h memory.h assert.h ctype.h errno.h)
-AC_CHECK_HEADERS(sys/ioctl.h termios.h termio.h sgttyb.h)
+AC_CHECK_HEADERS(sys/ioctl.h termios.h termio.h sgttyb.h regex.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -47,6 +47,10 @@ fp_C_PROTOTYPES
AC_TYPE_SIGNAL
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(char)
CFLAGS=${CFLAGS--g}
LDFLAGS=${LDFLAGS--g}
@@ -55,9 +59,10 @@ AC_SUBST(LDFLAGS)
dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
-AC_CHECK_FUNCS(getwd getcwd getopt_long re_comp)
+AC_CHECK_FUNCS(getwd getcwd getopt_long)
AC_CHECK_FUNCS(strdup strchr strrchr strcasecmp strerror)
AC_CHECK_FUNCS(memcpy bcopy memset bzero)
+AC_CHECK_FUNCS(regcomp regcmp re_comp)
AC_FUNC_ALLOCA
AC_SUBST(ALLOCA)
if test "$ac_cv_func_re_comp" = no; then REGEXP="regex.o"; fi
diff --git a/filenames.c b/filenames.c
index 9a766ac..0b288d7 100644
--- a/filenames.c
+++ b/filenames.c
@@ -471,8 +471,15 @@ kshgetwd (char *pathname)
/* By golly, that name is the same file as "." ! */
return strcpy (pathname, kshname);
}
+
/* Oh well, something did not work out right, do it the hard way */
+#if HAVE_GETCWD
+ return getcwd (pathname, BUFSIZ);
+#else
+#if HAVE_GETWD
return getwd (pathname);
+#endif
+#endif
}
/* unsymlink is a routine that resolves all symbolic links in
diff --git a/idfile.c b/idfile.c
index f759634..a7ccb65 100644
--- a/idfile.c
+++ b/idfile.c
@@ -48,7 +48,7 @@ init_idfile (char const *id_file, struct idhead *idh, struct idarg **id_args)
return NULL;
read_idhead (id_FILE, idh);
- if (!strnequ (idh->idh_magic, IDH_MAGIC, sizeof (idh->idh_magic)))
+ if (idh->idh_magic[0] != IDH_MAGIC_0 || idh->idh_magic[1] != IDH_MAGIC_1)
{
fprintf (stderr, "%s: Not an id file: `%s'\n", program_name, id_file);
exit (1);
@@ -111,15 +111,18 @@ io_read (FILE *input_FILE, void *addr, unsigned int size, int is_int)
{
switch (size)
{
- case sizeof (long):
- *(long *)addr = getc (input_FILE);
- *(long *)addr += getc (input_FILE) << 010;
- *(long *)addr += getc (input_FILE) << 020;
- *(long *)addr += getc (input_FILE) << 030;
+ case sizeof (uint32_t):
+ *(uint32_t *)addr = getc (input_FILE);
+ *(uint32_t *)addr += getc (input_FILE) << 010;
+ *(uint32_t *)addr += getc (input_FILE) << 020;
+ *(uint32_t *)addr += getc (input_FILE) << 030;
break;
- case sizeof (short):
- *(short *)addr = getc (input_FILE);
- *(short *)addr += getc (input_FILE) << 010;
+ case sizeof (uint16_t):
+ *(uint16_t *)addr = getc (input_FILE);
+ *(uint16_t *)addr += getc (input_FILE) << 010;
+ break;
+ case sizeof (uint8_t):
+ *(uint8_t *)addr = getc (input_FILE);
break;
default:
fprintf (stderr, "Unsupported size in io_write (): %d\n", size);
@@ -140,15 +143,18 @@ io_write (FILE *output_FILE, void *addr, unsigned int size, int is_int)
{
switch (size)
{
- case sizeof (long):
- putc (*(long *)addr, output_FILE);
- putc (*(long *)addr >> 010, output_FILE);
- putc (*(long *)addr >> 020, output_FILE);
- putc (*(long *)addr >> 030, output_FILE);
+ case sizeof (uint32_t):
+ putc (*(uint32_t *)addr, output_FILE);
+ putc (*(uint32_t *)addr >> 010, output_FILE);
+ putc (*(uint32_t *)addr >> 020, output_FILE);
+ putc (*(uint32_t *)addr >> 030, output_FILE);
+ break;
+ case sizeof (uint16_t):
+ putc (*(uint16_t *)addr, output_FILE);
+ putc (*(uint16_t *)addr >> 010, output_FILE);
break;
- case sizeof (short):
- putc (*(short *)addr, output_FILE);
- putc (*(short *)addr >> 010, output_FILE);
+ case sizeof (uint8_t):
+ putc (*(uint8_t *)addr, output_FILE);
break;
default:
fprintf (stderr, "Unsupported size in io_write (): %d\n", size);
@@ -182,4 +188,3 @@ io_idhead (FILE *fp, int (*io) (FILE *, void *, unsigned int, int), struct idhea
size += io (fp, &idh->idh_end_offset, sizeof (idh->idh_end_offset), 1);
return size;
}
-
diff --git a/idfile.h b/idfile.h
index fe017e8..efe255c 100644
--- a/idfile.h
+++ b/idfile.h
@@ -26,21 +26,22 @@
struct idhead
{
- char idh_magic[2];
-#define IDH_MAGIC "\311\304" /* ("ID" with hi bits set) */
- char idh_pad_1;
- char idh_version;
+ uint8_t idh_magic[2];
+#define IDH_MAGIC_0 ('I'|0x80)
+#define IDH_MAGIC_1 ('D'|0x80)
+ uint8_t idh_pad_1;
+ uint8_t idh_version;
#define IDH_VERSION 3
- unsigned short idh_flags;
+ uint16_t short idh_flags;
#define IDH_COUNTS 0x0001 /* occurrence counts are included with each token */
- unsigned long idh_args; /* total # of args for mkid update */
- unsigned long idh_paths; /* total # of file names for mkid update */
- unsigned long idh_tokens; /* total # of tokens */
- unsigned long idh_buf_size; /* # of bytes in longest entry (bufsiz for lid) */
- unsigned long idh_vec_size; /* # of hits in longest entry (max vector size for lid) */
- off_t idh_args_offset; /* file offset of args */
- off_t idh_tokens_offset; /* file offset of tokens section */
- off_t idh_end_offset; /* file offset beyond tokens section */
+ uint32_t idh_args; /* total # of args for mkid update */
+ uint32_t idh_paths; /* total # of file names for mkid update */
+ uint32_t idh_tokens; /* total # of tokens */
+ uint32_t idh_buf_size; /* # of bytes in longest entry (bufsiz for lid) */
+ uint32_t idh_vec_size; /* # of hits in longest entry (max vector size for lid) */
+ int32_t idh_args_offset; /* file offset of args */
+ int32_t idh_tokens_offset; /* file offset of tokens section */
+ int32_t idh_end_offset; /* file offset beyond tokens section */
};
struct idarg;
diff --git a/iid.c b/iid.c
index 0238db7..5dee019 100644
--- a/iid.c
+++ b/iid.c
@@ -1596,9 +1596,8 @@ int
main( int argc , char * argv [ ] )
{
int c ; /* current option */
- char * CmdPtr ; /* Points to the command string */
+ char * CmdPtr = NULL ; /* Points to the command string */
char Command [ MAXCMD ] ; /* Buffer for reading commands */
- int Do1 = 0 ; /* 1 if should only do 1 command */
int DoPrompt ; /* 1 if should write a prompt */
int errors = 0 ; /* error count */
@@ -1610,7 +1609,6 @@ main( int argc , char * argv [ ] )
break ;
case 'c':
CmdPtr = optarg ;
- Do1 = 1 ;
break ;
case 'H':
fputs("\
@@ -1644,7 +1642,7 @@ To get help after starting program type 'help'.\n\
/* run the parser */
- if (Do1) {
+ if (CmdPtr) {
ScanInit(CmdPtr) ;
exit(yyparse()) ;
} else {
diff --git a/iid.y b/iid.y
index fc8d03e..dff6f79 100644
--- a/iid.y
+++ b/iid.y
@@ -629,9 +629,8 @@ int
main( int argc , char * argv [ ] )
{
int c ; /* current option */
- char * CmdPtr ; /* Points to the command string */
+ char * CmdPtr = NULL ; /* Points to the command string */
char Command [ MAXCMD ] ; /* Buffer for reading commands */
- int Do1 = 0 ; /* 1 if should only do 1 command */
int DoPrompt ; /* 1 if should write a prompt */
int errors = 0 ; /* error count */
@@ -643,7 +642,6 @@ main( int argc , char * argv [ ] )
break ;
case 'c':
CmdPtr = optarg ;
- Do1 = 1 ;
break ;
case 'H':
fputs("\
@@ -677,7 +675,7 @@ To get help after starting program type 'help'.\n\
/* run the parser */
- if (Do1) {
+ if (CmdPtr) {
ScanInit(CmdPtr) ;
exit(yyparse()) ;
} else {
diff --git a/lid.c b/lid.c
index 010a37e..b35b793 100644
--- a/lid.c
+++ b/lid.c
@@ -1275,10 +1275,6 @@ tree8_to_argv (unsigned char const *hits_tree8)
return bits_to_argv (tree8_to_bits (bits_vec, hits_tree8));
}
-#if HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
#if HAVE_TERMIOS_H
#include <termios.h>
@@ -1290,6 +1286,10 @@ struct termios savemode;
#else /* not HAVE_TERMIOS_H */
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
#if HAVE_TERMIO_H
#include <termio.h>
struct termio linemode;
diff --git a/mkid.c b/mkid.c
index e6880cd..551f969 100644
--- a/mkid.c
+++ b/mkid.c
@@ -560,7 +560,8 @@ write_idfile (char const *file_name, struct idarg *idarg)
filerr ("create", file_name);
exit (1);
}
- strncpy (idh.idh_magic, IDH_MAGIC, sizeof (idh.idh_magic));
+ idh.idh_magic[0] = IDH_MAGIC_0;
+ idh.idh_magic[1] = IDH_MAGIC_1;
idh.idh_version = IDH_VERSION;
idh.idh_pad_1 = 0;
idh.idh_flags = IDH_COUNTS;
diff --git a/stamp-h.in b/stamp-h.in
index aa6add2..a6c6159 100644
--- a/stamp-h.in
+++ b/stamp-h.in
@@ -1 +1 @@
-Thu Feb 16 18:27:22 EST 1995
+Thu Feb 16 23:40:14 EST 1995