New man page for dired and recent changes

utzoo!decvax!harpo!utah-cs!lepreau utzoo!decvax!harpo!utah-cs!lepreau
Mon Jun 7 06:03:48 AEST 1982


Comments on dired:
--Dired is INVALUABLE for dealing with dirs with weird filenames, such as when
    unwedging uucp.  Its 2 window mode is great for quick directory perusal.
--It should use curses. (but why mess with running code)
--It runs fine on 4.1bsd also.

Here are some recent changes we have made to dired at Utah.

-The most important is an up to date man page.
-Addition of another command: '.' == repeat last shell command, substituting
	the current entry name for any metachars.  Very useful.
-MAXFILES bigger if on a vax.
-'q' as well as INT will now exit from 't'yping a file, as in "more".
-some buffers enlarged.
-Note that our version defaults to 2-window mode.  The initial value
	of "scrlen" controls this, if you want to change it.

Here are: new dired.1, new dired.hlp, and diffs -e and -c of dired.c.

: This is a shell script to unpack the distribution.
: Just run it.
echo Extracting dired.1
cat <<'EnDoFiNpUt' >dired.1
.TH DIRED LOCAL
.SH NAME
dired \- directory editor
.SH SYNOPSIS
.B dired
.nf
[ \-[s|r][nsrw] ] [ \-w[f|h|number] ] [ [dir-name|file-list] ]
.fi
.SH DESCRIPTION
Dired displays a long-form ls directory listing
on the screen
of a display terminal and allows you to 'edit' and peruse that listing by
moving up and down it, deleting, editing, and displaying entries.
Your shell TERM variable should be set to the standard
string which the Berkeley termcap library uses for distinguishing
terminals.
With no argument, the connected directory is used. With only one
argument, the argument is interpreted as a directory and it is used.
With multiple arguments, the arguments are interpreted as filenames.
Dired then types 'Reading' and gets information about the various
files/directories in your specification. This may take a short while
(depending on how many you give it), so it types one period (.) after
the word 'reading' for
every 10 files it has gathered information about. With this, you
can keep track of its progress. Interrupts, hangups, and the like
are disabled since your terminal is put into a special mode that
is only changed when you quit with the 'q' command.
.PP
Options, which are inherited by recursive invocations of dired:
.TP
.B \-[sr][n|s|r|w]
Sort or reverse sort by Name, Size, Read date, or Write date respectively.
"Normal sort" is the order you are most likely to desire, so is largest first
for size, and most recent for read and write date sorts.  Default is to
sort by name.
.TP
.B \-w[f|h|number]
Use 
.B number
lines for the directory index window, reserving the other half for quick
file display.
.B f
means use the full screen for the index.
.B h
means use half of the screen for the index.
.B h
is the default.
.PP
The format of the screen is as follows: each line represents a file (or
directory), the name of which is right-most. From left the fields
are: mode, link count, owner, size, write date and name. See ls(1)
for a description of what each of these mean. You move up and down
the column immediately left to the filename.  The bottom
half of the screen is used for displaying files via the 't'ype command.
If there are too many files to all fit on one window, more windows
are allocated. The 'f' and 'b' commands can be used for stepping forward
and backward windows.
The last screen line is used as an 'echo' line for displaying error messages
and reading arguments.

Commands consist of single characters, with any necessary arguments
prompted for, and echoed in the 'echo' line. The only commands which
take arguments are '!' (exclamation point), 'r', and 's'.

