]> rtime.felk.cvut.cz Git - socketcan-devel.git/blobdiff - test/canecho.c
Add kernel version depency for Kernel 3.1.x which extended __rtnl_register().
[socketcan-devel.git] / test / canecho.c
index 0194add8fe373a2908d9ae6d860ec38d06808a77..a51966f32f6998292eaf0ba09cadba3e0fcf0c3f 100644 (file)
@@ -1,19 +1,18 @@
 /*
- *  $Id: canecho.c,v 2.0 2006/04/13 10:37:20 ethuerm Exp $
+ *  $Id$
  */
 
 /*
  * canecho.c
  *
- * Copyright (c) 2002-2005 Volkswagen Group Electronic Research
+ * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions, the following disclaimer and
- *    the referenced file 'COPYING'.
+ *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
@@ -23,8 +22,8 @@
  *
  * Alternatively, provided that this notice is retained in full, this
  * software may be distributed under the terms of the GNU General
- * Public License ("GPL") version 2 as distributed in the 'COPYING'
- * file from the main directory of the linux kernel source.
+ * Public License ("GPL") version 2, in which case the provisions of the
+ * GPL apply INSTEAD OF those given above.
  *
  * The provided data structures and external interfaces from this code
  * are not restricted to be used by modules with a GPL compatible license.
@@ -42,7 +41,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * Send feedback to <llcf@volkswagen.de>
+ * Send feedback to <socketcan-users@lists.berlios.de>
  *
  */
 
@@ -57,8 +56,9 @@
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <sys/uio.h>
+#include <net/if.h>
 
-#include "af_can.h"
+#include <linux/can.h>
 
 extern int optind, opterr, optopt;
 
@@ -91,28 +91,28 @@ int main(int argc, char **argv)
 
        while ((opt = getopt(argc, argv, "f:t:p:v")) != -1) {
                switch (opt) {
-                       case 'f':
-                               family = atoi(optarg);
-                               break;
+               case 'f':
+                       family = atoi(optarg);
+                       break;
 
-                       case 't':
-                               type = atoi(optarg);
-                               break;
+               case 't':
+                       type = atoi(optarg);
+                       break;
 
-                       case 'p':
-                               proto = atoi(optarg);
-                               break;
+               case 'p':
+                       proto = atoi(optarg);
+                       break;
 
-                       case 'v':
-                               verbose = 1;
-                               break;
+               case 'v':
+                       verbose = 1;
+                       break;
 
-                       case '?':
-                               break;
+               case '?':
+                       break;
 
-                       default:
-                               fprintf(stderr, "Unknown option %c\n", opt);
-                               break;
+               default:
+                       fprintf(stderr, "Unknown option %c\n", opt);
+                       break;
                }
        }
 
@@ -122,7 +122,7 @@ int main(int argc, char **argv)
        }
        
        printf("interface = %s, family = %d, type = %d, proto = %d\n",
-                       argv[optind], family, type, proto);
+              argv[optind], family, type, proto);
        if ((s = socket(family, type, proto)) < 0) {
                perror("socket");
                return 1;