Annotation of researchv10dc/cmd/docsubmit/docsubmit.sh, revision 1.1.1.1

1.1       root        1: #      @(#)fulltext:docsubmit  1.18
                      2: 
                      3: # THis routine was originally written by Lorinda Cherry - it gathers up
                      4: # all the files connected with a documents, and transmits them via
                      5: # uucp to   mhuxd!~/full.text/
                      6: #
                      7: # It bundles all the files involved together into one cpio file
                      8: # called <1st 5 chars of machine name><process id>.cp
                      9: 
                     10: # Finding a good awk is a pain - set it here if you want
                     11: L=/usr/lib/docsubmit
                     12: AWK=""
                     13: if test -z "${AWK}"
                     14: then
                     15:     if ans=`sh -c 'logdir exptools' 2>&1` ; then
                     16:        :
                     17:     else
                     18:        ans=`grep '^exptools:' /etc/passwd | sed "s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*/\1/"`
                     19:        fi
                     20:     if test -r ${ans}/bin/nawk
                     21:     then
                     22:        AWK=${ans}/bin/nawk
                     23:        fi
                     24:     fi
                     25: if test -z "${AWK}"
                     26: then
                     27:     if test -r /usr/local/bin/awk
                     28:     then
                     29:        AWK=/usr/local/bin/awk
                     30:        fi
                     31:     fi
                     32: if test -z "${AWK}"
                     33: then
                     34:     AWK=awk
                     35:     fi
                     36: 
                     37: # Get machine nodename - swiped from rn build routine Configure
                     38: if ans=`sh -c hostname 2>&1` ; then
                     39:     MACH=$ans
                     40: elif ans=`sh -c 'uuname -l' 2>&1` ; then
                     41:        MACH=$ans
                     42: elif ans=`sh -c 'uname -n' 2>&1` ; then
                     43:        MACH=$ans
                     44: else
                     45:        MACH=failedget
                     46:        fi
                     47: # Get the users LOGNAME
                     48: if ans=`sh -c logname 2>&1` ; then
                     49:     LOGNAME=$ans
                     50: else
                     51:     LOGNAME=`echo $HOME|sed 's/.*\///'`
                     52:     fi
                     53: 
                     54: T=/tmp
                     55: AWKTEMP=/tmp/Doc.Awk.$$
                     56: OUTP="junk"
                     57: COVER="junk"
                     58: DOCNUM="junk"
                     59: REF=""
                     60: # cut the machine name down to a max of 5 characters
                     61: DIR=`echo ${MACH} | sed 's/\(.....\).*/\1/'`$$
                     62: NAME=$DIR
                     63: DIR=$T/$DIR
                     64: trap 'rm -f ${AWKTEMP} $DIR/* $T/$NAME.cp ; rmdir $DIR 2>>/dev/null; trap 0;exit' 0 1 2 15
                     65: if test $# -eq 0
                     66: then
                     67:        echo "docsubmit -C -c file.cover -N number -r ref_file -t  file(s)"
                     68:        echo "   -C if document complete without coversheet, else -c file.cover"
                     69:        echo "   -N number   if document number not included in the files"
                     70:        echo "   -r to include a refer file"
                     71:        echo "   -t if source is Knuths TeX instead of troff/nroff\n"
                     72:        echo "  Two examples, first with cover sheet, second without:"
                     73:        echo "    docsubmit -c mydoc.cover mydoc.text mydoc.append"
                     74:        echo "    docsubmit -C -N 79111-880324-01 mydoc.text"
                     75:        exit 0
                     76: fi
                     77: for i in $*
                     78: do case $i in
                     79:     -r) shift; REF=$1; shift; continue;;
                     80:     -c) shift; COVER=$1; shift; continue;;
                     81:     -C) shift; COVER=$$; continue;;
                     82:     -t) shift; TEX="yes"; ARG=$1; shift; continue;;
                     83:     -N) shift; DOCNUM=$1; shift; continue;;
                     84:     -*) echo docsubmit unknown flag $i; exit 1;;
                     85:     esac
                     86:     done
                     87: ARGS=$*
                     88: if test "$COVER" = "junk" 
                     89: then
                     90:     echo "You must include the coversheet file for the paper to be submitted"
                     91:     echo "If the coversheet is in the files (or the files are the complete document),"
                     92:     echo "       indicate this by using the -C flag"
                     93:     echo "Use the flag  -N number   if document number not included in the files"
                     94:     echo "     ===> Full text of document not sent <==="
                     95:     exit 1
                     96:     fi
                     97: 
                     98: # check the entered document number
                     99: if test ${DOCNUM} != "junk"
                    100: then
                    101:     x=`expr "${DOCNUM}" : '^[a-zA-Z0-9]*-[89][0-9]*-[0-9][0-9]'`
                    102:     if test $x -lt 2
                    103:     then
                    104:        echo "\nDocument numbers must be of form  OrgNum-Date-seq"
                    105:        echo "   Where Date is usually YYMMDD (e.g. 881224) [always starts with a year]"
                    106:        echo "   and the sequence number is always 2 digits (e.g. 03)"
                    107:        echo "     ===> Full text of document not sent <==="
                    108:        exit 1
                    109:        fi
                    110:     fi
                    111: OUTP=$DIR/$NAME
                    112: mkdir $DIR
                    113: if test $TEX
                    114: then
                    115:        case $OUTP in
                    116:        *.*) echo "the name for a TeX paper cannot contain . tex gets confused"
                    117:                echo "  use _ or - instead"
                    118:                exit 1
                    119:        esac
                    120:        BBL=$OUTP.bbl
                    121:        OUTP=$OUTP.tex
                    122:        echo "%...\\\"" `date` >$OUTP
                    123:        echo "%...\\\"" EmailAddress ${MACH}"!"${LOGNAME} >>$OUTP
                    124:        if test "${DOCNUM}" != "junk"
                    125:        then
                    126:            echo "%...\\\" DocNum ${DOCNUM}" >>$OUTP
                    127:            fi
                    128:        echo "%...\\\"" `pwd` >>$OUTP
                    129:        ${AWK} -f $L/tex.awk dir=$DIR texinp=$TEXINPUTS $ARG.tex >>$OUTP
                    130:        # Check that it ended okay
                    131:        if test $? -ne 0
                    132:        then
                    133:            echo "Sorry - couldnt collect together the full text of your document."
                    134:            echo "No full text was sent! Contact the docsubmit provider with questions."
                    135:            exit 1 
                    136:            fi
                    137: 
                    138:        if test -s $ARG.bbl
                    139:        then
                    140:                cp $ARG.bbl $BBL
                    141:        else if test \( -s $ARG.bib \) -a \( ! -s $DIR/$ARG.bib \)
                    142:        then
                    143:                cp $ARG.bib $BIB
                    144:        fi
                    145:        fi
                    146: else
                    147:        echo "...\\\"" `date` >$OUTP
                    148:        echo "...\\\"" EmailAddress ${MACH}"!"${LOGNAME} >>$OUTP
                    149:        if test "${DOCNUM}" != "junk"
                    150:        then
                    151:            echo "...\\\" DocNum ${DOCNUM}" >>$OUTP
                    152:            fi
                    153:        echo "...\\\"" `pwd` >>$OUTP
                    154:        if test $REF
                    155:        then
                    156:        cat >>$OUTP <<x
                    157: ...\"refer first
                    158: x
                    159:        fi
                    160:        if test $COVER = $$
                    161:        then
                    162:                PARMS="$ARGS"
                    163:        else
                    164:                PARMS="$COVER $ARGS"
                    165:        fi
                    166:        ${AWK} -f $L/troff.awk dir=$DIR $PARMS >>$OUTP
                    167:        if test $? -ne 0
                    168:        then
                    169:            echo "Sorry - couldnt collect together the full text of your document."
                    170:            echo "No full text was sent! Contact the docsubmit provider with questions."
                    171:            exit 1 
                    172:            fi
                    173: 
                    174:        if test $REF
                    175:        then
                    176:        cat >>$OUTP <<x
                    177: ...\"refer begin
                    178: x
                    179:        cat $REF >>$OUTP
                    180:        cat >>$OUTP <<x
                    181: ...\"refer end
                    182: x
                    183:        fi
                    184: fi
                    185: cd $T
                    186: ls $NAME/*|cpio -oc >$NAME.cp
                    187: chmod 0644 $NAME.cp
                    188: uucp -C $NAME.cp mhuxd!~/full.text/
                    189: echo "
                    190: The full text of your document has been sent to the Library Network.
                    191: Please note that an official paper copy MUST still be filed.
                    192: "
                    193: exit 0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.