[net.micro.att] 7300 goodies

corey@fluke.UUCP (Corey Satten) (09/09/85)

: ------ cut here ------ ------ cut here ------ ------ cut here ------
: To unbundle, remove any lines above this one and feed the rest to "sh"
: by typing: sh thisfile.  --DO NOT use csh--
: SHAR format archive created: Mon Sep 9 13:50:41 PDT 1985
echo x - READ_ME
echo '-rw-r--r--  1 corey        2203 Sep  6 15:27 READ_ME    (as sent)'
sed 's/^X//' >READ_ME <<'+FUNKY+STUFF+'
XI offer you the following little programs in case you find them helpful
Xor interesting:
X
X    fwrite - write a multi-floppy archive
X    fread  - read a multi-floppy archive
X    bvi    - run vi in a 24x80 big window
X    dis    - sensibly disassemble a shared-library executable file
X
XThe fread and fwrite scripts make it possible to do dumps in compressed
Xform using the public domain compress/uncompress programs posted by
Xallegra!vax135!petsd!joe (Joe Orost).  I find that this reduces the
Xnumber of disks required by a factor of two.  Unfortunately, it also
Xseems to increase the time (and noise) to do the dump by a factor of
Xthree (on a 1Mb system -- compress uses .5Mb).  The slowdown is more
Xtolerable when you consider the time it takes to format the disks
Xoriginally, and the time to switch them, and label them, and the fact
Xthat you can read a book if you only need to switch disks every 3
Xminutes, but you can't do anything else when you need to switch every
Xminute.  Also note that these scripts block the floppy in 4096 byte
Xblocks.  This probably allows slightly more complete utilization of the
Xdisk than the 5120 byte blocking you get with cpio -B (perhaps an extra
X1K/disk).  In any case, the two blockings are not compatible.  If
Xcompatibility is important, I suspect it can be achieved by changing
Xthe count and input buffer size options to dd.  Also note that there
Xseems to be a bug in tar or in the scheduler which prevents this scheme
Xfrom working properly with tar.  You can write the archive, and even
Xread it in to get a table of contents: tar -tv but if you try to
Xextract the files, eventually all the programs in the pipeline stop and
Xwait for each other.  This bug does not exist when using cpio.
X
Xbvi is a minimal C program which opens a new window on top of all the
Xothers (like the vt100 emulator does) and runs vi in it.  When vi exits,
Xthe big window goes away, revealing the other windows as before.
X
Xdis is a shell script which directs adb to disassembles executable 
Xobject files linked with the shared library.  It then substitutes
Xsystem call names for the shared library entry points so the code
Xis more readable.  Of course, nobody would ever want to do this...
+FUNKY+STUFF+
chmod u=rw,g=r,o=r READ_ME
ls -l READ_ME
echo x - bvi.c
echo '-rw-r--r--  1 corey         916 Sep  4 09:09 bvi.c    (as sent)'
sed 's/^X//' >bvi.c <<'+FUNKY+STUFF+'
X/*
X * BVI -- On an AT&T Unix-PC, run vi in a new 24x80 borderless window.
X *
X * This program will open a borderless (80 column) window on top of all
X * your other windows and run vi in it.  When vi exits, the window
X * will be removed, revealing the window in which you typed bvi unchanged.
X *
X * Usage:   bvi args-to-vi
X *
X * Author:  Corey Satten, fluke!corey Sept 1985
X *
X * This software is hereby officially introduced into the public domain.
X */
Xmain(ac,av,ep)
X    int ac;
X    char *av[], *ep[];
X    {
X    int fd, i;
X    char *termcap;
X
X    fd = open("/dev/window",2);
X    close(0); dup(fd);
X    close(1); dup(fd);
X    close(2); dup(fd);
X    av[0] = "/usr/bin/vi";
X    for (i=0; ep[i]; ++i) {
X	if (!strncmp(ep[i],"TERMCAP=",8)) {
X	    ep[i] = "TERMCAP=/etc/termcap";
X	    }
X	if (!strncmp(ep[i],"TERM=",5)) {
X	    ep[i] = "TERM=s4";
X	    }
X	}
X    av[0] = "/usr/bin/vi";
X    execve("/usr/bin/vi", av, ep);
X    }
+FUNKY+STUFF+
chmod u=rw,g=r,o=r bvi.c
ls -l bvi.c
echo x - dis
echo '-rwxr-xr-x  1 corey        1595 Sep  4 08:11 dis    (as sent)'
sed 's/^X//' >dis <<'+FUNKY+STUFF+'
X: '
X:  This script will disassemble an executable file which has
X:  been linked with the Unix-PC shared library.  It will replace
X:  absolute addresses of the library routines with their names.
X:
X:  Do not be surprised if no output is produced for a long time.
X:  Have faith.  Eventually, the output will appear on stdout.
X:  Regretably a potentially large tempfile is created in /tmp.
X:  This would not be necessary if adb wrote its diagnostic output
X:  to stderr instead of stdout.
X:
X:  Usage:  dis executable_filename
X:
X:  Author:  Corey Satten, fluke!corey Sept 1985
X:
X:  Disclaimer:  Use of this program may violate your license agreement.
X:
X:  This software is hereby officially introduced into the public domain.
X: '
Xtrap "rm -f /tmp/sd$$ /tmp/sd$$.??; exit 1" 1 2 13 15
X
Xif test ! -r "$1" ;then
X    echo $0: "Can't read $1" 1>&2
X    exit 1
Xfi
Xsed '
X1,13d
Xs/0x00\(3[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]\)/\1/
Xs/_dbase + 0x\([^;]\);/30100\1;/
Xs/_dbase + 0x\([^;][^;]\);/3010\1;/
Xs/_dbase + 0x\([^;][^;][^;]\);/301\1;/
Xs/_tbase + 0x\([^;]\);/31000\1;/
Xs/_tbase + 0x\([^;][^;]\);/3100\1;/
Xs/_tbase + 0x\([^;][^;][^;]\);/310\1;/
Xs/\([!-~]*\) = \([!-~]*\);/s\/\2\/\1\//
X' /lib/shlib.ifile | 
Xsplit -75 - /tmp/sd$$.
Xfor f in /tmp/sd$$.?? ;do
X    echo $pipe sed "'" >>/tmp/sd$$
X    cat $f >>/tmp/sd$$
X    pipe="' |"
X    done
Xecho 's/	//' >>/tmp/sd$$
Xecho "'" >>/tmp/sd$$
Xrm /tmp/sd$$.??
X( echo "\$>/tmp/sd$$.ou"
X  echo '<e?i'
X  while test ! -s /tmp/sd$$.er ;do
X  sed 's/.*//' /tmp/sd$$
X  done
X) | adb $1 >/tmp/sd$$.er 
Xsh /tmp/sd$$ </tmp/sd$$.ou
Xrm /tmp/sd$$ /tmp/sd$$.ou /tmp/sd$$.er
Xexit 0
+FUNKY+STUFF+
chmod u=rwx,g=rx,o=rx dis
ls -l dis
echo x - fread
echo '-rwxr-xr-x  1 corey         819 Sep  9 13:47 fread    (as sent)'
sed 's/^X//' >fread <<'+FUNKY+STUFF+'
X: '  
X:  Read as many Unix-PC floppy disks to standard output as are needed
X:  to satisfy the program reading them. (such as tar or cpio.)
X:
X:  Sample usage: fread | uncompress | tar xvf -
X:                fread | uncompress | cpio -icdumv
X:
X:  Author: Corey Satten, fluke!corey Aug. 1985
X:  This software is hereby officially introduced into the public domain.
X: '
Xtrap "/etc/dismount -f 2>/dev/null 1>&2; exit 0" 0
Xtrap "/etc/dismount -f 1>&2; exit 1" 1 2 13 15
Xdiskno=1
Xwhile dd if=/dev/rfp021 ibs=4096 count=79 2>/dev/null ;do
X    /etc/dismount -f 1>&2
X    diskno=`expr $diskno + 1`   
X    echo "To EXIT -- press <E> followed by <RETURN>." 1>&2
X    echo "To continue - insert floppy disk #$diskno and press the <RETURN> key." 1>&2
X    choice=`head -1 </dev/tty`
X    case "$choice" in
X	E*|e*) exit 1;;
X    esac
Xdone
+FUNKY+STUFF+
chmod u=rwx,g=rx,o=rx fread
ls -l fread
echo x - fwrite
echo '-rwxr-xr-x  1 corey         887 Sep  9 13:48 fwrite    (as sent)'
sed 's/^X//' >fwrite <<'+FUNKY+STUFF+'
X: '  
X:  Copy standard input onto as many Unix-PC floppy disks as needed,
X:  buffering appropriately, and prompting the user to change as necessary.
X:
X:  Sample usage: tar cvf - . | compress | fwrite
X:                find . -print | cpio -oc | compress | fwrite
X:
X:  Author: Corey Satten, fluke!corey Aug. 1985
X:  This software is hereby officially introduced into the public domain.
X: '
X
Xtrap "/etc/dismount -f 1>&2; exit 1" 1 2 13 15
Xdiskno=1
Xgo=true
Xwhile $go ;do
X    set `dd of=/dev/rfp021 obs=4096 count=632 2>&1`
X    if test $1 = 632+0 ;then
X	/etc/dismount -f 1>&2
X	diskno=`expr $diskno + 1`   
X	echo "To EXIT -- press <E> followed by <RETURN>." 1>&2
X	echo "To continue - insert floppy disk #$diskno and press the <RETURN> key." 1>&2
X	choice=`head -1 </dev/tty`
X	case "$choice" in
X	    E*|e*) exit 1;;
X	esac
X    else
X	/etc/dismount -f 2>/dev/null 1>&2
X	go=false
X    fi
Xdone
Xexit 0
+FUNKY+STUFF+
chmod u=rwx,g=rx,o=rx fwrite
ls -l fwrite
exit 0
-- 

                                *******
Corey Satten; John Fluke Mfg. Co MS 223B; PO Box C9090 Everett WA 98206
{uw-beaver,decvax!microsoft,ucbvax!lbl-csam,allegra,tikal}!fluke!corey
                             (206) 356-5058