mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 06:20:00 +02:00
isotpsniffer: Use isprint() instead of manual check
This commit is contained in:
+2
-1
@@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
@@ -153,7 +154,7 @@ void printbuf(unsigned char *buffer, int nbytes, int color, int timestamp,
|
|||||||
if (format & FORMAT_ASCII) {
|
if (format & FORMAT_ASCII) {
|
||||||
printf("'");
|
printf("'");
|
||||||
for (i=0; i<nbytes; i++) {
|
for (i=0; i<nbytes; i++) {
|
||||||
if ((buffer[i] > 0x1F) && (buffer[i] < 0x7F))
|
if (isprint(buffer[i]))
|
||||||
printf("%c", buffer[i]);
|
printf("%c", buffer[i]);
|
||||||
else
|
else
|
||||||
printf(".");
|
printf(".");
|
||||||
|
|||||||
Reference in New Issue
Block a user