heirloom-ed

changeset 2:a09d0630f05b

removed unnecessary command line options
author markus schnalke <meillo@marmaro.de>
date Tue, 12 Aug 2014 18:08:24 +0200
parents db609ba8ab93
children ac52712b2b5e
files ed.1 ed.c
diffstat 2 files changed, 11 insertions(+), 59 deletions(-) [+]
line diff
     1.1 --- a/ed.1	Mon Sep 05 16:36:26 2011 +0200
     1.2 +++ b/ed.1	Tue Aug 12 18:08:24 2014 +0200
     1.3 @@ -38,7 +38,7 @@
     1.4  .SH NAME
     1.5  ed \- text editor
     1.6  .SH SYNOPSIS
     1.7 -\fBed\fR [\fB\-\fR\ |\ \fB\-s\fR] [\fB\-p\fI\ prompt\fR] [\fIname\fR]
     1.8 +\fBed\fR [\fB\-\fR\] [\fIname\fR]
     1.9  .SH DESCRIPTION
    1.10  .I Ed
    1.11  is the standard text editor.
    1.12 @@ -55,8 +55,6 @@
    1.13  buffer so that it can be edited.
    1.14  The optional
    1.15  .B \-
    1.16 -or
    1.17 -.B \-s
    1.18  suppresses the printing
    1.19  of character counts by
    1.20  .IR e ,
    1.21 @@ -66,13 +64,6 @@
    1.22  commands,
    1.23  and of the `!' after completion of a shell command.
    1.24  .PP
    1.25 -With the
    1.26 -.B \-p
    1.27 -option,
    1.28 -the given
    1.29 -.I prompt
    1.30 -string is printed before each command is read.
    1.31 -.PP
    1.32  .I Ed
    1.33  operates on a copy of any file it is editing; changes made
    1.34  in the copy have no effect on the file until a
    1.35 @@ -564,10 +555,7 @@
    1.36  .B P
    1.37  This command causes a prompt to be printed
    1.38  before following commands are read.
    1.39 -The default prompt is a `*' character,
    1.40 -but can be set with the
    1.41 -.I \-p
    1.42 -command line option (which also enables the prompt).
    1.43 +The default prompt is a `*' character.
    1.44  Another 
    1.45  .I P
    1.46  disables the prompt.
     2.1 --- a/ed.c	Mon Sep 05 16:36:26 2011 +0200
     2.2 +++ b/ed.c	Tue Aug 12 18:08:24 2014 +0200
     2.3 @@ -175,7 +175,7 @@
     2.4  
     2.5  static jmp_buf	savej;
     2.6  
     2.7 -static void	usage(char, int);
     2.8 +static void	usage(char);
     2.9  static void	commands(void);
    2.10  static long	*address(void);
    2.11  static void	setdot(void);
    2.12 @@ -295,46 +295,13 @@
    2.13  		sigset(SIGTERM, quit);
    2.14  	oldpipe = sigset(SIGPIPE, onpipe);
    2.15  	argv++;
    2.16 -	while (argc > 1 && **argv=='-') {
    2.17 -		if ((*argv)[1] == '\0') {
    2.18 +	if (argc > 1 && **argv=='-') {
    2.19 +		if ((*argv)[1]=='\0') {
    2.20  			vflag = 0;
    2.21 -			goto next;
    2.22 -		} else if ((*argv)[1] == '-' && (*argv)[2] == '\0') {
    2.23 -			argv++;
    2.24 -			argc--;
    2.25 -			break;
    2.26 +		} else {
    2.27 +			usage((*argv)[1]);
    2.28  		}
    2.29 -	letter:	switch((*argv)[1]) {
    2.30 -
    2.31 -		case 's':
    2.32 -			vflag = 0;
    2.33 -			break;
    2.34 -
    2.35 -		case 'q':
    2.36 -			sigset(SIGQUIT, SIG_DFL);
    2.37 -			vflag = 1;
    2.38 -			break;
    2.39 -
    2.40 -		case 'p':
    2.41 -			if ((*argv)[2])
    2.42 -				prompt = &(*argv)[2];
    2.43 -			else if (argv[1]) {
    2.44 -				prompt = argv[1];
    2.45 -				argv++;
    2.46 -				argc--;
    2.47 -			} else
    2.48 -				usage((*argv)[1], 1);
    2.49 -			Pflag = 1;
    2.50 -			goto next;
    2.51 -
    2.52 -		default:
    2.53 -			usage((*argv)[1], 0);
    2.54 -		}
    2.55 -		if ((*argv)[2]) {
    2.56 -			(*argv)++;
    2.57 -			goto letter;
    2.58 -		}
    2.59 -	next:	argv++;
    2.60 +		argv++;
    2.61  		argc--;
    2.62  	}
    2.63  
    2.64 @@ -372,20 +339,17 @@
    2.65  }
    2.66  
    2.67  static void
    2.68 -usage(char c, int misarg)
    2.69 +usage(char c)
    2.70  {
    2.71  	if (c) {
    2.72  		write(2, progname, strlen(progname));
    2.73 -		if (misarg)
    2.74 -			write(2, ": option requires an argument -- ", 33);
    2.75 -		else
    2.76 -			write(2, ": illegal option -- ", 20);
    2.77 +		write(2, ": illegal option -- ", 20);
    2.78  		write(2, &c, 1);
    2.79  		write(2, "\n", 1);
    2.80  	}
    2.81  	write(2, "usage: ", 7);
    2.82  	write(2, progname, strlen(progname));
    2.83 -	write(2, " [- | -s] [-p string] [file]\n", 29);
    2.84 +	write(2, " [-] [file]\n", 12);
    2.85  	exit(2);
    2.86  }
    2.87