On Sun, Nov 29, 2020 at 07:21:53PM -0800, Greg Steuck wrote:
> Vitaliy Makkoveev <[email protected]> writes:
>
> > 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);
>
> In the name of bike-shedding this should be a putchar, then OK gnezdo@
It makes sence.
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 30 Nov 2020 10:02:25 -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);
+ putchar(c);
else
- printf("\\%03o", c & 0xff);
+ printf("\\%03o", c);
}
/*