delim = strchr(arg, ':');
if (delim == NULL) {
- fprintf(stderr, "expected ':' (<hostname>:<port>)");
+ fprintf(stderr, "'%s' is not in <hostname>:<port> format\n", arg);
exit(1);
}
ret = getaddrinfo(arg, delim, &hints, &res);
if (ret != 0) {
- fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret));
+ fprintf(stderr, "getaddrinfo(%s) failed: %s\n", arg, gai_strerror(ret));
exit(1);
}
can_addr.can_family = AF_CAN;
tmpi = if_nametoindex(argv[i]);
if (tmpi == 0) {
- fprintf(stderr, "given can interface not found\n");
+ perror(argv[i]);
return 1;
}
gwctl->udp_addrlen = addrlen;
if (ioctl(fd, CEGW_IOCTL_START, gwctl) != 0) {
- perror("ioctl");
+ perror("ioctl(CEGW_IOCTL_START)");
return 1;
}
printf("gateway successfully set and running\n");
return 0;
}
-