$NetBSD: patch-aa,v 1.5 2010/01/03 14:30:37 schwarz Exp $ --- Crack.orig 1996-12-21 02:09:41.000000000 +0100 +++ Crack 2010-01-03 15:01:01.000000000 +0100 @@ -1,4 +1,4 @@ -#!/bin/sh +#!@@SH@@ ### # This program was written by and is copyright Alec Muffett 1991, # 1992, 1993, 1994, 1995, and 1996, and is provided as part of the @@ -12,8 +12,8 @@ # User-configurable junk for Crack ### -# nice, generic path (RedHat Linux, Solaris1, Solaris2) -CRACK_PATH=/usr/local/bin:/usr/ccs/bin:/usr/sbin:/sbin:/usr/bin:/bin:/usr/ucb:/usr/etc:$PATH +# Path for NetBSD +CRACK_PATH=${PATH}:/usr/local/bin:/bin:/usr/bin:/usr/sbin:/sbin:@@PREFIX@@/bin # compiler options for crack 5.0 # @@ -42,8 +42,8 @@ # # vanilla unix cc -CC=cc -CFLAGS="-g -O $C5FLAGS" +#CC=cc +CFLAGS="$CFLAGS $C5FLAGS" #LIBS=-lcrypt # uncomment only if necessary to use stdlib crypt(), eg: NetBSD MD5 # gcc 2.7.2 @@ -108,41 +108,11 @@ # home base ### -CRACK_HOME=`echo $0 | sed -e 's/Crack$//'` - -if [ "$CRACK_HOME" = "" ] -then - CRACK_HOME=. -fi - -if cd $CRACK_HOME -then - CRACK_HOME=`pwd` -else - echo "Fatal Error: $CRACK_HOME: cannot chdir" 1>&2 - exit 1 -fi - +PREFIX=@@PREFIX@@ +CRACK_HOME=${PREFIX}/share/crack export CRACK_HOME -### -# sanity check -### -if [ ! -f "$CRACK_HOME/Crack" ] -then - echo "Fatal Error: $CRACK_HOME: something weird going down" 1>&2 - exit 1 -fi - -### -# Hierarchy -### - -for dir in run run/bin -do - test -d $dir || mkdir $dir || exit 1 -done ### # Flagwaving @@ -279,110 +249,76 @@ # Sanity test bindir - written in gruntscript for clarity. ### -bdname=`scripts/binstamp 2>/dev/null` - -if [ "x$bdname" = "x" ] -then - echo "Crack: error: cannot continue as binstamp returned empty string" 1>&2 - exit 0 -fi - -echo "Stamp: $bdname" -echo "" +bindir=${PREFIX}/libexec/crack -if [ "x$1" != "x" ] -then - if [ "$1" = "-fmt" ] # use generic name - then - bindir=run/bin/$bdname - elif [ -d run/bin/$1 ] # have been here before - then - bindir=run/bin/$1 - shift - elif [ ! -f $1 ] # use specified name - then - bindir=run/bin/$1 - shift - else # use generic name - bindir=run/bin/$bdname - fi -else # supporting "-makeonly" - if [ "$makeonlyflag" != "" ] - then - bindir=run/bin/$bdname - - elif [ "$makedictflag" != "" ] - then - bindir=run/bin/$bdname - - elif [ "$remoteflag" != "" ] - then - bindir=run/bin/$bdname - else - echo $usage 1>&2 - exit 1 - fi -fi - ### # Reset PATH in advance ### -PATH=$CRACK_HOME/scripts:$CRACK_HOME/$bindir:$PATH +PATH=$CRACK_HOME/scripts:${bindir}:$PATH export PATH ### # Make the binaries ### -echo "Crack: making utilities in $bindir" - -if [ ! -d $bindir ] # small redundancy, big benefit -then - mkdir $bindir || exit 1 -fi - -make clean || exit 1 - -make ARGS="\"XDIR=../../$bindir\" \"XCFLAGS=$CFLAGS\" \"XCC=$CC\" \"XLIBS=$LIBS\"" utils || exit 1 - ### # Make Only ? ### if [ "x$makeonlyflag" != "x" ] then + echo "Crack: making utilities in run/bin" + + if [ ! -d run/bin ] # small redundancy, big benefit + then + mkdir -p run/bin || exit 1 + fi + PATH=${PATH}:`pwd`/scripts + export PATH + make clean || exit 1 + + make ARGS="\"XDIR=../../run/bin\" \"XCFLAGS=$CFLAGS\" \"XCC=$CC\" \"XLIBS=$LIBS\"" utils || exit 1 + echo "Crack: makeonly done" exit 0 fi ### +# All but makeonly has to be run in $CRACK_HOME +### +if ! cd $CRACK_HOME; then + echo "Fatal Error: $CRACK_HOME: cannot chdir" 1>&2 + exit 1 +fi + +### # Make the dictionary passes ### dp=run/dict dplf=$dp/.dictmade -if [ ! -f $dplf ] -then - test -d $dp && rm -rf $dp - - echo "Crack: making dictionary groups, please be patient..." - mkdictgrps $dp || exit 1 - - echo "Crack: Created new dictionaries..." - date > $dplf -else - echo "Crack: The dictionaries seem up to date..." -fi - ### # Make Dict Only ? ### if [ "x$makedictflag" != "x" ] then + if [ ! -f $dplf ] + then + test -d $dp && rm -rf $dp + + echo "Crack: making dictionary groups, please be patient..." + mkdictgrps $dp || exit 1 + + echo "Crack: Created new dictionaries..." + date > $dplf + else + echo "Crack: The dictionaries seem up to date..." + fi + echo "Crack: makedict done" exit 0 fi