anyone?

On 05/24/18 09:40, Martijn van Duren wrote:
> Since we accept "!" as a full command to system(3), I decided to do even
> more trimming than when BACKWARDS is not defined. This way we trim even
> more LoC and have one less error case.
> 
> Note that running "!!" without a prior command adds an extra empty line
> if suppress diagnostics is not active, because substitution prints the
> replaced line, which would be empty. But this would be identical to
> first running "!" followed by a "!!" with BACKWARDS disabled.
> 
> If people do care about this error message I suggest that we also add
> another case for when the command is completely empty, because right
> now this would work as well:
> $ ed -p'>'
>> !
> !
>> a 
> foo
> .
>> w !
> 4
> 
> OK?
> 
> martijn@
> 
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/bin/ed/main.c,v
> retrieving revision 1.62
> diff -u -p -r1.62 main.c
> --- main.c    24 May 2018 06:24:29 -0000      1.62
> +++ main.c    24 May 2018 07:35:08 -0000
> @@ -1012,20 +1012,13 @@ get_shell_command(void)
>                               REALLOC(buf, n, i + 1, ERR);
>                               buf[i++] = *ibufp++;
>                       }
> -#ifdef BACKWARDS
> -                     else if (shcmd == NULL || *(shcmd + 1) == '\0')
> -#else
> -                     else if (shcmd == NULL)
> -#endif
> -                     {
> -                             seterrmsg("no previous command");
> -                             return ERR;
> -                     } else {
> +                     if (shcmd != NULL) {
>                               REALLOC(buf, n, i + shcmdi, ERR);
>                               for (s = shcmd + 1; s < shcmd + shcmdi;)
>                                       buf[i++] = *s++;
> -                             s = ibufp++;
> +                             s = ibufp;
>                       }
> +                     ibufp++;
>                       break;
>               case '%':
>                       if (*old_filename  == '\0') {
> 

Reply via email to