Hi.

For me `ch' is unwanted here.

Index: usr.sbin/tcpdump/util.c
===================================================================
RCS file: /cvs/src/usr.sbin/tcpdump/util.c,v
retrieving revision 1.30
diff -u -p -r1.30 util.c
--- usr.sbin/tcpdump/util.c     24 Jan 2020 22:46:37 -0000      1.30
+++ usr.sbin/tcpdump/util.c     29 Nov 2020 22:56:23 -0000
@@ -303,13 +303,11 @@ safeputs(const char *s)
 void
 safeputchar(int c)
 {
-       unsigned char ch;
-
-       ch = (unsigned char)(c & 0xff);
+       c &= 0xff;
        if (c < 0x80 && isprint(c))
-               printf("%c", c & 0xff);
+               printf("%c", c);
        else
-               printf("\\%03o", c & 0xff);
+               printf("\\%03o", c);
 }
 
 /*

On Sun, Nov 29, 2020 at 10:29:46PM +0100, Martin Vahlensieck wrote:
> Hi
> 
> I think this is the way it was meant.
> 
> Best,
> 
> Martin
> 
> Index: util.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/tcpdump/util.c,v
> retrieving revision 1.30
> diff -u -p -r1.30 util.c
> --- util.c    24 Jan 2020 22:46:37 -0000      1.30
> +++ util.c    29 Nov 2020 21:23:37 -0000
> @@ -306,7 +306,7 @@ safeputchar(int c)
>       unsigned char ch;
>  
>       ch = (unsigned char)(c & 0xff);
> -     if (c < 0x80 && isprint(c))
> +     if (ch < 0x80 && isprint(ch))
>               printf("%c", c & 0xff);
>       else
>               printf("\\%03o", c & 0xff);
> 

Reply via email to