[net.sources] VSH 7 of 6

dan@rna.UUCP (Dan Ts'o) (07/18/85)

Hi,
	This article contains a tiny bug fix for the recently distributed VSH.
Basically the feature where the parameter MAIL with a value like

	/usr/spool/mail/~

	was to replace the ~ with the current login name, didn't work, its
code was misplaced.

	Also included is an additional sample VSH configuration for very
naive users. A menu is presented and very basic commands are given.
It complements (but doesn't require) a simple configuration for the JOVE
EMACS editor which allows the naive user to enter text in a very simple
minded way. (Let me know if you want the .joverc and .jovemac files).


					Cheers,
					Dan Ts'o
					Dept. Neurobiology
					Rockefeller Univ.
					1230 York Ave.
					NY, NY 10021
					212-570-7671
					...cmcl2!rna!dan


*** /usr/spool/uucppublic/main.c	Tue Jul 16 03:42:49 1985
--- main.c	Mon Jul 15 03:54:47 1985
***************
*** 79,96
  	/* Give root a different arrow */
  	arrow = i ? "->" : "#>";
  
- 	if (MAIL && *MAIL) {
- 		i = strlen(MAIL);
- 		if (MAIL[i-1] == '~') {
- 			s = (char *) malloc(i+1+USERSIZE);
- 			if (s != NULL) {
- 				strcpy(s, MAIL);
- 				strcpy(&s[i-1], username);
- 				MAIL = s;
- 			}
- 		}
- 	}
- 
  	if (signal(SIGHUP, leave) == SIG_IGN)
  		signal(SIGHUP, SIG_IGN);
  	if (signal(SIGTERM, leave) == SIG_IGN)

--- 79,84 -----
  	/* Give root a different arrow */
  	arrow = i ? "->" : "#>";
  
  	if (signal(SIGHUP, leave) == SIG_IGN)
  		signal(SIGHUP, SIG_IGN);
  	if (signal(SIGTERM, leave) == SIG_IGN)
***************
*** 118,124
  	if (!fflag && i) {
  #endif
  		fprintf(stderr, "Not a screen terminal");
! 		if (c > 1 && (**v == '-' || strcmp(v[j], "-") == 0)) {
  			fprintf(stderr, ", exec'ing %s...\r\n", SHELL);
  			signal(SIGINT, oi);
  			signal(SIGQUIT, oq);

--- 106,113 -----
  	if (!fflag && i) {
  #endif
  		fprintf(stderr, "Not a screen terminal");
! 		if ((c > 0 && **v == '-')
! 			|| (c > 1 && strcmp(v[j], "-") == 0)) {
  			fprintf(stderr, ", exec'ing %s...\r\n", SHELL);
  			signal(SIGINT, oi);
  			signal(SIGQUIT, oq);
***************
*** 131,136
  
      erase (); printf ("Vsh %s\r\n", VERSION);
      cmdldrc ();
      wdfile = -1;
      if (curdir () || enterdir (DOT) == NOREPLOT)
  	leave ();

--- 120,138 -----
  
      erase (); printf ("Vsh %s\r\n", VERSION);
      cmdldrc ();
+ 
+ 	if (MAIL && *MAIL) {
+ 		i = strlen(MAIL);
+ 		if (MAIL[i-1] == '~') {
+ 			s = (char *) malloc(i+1+USERSIZE);
+ 			if (s != NULL) {
+ 				strcpy(s, MAIL);
+ 				strcpy(&s[i-1], username);
+ 				MAIL = s;
+ 			}
+ 		}
+ 	}
+ 
      wdfile = -1;
      if (curdir () || enterdir (DOT) == NOREPLOT)
  	leave ();
*** /usr/spool/uucppublic/xeq.c	Tue Jul 16 03:43:55 1985
--- xeq.c	Mon Jul 15 01:47:23 1985
***************
*** 78,83
  			else if (query || !NOARG) {
  				tty_push(COOKEDMODE);
  				if (argcnt == 0) {
  					hilite(1);
  					printf("\r(");
  					for (i = 0;;) {

--- 78,85 -----
  			else if (query || !NOARG) {
  				tty_push(COOKEDMODE);
  				if (argcnt == 0) {
+ 					if (pflag)
+ 						sleep(1);
  					hilite(1);
  					printf("\r(");
  					for (i = 0;;) {
***************
*** 97,103
  					argcnt++;
  				}
  				else
! 					hilite("Arg%d:", ++argcnt);
  				putch(' ');
  				i = xgetline(stdin, s, (&argbuf[STRMAX]-s));
  				tty_pop();

--- 99,105 -----
  					argcnt++;
  				}
  				else
! 					hilite("Argument%d:", ++argcnt);
  				putch(' ');
  				i = xgetline(stdin, s, (&argbuf[STRMAX]-s));
  				tty_pop();

***** shell archive for new VSH stuff *****
echo doc/README
sed 's/^X//' > doc/README << 'All work and no play makes Jack a dull boy'
X	The files genhelp, genhelp.dan, rmhelp, showhelp, vsh.doc all
Xbelong in /usr/lib/vsh.
X
X	vshelp is a sample help menu for novices. Set helpfile to vshelp
Xbefore entering VSH (in .vshrc) to use a help menu. It is not very compatible
Xwith multi column directory displays.
X
X	vshrc is a sample initialization file which is similar to the way
XI like to use VSH. Its companion helpfile is genhelp.dan .
X
X	*.beg are sample configuration files for a beginner. We use a
Xsimply configured JOVE editor but I put in VI in *.beg since not everyone has
XJOVE. In particular, a help menu is provided.
All work and no play makes Jack a dull boy
echo doc/genhelp.beg
sed 's/^X//' > doc/genhelp.beg << 'All work and no play makes Jack a dull boy'
X			  Command Summary
XCommand		Action
X
X<ESCAPE>	Leave Vsh, must be entered twice
X<RETURN>	See a selected file or directory
XC		Create file or directory, rename existing files
XD		Date
XE		Edit file with VI
XF		Format an NROFF manuscript on printer
XG		play Games
XH		go to your Home directory
XI		ask for Information, phone numbers, restaurants
XL		Long listing of files on current page
XM		read your Mail
XN		read the News
XP		Print a file on the printer
XQ		Compute disk usage
XR		Remove files
XS		Send mail to someone
XT		Talk to someone logged in
XU		go Up to previous directory
XW		See Who is logged in
XX		Run a shell command
XY		Re-execute previous ';' shell command
X
XCommand		Action
X
X1-9		Select page 1-9
X0		Select page 10
X+, ^D, ^F, <SP>	Select next page, + next column
X-, ^U		Select previous page, - previous column
X^L		Re-display same page
X.		Select page with files beginning with letter prompted for (find)
Xa-z		Select a file
X^		Change to Home directory
X/		Enter file prompted for (display, chdir, etc.)
X\		Change to previous directory (undo last change directory)
X?		Display this page
X!		Execute shell
X%		Chain to shell (does not return to Vsh)
X$		Execute Bourne shell
Xline feed	Change to parent directory
X;		Execute any shell command
X
XThese commands are useful in select mode.
XCommand		Action
X<TAB>		Forward column
X^F		Forward column (Emacs style)
X^B		Backward column
X^P		uP column
X^N		dowN column
X^A		Back series
X^E		Forward series
Xh,j,k,l		Forward, backward, up, and down (VI style)
X'		Enter selected item
X(arrow keys)	Forward, backward, up, and down
X
XThese commands are available when viewing files or output through VSH's pager,
X(More? prompt with the VSH display command, help or pexec)
X1,<		First line
XG,>		Last line
X?,^R		Reverse search
X/,^S		Forward search (wraps around)
Xe,v		Invoke $EDITOR
X-,^P,k		Previous line
X<CR>,^N,j	Next line
X^U		Previous half page
X^D		Next half page
X^B,^		Previous full page
X^L		Re-paint page
X!		Fork a subshell
X(anything else)	Next full page
X
XMost of the above commands, especially A-Z, are user-alterable.
XSee "help vsh" for more information.
All work and no play makes Jack a dull boy
echo doc/vshelp.beg
sed 's/^X//' > doc/vshelp.beg << 'All work and no play makes Jack a dull boy'
X	<ESCAPE> QUIT (type twice)	X	run a PROGRAM
X	<RETURN> see a file or dir	Y	rerun PROGRAM
X	C	CREATE a file or dir	a-z	SELECT a file
X	D	show the DATE & time	^L	redraw screen
X	E	EDIT a text file	<SPACE>	see more files
X	F	FORMAT an NROFF file	$	QUIT to SHELL
X	G	play GAMES
X	H	go to HOME directory
X	I	INFO, phone numbers
X	L	LONG listing of files
X	M	read your MAIL
X	N	read the NEWS
X	P	PRINT a file
X	R	REMOVE files
X	S	SEND MAIL
X	T	TALK to someone
X	U	go UP to last directory
X	W	WHO is logged in
X	(arrow keys) SELECT a file
X	^C	STOP a program		?	get more HELP
All work and no play makes Jack a dull boy
echo doc/vshrc.beg
sed 's/^X//' > doc/vshrc.beg << 'All work and no play makes Jack a dull boy'
Xvshmode select
Xquitchar [
Xpagechar `
Xentertext display
Xwindow 24
Xhelpfile /usr/lib/vsh/vshelp.beg
XSHELL /bin/sh
XMAIL /usr/spool/mail/~
X? display /usr/lib/vsh/genhelp.beg
X! exec ;sh
X$ chain sh
X; xecute
X# exec ;setuid root vsh -
X/ file
X( exec ;compress $
X) exec ;uncompress $
X~ file
X` file .
X, pexec sh -c ??Command:
X[ file ..
X] exec ;top
XE exec ;vi $
XF xecute ;nroff -ms -T630-12 $
XH home
XI pexec tele "??Information on:"
XG exec play
XM exec mail
XN exec ;rn
XP exec ;lpr $
XQ pexec du
XS exec mail "??Send mail to:"
XT exec talk "??Talk to which person:"
XU file ..
XV chain vsh -
XW pexec who
XX xecute
Xv exec ;vi $
Xz exec ;jove $
All work and no play makes Jack a dull boy
echo misc/pp
sed 's/^X//' > misc/pp << 'All work and no play makes Jack a dull boy'
X#!/bin/ksh
XPATH=/usr/ucb:/bin:/usr/bin:/usr/local/bin
Xcase x$1 in
X	x)
X		echo Usage: $0 files...
X		exit
X		;;
Xesac
X
Xwhile :
Xdo
X	echo -n "How do you want to print these files:
Xscreen formatted (NROFF)
Xprinter formatted (NROFF)
Xtypeset to printer (TROFF)
Xlineprinter
Xdiablo to printer (typewriter-style)
X? "
X	read how
X	case x$how in
X		xl*)
X			how=lineprinter
X			break
X			;;
X		xs*)
X			how=screen
X			break
X			;;
X		xp*)
X			how=printer
X			break
X			;;
X		xt*)
X			how=typeset
X			break
X			;;
X		xd*)
X			how=diablo
X			break
X			;;
X		*)
X			echo "Unknown printing command."
X			;;
X	esac
Xdone
Xecho "Printing $* ..."
Xcase $how in
X	l*)
X		qp -n $*
X		;;
X	p*)
X		nroff -ms -T630-12 $* | qdiablo -12
X		;;
X	d*)
X		qdiablo -i -12 $*
X		;;
X	s*)
X		nroff -ms $* | ${PAGER-less}
X		;;
X	t*)
X		qtroff -ms $*
X		;;
Xesac
All work and no play makes Jack a dull boy
echo doc/vshrc
sed 's/^X//' > doc/vshrc << 'All work and no play makes Jack a dull boy'
Xvshmode select
Xquitchar [
Xpagechar `
Xentertext display
Xhelpfile ""
Xcolumn 10
Xwindow 11
Xenterpath :/usr/spool:/src:~
X? display /usr/lib/vsh/genhelp.dan
X= pexec ls $
X; xecute
X% exec /bin/csh
X# exec ;su root vsh -
X/ file
X@ exec ;rm -r $
X& xecute ;cc -O -c $ &
X( exec ;pack $
X) exec ;unpack $
X~ file
X` file .
X, pexec sh -c ??Command:
X: exec ;chmod "??New mode:" $
XA exec ;adb $
XB pexec od $
XF pexec df
XH home
XI pexec tar tvf $
XJ pexec nroff -ms $
XK exec ;notes -i *.*
XP pexec ps -la
XQ pexec du $
XT pexec tail -19 $
XU exec ;su
XV chain vsh -
XW pexec who
XX exec $
Xu pexec uustat
Xv exec ;vi $
Xw exec ;mail
Xx pexec size $
Xy pexec file $
Xz exec ;jove $
All work and no play makes Jack a dull boy