blob: 300545d8e11e9057f1cd55ee5d2844dc0b4b356d [file] [log] [blame]
wdenkb00ec162003-06-19 23:40:20 +00001/*
2 * (C) Copyright 2000
3 * Murray Jensen <Murray.Jensen@csiro.au>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
wdenk3ba68652000-10-11 22:04:29 +000024#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
27#include <unistd.h>
28#include "serial.h"
29#include "error.h"
30#include "remote.h"
31
32char *serialdev = "/dev/term/b";
33speed_t speed = B230400;
34int verbose = 0;
35
36int
37main(int ac, char **av)
38{
39 int c, sfd;
40
41 if ((pname = strrchr(av[0], '/')) == NULL)
42 pname = av[0];
43 else
44 pname++;
45
46 while ((c = getopt(ac, av, "b:p:v")) != EOF)
47 switch (c) {
48
49 case 'b':
50 if ((speed = cvtspeed(optarg)) == B0)
51 Error("can't decode baud rate specified in -b option");
52 break;
53
54 case 'p':
55 serialdev = optarg;
56 break;
57
58 case 'v':
59 verbose = 1;
60 break;
61
62 default:
63 usage:
64 fprintf(stderr, "Usage: %s [-b bps] [-p dev] [-v]\n", pname);
65 exit(1);
66 }
67 if (optind != ac)
68 goto usage;
69
70 if (verbose)
71 fprintf(stderr, "Opening serial port and sending continue...\n");
72
73 if ((sfd = serialopen(serialdev, speed)) < 0)
74 Perror("open of serial device '%s' failed", serialdev);
75
76 remote_desc = sfd;
77 remote_reset();
78 remote_continue();
79
80 if (serialclose(sfd) < 0)
81 Perror("close of serial device '%s' failed", serialdev);
82
83 if (verbose)
84 fprintf(stderr, "Done.\n");
85
86 return (0);
87}