/*
* 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.
*
* 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.
#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;
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;
}
}
}
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;