1 /*
2  * Copyright 1986 by Larry Campbell, 73 Concord Street, Maynard MA 01754 USA
3  * (maynard!campbell).
4  *
5  * John Chmielewski (tesla!jlc until 9/1/86, then rogue!jlc) assisted
6  * by doing the System V port and adding some nice features.  Thanks!
7  */
8 /*
9  * updated by Daniel Suthers, dbs@tanj.com 1996 -- 2000
10  */
11 
12 /*
13  *   This program is free software: you can redistribute it and/or modify
14  *   it under the terms of the GNU General Public License as published by
15  *   the Free Software Foundation, either version 3 of the License, or
16  *   (at your option) any later version.
17  *
18  *   This program is distributed in the hope that it will be useful,
19  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *   GNU General Public License for more details.
22  *
23  *   You should have received a copy of the GNU General Public License
24  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  *
26  */
27 
28 #include <stdio.h>
29 #include "x10.h"
30 
31 char *E_2MANY = EM_2MANY;
32 char *E_INVCN = EM_INVCN;
33 char *E_WNA = EM_WNA;
34 char *E_NMA = EM_NMA;
35 char *E_NOCMD = EM_NOCMD;
36 
37 void exit();
38 
usage(s)39 int usage(s)
40 char *s;
41 {
42 
43     char RCSID[]= "@(#) $Id: message.c,v 1.12 1999/12/26 20:37:17 dbs Exp dbs $\n";
44 
45 /*
46  * Don't combine the two calls to fputs or my compiler will
47  * gag with "token too long"
48  */
49 
50     display(RCSID);
51 
52     if( s != NULL )
53     (void) fprintf(stderr, "Command error: %s\n", s);
54     (void) fputs("Usage:\n\
55  heyu help                   Display new commands in heyu ALPHA\n\
56  heyu date                    Return date in date(1) input format\n", stderr);
57 
58     (void) fputs("\
59  heyu erase                   Zero CM11a EEPROM, erasing all events and macros\n\
60  heyu help                    Print this message and exit\n\
61  heyu info                    Display current CM11a registers and clock\n\
62  heyu monitor                 Monitor X10 activity (end with <BREAK>)\n", stderr);
63 
64     (void) fputs("\
65  heyu preset ann vv           Set unit to level vv for next dim/bright\n\
66  heyu reset  [housecode]      Reset interface to 'A' or specified housecode\n\
67  heyu setclock                Set CM11a clock to system clock (per schedule)\n\
68  heyu status ann[,nn...]      Return status of smart modules (rr501...)\n\
69  heyu stop                    Stop the current relay daemon\n", stderr);
70 
71     (void) fputs("\
72  heyu turn ann[,nn...] on|off|dim|bright [vv]\n\
73                               Change state of housecode a, unit nn by vv\n\
74  heyu upload [check|croncheck|status|cronstatus]\n\
75                               Upload schedule to CM11a or check schedule file\n\
76                                 or display status of uploaded schedule\n\
77  heyu utility <option>        (Enter 'heyu utility' to see options)\n\
78  heyu version                 Display the Heyu version and exit\n\
79 ", stderr);
80 
81     (void) fputs("Verbose mode is enabled if the first parameter is -v\n",
82             stderr);
83     exit(1);
84 }
85 
error(s)86 void error(s)
87 char *s;
88 {
89     extern void quit();
90     extern int munlock();
91     extern int port_locked;
92 
93     (void) fprintf(stderr, "HEYU: %s\n", s);
94     if( port_locked == 1 )
95         munlock( "heyu.write" );
96 
97     quit();
98 }
99