These are the differences between sed.c 1.15 and sed.c 1.16. They are all bug fixes and standard-conformance fixes. *** Start "gdiff -u ../sed-1.15/sed.c sed.c" in /afs/andrew.cmu.edu/usr11/lord/fsf/sed-1.16/ at 12:38:56 --- ../sed-1.15/sed.c Fri May 21 01:40:49 1993 +++ sed.c Sat May 22 19:59:52 1993 @@ -21,6 +21,7 @@ #define VOID char #endif + #define _GNU_SOURCE #include #ifndef isblank @@ -67,7 +68,7 @@ #endif #endif -char *version_string = "GNU sed version 1.15"; +char *version_string = "GNU sed version 1.16"; /* Struct vector is used to describe a chunk of a compiled sed program. * There is one vector for the main program, and one for each { } pair, @@ -257,7 +258,7 @@ void line_copy P_ ((struct line * from, struct line * to)); void line_append P_ ((struct line * from, struct line * to)); void str_append P_ ((struct line * to, char *string, int length)); -void usage P_ ((void)); +void usage P_ ((int)); extern char *myname; @@ -355,6 +356,7 @@ {"quiet", 0, NULL, 'n'}, {"silent", 0, NULL, 'n'}, {"version", 0, NULL, 'V'}, + {"help", 0, NULL, 'h'}, {NULL, 0, NULL, 0} }; @@ -371,9 +373,8 @@ /* see regex.h */ re_set_syntax (RE_SYNTAX_POSIX_BASIC); - myname = argv[0]; - while ((opt = getopt_long (argc, argv, "ne:f:V", longopts, (int *) 0)) + while ((opt = getopt_long (argc, argv, "hne:f:V", longopts, (int *) 0)) != EOF) { switch (opt) @@ -403,8 +404,12 @@ fprintf (stderr, "%s\n", version_string); exit (0); break; + case 'h': + usage (0); + break; default: - usage (); + usage (4); + break; } } if (e_strings) @@ -415,7 +420,7 @@ if (!compiled) { if (optind == argc) - usage (); + usage (4); compile_string (argv[optind++]); } @@ -528,7 +533,7 @@ int open_line; { struct sed_cmd *cur_cmd; - int ch; + int ch, pch; int slash; VOID *b; unsigned char *string; @@ -548,8 +553,9 @@ skip_comment: do { + pch = ch; ch = inchar (); - if (ch == '\\') + if ((pch == '\\') && (ch == '\n')) ch = inchar (); } while (ch != EOF && (isblank (ch) || ch == '\n' || ch == ';')); @@ -1781,13 +1787,6 @@ input_EOF++; return; } - *p++ = ch; - --n; - if (ch == '\n') - { - line.length = line.alloc - n; - break; - } if (n == 0) { line.text = ck_realloc (line.text, line.alloc * 2); @@ -1795,6 +1794,13 @@ n = line.alloc; line.alloc *= 2; } + *p++ = ch; + --n; + if (ch == '\n') + { + line.length = line.alloc - n; + break; + } } ch = getc (input_file); if (ch != EOF) @@ -1853,11 +1859,12 @@ } void -usage () +usage (status) + int status; { - fprintf (stderr, "\ + fprintf (status ? stderr : stdout, "\ Usage: %s [-nV] [--quiet] [--silent] [--version] [-e script]\n\ [-f script-file] [--expression=script] [--file=script-file] [file...]\n", myname); - exit (4); + exit (status); }