Page MenuHomeFreeBSD

D16798.id46915.diff
No OneTemporary

D16798.id46915.diff

Index: usr.bin/sed/extern.h
===================================================================
--- usr.bin/sed/extern.h
+++ usr.bin/sed/extern.h
@@ -46,6 +46,8 @@
extern const char *fname, *outfname;
extern FILE *infile, *outfile;
extern int rflags; /* regex flags to use */
+extern const char *inplace;
+extern int quit;
void cfclose(struct s_command *, struct s_command *);
void compile(void);
Index: usr.bin/sed/main.c
===================================================================
--- usr.bin/sed/main.c
+++ usr.bin/sed/main.c
@@ -102,6 +102,7 @@
int aflag, eflag, nflag;
int rflags = 0;
+int quit = 0;
static int rval; /* Exit status */
static int ispan; /* Whether inplace editing spans across files */
@@ -115,7 +116,7 @@
const char *outfname; /* Output file name */
static char oldfname[PATH_MAX]; /* Old file name (for in-place editing) */
static char tmpfname[PATH_MAX]; /* Temporary file name (for in-place editing) */
-static const char *inplace; /* Inplace edit file extension. */
+const char *inplace; /* Inplace edit file extension. */
u_long linenum;
static void add_compunit(enum e_cut, char *);
@@ -338,7 +339,7 @@
}
for (;;) {
- if (infile != NULL && (c = getc(infile)) != EOF) {
+ if (infile != NULL && (c = getc(infile)) != EOF && !quit) {
(void)ungetc(c, infile);
break;
}
Index: usr.bin/sed/process.c
===================================================================
--- usr.bin/sed/process.c
+++ usr.bin/sed/process.c
@@ -210,10 +210,14 @@
}
break;
case 'q':
- if (!nflag && !pd)
- OUT();
- flush_appends();
- exit(0);
+ if (inplace == NULL) {
+ if (!nflag && !pd)
+ OUT();
+ flush_appends();
+ exit(0);
+ }
+ quit = 1;
+ break;
case 'r':
if (appendx >= appendnum)
if ((appends = realloc(appends,

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 8, 9:19 PM (19 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28498896
Default Alt Text
D16798.id46915.diff (1 KB)

Event Timeline