blob: ee9553cd52bb2c84da8a4d92337089f8acba7799 [file] [log] [blame]
wdenk3ba68652000-10-11 22:04:29 +00001#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4#include <unistd.h>
5#include "serial.h"
6#include "error.h"
7#include "remote.h"
8
9char *serialdev = "/dev/term/b";
10speed_t speed = B230400;
11int verbose = 0;
12
13int
14main(int ac, char **av)
15{
16 int c, sfd;
17
18 if ((pname = strrchr(av[0], '/')) == NULL)
19 pname = av[0];
20 else
21 pname++;
22
23 while ((c = getopt(ac, av, "b:p:v")) != EOF)
24 switch (c) {
25
26 case 'b':
27 if ((speed = cvtspeed(optarg)) == B0)
28 Error("can't decode baud rate specified in -b option");
29 break;
30
31 case 'p':
32 serialdev = optarg;
33 break;
34
35 case 'v':
36 verbose = 1;
37 break;
38
39 default:
40 usage:
41 fprintf(stderr, "Usage: %s [-b bps] [-p dev] [-v]\n", pname);
42 exit(1);
43 }
44 if (optind != ac)
45 goto usage;
46
47 if (verbose)
48 fprintf(stderr, "Opening serial port and sending continue...\n");
49
50 if ((sfd = serialopen(serialdev, speed)) < 0)
51 Perror("open of serial device '%s' failed", serialdev);
52
53 remote_desc = sfd;
54 remote_reset();
55 remote_continue();
56
57 if (serialclose(sfd) < 0)
58 Perror("close of serial device '%s' failed", serialdev);
59
60 if (verbose)
61 fprintf(stderr, "Done.\n");
62
63 return (0);
64}