ed: use arg.h

This commit is contained in:
Quentin Rameau 2015-12-15 15:45:16 +01:00 committed by sin
parent c5b36e1760
commit d1bef890ea
1 changed files with 15 additions and 20 deletions

25
ed.c
View File

@ -13,6 +13,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "arg.h"
#define REGEXSIZE 100 #define REGEXSIZE 100
#define LINESIZE 80 #define LINESIZE 80
#define NUMLINES 32 #define NUMLINES 32
@ -1332,27 +1334,20 @@ sighup(int dummy)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *p; ARGBEGIN {
case 'p':
while (*++argv) { prompt = EARGF(usage());
if (argv[0][0] != '-') optprompt = 1;
break; break;
for (p = argv[0] + 1; *p; ++p) {
switch (*p) {
case 's': case 's':
optdiag = 0; optdiag = 0;
break; break;
case 'p':
if (!*++argv)
usage();
prompt = *argv;
optprompt = 1;
break;
default: default:
usage(); usage();
} } ARGEND
}
} if (argc > 1)
usage();
signal(SIGINT, sigintr); signal(SIGINT, sigintr);
signal(SIGHUP, sighup); signal(SIGHUP, sighup);