36int main(
int argc,
char *argv[]) {
37 int option, debuglevel;
42 while ((option = getopt(argc, argv,
"D:SBUV")) != -1) {
45 inF = open(
"/proc/tty/driver/usb-serial", O_RDONLY);
46 if (inF == -1) inF = open(
"/proc/tty/driver/usbserial", O_RDONLY);
49 if ((ouF = open(
"/var/tmp/usbserial", O_WRONLY | O_CREAT | O_TRUNC,
51 while ((bytes = read(inF, line,
sizeof(line))) > 0)
52 write(ouF, line, bytes);
61 inF = open(
"/proc/tty/driver/serial", O_RDONLY);
64 if ((ouF = open(
"/var/tmp/serial", O_WRONLY | O_CREAT | O_TRUNC,
66 while ((bytes = read(inF, line,
sizeof(line))) > 0)
67 write(ouF, line, bytes);
77 unlink(
"/var/tmp/usbserial");
78 unlink(
"/var/tmp/serial");
83 debuglevel = (int)strtol(optarg, 0, 0);
88 (void)printf(
"ocpnhelper %s\n", VERSION);