UnixCommandsDoc.tioga
Michael Plass, January 14, 1993 5:18 pm PST
UnixCommands
Cedar10.1
UnixCommands
Commander access to UnixTM shell commands
Michael Plass
Ó Copyright 1990, 1992 Xerox Corporation. All rights reserved.
Abstract: UnixCommands provides access to UnixTM shell commands via the Cedar Commander, without creating new windows. This is handy when, for instance, are talking to the Commander from a dumb terminal, or just when you don't want to switch between viewers all the time.
Created by: Michael Plass
Maintained by: Michael Plass <Plass:PARC>
Keywords: shell, Plumber, Commander, Unix, sh, mkdir, rmdir, commands, interoperability
XEROX  Xerox Corporation
   Palo Alto Research Center
   3333 Coyote Hill Road
   Palo Alto, California 94304

News
Changed UnixSpawnImpl.CopyFDToStream to do one Read call per character, rather than trying to get a chunk. While this hurts performance, it seems to circumvent a PCR/Unix interaction problem that causes output at the end to get lost. (mfp, January 14, 1993)
Monitorized the spawning code to synchonize the teardown of the spawned job. If I got it right, the problems with lost output and hangs should be eliminated.
Added .command files for sh, sh1, env, du, df, ps, chown, chgrp, chmod, pstat, del~ (February 19, 1991)
Added -v and -w switches (January 3, 1991)
Bug fix: Catches EditedStream.Rubout (June 27, 1990)
UnixSpawnImpl now catches EditedStream.Rubout. What this means is that the "DEL" key acts like a control-C. There is still a bug in that the looks are lost on the echo stream when the input stream is reset, but that is a lot better than the old behavior of wedging your world.
New package (March 6, 1990)
Commands
sh1 Executes the rest of the command line as a UnixTM command.
UnixCommand Declare a UnixTM command to be accessible through the Commander
Usage: UnixCommand [ switch ... ] commanderName [ unixCommandPrefix ]
unixCommandPrefix defaults to be the same as commanderName
switches:
-e   exec the command
-t   pass -t tty and -p pty arguments to command
-in fname  get stdin from named file
-n   get stdin from /dev/null (good for commands that don't read)
-out fname  redirect stdin to named file
-d   print debugging information about spawning
-v   allow a vux working directory
-w dirname execute the command in this directory instead of the current one
UnixTM Commands
The following UnixTM commands have .command files already defined, so you do not need to add them to your personal environment to be able to use them. Refer to the UnixTM man pages for further information.
chgrp chmod chown df du env mkdir ps pstat rmdir sh
None of these take stdin, except for sh, which provides an interactive Bourne shell.
Other Commands
del~
This deletes old versions of all files under the current directory that match the pattern *.c2c.?~ - useful for cleaning up ux directories.
Examples

%
UnixCommand -n ls "ls -F"
% UnixCommand sh "TERM=network TERMCAP='sa|network:am:co#80:do=^J:' sh"
% UnixCommand rlogin "TERM=network TERMCAP='sa|network:am:co#80:do=^J:' rlogin"
% UnixCommand -t LocalShell
% pmp /moderato
 /moderato  -ux:/net/moderato/moderato
% pwd
/moderato/plass/UnixCommands/
% ls -l
total 768
-rw-rw-r-- 1 plass 15864 Feb 23 1989 Ascii.mob
.
.
(lots of stuff)
.
drwxrwsr-x 2 plass 512 Mar 5 14:08 sun4-o3/
% df .
Filesystem kbytes used avail capacity Mounted on
/dev/sd1c 95909 70943 15375 82% /moderato
% cd /tilde/plass
/tilde/plass/
% ls
Cedar/ StartXNews* debris/
MakeDo.log Transfer/ noviewers*
MakeVerify.log XScheme/ noviewers~*
PCedarTools~* XrDBXInner* sun4/
SimpleDisplays.mesa bin/ sun4-o3/
StartX* cedartools* x.log
% df .
Filesystem kbytes used avail capacity Mounted on
palain:/palain/plass 842171 772263 53064 94% /tmp←mnt/tilde/plass
% push /pcedar/top
/pcedar/top/
% ls
Not a valid -ux file system directory: -vux:/pseudo/pcedar2.0/top
% pop
/tilde/plass/
% sh
$ env
HOME=/net/palain/palain/plass
LOGNAME=plass
.
.
(lots of stuff)
.
pcedar←release=2.0
$ exit
{ 10.85 sec }
%
A slice for your boot commands profile entry
N.B. Remember to escape the double quotes!
UnixCommand -n ls "ls -F"
N.B. You may not want to overwrite the Cedarish "LS"; however, that command also goes by the name of "List", so you will not really lose any functionality.
The -F marks directories and executables (with / and *, respectively), so you can tell them from other files.
UnixCommand sh "TERM=network TERMCAP='sa|network:am:co#80:do=^J:' sh"
UnixCommand rlogin "TERM=network TERMCAP='sa|network:am:co#80:do=^J:' rlogin"
UnixCommand -t LocalShell "/project/cedar10.1/bin/LocalShell"
UnixCommand -n chmod
UnixCommand -n chgrp
UnixCommand -n chown
UnixCommand -n -v ps
UnixCommand -n -v df
UnixCommand -n -v du
UnixCommand -n rsh
UnixCommand -n -v env
UnixCommand -n uman "man -"
UnixCommand -n cc "/usr/local/bin/ccc"
"ccc" is the cedar c compile that filters off the tioga formatting.
Bugs
You cannot sensibly use "UnixCommand csh" because of tty ownership headaches. Use the LocalShell hack above, or, better, use the Plumb command.
Stopping a command in progress is not wonderfully robust. If you are working over a tty-line and don't have a STOP! button, it is very ungraceful since pcr steals the ^C long before the input stream ever sees it.
The relevant environment variables (TERM, TERMCAP) are not recomputed to make sense. This confuses programs like "more" that use this info.
No attempt is made to translate file names on the command line. The command does set the correct UnixTM working directory (which must be a -ux view directory, to lower the chance of confusion, unless the -v switch is used).
Typeahead to an interactive command gets confuses editable typescripts. Use the -n switch wherever possible to minimize this problem.
CEDAR DEFINITIONS
UnixSpawn is an interface that looks an awful lot like Plumber.mesa; however, the implementation has no Viewers dependencies, and so makes sense in a noviewers world.
UnixSpawnTCP is an interface that spawns in a different (probably more reliable) way.