summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sed/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c
index a5ff462..36a3299 100644
--- a/usr.bin/sed/main.c
+++ b/usr.bin/sed/main.c
@@ -125,6 +125,7 @@ int
main(int argc, char *argv[])
{
int c, fflag;
+ char *temp_arg;
(void) setlocale(LC_ALL, "");
@@ -146,7 +147,11 @@ main(int argc, char *argv[])
break;
case 'e':
eflag = 1;
- add_compunit(CU_STRING, optarg);
+ if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL)
+ err(1, "malloc");
+ strcpy(temp_arg, optarg);
+ strcat(temp_arg, "\n");
+ add_compunit(CU_STRING, temp_arg);
break;
case 'f':
fflag = 1;
OpenPOWER on IntegriCloud