X-Git-Url: https://git.librecmc.org/?p=oweals%2Fthc-archive.git;a=blobdiff_plain;f=Tools%2Fdosfndecode.sh;fp=Tools%2Fdosfndecode.sh;h=bdda9d94ae0d7cfedf85fedefba19d2b7c8131f0;hp=0000000000000000000000000000000000000000;hb=dfbf6f563fd603e051f44a00e375b592a002b736;hpb=1bf41562f218d9a607f88640fb33bf0775424756 diff --git a/Tools/dosfndecode.sh b/Tools/dosfndecode.sh new file mode 100644 index 0000000..bdda9d9 --- /dev/null +++ b/Tools/dosfndecode.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# dosfndecode - dos filename decoder +# (c) 2000 by plasmoid / thc +# +# convert files cutted to the dos extension (8.3 format) into proper unix +# files by evaluating the ident definition. the ident definition can be +# found in correct formated source trees, as for e.g. *surprise* *surprise* +# the solaris source. +# +# this tool comes really handy if you have the broken solaris 2.7 source +# that is flying around. but don't ask us, we don't have warez. sorry! +# + +prepath=`pwd` + +if [ "x$1" = "x" -o ! -d $1 ] ; then + echo "dos filename decoder - (C) 2000 by plasmoid / thc " + echo "usage: $0 dir" + echo " where dir is the directory to convert recursively" + exit 0 +fi + +for j in `find $1 -type d` ; do +echo " entering $j" +cd $j + for i in * ; do + identline=`egrep -se \("#ident"\|"#pragma ident"\) $i` + + if [ "x$identline" != "x" -a "x`echo $0 | grep $i`" = "x" ] ; then + newname=`echo $identline | sed s/@\(\#\)/!/g | cut -d! -f2` + newname=`echo $newname | awk '{ print $1 }'` + if [ "x`echo $newname | grep :`" != "x" ] ; then + newname=`echo $newname | cut -d: -f2` + fi + if [ $i != $newname ] ; then + echo " -- converting $i -> $newname" + mv -f $i $newname + fi + fi + done +echo " leaving $j" +cd $prepath +done +exit 1