Message-Id: Date: Wed, 13 May 98 16:32:53 MET DST From: Michel de Ruiter To: friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu cc: djgpp-workers AT delorie DOT com, dj AT delorie DOT com Subject: Changes to doschk-1.1 Precedence: bulk Dear sir, I noticed doschk-1.1 on the gnu ftp-archive, and thought it would be very useful in porting packages to DOS. But, I found problems with some checks done by doschk so I made enhancements/changes to make it work. Also, I added some missing install-sh and converted spaces to tabs in the changelog (the way Emacs likes it). Following this is the diff against the original distribution. Hope it helps. -- Groeten, Michel. http://www.cs.vu.nl/~mdruiter ____________ \ /====\ / "You know, Beavis, you need things that suck, \/ \/ to have things that are cool", Butt-Head. diff -drpPC3 old/changelog doschk-1.1/changelog *** old/changelog Fri May 21 21:14:22 1993 --- doschk-1.1/changelog Tue May 12 14:56:48 1998 *************** *** 1,48 **** ! Fri May 21 15:14:18 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * Version 1.1 released. ! Tue Apr 20 17:46:42 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * doschk.c: Remove all includes for alloc.h or malloc.h. Instead ! just declare `extern char *malloc()'. ! configure.in: Remove check for malloc.h. ! Fri Apr 16 21:06:13 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * README: include bug reporting address. ! * doschk.c (dos_special_names): New global variable. ! (display_problems): Use it to check for special DOS device names. ! Ignore trailing dot when checking for names which will resolve to ! identical names under DOS. ! Change printf format from %14s to %-14s. ! * doschk.c (alloc_ent): Ignore trailing periods. ! Check for `:' in filenames. ! * doschk.c (mpath): Increase size of buf to 1024. ! Wed Apr 14 17:01:07 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * configure.in: Check for malloc.h. ! doschk.c [!__MSDOS__]: Don't include malloc.h unless HAVE_MALLOC_H ! is defined. ! Tue Apr 13 12:31:25 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * Version 1.0 released. ! * COPYING, README, Makefile.in, configure.in: New files. ! * doschk.c: Inserted copyright notice and usage in comments. ! Reformatted through `indent -gnu'. ! * doschk.c (xmalloc): New function. ! (alloc_end, fill_ent, display_problems): Use it instead of malloc. ! * doschk.c (fill_ent): If ent->path is allocated 0 bytes, reassign ! pointer to fixed string instead of setting first byte to '\0'. ! * doschk.c (main): Return 0. --- 1,53 ---- ! Tue May 12 02:51:50 MET DST 1998 Michel de Ruiter (mdruiter AT cs DOT vu DOT nl) ! * doschk.c (display_problems): Fixed check for special DOS device ! names with dot, and fixed check for "names are equal except for ! trailing dot". ! Fri May 21 15:14:18 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * Version 1.1 released. ! Tue Apr 20 17:46:42 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * doschk.c: Remove all includes for alloc.h or malloc.h. Instead ! just declare `extern char *malloc()'. ! configure.in: Remove check for malloc.h. ! Fri Apr 16 21:06:13 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * README: include bug reporting address. ! * doschk.c (dos_special_names): New global variable. ! (display_problems): Use it to check for special DOS device names. ! Ignore trailing dot when checking for names which will resolve to ! identical names under DOS. ! Change printf format from %14s to %-14s. ! * doschk.c (alloc_ent): Ignore trailing periods. ! Check for `:' in filenames. ! * doschk.c (mpath): Increase size of buf to 1024. ! Wed Apr 14 17:01:07 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * configure.in: Check for malloc.h. ! doschk.c [!__MSDOS__]: Don't include malloc.h unless HAVE_MALLOC_H ! is defined. ! Tue Apr 13 12:31:25 1993 Noah Friedman (friedman AT nutrimat DOT gnu DOT ai DOT mit DOT edu) ! * Version 1.0 released. ! * COPYING, README, Makefile.in, configure.in: New files. ! * doschk.c: Inserted copyright notice and usage in comments. ! Reformatted through `indent -gnu'. ! * doschk.c (xmalloc): New function. ! (alloc_end, fill_ent, display_problems): Use it instead of malloc. + * doschk.c (fill_ent): If ent->path is allocated 0 bytes, reassign + pointer to fixed string instead of setting first byte to '\0'. + + * doschk.c (main): Return 0. diff -drpPC3 old/doschk.c doschk-1.1/doschk.c *** old/doschk.c Tue Apr 20 23:46:22 1993 --- doschk-1.1/doschk.c Tue May 12 02:51:36 1998 *************** *** 51,56 **** --- 51,57 ---- #include #include #include + #include extern char *malloc (); *************** typedef struct ENT *** 68,93 **** * Not all of these are problems on all MSLOSS systems, but most would not * work on most of them. */ ! static char *dos_special_names[] = { ! "NUL", ! "CON", ! "PRN", ! "AUX", ! "COM1", ! "COM2", ! "COM3", ! "COM4", ! "LPT1", ! "LPT2", ! "LPT3", ! "MS$MOUSE", ! "EMMXXXX0", ! "XMSXXXX0", ! "SMARTAAR", ! "SETVERXX", ! NULL ! } ; ENT *eroot = 0; --- 69,99 ---- * Not all of these are problems on all MSLOSS systems, but most would not * work on most of them. */ ! struct special_name { ! char* name; ! size_t len; ! }; ! ! static struct special_name dos_special_names[] = { ! {"NUL", 3}, ! {"CON", 3}, ! {"PRN", 3}, ! {"AUX", 3}, ! {"COM1", 4}, ! {"COM2", 4}, ! {"COM3", 4}, ! {"COM4", 4}, ! {"LPT1", 4}, ! {"LPT2", 4}, ! {"LPT3", 4}, ! {"MS$MOUSE", 8}, ! {"EMMXXXX0", 8}, ! {"XMSXXXX0", 8}, ! {"SMARTAAR", 8}, ! {"SETVERXX", 8}, ! { NULL, 0} ! }; ENT *eroot = 0; *************** invalid_msg () *** 114,120 **** char * xmalloc (size) ! int size; { char *s; --- 120,126 ---- char * xmalloc (size) ! size_t size; { char *s; *************** display_problems () *** 323,329 **** { ENT **elist, *ent; int ecount, i, first, first_err; ! char **dos_dev_name; for (ecount = 0, ent = eroot; ent; ent = ent->next, ecount++); elist = (ENT **) xmalloc (sizeof (ENT *) * ecount); --- 329,335 ---- { ENT **elist, *ent; int ecount, i, first, first_err; ! struct special_name *dos_dev_name; for (ecount = 0, ent = eroot; ent; ent = ent->next, ecount++); elist = (ENT **) xmalloc (sizeof (ENT *) * ecount); *************** display_problems () *** 335,348 **** first_err = 1; for (i = 0; i < ecount; i++) { - int elist_len = strlen (elist[i]->dos_name); - dos_dev_name = dos_special_names; ! while (*dos_dev_name) { ! if ((strcmp (elist[i]->dos_name, *dos_dev_name) == 0) ! || ((*(elist[i]->dos_name + elist_len - 1) == '.') ! && (strncmp (elist[i]->dos_name, *dos_dev_name, elist_len - 2) == 0))) { if (first_err) { --- 341,354 ---- first_err = 1; for (i = 0; i < ecount; i++) { dos_dev_name = dos_special_names; ! while (dos_dev_name->name) { ! /* "con" or "con.*" */ ! if ((strcmp (elist[i]->dos_name, dos_dev_name->name) == 0) ! || ((*(elist[i]->dos_name + dos_dev_name->len) == '.') ! && (strncmp (elist[i]->dos_name, dos_dev_name->name, ! dos_dev_name->len) == 0))) { if (first_err) { *************** display_problems () *** 366,375 **** { int elist1_len = strlen (elist[i + 1]->dos_name); ! if (((strcmp (elist[i]->dos_name, elist[i + 1]->dos_name) == 0) ! && (strcmp (elist[i]->path, elist[i + 1]->path) == 0)) ! || ((*(elist[i + 1]->dos_name + elist1_len - 1) == '.') ! && (strncmp (elist[i]->dos_name, elist[i + 1]->dos_name, elist1_len - 2) == 0))) { if (first_err) { --- 372,385 ---- { int elist1_len = strlen (elist[i + 1]->dos_name); ! if ((strcmp (elist[i]->path, elist[i + 1]->path) == 0) ! /* "name" and "Name" */ ! && ((strcmp (elist[i]->dos_name, elist[i + 1]->dos_name) == 0) ! /* or "name" and "name." */ ! || ((*(elist[i + 1]->dos_name + elist1_len - 1) == '.') ! && (strncmp (elist[i]->dos_name, elist[i + 1]->dos_name, ! elist1_len - 1) == 0) ! && (*(elist[i]->dos_name + elist1_len - 1) == '\0')))) { if (first_err) { *************** display_problems () *** 445,450 **** --- 455,461 ---- * Main entry point * \****************************************************************/ + int main (argc, argv) int argc; char **argv; diff -drpPC3 old/install-sh doschk-1.1/install-sh *** old/install-sh Thu Jan 1 01:00:00 1970 --- doschk-1.1/install-sh Tue May 12 02:36:56 1998 *************** *** 0 **** --- 1,250 ---- + #! /bin/sh + # + # install - install a program, script, or datafile + # This comes from X11R5 (mit/util/scripts/install.sh). + # + # Copyright 1991 by the Massachusetts Institute of Technology + # + # Permission to use, copy, modify, distribute, and sell this software and its + # documentation for any purpose is hereby granted without fee, provided that + # the above copyright notice appear in all copies and that both that + # copyright notice and this permission notice appear in supporting + # documentation, and that the name of M.I.T. not be used in advertising or + # publicity pertaining to distribution of the software without specific, + # written prior permission. M.I.T. makes no representations about the + # suitability of this software for any purpose. It is provided "as is" + # without express or implied warranty. + # + # Calling this script install-sh is preferred over install.sh, to prevent + # `make' implicit rules from creating a file called install from it + # when there is no Makefile. + # + # This script is compatible with the BSD install script, but was written + # from scratch. + # + + + # set DOITPROG to echo to test this script + + # Don't use :- since 4.3BSD and earlier shells don't like it. + doit="${DOITPROG-}" + + + # put in absolute paths if you don't have them in your path; or use env. vars. + + mvprog="${MVPROG-mv}" + cpprog="${CPPROG-cp}" + chmodprog="${CHMODPROG-chmod}" + chownprog="${CHOWNPROG-chown}" + chgrpprog="${CHGRPPROG-chgrp}" + stripprog="${STRIPPROG-strip}" + rmprog="${RMPROG-rm}" + mkdirprog="${MKDIRPROG-mkdir}" + + transformbasename="" + transform_arg="" + instcmd="$mvprog" + chmodcmd="$chmodprog 0755" + chowncmd="" + chgrpcmd="" + stripcmd="" + rmcmd="$rmprog -f" + mvcmd="$mvprog" + src="" + dst="" + dir_arg="" + + while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac + done + + if [ x"$src" = x ] + then + echo "install: no input file specified" + exit 1 + else + true + fi + + if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi + else + + # Waiting for this to be detected by the "$instcmd $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + + # If destination is a directory, append the input filename; if your system + # does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi + fi + + ## this sed command emulates the dirname command + dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + # this part is taken from Noah Friedman's mkinstalldirs script + + # Skip lots of stat calls in the usual case. + if [ ! -d "$dstdir" ]; then + defaultIFS=' + ' + IFS="${IFS-${defaultIFS}}" + + oIFS="${IFS}" + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` + IFS="${oIFS}" + + pathcomp='' + + while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" + done + fi + + if [ x"$dir_arg" != x ] + then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + else + + # If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + + # don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + + # Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + + # Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + + # and set any options; do chmod last to preserve setuid bits + + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + + # Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + + fi && + + + exit 0 diff -drpPC3 old/makefile.in doschk-1.1/makefile.in *** old/makefile.in Fri May 21 21:14:08 1993 --- doschk-1.1/makefile.in Tue May 12 02:38:28 1998 *************** INSTALL_DATA = @INSTALL_DATA@ *** 29,38 **** DEFS = @DEFS@ LIBS = @LIBS@ ! CFLAGS = -g ! LDFLAGS = -g ! prefix = /usr/local exec_prefix = $(prefix) bindir = $(exec_prefix)/bin --- 29,38 ---- DEFS = @DEFS@ LIBS = @LIBS@ ! CFLAGS = -O ! LDFLAGS = ! prefix = @prefix@ exec_prefix = $(prefix) bindir = $(exec_prefix)/bin