[mod.sources] v06i044: Help programs

sources-request@mirror.UUCP (07/09/86)

Submitted by: talcott!seismo!wucs!nz (Neal Ziring)
Mod.sources: Volume 6, Issue 46
Archive-name: help/Part2

[  This is a sample small help directory, to get you started.  Note
   that any files within the help tree must have world-read
   permission, and all directories must have world-read/execute.
   Also, if you put this tree in somewhere other than /usr/help
   (the shar specifies ./help.dir), you'll have to change the
   HELPDIR #define in help.h source  --r$ ]

#!/bin/sh
# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by mirror!rs on Wed Jul  9 13:05:00 EDT 1986
# Contents:  help.dir// help.dir/vi/ help.dir/vi/commands/
#	help.dir/.HLP help.dir/COMMANDS.HLP help.dir/date.HLP
#	help.dir/su.HLP help.dir/su.MANUAL help.dir/who.HLP
#	help.dir/who.MANUAL help.dir/vi/options.HLP
#	help.dir/vi/starting.HLP help.dir/vi/states.HLP
#	help.dir/vi/commands/change.HLP help.dir/vi/commands/delete.HLP
#	help.dir/vi/commands/funky.HLP help.dir/vi/commands/insert.HLP
#	help.dir/vi/commands/other_commands.HLP
 
echo mkdir - help.dir/
mkdir help.dir/
chmod u=rwx,g=rwx,o=rwx help.dir/
 
echo x - help.dir/.HLP
sed 's/^XX//' > "help.dir/.HLP" <<'@//E*O*F help.dir/.HLP//'
XXThis is a dummy top-level help file.  A good use of this file is
XXto give pointers to the maintainers of the HLP documentation.
@//E*O*F help.dir/.HLP//
chmod u=rw,g=rw,o=rw help.dir/.HLP
 
echo x - help.dir/COMMANDS.HLP
sed 's/^XX//' > "help.dir/COMMANDS.HLP" <<'@//E*O*F help.dir/COMMANDS.HLP//'

XX    	Here is a list of popular commands and software systems
XX	available on the CEC UNIX systems.  To get the manual 
XX	page for a command, try `man command_name'.  To get
XX	the help on that command, if any, try `help topic_name'.  


XX      COMMAND                     FUNCTION                     HELP TOPIC

XX      adb                                          debugger
XX      apropos                    locate commands by keyword    apropos
XX      ar                        archive, library maintainer
XX      at                     execute commands at later time
XX      awk            pattern scanning & processing language
XX      ada                     Ada language compiler and RTS    ada
XX      apl                                   APL interpreter
XX      biff                  be notified if new mail arrives    mail
XX      cal                                   print calendars    calendar
XX      cat                                     catenate data    cat,shell
XX      caesar                        graphical layout editor    cad
XX      cb                               C program beautifier    C
XX      cc                                         C compiler    C
XX      cd                           change working directory    cd,shell
XX      chmod                         change protection modes    chmod
XX      clear                           clear terminal screen    clear
XX      col                           filter formatter output    documents
XX      correct                     correct spelling mistakes    documents
XX      cp                                         copy files    copy
XX      csh            command interpreter with C-like syntax    shell
XX      ctrlc                  system/matrix analysis program    ctrlc
XX      curses                  Optimal cursor motion package
XX      date                          print the time and date    time_of_day
XX      dbx                                 symbolic debugger    dbx
XX      dd                              copy and convert data
XX      deroff                      remove formatter commands    documents
XX      df                       list disk usage by partition    df
XX      diction                          find wordy sentences    documents
XX      diff            differential file & directory compare    diff
XX      ditroff               troff typesetter for the Imagen    documents
XX      du                  summarize disk usage of directory    du
XX      echo                                   echo arguments    shell
XX      eqn                               typeset mathematics
XX      explain                        theasaurus for diction    documents
XX      f77                               Fortran 77 compiler    fortran
XX      file                              determine file type    file
XX      find                                       find files
XX      finger                        user information lookup    finger
XX      fold                             fold long text lines    fold
XX      from                        print sources of new mail    mail
XX      fsplit                      split up fortran programs
XX      ftp                 intersystem File Transfer Program    copy
XX      gemacs (GNU)                   veratile screen editor    emacs
XX      gpssh                          GPSS simulation system
XX      graph                       plot data on a nice graph    graphics
XX      grep                       search a file for patterns    grep
XX      groups                          show group membership    groups
XX      head                             give first few lines
XX      hostname                   print name of current host    hostname
XX      indent                   indent and format C programs    C
XX      join                          join database primitive
XX      kill                                   kick a process    kill
XX      last                         print recent user logins    last
XX      learn              computer-aided instruction on UNIX    learn
XX      leave               remind you when you have to leave    leave
XX      lex                    generator of lexical analyzers    lex
XX      lisp                       Franz Lisp dialect of lisp    lisp
XX      ln                                         make links    ln
XX      lock                            reserve your terminal
XX      lpq                       Examine line-printer queues    printing
XX      lpr                     Print stuff at a line printer    printing
XX      lprm                     remove jobs from print queue    printing
XX      ls                       list contents of directories    ls
XX      m4                       compleat macro pre-processor    m4
XX      mail                 electronic (network) mail system    mail
XX      make                          maintain program groups    make
XX      man                   on-line UNIX programmers manual    man
XX      mkdir                                make a directory    mkdir
XX      more                             file perusal program    more
XX      mt                       manipulate the magtape drive
XX      mv                              move and rename files    mv
XX      passwd                          change login password    password
XX      pc                                    pascal compiler    pascal
XX      pi                                 pascal interpreter
XX      plot                                 graphics filters    graphics
XX      postnews                        submit a news article    news
XX      pr                 paginate, label, and collate files    pr
XX      print                         paginate and print file    printing
XX      ps                             display process status    ps
XX      pwd                   print current working directory    shell
XX      quota                            print current quotas    quota
XX      ratfor                 rational fortran pre-processor
XX      rcp                                  Remote file copy    copy
XX      reset          reset the tty driver to sensible state    terminals
XX      rm                        remove files or directories    rm
XX      rsh                  run a command on a remote system    rsh
XX      ruptime           show status of all hosts on network    ruptime
XX      rwho               show who is logged in on all hosts    rwho
XX      script             make a typescript of login session    script
XX      sed                            stream editor (filter)    sed
XX      sh                       standard command interpreter
XX      slam               discrete-event simulation language
XX      sort                             sort and merge files    sort
XX      spell                            find spelling errors    spell
XX      spice            accurate low-level circuit simulator    cad
XX      spitbol                  SNOBOL4 language interpreter    spitbol
XX      spline                       interpolate smooth curve    graphics
XX      split                        split a file into pieces    split
XX      su                        substitute user temporarily    su
XX      tail                      deliver last part of a file    tail
XX      talk               talk to another user on the screen    talk
XX      tbl                              format pretty tables    documents
XX      tee                                      pipe fitting    tee
XX      tr                               translate characters    tr
XX      tset                  set up terminal characteristics    terminals
XX      tty                         print name of current tty    terminals
XX      uniq           filter out duplicate lines from stream    uniq
XX      uptime               how long has the system been up?    w
XX      vi                                      visual editor    vi
XX      vlsi tools                 Berkeley VSLI design tools    cad
XX      vnews                full-screen news-reading program    news
XX      w          who is on the system? What are they up to?    w
XX      whatis                     describe what a program is    whatis
XX      who                              who is on the system    who
XX      whoami                print current effective user id    whoami
XX      wport          print information about users and ttys    wport
XX      yacc                        LALR(1) compiler-compiler
XX      z           flexible command-based full-screen editor    z


XX	There are many more useful commands and applications programs
XX	available.  For more information, see section 1 of the UNIX
XX	PROGRAMMER'S MANUAL, or ask a consultant.

@//E*O*F help.dir/COMMANDS.HLP//
chmod u=rw,g=rw,o=rw help.dir/COMMANDS.HLP
 
echo x - help.dir/date.HLP
sed 's/^XX//' > "help.dir/date.HLP" <<'@//E*O*F help.dir/date.HLP//'

XX	The command `date' returns the system time and date.
XX	The form in which it is returned uses three-letter
XX	abbreviations for days of the week and months of the
XX	year.  Time is given in military (24-hr) style.

XX		% date
XX		Tue Feb 30 13:38:31 CST 1985

@//E*O*F help.dir/date.HLP//
chmod u=rw,g=rw,o=rw help.dir/date.HLP
 
echo x - help.dir/su.HLP
sed 's/^XX//' > "help.dir/su.HLP" <<'@//E*O*F help.dir/su.HLP//'

XX	Su subsitutes a new user identity on top of the current one.
XX	The syntax of  su  is simple:

XX	    su  [ username ]

XX	Usually, su is used to substitute a new user identity for
XX	the purpose of accessing files or programs owned by that
XX	user.  For instance,

XX		% su cs456t5

XX	might be used to substitute the cs456 term 5 user identity
XX	to work on a team report.

XX	If the user whose identity you are trying to assume has a
XX	password, su will insist on you typing this password correctly
XX	before granting you the new identity.

XX	When given no parameters, su assumes you wish to substitute the
XX	"root" user identity.  Root wields all system privileges and
XX	powers.  The command

XX		% su

XX	is therefore used only by system staff.

XX	To exit from the shell created by su, type the command `exit'.

XX		% su cs456t7
XX		Password: ...
XX		456> vi report.nroff
XX		456> nroff -me report.nroff | lpr
XX		456> exit
XX		% 

@//E*O*F help.dir/su.HLP//
chmod u=rw,g=rw,o=rw help.dir/su.HLP
 
echo x - help.dir/su.MANUAL
sed 's/^XX//' > "help.dir/su.MANUAL" <<'@//E*O*F help.dir/su.MANUAL//'
XX man 1 su
@//E*O*F help.dir/su.MANUAL//
chmod u=rwx,g=rwx,o=rwx help.dir/su.MANUAL
 
echo x - help.dir/who.HLP
sed 's/^XX//' > "help.dir/who.HLP" <<'@//E*O*F help.dir/who.HLP//'

XX	Who is a command to find out what users are on the system and
XX	when they logged on.  To use this command, just type

XX	%who

@//E*O*F help.dir/who.HLP//
chmod u=rw,g=rw,o=rw help.dir/who.HLP
 
echo x - help.dir/who.MANUAL
sed 's/^XX//' > "help.dir/who.MANUAL" <<'@//E*O*F help.dir/who.MANUAL//'
XX man 1 who
@//E*O*F help.dir/who.MANUAL//
chmod u=rwx,g=rwx,o=rwx help.dir/who.MANUAL
 
echo mkdir - help.dir/vi
mkdir help.dir/vi
chmod u=rwx,g=rwx,o=rwx help.dir/vi
 
echo mkdir - help.dir/vi/commands
mkdir help.dir/vi/commands
chmod u=rwx,g=rwx,o=rwx help.dir/vi/commands
 
echo x - help.dir/vi/options.HLP
sed 's/^XX//' > "help.dir/vi/options.HLP" <<'@//E*O*F help.dir/vi/options.HLP//'

XX	Many parameters of the vi editor are controlled by option
XX	settings: search modes, margins, tabs, line numbers, etc.
XX	To set these modes the way you like, you can modify the
XX	values of these options.

XX	There are two ways to set the value of an option: interactively
XX	or thru initialization.  The environment variable `EXINIT' is
XX	used by vi to set the initial option values.   You could have
XX	a line in your ".login" file like this:

XX	  setenv EXINIT 'set magic ignorecase nowrapscan shiftwidth=8'

XX	to set the logical options magic, ignorecase, and wrapscan, and
XX	to set the numerical option shiftwidth.

XX	You can also set options while in the vi edit session.  Just
XX	type colon ':' and to the prompt type:

XX		set autowrite

XX	to set the autowrite option.

XX	Note that setting options is done in "last line" state.

XX	Here is a list of useful options, numerical options are 
XX	followed by a '=n'.  You set their value with the `=###'
XX	construct shown above.  Boolean options are reset by preceding
XX	their name with "no" (e.g. "nomagic").

XX	  autowrite	- write buffer before changing files

XX	  lisp		- set up lisp mode

XX	  ignorecase	- ignore case of letters in searches

XX	  magic		- allow pattern-matching expression searches

XX	  number	- number lines

XX	  redraw	- simulate a smart terminal

XX	  shiftwidth=n	- set shift-command widths to n

XX	  showmatch	- show matching parentheses as they are closed

XX	  wrapmargin=n	- wrap lines n columns from right margin


XX	Personally, I prefer the following options combination:

XX	  setenv EXINIT 'set redraw noslowopen showmatch magic optimize'

XX	For a complete list of options, get into vi and type ":set all".

@//E*O*F help.dir/vi/options.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/options.HLP
 
echo x - help.dir/vi/starting.HLP
sed 's/^XX//' > "help.dir/vi/starting.HLP" <<'@//E*O*F help.dir/vi/starting.HLP//'

XX	To enter vi, just type `vi' and the name of the file to
XX	edit.

XX	  % vi newhelp.c

XX	This will cause vi to read the file, and set up for you to
XX	edit it.  If the file does not exist, vi will tell you so.
XX	Editing a new file just gives you a blank buffer to start.

XX	There are options to vi that allow you to start up your
XX	editing session differently:

XX	  % vi + newhelp.c	# start editing at the bottom of the file

XX	  % vi +50 oldhelp.c    # start editing at line 50

XX	  % vi +/main help.c	# start editing at first occurence of `main'

XX	  % vi -r prog2.p       # recover edit session of prog2.p from last
XX				# time system crashed

@//E*O*F help.dir/vi/starting.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/starting.HLP
 
echo x - help.dir/vi/states.HLP
sed 's/^XX//' > "help.dir/vi/states.HLP" <<'@//E*O*F help.dir/vi/states.HLP//'

XX	Vi operates in one of three basic states.  When you start the
XX	edit session, you are in "visual" state.  The text insertion
XX	commands (i, a, c., etc...) use "insert" state.  Searches
XX	and special commands are performed in "last line" state.
XX	
XX	"Visual" state lets you move around and look at the file.  To
XX	put in new text or change old text you use "insert" state.  To
XX	execute complicated commands (e.g. 1,.s/x/X/g) you type a colon
XX	to enter "Last line" state.  In "last line" state you are typing
XX	to a prompt at the bottom of the screen.


XX	STATE SUMMARY:

XX		-------------   insert cmd.s      -------------
XX		|	    | ------------------> |           |
XX		|  VISUAL   |                     |   INSERT  |
XX		|           | <------------------ |           | 
XX		-------------      ESCape key     -------------
XX		 |        ^
XX	     '?' |        | 
XX	     '/' |	  | RETURN or
XX	     ':' |        | ESCape
XX		 |        |
XX		 V        |
XX		-------------
XX		|           |
XX		| LAST LINE |
XX		|           |
XX		-------------

@//E*O*F help.dir/vi/states.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/states.HLP
 
echo x - help.dir/vi/commands/change.HLP
sed 's/^XX//' > "help.dir/vi/commands/change.HLP" <<'@//E*O*F help.dir/vi/commands/change.HLP//'

XX	Change is an operator to replace text.  It takes the scope
XX	of its "changing" from a following motion command.  
XX	For instance, 'ce' sets up to change text up to the end
XX	of the current word.  

XX	Changing text is done in "insert" state.  Here are some
XX	examples of command sequences to change text:

XX	  ce	change to end of word
XX	  c$	change to end of line
XX	  c/pat	change to first occurence of pat
XX	  c)	change to end of sentence
XX	
@//E*O*F help.dir/vi/commands/change.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/commands/change.HLP
 