Command list:
.TP 5
.RB <cr>
.br
.ns
.TP 5
.RB <lf>
.br
.ns
.TP 5
.RB ^N
steps to the next file. If this crosses a window boundary, the
next window is displayed with a one line overlap.
.TP 5
.RB ^
.br
.ns
.TP 5
.RB -
.br
.ns
.TP 5
.RB <backspace>
.br
.ns
.TP 5
.RB ^P
steps to previous file. If this crosses a window boundary, the
previous window is displayed with a one line overlap.
.TP 5
.RB !
prompts for a system command to invoke. The command is executed,
and confirmation is required before returning to the display.  
All
.B %
characters in the command are replaced with the full pathname of the current
entry, and all
.B #
chars are replaced with just the trailing filename component
(what you see on the screen).
.TP 5
.RB .
Repeats the previous
.B !
shell command, substituting the current entry for any special chars (%#)
in the original command.
.TP 5
.RB a
aborts completely out of dired. No deletions are done.
.TP 5
.RB b
goes backward a window, leaving a one line overlap.
.TP 5
.RB c
refreshes the current line.
.TP 5
.RB d
marks for deletion the current entry. Upon exit and confirmation,
this entry will be deleted.  WARNING: this includes directories!
If it is a directory, everything in it and underneath it will be
removed.
.TP 5
.RB e
runs the editor defined in your EDITOR environment variable
upon the current file.  If EDITOR is not defined, 'ex' is used.
However, if the current
file is a directory it is not edited, but rather, dired forks
a copy of itself upon that directory. In this manner, you can
examine the contents of that directory and thus move down
the directory hierarchy.
.TP 5
.RB f
goes forward a window, leaving a one line overlap.
.TP 5
.RB h
.br
.ns
.TP 5
.RB ?
displays a help file.
.TP 5
.RB l
.br
.ns
.TP 5
.RB ^L
refreshes the current window.
.TP 5
.RB m
runs Berkeley's
.B more
program on the current entry.
.TP 5
.RB p
prints the current file on the line-printer in small font (pr2).
.TP 5
.RB P
prints the current file on the line-printer in normal font.
.TP 5
.RB q
exits the program, displaying files marked for deletion and requiring
confirmation before deleting them. If no confirmation is given
(typing anything other than y), dired goes back to its display.
.TP 5
.RB r
.br
.ns
.TP 5
.RB s
sorts the file list by various fields: name, read date, size, write
date. Only the first letter (e.g. n, r, s, or w) is required after
giving the r and s commands. s sorts in increasing alphabetic, decreasing
size, newest to oldest dates. r reverses the sense of s. For the
n, s, and w subcommands, the date field is the write date. For
the r subcommand, the date field is the read date. Whenever a sort
is done, you are positioned at the top of the list afterwards.
A sort can be aborted via ^G.
.TP 5
.RB t
types the file out to the terminal, which is
considerably faster than firing up an editor on the file. If
in two-window mode, the bottom window is used, pausing after
each screenful.
The type-out may be interrupted by Ctrl-C or 'q'.
.TP 5
.RB T
same as 't' but without any pauses.
.TP 5
.RB u
undeletes the current entry, if it was previously marked for deletion.
.SH FILES
/usr/help/dired.hlp    help file for ? and h
.SH SEE ALSO
ls(1)
.SH DIAGNOSTICS
The error messages are basically self-explanatory.
.SH AUTHOR
Stuart Mclure Cracraft
.br
Enhancements by Jay Lepreau
.SH BUGS
Long lines sometimes screw up the 't' display.
.br
Needs a search (for a given file) command.
'EnDoFiNpUt'
echo Extracting dired.hlp
cat <<'EnDoFiNpUt' >dired.hlp
Dired commands:
	<crlf>, ^N	go to next entry
	^, -, <bsp>,^P 	go to previous entry
	! cmd		execute 'cmd', replacing % by full pathname, # by tail
	.		executes last '!' cmd, substituting current filename
	a		aborts out completely
	b		backward a window
	c		refresh current line
	d		mark current entry for deletion
	e		edit current entry via editor or via dired if directory
	f		forward a window
	h, ?		display this help blurb
	l, ^L	     	refresh current window
	m		Use 'more' to display the current entry.
	p		print current entry on line printer in small font (pr2)
	P		print current entry on line printer in large font
	q		exit
	r [n,r,s,w]	reverse sort by name/read date/size/write date
	s		same as r but normal sort
	t		type current entry on terminal & pause in 2 window mode,
			abort with 'q' or interrupt (^C).
	T		type current entry on terminal, no pause.
	u		undelete current entry
'EnDoFiNpUt'
echo Extracting dired.e
cat <<'EnDoFiNpUt' >dired.e
	1291c
		if (getchar() == 'q')
		    sigint = 1;		/* simulate interrupt */
	.
	350a
			    strcpy(combuf, tempbuf);	/* remember the command */
	.
	349c
			    char     bldbuf[256];
	.
	345c
			if ((command == '!' ? gets(tempbuf) : strcpy(tempbuf, combuf))
					      != NULL && tempbuf[0] != '\0') {
	.
	339a
		    case '.':		/* repeat the previous ! command */
	.
	288c
		printf("\n?Empty directory\007\n");
	.
	186c
	    char    nambuf[256];
	    char    combuf[256];	/* Holds last ! command */
	.
	162c
	        tcapbuf[256];
	.
	148c
	int     scrlen = 999;	/* Default length of dired index part of screen: */
			/* 999 ==> 2 windows (half size), 0 ==> 1 window (full size) */
	.
	141c
	char    tempbuf[256];		/* Random temporary buffer */
	.
	97a
	#endif
	
	.
	96a
	#else
	#define MAXFILES	1000	/* Probably should be even bigger */
	#endif
	.
	95a
	#ifndef MAXFILES /* This way can override on the cmd line for a huge version */
	
	#ifndef vax
	.
	16c
	 *			decvax!{harpo,randvax}!utah-cs!lepreau	      *
	.
'EnDoFiNpUt'
echo Extracting dired.diff
cat <<'EnDoFiNpUt' >dired.diff
*** ../Odired.c	Mon Jun  7 04:19:49 1982
--- ../dired.c	Mon Jun  7 04:58:37 1982
***************
*** 15,17
   *	so would I:	Jay Lepreau 	lepreau at utah-20,	      *
!  *				decvax!randvax!utah-cs!lepreau	      *
   **********************************************************************

--- 15,17 -----
   *	so would I:	Jay Lepreau 	lepreau at utah-20,	      *
!  *			decvax!{harpo,randvax}!utah-cs!lepreau	      *
   **********************************************************************
***************
*** 95,96
  
  #define MAXFILES	500	/* Max number of files we can handle */

--- 95,99 -----
  
+ #ifndef MAXFILES /* This way can override on the cmd line for a huge version */
+ 
+ #ifndef vax
  #define MAXFILES	500	/* Max number of files we can handle */
***************
*** 96,97
  #define MAXFILES	500	/* Max number of files we can handle */
  

--- 99,103 -----
  #define MAXFILES	500	/* Max number of files we can handle */
+ #else
+ #define MAXFILES	1000	/* Probably should be even bigger */
+ #endif
  
***************
*** 97,98
  
  struct lbuf

--- 103,106 -----
  
+ #endif
+ 
  struct lbuf
***************
*** 140,142
  int     lastuid = -1;		/* Last uid/gid we handled */
! char    tempbuf[128];		/* Random temporary buffer */
  char    userbuf[35];		/* Temporary buffer for user name */

--- 148,150 -----
  int     lastuid = -1;		/* Last uid/gid we handled */
! char    tempbuf[256];		/* Random temporary buffer */
  char    userbuf[35];		/* Temporary buffer for user name */
***************
*** 147,149
  int     curline = 0;		/* Line that we're on */
! int     scrlen =  0;		/* Length of screen - dired part: half size */
  int	Worklen = 0;		/* Length of 'working window', the other part*/

--- 155,158 -----
  int     curline = 0;		/* Line that we're on */
! int     scrlen = 999;	/* Default length of dired index part of screen: */
! 		/* 999 ==> 2 windows (half size), 0 ==> 1 window (full size) */
  int	Worklen = 0;		/* Length of 'working window', the other part*/
***************
*** 161,163
  char    tbuf[1024],
!         tcapbuf[128];
  char   *tgetstr (), *tgoto ();

--- 170,172 -----
  char    tbuf[1024],
!         tcapbuf[256];
  char   *tgetstr (), *tgoto ();
***************
*** 185,187
              status;
!     char    nambuf[128];
      char    command;		/* Holds last command */

--- 194,197 -----
              status;
!     char    nambuf[256];
!     char    combuf[256];	/* Holds last ! command */
      char    command;		/* Holds last command */
***************
*** 287,289
      if (totfiles == 0) {
! 	printf("\n?Empty directory\n");
  	unsetdpy();

--- 297,299 -----
      if (totfiles == 0) {
! 	printf("\n?Empty directory\007\n");
  	unsetdpy();
***************
*** 339,340
  	    case '!': 		/* Execute a system command */
  		telluser ("");

--- 349,351 -----
  	    case '!': 		/* Execute a system command */
+ 	    case '.':		/* repeat the previous ! command */
  		telluser ("");
***************
*** 344,346
  		tempbuf[0] = 'x';	/* dummy kludge */
! 		if (gets(tempbuf) != NULL && tempbuf[0] != '\0') {
  		    extern   char *skipto();

--- 355,358 -----
  		tempbuf[0] = 'x';	/* dummy kludge */
! 		if ((command == '!' ? gets(tempbuf) : strcpy(tempbuf, combuf))
! 				      != NULL && tempbuf[0] != '\0') {
  		    extern   char *skipto();
***************
*** 348,350
  				  *np;		/* new ptr */
! 		    char     bldbuf[70];
  

--- 360,362 -----
  				  *np;		/* new ptr */
! 		    char     bldbuf[256];
  
***************
*** 350,351
  
  		    bldbuf[0] = '\0';	

--- 362,364 -----
  
+ 		    strcpy(combuf, tempbuf);	/* remember the command */
  		    bldbuf[0] = '\0';	
***************
*** 1290,1292
  	curxy(0, Tscrlen);
! 	getchar();
  	ceol();

--- 1303,1306 -----
  	curxy(0, Tscrlen);
! 	if (getchar() == 'q')
! 	    sigint = 1;		/* simulate interrupt */
  	ceol();
'EnDoFiNpUt'
echo Finished



More information about the Comp.sources.unix mailing list