Gettin' there
This commit is contained in:
parent
8d3c24696e
commit
8dd5864e67
2 changed files with 28 additions and 8 deletions
|
@ -1086,7 +1086,7 @@ int patty_ax25_server_run(patty_ax25_server *server) {
|
||||||
&server->fds_r,
|
&server->fds_r,
|
||||||
&server->fds_w,
|
&server->fds_w,
|
||||||
NULL,
|
NULL,
|
||||||
&server->timeout)) < 0) {
|
NULL)) < 0) {
|
||||||
goto error_io;
|
goto error_io;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,13 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/un.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <patty/ax25.h>
|
#include <patty/ax25.h>
|
||||||
|
|
||||||
|
@ -15,26 +22,39 @@ static void usage(int argc, char **argv, const char *message, ...) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "usage: %s /dev/ttyXX|kiss.cap\n", argv[0]);
|
fprintf(stderr, "usage: %s /var/run/patty/patty.sock\n", argv[0]);
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
patty_ax25_if *iface;
|
struct sockaddr_un addr;
|
||||||
|
int fd;
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
usage(argc, argv, "No TNC device or KISS dump file provided");
|
usage(argc, argv, "No patty socket provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((iface = patty_ax25_if_new(PATTY_AX25_IF_KISS_TNC, argv[1])) == NULL) {
|
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||||
goto error_if_create;
|
fprintf(stderr, "%s: %s: %s: %s\n",
|
||||||
|
argv[0], "socket()", argv[1], strerror(errno));
|
||||||
|
|
||||||
|
goto error_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
patty_ax25_if_destroy(iface);
|
memset(&addr, '\0', sizeof(addr));
|
||||||
|
addr.sun_family = AF_UNIX;
|
||||||
|
strncpy(addr.sun_path, argv[1], sizeof(addr.sun_path));
|
||||||
|
|
||||||
|
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
|
goto error_connect;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_if_create:
|
error_connect:
|
||||||
|
error_socket:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue