summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2005-06-06 13:35:23 +0000
committerMarc Kleine-Budde <mkl@pengutronix.de>2005-06-06 13:35:23 +0000
commitb5d8af82fc6891259232da08f2bc197d4b904c9f (patch)
tree2dc1b53254cb7802251ea09f8a9cb1bc928caf72
parentdcf7d97ab6f03be030709ffa244108216f9fb5dd (diff)
downloadcanutils-b5d8af82fc6891259232da08f2bc197d4b904c9f.tar.gz
* 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.c9
-rw-r--r--candump.c8
-rw-r--r--canecho.83
-rw-r--r--cansend.85
-rw-r--r--cansend.c10
-rw-r--r--configure.ac2
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";
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 <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.
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 <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