From b5d8af82fc6891259232da08f2bc197d4b904c9f Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Mon, 6 Jun 2005 13:35:23 +0000 Subject: * minior fixes, (compile warnings, formating output, etc) git-svn-id: https://iocaste.extern.pengutronix.de/svn/canutils/trunks/canutils-1.0-trunk@27 5fd5a299-6ef2-0310-aa18-8b01d7c39d8c --- canconfig.c | 9 ++++++--- candump.c | 8 ++++---- canecho.8 | 3 ++- cansend.8 | 5 +++-- cansend.c | 10 +++++----- configure.ac | 2 ++ 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/canconfig.c b/canconfig.c index 8fbd130..f46ead8 100644 --- a/canconfig.c +++ b/canconfig.c @@ -23,10 +23,13 @@ #include #include #include +#include + #include #include #include #include + #include #include #include @@ -117,11 +120,11 @@ void do_show_baudrate(int argc, char* argv[]) if (value != 0) fprintf(stdout, "%s: baudrate %d btr 0x%02x 0x%02x 0x%02x\n", - &ifr.ifr_name, value, br->btr[0], br->btr[1], br->btr[2]); + ifr.ifr_name, value, br->btr[0], br->btr[1], br->btr[2]); else fprintf(stdout, "%s: baudrate btr 0x%02x 0x%02x 0x%02x\n", - &ifr.ifr_name, br->btr[0], br->btr[1], br->btr[2]); + ifr.ifr_name, br->btr[0], br->btr[1], br->btr[2]); } @@ -207,7 +210,7 @@ void do_show_state(int argc, char *argv[]) } state = settings->state; - fprintf(stdout, "%s: state ", &ifr.ifr_name); + fprintf(stdout, "%s: state ", ifr.ifr_name); switch (state) { case CAN_STATE_BUS_PASSIVE: str = "bus passive"; diff --git a/candump.c b/candump.c index 7fef4d6..797746e 100644 --- a/candump.c +++ b/candump.c @@ -46,15 +46,15 @@ int main(int argc, char **argv) while ((opt = getopt(argc, argv, "f:t:p:m:v:")) != -1) { switch (opt) { case 'f': - family = atoi(optarg); + family = strtoul(optarg, NULL, 0); break; case 't': - type = atoi(optarg); + type = strtoul(optarg, NULL, 0); break; case 'p': - proto = atoi(optarg); + proto = strtoul(optarg, NULL, 0); break; case '?': @@ -109,5 +109,5 @@ int main(int argc, char **argv) } } - return 0; + exit (EXIT_SUCCESS); } diff --git a/canecho.8 b/canecho.8 index b24694b..f453ac6 100644 --- a/canecho.8 +++ b/canecho.8 @@ -25,7 +25,8 @@ Specifies the socket type to be sniffed on. Default is SOCK_RAW, which is 3. .TP .B -p proto -Specifies the protocol to sniff for; default is CAN_PROTO_RAW, which is +Specifies the protocol to sniff for; default is CAN_PROTO_RAW, which +is 0. .TP .B -v Verbose mode. diff --git a/cansend.8 b/cansend.8 index f226be4..66f96bd 100644 --- a/cansend.8 +++ b/cansend.8 @@ -2,7 +2,7 @@ .SH NAME cansend \- send data on a CAN interface .SH SYNOPSIS -.B "send -i [Options] message" +.B "send [Options] -i message" .br .SH DESCRIPTION cansend sends messages on a CAN (Controller Area Network) bus interface. @@ -22,7 +22,8 @@ Specifies the socket type to be sniffed on. Default is SOCK_RAW, which is 3. .TP .B -p proto -Specifies the protocol to sniff for; default is CAN_PROTO_RAW, which is +Specifies the protocol to sniff for; default is CAN_PROTO_RAW, which +is 0. .TP .B -v Verbose mode. diff --git a/cansend.c b/cansend.c index 4a075f5..d42cdcf 100644 --- a/cansend.c +++ b/cansend.c @@ -23,7 +23,7 @@ void sigterm(int signo) void print_usage(char *prg) { - fprintf(stderr, "Usage: %s -i [can-interface] [Options]\n", prg); + fprintf(stderr, "Usage: %s [Options] -i \n", prg); fprintf(stderr, "Options: -f (default PF_CAN = %d)\n", PF_CAN); fprintf(stderr, " -t (default SOCK_RAW = %d)\n", SOCK_RAW); fprintf(stderr, " -p (default CAN_PROTO_RAW = %d)\n", CAN_PROTO_RAW); @@ -46,15 +46,15 @@ int main(int argc, char **argv) while ((opt = getopt(argc, argv, "f:t:p:vi:")) != -1) { switch (opt) { case 'f': - family = atoi(optarg); + family = strtoul(optarg, NULL, 0); break; case 't': - type = atoi(optarg); + type = strtoul(optarg, NULL, 0); break; case 'p': - proto = atoi(optarg); + proto = strtoul(optarg, NULL, 0); break; case 'v': @@ -62,7 +62,7 @@ int main(int argc, char **argv) break; case 'i': - frame.can_id = atoi(optarg); + frame.can_id = strtoul(optarg, NULL, 0); case '?': break; diff --git a/configure.ac b/configure.ac index 147cf4e..9271b8a 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,8 @@ AC_CONFIG_AUX_DIR([config/autoconf]) AC_CANONICAL_BUILD AC_CANONICAL_HOST +CFLAGS="${CFLAGS} -Wall -O2 -g" + # Checks for programs. AC_PROG_CC AC_PROG_INSTALL -- cgit v1.2.3