diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2005-06-06 13:35:23 +0000 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2005-06-06 13:35:23 +0000 |
commit | b5d8af82fc6891259232da08f2bc197d4b904c9f (patch) | |
tree | 2dc1b53254cb7802251ea09f8a9cb1bc928caf72 | |
parent | dcf7d97ab6f03be030709ffa244108216f9fb5dd (diff) | |
download | canutils-b5d8af82fc6891259232da08f2bc197d4b904c9f.tar.gz canutils-b5d8af82fc6891259232da08f2bc197d4b904c9f.tar.xz |
* 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
-rw-r--r-- | canconfig.c | 9 | ||||
-rw-r--r-- | candump.c | 8 | ||||
-rw-r--r-- | canecho.8 | 3 | ||||
-rw-r--r-- | cansend.8 | 5 | ||||
-rw-r--r-- | cansend.c | 10 | ||||
-rw-r--r-- | 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 <stdio.h> #include <stdlib.h> #include <termios.h> +#include <string.h> + #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/socket.h> + #include <net/if.h> #include <netinet/in.h> #include <netinet/ether.h> @@ -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 <unknown> 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"; @@ -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); } @@ -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. @@ -2,7 +2,7 @@ .SH NAME cansend \- send data on a CAN interface .SH SYNOPSIS -.B "send -i <interface> [Options] message" +.B "send [Options] <interface> -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. @@ -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 <can-interface> [Options] -i <identifier> <can-msg>\n", prg); fprintf(stderr, "Options: -f <family> (default PF_CAN = %d)\n", PF_CAN); fprintf(stderr, " -t <type> (default SOCK_RAW = %d)\n", SOCK_RAW); fprintf(stderr, " -p <proto> (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 |