echo x - help.dir/vi/commands/delete.HLP
sed 's/^XX//' > "help.dir/vi/commands/delete.HLP" <<'@//E*O*F help.dir/vi/commands/delete.HLP//'

XX	The letter 'd' is the delete operator in vi.  Because it is
XX	an operator, it has no effect by itself; but requires a 
XX	motion command to tell it the scope of the deletion.  As
XX	a special case, "dd" deletes the entire current line.

XX	So, what can we do with this delete operator?  Basically,
XX	'd' followed by any command that would move the cursor deletes
XX	text up to and including where the cursor would have gone for
XX	that motion.

XX	For example:

XX	  de	delete 'til end of word
XX	  d^	delete back to beginning of line
XX	  df:	delete until next occurence of a ':'	
XX	  dL	delete to bottom of screen
XX	  d/how	delete up to next occurrence of "how"

XX	  d?^[a-q]*:
XX		delete back to next line which matches "^[a-q]*:"


XX	Deletions are saved in queue of 10 buffers, numbered 1 thru 10.
XX	The most recent deletion is always in 1.  You can get back
XX	your most recent deletion with 'p', and other deletions
XX	with `"np' where " is itself, and n is the number of the buffer.

XX	Therefore, to reverse the order of 3 lines, you could use 
XX	this sequence of four commands:

XX		ddddp"2p
XX		 
@//E*O*F help.dir/vi/commands/delete.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/commands/delete.HLP
 
echo x - help.dir/vi/commands/funky.HLP
sed 's/^XX//' > "help.dir/vi/commands/funky.HLP" <<'@//E*O*F help.dir/vi/commands/funky.HLP//'

XX	To help you learn vi a little better, here are some 
XX	funky command sequences that will do powerful things
XX	in vi.

XX	1)	Piping your buffer thru a command

XX	  Let's say you want to quote something in a letter or
XX	  other text, by making it all upper-case.  
XX	  You could do this in vi command state:
XX	
XX		10!!tr 'a-z' 'A-Z'

XX	  Another example: let's say you needed to sort a
XX	  buffer alphabetically.  You could use this sequence
XX	  in vi to pipe the whole buffer to sort(1) and back again.

XX		1G!Gsort -df	
XX		

XX	2)	Pattern matching and replacement

XX	  The general pattern-match-and-replacement capabilities
XX	  of ex(1) are excellent.  They even provide interactive
XX	  query-replace.

XX	  Let's say you need replace the strings "XMACnnn' where 
XX	  'nnn' is a number, by 'ZMACROnnn' in almost every place
XX	  it occurs.  You could use this interactive replace to do
XX	  the job

XX		1,$s/XMAC\([0-9]*\)/ZMACRO\1/c

XX	  Each time vi finds a candidate for replacement, it will 
XX	  display the line on which was found and you can type
XX	  "yes" or "no" to replace or not replace.  For more info
XX	  on regular-expression pattern-matching and area addressing,
XX	  see "The Ex Reference Manual".


XX	3)	Macros  	(Yes, really!)

XX	  Vi has a limited macro facility that is part of ex(1).
XX	  The macros written using this facility can perform an
XX	  vi command, but have no parameters and do not nest.

XX	  Macros are defined using the ":map" command.  The basic
XX	  syntax is:
XX			:map lhs rhs

XX	  The lhs should be a single character (such as 'E' or '+')
XX	  and may be a control character if quoted with ^V.  Let's
XX	  define a macro to start up an nroff paragraph.  The command
XX	  character will be 'P'.

XX			:map P oi.pp^V^[o

XX	  You can learn more about macros in section 6.9 of
XX	  "An Introduction to Display Editing with Vi".


XX	4) 	Abbreviations

XX	  You can define abbreviations with the ex command 'ab'.
XX	  For instance, to define "ax" as an abbreviation for
XX	  "AIRX project", you would do this:

XX		:ab ax AIRX project

XX	  Abbreviations are different from macros in that they are
XX	  expanded in insert state, and they only work when the
XX	  lhs is a single word (i.e. if 'ax' were part of a longer
XX	  word it would be left alone).

@//E*O*F help.dir/vi/commands/funky.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/commands/funky.HLP
 
echo x - help.dir/vi/commands/insert.HLP
sed 's/^XX//' > "help.dir/vi/commands/insert.HLP" <<'@//E*O*F help.dir/vi/commands/insert.HLP//'

XX	The main way to put text in your buffer in vi is insert.
XX	Several commands enter "insert" state:

XX	  i	insert text right here
XX	  a	insert text to the right of right here
XX	  A	insert text at the end of the line
XX	  I	insert text at the beginning of this line
XX	  o	insert text on a following blank line
XX	  O	insert text on a preceding blank line

XX	Insert state is terminated with the ESCape key. 
XX	You can also terminate insert with ^C (intr) but
XX	that ABORTs the insert state, and your text is lost.
XX	Note that insert state IS line oriented, when you have
XX	finished inserting each line, that line is in the buffer
XX	to stay.

XX	Several control characters have special meaning to vi
XX	when you are inserting text, so they will cause actions
XX	rather than be inserted.  Do not be alarmed, this kind
XX	of ragged non-parameteric functionality is common in vi.
XX		
XX	The following commands work within insert state:

XX	  ^H	erase last character
XX	  ^W	erase last word
XX	  ^U	erase this insert line
XX	  \	quote next character
XX	  ^V	really really quote next character

@//E*O*F help.dir/vi/commands/insert.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/commands/insert.HLP
 
echo x - help.dir/vi/commands/other_commands.HLP
sed 's/^XX//' > "help.dir/vi/commands/other_commands.HLP" <<'@//E*O*F help.dir/vi/commands/other_commands.HLP//'

XX	Here is a list of other useful commands for vi.  For
XX	a comprehensive list of commands, see the "VI QUICK
XX	REFERENCE" card.

XX	:wq	write and quit
XX	:e xxx	edit file 'xxx'
XX	:sh	run a subshell
XX	
XX	n	repeat last search
XX	N	repeat last search but in opposite direction
XX	%	find matching brace or parenthesis
XX	)	forward to next sentence
XX		or to next s-expr (lisp option)
XX	(	backward sentence
XX		or back s-expr (lisp option)
XX	
XX	''	back to previous location
XX	mX	mark this spot with letter 'X'
XX	'X	go back to spot marked with 'X'

XX	J	join this line and next
XX	D	delete to end of line (same as d$)
XX	X	delete character before cursor

XX	>	left shift operator
XX	<	right shift operator
XX	!	filter thru command operator
XX			
XX	:[addr1,addr2]s/pattern/replacement/[option]
XX		general pattern-match replacement (see ed(1) and ex(1))

XX	:r fn	read file "fn" into buffer
XX	
XX	:[addr1,addr2]d
XX		delete everything between addr1 and addr2
XX		
@//E*O*F help.dir/vi/commands/other_commands.HLP//
chmod u=rw,g=rw,o=rw help.dir/vi/commands/other_commands.HLP
 
echo Inspecting for damage in transit...
temp=/tmp/sharin$$; dtemp=/tmp/sharout$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
       2      24     127 .HLP
     133     744    8433 COMMANDS.HLP
       9      44     252 date.HLP
      36     155     898 su.HLP
       1       3      10 su.MANUAL
       6      25     126 who.HLP
       1       3      11 who.MANUAL
      55     260    1652 options.HLP
      22     122     634 starting.HLP
      32     149    1008 states.HLP
      14      77     434 change.HLP
      33     188    1071 delete.HLP
      74     354    2217 funky.HLP
      31     181    1051 insert.HLP
      37     147     907 other_commands.HLP
     486    2476   18831 total
!!!
wc  help.dir/.HLP help.dir/COMMANDS.HLP help.dir/date.HLP help.dir/su.HLP help.dir/su.MANUAL help.dir/who.HLP help.dir/who.MANUAL help.dir/vi/options.HLP help.dir/vi/starting.HLP help.dir/vi/states.HLP help.dir/vi/commands/change.HLP help.dir/vi/commands/delete.HLP help.dir/vi/commands/funky.HLP help.dir/vi/commands/insert.HLP help.dir/vi/commands/other_commands.HLP | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if test -s $dtemp
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0