Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144328941
D16798.id46915.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D16798.id46915.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D16798: sed: fix -i option behavior with 'q' command
Attached
Detach File
Event Timeline
Log In to Comment