From 08389b878149a364d3ceafd758184eeaab2dc000 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Fri, 3 Jul 2020 15:13:23 -0400 Subject: [PATCH] Show function names in errors in examples/decode.c --- examples/decode.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/decode.c b/examples/decode.c index c352159..8fce493 100644 --- a/examples/decode.c +++ b/examples/decode.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -52,7 +53,8 @@ int main(int argc, char **argv) { patty_ax25_frame frame; if ((len = patty_kiss_tnc_recv(tnc, buf, PATTY_KISS_BUFSZ, &port)) < 0) { - perror("Unable to read frame"); + fprintf(stderr, "%s: %s: %s\n", + argv[0], "patty_kiss_tnc_recv()", strerror(errno)); goto error_kiss_tnc_recv; } else if (len == 0) { @@ -60,13 +62,15 @@ int main(int argc, char **argv) { } if (patty_ax25_frame_decode(&frame, PATTY_AX25_FRAME_NORMAL, buf, len) < 0) { - perror("Unable to decode frame"); + fprintf(stderr, "%s: %s: %s\n", + argv[0], "patty_ax25_frame_decode()", strerror(errno)); goto error_ax25_frame_decode; } if (patty_print_frame(stdout, &frame, buf, len) < 0) { - perror("Unable to print frame"); + fprintf(stderr, "%s: %s: %s\n", + argv[0], "patty_print_frame()", strerror(errno)); goto error_print_frame; }