3 # Written by Christofer Edvardsen <ce@earthling.net>, Feb 1998
5 # This script makes it possible to view and copy files to/from a hp48
6 # (tested with a HP48G and the emulator x48)
8 # To use the hp48 external filesystem:
9 # - read the relevant parts of your HP48 manual
11 # - connect the HP48 to your computer or start x48
12 # - below change the line which reflects the serial device you use
13 # - configure your HP48 (<left shift> - i/o - iopar):
16 # transfer format: binary (fast transfers) or
17 # ascii (editable on the pc)
18 # - start the server on the HP48: <left shift> - i/o - srvr - serve
19 # or the shortcut <right shift> - <right arrow>
20 # - on MC's commandline enter "cd hp48:"
22 # Make sure you have kermit installed and that it's using the right serial
23 # device by changing /dev/ttyXX on the next line
25 KERMIT
="kermit -l /dev/ttyS1 -b 9600"
29 $KERMIT -C "SET EXIT WARNING OFF,REMOTE $1,QUIT"
34 (echo SET EXIT WARNING OFF
;echo REMOTE HOST HOME
35 for HP48_DIR
in `echo "$1" | tr '/' ' '`;do
36 if [ "x$HP48_DIR" != "x." ];then echo REMOTE HOST
"$HP48_DIR"; fi
38 echo QUIT
)|
$KERMIT -B >/dev
/null
48 printf "%d" "$2" 2>/dev
/null
55 while [ "x$INPUT" != "xEOF" ]
57 case `echo "$INPUT" | $AWK '{if (int($2)) if ($3 == "Directory") print "dir";else print "file"}'` in
58 dir
) HP48_DIRS
="$HP48_DIRS `hp48_retdir \"$INPUT\"`"
59 printf "drwxr-xr-x 1 %-8d %-8d %8d %s %s\n" 0 0 `hp48_retsize "$INPUT"` "`date +\"%b %d %Y %k:%M\"`" "$HP48_CDIR/`hp48_retdir \"$INPUT\"`";;
60 file) printf "-rw-r--r-- 1 %-8d %-8d %8d %s %s\n" 0 0 `hp48_retsize "$INPUT"` "`date +\"%b %d %Y %k:%M\"`" "$HP48_CDIR/`hp48_retdir \"$INPUT\"`";;
64 for HP48_DIR
in $HP48_DIRS;
66 HP48_PDIR
="$HP48_CDIR"
67 HP48_CDIR
="$HP48_CDIR/$HP48_DIR"; hp48_cmd
"HOST $HP48_DIR" >/dev
/null
69 HP48_CDIR
="$HP48_PDIR"; hp48_cmd
"HOST UPDIR" >/dev
/null
75 { hp48_cmd
"DIRECTORY"; echo; echo EOF
; } | hp48_parser
78 # override any locale for dates
84 hp48_cmd
"HOST HOME" >/dev
/null
89 hp48_cd
"`dirname "$3"`"
90 $KERMIT -B -g "`basename "$3"`" -a "$4" >/dev
/null
94 hp48_cd
"`dirname "$3"`"
95 $KERMIT -B -s "$4" -a "`basename "$3"`" >/dev
/null