# HG changeset patch # User markus schnalke # Date 1407859704 -7200 # Node ID a09d0630f05b2b4d78205d4d10b4e12ac689d5d8 # Parent db609ba8ab93eb524ac2933275f6a5a326ec0a38 removed unnecessary command line options diff -r db609ba8ab93 -r a09d0630f05b ed.1 --- a/ed.1 Mon Sep 05 16:36:26 2011 +0200 +++ b/ed.1 Tue Aug 12 18:08:24 2014 +0200 @@ -38,7 +38,7 @@ .SH NAME ed \- text editor .SH SYNOPSIS -\fBed\fR [\fB\-\fR\ |\ \fB\-s\fR] [\fB\-p\fI\ prompt\fR] [\fIname\fR] +\fBed\fR [\fB\-\fR\] [\fIname\fR] .SH DESCRIPTION .I Ed is the standard text editor. @@ -55,8 +55,6 @@ buffer so that it can be edited. The optional .B \- -or -.B \-s suppresses the printing of character counts by .IR e , @@ -66,13 +64,6 @@ commands, and of the `!' after completion of a shell command. .PP -With the -.B \-p -option, -the given -.I prompt -string is printed before each command is read. -.PP .I Ed operates on a copy of any file it is editing; changes made in the copy have no effect on the file until a @@ -564,10 +555,7 @@ .B P This command causes a prompt to be printed before following commands are read. -The default prompt is a `*' character, -but can be set with the -.I \-p -command line option (which also enables the prompt). +The default prompt is a `*' character. Another .I P disables the prompt. diff -r db609ba8ab93 -r a09d0630f05b ed.c --- a/ed.c Mon Sep 05 16:36:26 2011 +0200 +++ b/ed.c Tue Aug 12 18:08:24 2014 +0200 @@ -175,7 +175,7 @@ static jmp_buf savej; -static void usage(char, int); +static void usage(char); static void commands(void); static long *address(void); static void setdot(void); @@ -295,46 +295,13 @@ sigset(SIGTERM, quit); oldpipe = sigset(SIGPIPE, onpipe); argv++; - while (argc > 1 && **argv=='-') { - if ((*argv)[1] == '\0') { + if (argc > 1 && **argv=='-') { + if ((*argv)[1]=='\0') { vflag = 0; - goto next; - } else if ((*argv)[1] == '-' && (*argv)[2] == '\0') { - argv++; - argc--; - break; + } else { + usage((*argv)[1]); } - letter: switch((*argv)[1]) { - - case 's': - vflag = 0; - break; - - case 'q': - sigset(SIGQUIT, SIG_DFL); - vflag = 1; - break; - - case 'p': - if ((*argv)[2]) - prompt = &(*argv)[2]; - else if (argv[1]) { - prompt = argv[1]; - argv++; - argc--; - } else - usage((*argv)[1], 1); - Pflag = 1; - goto next; - - default: - usage((*argv)[1], 0); - } - if ((*argv)[2]) { - (*argv)++; - goto letter; - } - next: argv++; + argv++; argc--; } @@ -372,20 +339,17 @@ } static void -usage(char c, int misarg) +usage(char c) { if (c) { write(2, progname, strlen(progname)); - if (misarg) - write(2, ": option requires an argument -- ", 33); - else - write(2, ": illegal option -- ", 20); + write(2, ": illegal option -- ", 20); write(2, &c, 1); write(2, "\n", 1); } write(2, "usage: ", 7); write(2, progname, strlen(progname)); - write(2, " [- | -s] [-p string] [file]\n", 29); + write(2, " [-] [file]\n", 12); exit(2); }