Re: ed remove BACKWARDS from GET_THIRD_ADDR

2018-06-15 Thread Martijn van Duren
ping

On 06/02/18 15:51, Martijn van Duren wrote:
> Hello tech@,
> 
> The following patch removes the non-backwards case for GET_THIRD_ADDR.  
> POSIX states nothing about making it optional, and since it is our and
> NetBSD's current behaviour, just leave it as is.
> 
> I can see how for interactive use making the 3rd argument default to
> the current address could make life easier, but if people use that
> behaviour in scripts it makes them less non-portable, so lets just
> discourage it altogether.
> 
> 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.c24 May 2018 06:24:29 -  1.62
> +++ main.c2 Jun 2018 13:50:06 -
> @@ -404,7 +404,6 @@ next_addr(void)
>  }
>  
>  
> -#ifdef BACKWARDS
>  /* GET_THIRD_ADDR: get a legal address from the command buffer */
>  #define GET_THIRD_ADDR(addr) \
>   do { \
> @@ -425,26 +424,6 @@ next_addr(void)
>   first_addr = ol1; \
>   second_addr = ol2; \
>   } while (0)
> -
> -#else/* BACKWARDS */
> -/* GET_THIRD_ADDR: get a legal address from the command buffer */
> -#define GET_THIRD_ADDR(addr) \
> - do { \
> - int ol1, ol2; \
> - \
> - ol1 = first_addr; \
> - ol2 = second_addr; \
> - if (extract_addr_range() < 0) \
> - return ERR; \
> - if (second_addr < 0 || addr_last < second_addr) { \
> - seterrmsg("invalid address"); \
> - return ERR; \
> - } \
> - addr = second_addr; \
> - first_addr = ol1; \
> - second_addr = ol2; \
> - } while (0)
> -#endif
>  
>  
>  /* GET_COMMAND_SUFFIX: verify the command suffix in the command buffer */
> 



ed remove BACKWARDS from GET_THIRD_ADDR

2018-06-02 Thread Martijn van Duren
Hello tech@,

The following patch removes the non-backwards case for GET_THIRD_ADDR.  
POSIX states nothing about making it optional, and since it is our and
NetBSD's current behaviour, just leave it as is.

I can see how for interactive use making the 3rd argument default to
the current address could make life easier, but if people use that
behaviour in scripts it makes them less non-portable, so lets just
discourage it altogether.

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 -  1.62
+++ main.c  2 Jun 2018 13:50:06 -
@@ -404,7 +404,6 @@ next_addr(void)
 }
 
 
-#ifdef BACKWARDS
 /* GET_THIRD_ADDR: get a legal address from the command buffer */
 #define GET_THIRD_ADDR(addr) \
do { \
@@ -425,26 +424,6 @@ next_addr(void)
first_addr = ol1; \
second_addr = ol2; \
} while (0)
-
-#else  /* BACKWARDS */
-/* GET_THIRD_ADDR: get a legal address from the command buffer */
-#define GET_THIRD_ADDR(addr) \
-   do { \
-   int ol1, ol2; \
-   \
-   ol1 = first_addr; \
-   ol2 = second_addr; \
-   if (extract_addr_range() < 0) \
-   return ERR; \
-   if (second_addr < 0 || addr_last < second_addr) { \
-   seterrmsg("invalid address"); \
-   return ERR; \
-   } \
-   addr = second_addr; \
-   first_addr = ol1; \
-   second_addr = ol2; \
-   } while (0)
-#endif
 
 
 /* GET_COMMAND_SUFFIX: verify the command suffix in the command buffer */