bottlerocket-0.05b3/ 40775 764 764 0 6752471362 12534 5ustar tymmtymmbottlerocket-0.05b3/br.c100644 764 764 44106 6752474546 13432 0ustar tymmtymm /* * * br (BottleRocket) * * Control software for the X10 FireCracker wireless computer * interface kit. * * (c) 1999 Ashley Clark (aclark@ghoti.org) and Tymm Twillman (tymm@acm.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #define VERSION "0.05b3" #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #include #include #include #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_FEATURES_H #include #endif #ifdef HAVE_GETOPT_LONG #include #endif #include "br.h" #include "br_cmd.h" #include "br_cmd_engine.h" int Verbose = 0; char *MyName; void (*saved_br_error_handler)(char *, char *); void usage() { fprintf(stderr, "BottleRocket version %s\n", VERSION); fprintf(stderr, "\n"); fprintf(stderr, "Usage: %s [][() " " ...]\n\n", MyName); fprintf(stderr, " Options:\n"); #ifdef HAVE_GETOPT_LONG fprintf(stderr, " -v, --verbose\t\t\tadd v's to increase verbosity\n"); fprintf(stderr, " -x, --port=PORT\t\tset port to use\n"); fprintf(stderr, " -c, --house=[A-P]\t\tuse alternate house code " "(default \"A\")\n"); fprintf(stderr, " -n, --on=LIST\t\t\tturn on devices in LIST\n"); fprintf(stderr, " -f, --off=LIST\t\tturn off devices in LIST\n"); fprintf(stderr, " -N, --ON\t\t\tturn on all devices in housecode\n"); fprintf(stderr, " -F, --OFF\t\t\tturn off all devices in housecode\n"); fprintf(stderr, " -d, --dim=LEVEL[,LIST]\tdim devices in housecode to " " relative LEVEL\n"); fprintf(stderr, " -B, --lamps_on\t\tturn all lamps in housecode on\n"); fprintf(stderr, " -D, --lamps_off\t\tturn all lamps in housecode off\n"); fprintf(stderr, " -r, --repeat=NUM\t\trepeat commands NUM times " "(0 = ~ forever)\n"); fprintf(stderr, " -h, --help\t\t\tthis help\n\n"); #else fprintf(stderr, " -v\tverbose (add v's to increase verbosity)\n"); fprintf(stderr, " -x\tset port to use\n"); fprintf(stderr, " -c\tuse alternate house code (default \"A\")\n"); fprintf(stderr, " -n\tturn on devices\n"); fprintf(stderr, " -f\tturn off devices\n"); fprintf(stderr, " -N\tturn all devices in housecode on\n"); fprintf(stderr, " -F\tturn all devices in housecode off\n"); fprintf(stderr, " -d\tdim devices in housecode to relative dimlevel\n"); fprintf(stderr, " -B\tturn all lamps in housecode on\n"); fprintf(stderr, " -D\tturn all lamps in housecode off\n"); fprintf(stderr, " -r\trepeat commands times (0 basically " "means don't stop)\n"); fprintf(stderr, " -h\tthis help\n\n"); #endif fprintf(stderr, "\t\tis a comma separated list of devices " "(no spaces),\n"); fprintf(stderr, "\t\teach ranging from 1 to 16\n"); fprintf(stderr, "\tis an integer from %d to %d " "(0 means no change)\n", -DIMRANGE, DIMRANGE); fprintf(stderr, "\tis a letter between A and P\n"); fprintf(stderr, "\tis one of ON, OFF, DIM, BRIGHT, " "ALL_ON, ALL_OFF,\n"); fprintf(stderr, "\t\tLAMPS_ON or LAMPS_OFF\n\n"); fprintf(stderr, "For native commands, should only be specified " "for ON or OFF.\n\n"); } void my_br_error_handler(char *where, char *problem) { int tmperrno = errno; char *tmpwhere; /* * Don't print out possibly confusing error info * unless in verbose mode */ tmpwhere = (Verbose ? where:NULL); fprintf(stderr, "%s: ", MyName); errno = tmperrno; (*saved_br_error_handler)(tmpwhere, problem); } int checkimmutableport(char *port_source) { /* * Check to see if the user is allowed to specify an alternate serial port */ if (!ISSETID()) return 0; errno = EPERM; br_error("checkimmutableport", "You are not authorized to change the X10 port!"); fprintf(stderr, "\tPort specified %s\n", port_source); return -1; } int add_dimcmd(br_control_info *cinfo, br_unit_list *units, int dim_level) { /* * Turn info into stuff usable by the command engine and add it to the * list of things to do. */ register int i; int index = 0; int dev; int house; int cmd; cmd = ((dim_level < 0) ? DIM:BRIGHT); dim_level = (dim_level < 0) ? -dim_level:dim_level; if (br_get_num_units(units)) { while ((dev = br_get_ul_device(units, index)) != -1) { house = br_get_ul_house(units, index); if (br_add_cmd(cinfo, ON, house, dev) < 0) return -1; for (i = 0; i < dim_level; i++) { if (br_add_cmd(cinfo, cmd, house, 0) < 0) return -1; } index++; } } else { for (i = 0; i < dim_level; i++) { if (br_add_cmd(cinfo, cmd, br_default_house, 0) < 0) return -1; } } return 0; } int gethouse(char *house) { /* * Grab a house code from the command line */ char *end; int c; c = br_strtohc(house, &end); if ((c < 0) || (*end != '\0')) { errno = EINVAL; br_error("gethouse", "House code must be in range [A-P]"); return -1; } return c; } int getunits(char *list, br_unit_list **units) { /* * Get a list of devices for an operation to be performed on from * the command line */ char *end; if (*units == NULL) { if ((*units = br_new_unit_list()) == NULL) return -1; } if ((br_strtoul(list, *units, &end) < 0) || (*end != '\0')) { br_free_unit_list(*units); errno = EINVAL; br_error("getunits", "Devices must be in the range of [1-16], housecodes [A-P]"); *units = NULL; return -1; } return 0; } int getdim(char *list, br_unit_list **units, int *dim) { /* * Get devices that should be dimmed from the command line, and how * much to dim them */ char *end; *dim = strtol(list, &end, 0); while (isspace(*end)) end++; if (*end == ',') end++; if (*end) { if (getunits(end, units) < 0) return -1; /* error already printed */ } else { if (*units) br_free_unit_list(*units); *units = NULL; } /* * May have more dimlevels when I get a chance to play with variable * dimming */ if ((*dim < -DIMRANGE) || (*dim > DIMRANGE)) { if (*units) br_free_unit_list(*units); *units = NULL; errno = EINVAL; br_error("getdim", "Invalid dim level"); return -1; } return 0; } int open_port(br_control_info *cinfo, char *port) { /* * Open the serial port that a FireCracker device is (we expect) on */ int fd; if (Verbose >= 2) printf("%s: Opening serial port %s.\n", MyName, port); /* * Oh, yeah. Don't need O_RDWR for ioctls. This is safer. */ if ((fd = open(port, O_RDONLY | O_NONBLOCK)) < 0) { br_error("open_port", "Unable to open serial port"); return -1; } /* * If we end up with a reserved fd, don't mess with it. Just to make sure. */ if (!SAFE_FILENO(fd)) { close(fd); errno = EBADF; return -1; } return fd; } int close_port(int fd) { /* * Close the serial port when we're done using it */ if (Verbose >= 2) printf("%s: Closing serial port.\n", MyName); close(fd); return 0; } int native_getunits(char *arg, br_unit_list **units) { /* * Get units to be accessed from the command line in native BottleRocket style */ if (strlen(arg) < 2) { errno = EINVAL; br_error("native_getunits", "No units specified"); return -1; } if (getunits(arg, units) < 0) return -1; /* error already printed */ return 0; } int native_getcmd(char *arg) { /* * Convert a native BottleRocket command to the appropriate token */ if (!strcasecmp(arg, "ON")) return ON; if (!strcasecmp(arg, "OFF")) return OFF; if (!strcasecmp(arg, "DIM")) return DIM; if (!strcasecmp(arg, "BRIGHT")) return BRIGHT; if (!strcasecmp(arg, "ALL_ON")) return ALL_ON; if (!strcasecmp(arg, "ALL_OFF")) return ALL_OFF; if (!strcasecmp(arg, "LAMPS_ON")) return ALL_LAMPS_ON; if (!strcasecmp(arg, "LAMPS_OFF")) return ALL_LAMPS_OFF; errno = EINVAL; br_error("native_getcmd", "Native br commands are ON, OFF, DIM,\n\t" "BRIGHT, ALL_ON, ALL_OFF, LAMPS_ON or LAMPS_OFF"); errno = EINVAL; return -1; } int native_cmdline(br_control_info *cinfo, int argc, char *argv[], int optind) { /* * Get arguments from the command line in native BottleRocket style */ int cmd; int i; int house; br_unit_list *units = NULL; if (argc - optind < 2) { usage(); errno = EINVAL; return -1; } /* * Two arguments at a time; device and command */ for (i = optind; i < argc - 1; i += 2) { cmd = native_getcmd(argv[i + 1]); switch(cmd) { case ON: if (native_getunits(argv[i], &units) < 0) return -1; if (br_add_ul_cmd(cinfo, ON, units) < 0) return -1; break; case OFF: if (native_getunits(argv[i], &units) < 0) return -1; if (br_add_ul_cmd(cinfo, OFF, units) < 0) return -1; break; case DIM: if ((house = gethouse(argv[i])) < 0) return -1; if (br_add_cmd(cinfo, DIM, house, 0) < 0) return -1; break; case BRIGHT: if ((house = gethouse(argv[i])) < 0) return -1; if (br_add_cmd(cinfo, BRIGHT, house, 0) < 0) return -1; break; case ALL_ON: if ((house = gethouse(argv[i])) < 0) return -1; if (br_add_cmd(cinfo, ALL_ON, house, 0) < 0) return -1; break; case ALL_OFF: if ((house = gethouse(argv[i])) < 0) return -1; if (br_add_cmd(cinfo, ALL_OFF, house, 0) < 0) return -1; break; case ALL_LAMPS_ON: if ((house = gethouse(argv[i])) < 0) return -1; if (br_add_cmd(cinfo, ALL_LAMPS_ON, house, 0) < 0) return -1; break; case ALL_LAMPS_OFF: if ((house = gethouse(argv[i])) < 0) return -1; if (br_add_cmd(cinfo, ALL_LAMPS_OFF, house, 0) < 0) return -1; break; default: errno = EINVAL; return -1; } } if (i != argc) { usage(); errno = EINVAL; return -1; } if (units) br_free_unit_list(units); return 0; } int main(int argc, char **argv) { char *port_source = "at compile time"; char *tmp_port; char *port = X10_PORTNAME; int opt; int house = 0; int repeat; int dimlevel = 0; int fd; br_control_info *cinfo = NULL; br_unit_list *units = NULL; #ifdef HAVE_GETOPT_LONG int opt_index; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"port", required_argument, 0, 'x'}, {"repeat", required_argument, 0, 'r'}, {"on", required_argument, 0, 'n'}, {"off", required_argument, 0, 'f'}, {"ON", no_argument, 0, 'N'}, {"OFF", no_argument, 0, 'F'}, {"dim", required_argument, 0, 'd'}, {"lamps_on", no_argument, 0, 'B'}, {"lamps_off", no_argument, 0, 'D'}, {"inverse", no_argument, 0, 'i'}, {"house", required_argument, 0, 'c'}, {"verbose", no_argument, 0, 'v'}, {"pause", no_argument, 0, 'p'}, {0, 0, 0, 0} }; #endif #define OPT_STRING "x:hvr:ic:n:Nf:Fd:BDp" /* * Jimmy in the local error handler that hides the * function where the error occurred (to keep from * being confusing) and also prints the program name */ saved_br_error_handler = br_error_handler; br_error_handler = my_br_error_handler; MyName = argv[0]; /* * This is where we store all of the info to be passed to the * command engine. */ if ((cinfo = br_new_control_info()) == NULL) exit(errno); if ((tmp_port = getenv("X10_PORTNAME"))) { port_source = "in the environment variable X10_PORTNAME"; if (checkimmutableport(port_source)) { exit(errno); } else { port = tmp_port; } } #ifdef HAVE_GETOPT_LONG while ((opt = getopt_long(argc, argv, OPT_STRING, long_options, &opt_index)) != -1) { #else while ((opt = getopt(argc, argv, OPT_STRING)) != -1) { #endif switch (opt) { case 'x': /* Set the port */ port_source = "on the command line"; if (checkimmutableport(port_source) < 0) exit(errno); port = optarg; break; case 'r': /* Repeat */ repeat = atoi(optarg); if (!repeat && !isdigit(*optarg)) { errno = EINVAL; br_error(NULL, "Invalid repeat value"); exit(errno); } cinfo->repeat = (repeat ? repeat:INT_MAX); break; case 'v': /* Verbose */ if (Verbose++ == 10) fprintf(stderr, "\nGet a LIFE already. " "I've got enough v's, thanks.\n\n"); if (Verbose >= 4) br_verbose = Verbose - 3; break; case 'i': cinfo->inverse++; /* no this isn't documented. * your free gift for reading the source. */ break; case 'c': /* Set housecode */ if ((br_default_house = gethouse(optarg)) < 0) exit(errno); break; case 'n': /* Device(s) on */ if (getunits(optarg, &units) < 0) exit(errno); if (br_add_ul_cmd(cinfo, ON, units) < 0) exit(errno); break; case 'N': /* All on */ if (br_add_cmd(cinfo, ALL_ON, house, 0) < 0) exit(errno); break; case 'f': /* Device(s) off */ if (getunits(optarg, &units) < 0) exit(errno); if (br_add_ul_cmd(cinfo, OFF, units) < 0) exit(errno); break; case 'F': /* All off */ if (br_add_cmd(cinfo, ALL_OFF, house, 0) < 0) exit(errno); break; case 'd': /* Dim (/bright) */ if (getdim(optarg, &units, &dimlevel) < 0) exit(errno); if (add_dimcmd(cinfo, units, dimlevel) < 0) exit(errno); break; case 'B': /* All lamps on */ if (br_add_cmd(cinfo, ALL_LAMPS_ON, house, 0) < 0) exit(errno); break; case 'D': /* All lamps off */ if (br_add_cmd(cinfo, ALL_LAMPS_OFF, house, 0) < 0) exit(errno); break; case 'p': if (br_add_cmd(cinfo, PAUSE, 0, 0) < 0) exit(errno); break; case 'h': /* Help */ usage(); exit(0); default: /* Someone messed up. */ usage(); exit(EINVAL); } } if (argc > optind) { /* * Must be using the native BottleRocket command line... */ if (native_cmdline(cinfo, argc, argv, optind) < 0) exit(errno); } if (!br_get_num_commands(cinfo)) { usage(); exit(EINVAL); } if ((fd = open_port(cinfo, port)) < 0) exit(errno); if (Verbose >= 2) printf("%s: Executing %d commands\n", MyName, br_get_num_commands(cinfo)); if (br_execute(fd, cinfo) < 0) exit(errno); if (close_port(fd) < 0) exit(errno); if (Verbose >= 3) printf("%s: Cleaning up...\n", MyName); br_free_unit_list(units); br_free_control_info(cinfo); return 0; } bottlerocket-0.05b3/README100644 764 764 17175 6752474203 13537 0ustar tymmtymmDESCRIPTION ----------- BottleRocket is an interface to the X10 FireCracker home automation kit. The FireCracker kit consists of a dongle-like RF transmitter that connects to the serial port of a PC, and a receiver that plugs into a wall socket and intercepts the signals, passing them on through house wiring to other units that turn appliances on/off or dim/brighten lamps. It doesn't support any kind of 2-way communication, unlike some of the other X10 products. This is version 0.05b3. It includes a different internal way of handling commands (allowing an unlimited # of commands to be specified, until of course you run out of memory), a library is now built with the command handling functions, and more. I have had reports that version 0.04c worked on: Linux/x86 Linux/Alpha Linux/ARM Linux/Sparc Digital Unix/Alpha FreeBSD/x86 NetBSD/x86 This one should too; if you have problems, let me know. I do know that it's not Minix friendly, though, so don't even ask. Also there seem to be problems with controlling DTR/CTS lines under Irix; I'm not sure if this is an OS or hardware issue. Version 0.04 incorporated a bunch of code by Ashley Clark for x10-amh compatability, code cleanups and other features, as well as more commands (ALL_ON, ALL_OFF, LAMPS_ON, LAMPS_OFF), security fixes and more. Thanks to Warner Losh for portability/security info. Thanks also to Christian Gafton for patches for cleanups/fixes for 0.04a and for supplying RedHat 6.0 RPMs. Version 0.03 started the x10-amh compatability and nicer serial port usage as well as the ability to repeat commands, and environment/command line selectable port (for root, at least). 0.03a was a bugfix release. Version 0.02 moved command handling into its own file so it can be linked into other things. 0.02a and 0.02b were bug fixes. This version has accidentally been tested while my modem was online, and everything worked just fine. I still wouldn't suggest it though. FILES ----- README - you're looking at it. Makefile - decided to add one of these to make things easier now that there is more than one file in the collection br.c - The command line interface; uses the br_cmd stuff (below) to carry out commands. br.h - Header file for br.c; includes macros and definitions used by the program. br_cmd.c - Functions for executing X10 comands using the FireCracker home automation system. Basically only one function you need in this: x10_br_out which takes the file descriptor of the serial port to which the Dynamite interface is connected, an address (high 4 bits correspond to the letter of the device address, lower 4 correspond to the numeric part) and a command (these are defined in br_cmd.h; valid commands are ON, OFF, DIM and BRIGHT). Note that you should set the address to 0 if you're using DIM and BRIGHT. br_cmd.h - The file you should include to make use of br_cmd.c. It holds the numeric IDs of the commands. br_translate.h - Translation tables used by br_cmd to build commands. You shouldn't have to mess with this unless you're messing around with innards. Doesn't need to be #included by other programs to use br_cmd stuff. br_cmd_engine.c - Command handling functions to allow a simpler interface to br commands, including building lists of commands to be executed and string to device ID parsing functions. br_cmd_engine.h - Header file for br_cmd_engine.h. #include this to use the command handling functions. COMPILING --------- Change to the bottlerocket directory and type "./configure", then "make". Optionally run "make install". configure also has some command line options (try "./configure --help" to list them); the most useful is probably "--with-x10port=" (I recommend using --with-x10port=/dev/firecracker and making a link from /dev/firecracker to whatever device your firecracker is plugged into. That way you only have to change the link if you plug your firecracker into another port. RUNNING ------- Use is simple. Just run BottleRocket with the address of the unit you want to control and the command you want it to execute. Note that dim/brighten are only able to address a whole letter group of units at a time, so only the letter portion should be specified on the command line for these commands. e.g. br A6 on -- turns on appliance set to be unit "A6" br P dim -- dims last selected lamp set to housecode "P" Also, Ashley Clark has given me code for x10-amh compatability so you can do things like: br -c A -f 1,2,3,4,5,6 -n 7 to turn off units 1-6 and unit 7 on. All 'on' commands will be executed before 'off', and 'dim' comes last, so br -c A -f 1 -n 1 will turn A1 on then off. Note: You generally have to be root to run this, as it requires serial port access. You may wish to make br setgid to the group that owns the serial port ("dialers" under FreeBSD, "tty" under Linux), but make sure you understand what you're doing and why first. THE INTERFACE ------------- The interface is really pretty simple; just wiggle the RTS and DTR lines on a serial port and the little box hooked up to your machine will transmit signals to another little box that routes the signal to where it should go (if everything works). The module is made as a pass-thru kind of thing, and X10 claims that you can hook up other serial devices to the same port without a problem, but I wouldn't suggest it (at least if you're using any kind of hardware handshaking, or have a modem that will drop carrier if it loses DTR... those lines are actually generally pretty nice to have working without someone jittering bits down them)... KNOWN BUGS (not as many as it looks) ---------- Some of the macro commands (ALL_ON, LIGHTS_OFF) may not work with all X10 devices. It seems that X10 has unofficially added these to the protocol list recently, and older devices (and maybe some newer ones?) will not recognize them. Sometimes commands are lost; this appears to be a hardware issue rather than a software one. If you are doing anything important, you may wish to issue commands multiple times to account for this. The usage information given by br is not comprehensive; there have been additions to the command handling code, but what is already displayed is already rather large, and it's just not worth it to add the new stuff to it. You can now add housecodes in the middle of a list of devices that you specify to br, and the last housecode listed will become the default for the rest of that command; e.g. br -c a -n 1,2,b1,2,c1,2 -f 1 will turn on a1, a2, b1, b2, c1 and c2 and then turn off a1. This was added largely so that the same parsing function can be used for when the "users" file is added (specifying which users have access to which devices). Documentation may not be completely up to date. I try to keep things at least fairly recent, but as this code can change very quickly, it is hard to keep everything in sync. If you find inconsistencies, email me and I will try to fix them. If you find a bug not listed here, please do let me know and I will try to get it fixed by the next release (or at least mention it here). Note that BottleRocket is still in very much a development stage and I do not consider it to be "stable" yet; work is still primarily to get in the features that I want; after these have been added, I plan to review the code, perhaps rewrite a bit, and security audit it from the base up. Therefore, moronic bugs can still be expected. CONTACTING ME ------------- If you have ideas/comments/code/bug reports, email me at tymm@acm.org. bottlerocket-0.05b3/br_cmd.c100644 764 764 22270 6747527441 14250 0ustar tymmtymm/* * * BottleRocket command output functions. x10_br_out, br_error, BitWait, * Delay, HoldLoops and br_error_handler are accessable to programs. * (c) 1999 Tymm Twillman (tymm@acm.org) * * This is for interfacing with the X10 Dynamite wireless transmitter for X10 * home automation hardware. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * */ #ifdef __cplusplus extern C { #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #include #include #include #ifdef HAVE_ERRNO_H #include #else extern int errno; #endif #ifdef HAVE_SYS_TERMIOS_H #include #endif #ifdef HAVE_TERMIOS_H #include #endif #include "br_cmd.h" #include "br_translate.h" #ifndef TIOCM_FOR_0 #define TIOCM_FOR_0 TIOCM_DTR #endif #ifndef TIOCM_FOR_1 #define TIOCM_FOR_1 TIOCM_RTS #endif /* * These values should be good for pretty much everyone, but you can * try increasing them if you have problems. Values are in uSec; * PreCmdDelay is the amount of time to hold output lines in * "clock" position before a command, PostCmdDelay is how long * to stay in "clock" position after a command, and InterBitDelay * is how long each bit/clock wiggled out the serial port should * last. */ int br_pre_cmd_delay = 350000; /* empirically found... */ int br_post_cmd_delay = 350000; int br_inter_bit_delay = 1400; int br_verbose = 0; const char *br_cmd_list[] = { "ON", "OFF", "DIM", "BRIGHT", "ALL OFF", "ALL ON", "ALL LAMPS OFF", "ALL LAMPS ON", "PAUSE" }; /* * Can externally set the error handler in case an app wants to handle * the output for itself * */ static void br_int_err_handler(char *, char *); void (*br_error_handler)(char *, char *) = br_int_err_handler; void br_error(char *where, char *problem) { int tmperrno; tmperrno = errno; if (br_error_handler) (*br_error_handler)(where, problem); errno = tmperrno; } static void br_int_err_handler(char *where, char *problem) { int tmperrno = errno; fprintf(stderr, "error: "); if (tmperrno) fprintf(stderr, "[%s] ", strerror(tmperrno)); if (problem) fprintf(stderr, "%s ", problem); if (where) fprintf(stderr, "in %s", where); if (!where && !problem && !tmperrno) fprintf(stderr, "(unknown error)"); fprintf(stderr, "\n"); } static int usec_sleep(long usecs) { /* * Sleep for a little while. Using select() so we don't busy- * wait for this long. */ struct timeval sleeptime; sleeptime.tv_sec = usecs / 1000000; sleeptime.tv_usec = usecs % 1000000; if (select(0, NULL, NULL, NULL, &sleeptime) < 0) { br_error("usec_sleep", "select"); return -1; } return 0; } static int usec_delay(long usecs) { /* * busy-wait for short delays */ struct timeval endtime; struct timeval currtime; /* * This way of doing things stolen from Firecracker, by Chris Yokum. * Much better. What was I thinking before? */ if (gettimeofday(&endtime, NULL) < 0) { br_error("usec_delay", "gettimeofday"); return -1; } endtime.tv_usec += usecs; if (endtime.tv_usec >= 1000000) { endtime.tv_sec++; endtime.tv_usec -= 1000000; } do { if (gettimeofday(&currtime, NULL) < 0) { br_error("usec_delay", "gettimeofday"); return -1; } } while (timercmp(&endtime, &currtime, >)); return 0; } static int bits_out(const int fd, const int bits) { /* * Send out one command bit; set RTS or DTR (but only one) depending on * value. * * This now assumes that both RTS and DTR are high; it just clears the one * that we don't want set for this bit. */ int out; out = (bits) ? TIOCM_FOR_0:TIOCM_FOR_1; /* Set RTS, DTR to desired settings */ if (ioctl(fd, TIOCMBIC, &out) < 0) { br_error("bits_out", "ioctl"); return -1; } if (usec_delay(br_inter_bit_delay) < 0) return -1; return 0; } static int clock_out(const int fd) { /* * Send out a "clock pulse" -- both RTS and DTR set; used before/after * command (long pulse) and between command bits (short) */ int out = TIOCM_FOR_0 | TIOCM_FOR_1; if (ioctl(fd, TIOCMBIS, &out) < 0) { br_error("clock_out", "ioctl"); return -1; } if (usec_delay(br_inter_bit_delay) < 0) return -1; return 0; } int br_cmd(int fd, unsigned char unit, int cmd) { /* * Put together the commands to send out. The basic start and end of * each command is the same; just fill in the little bits in the middle * */ unsigned char cmd_seq[5] = { 0xd5, 0xaa, 0x00, 0x00, 0xad }; register int i; register int j; unsigned char byte; int out; int housecode; int serial_state; int device; #ifdef USE_CLOCAL struct termios termios; struct termios tmp_termios; #endif if (cmd > MAX_CMD || cmd < 0) return -1; /* * Make sure to set the numeric part of the device address to 0 * for dim/bright (they only work per housecode) */ if ((cmd == DIM) || (cmd == BRIGHT)) unit &= 0xf0; if (br_verbose >= 2) { if (cmd == PAUSE) { printf("Pausing 1 second\n"); } else if (ISDIMCMD(cmd)) { printf("Sending command %s to %c\n", br_cmd_list[cmd], 'A' + ((unit & 0xf0) >> 4)); } else { printf("Sending command %s to %c%d\n", br_cmd_list[cmd], 'A' + ((unit & 0xf0) >> 4), (unit & 0x0f) + 1); } } if (cmd == PAUSE) { return usec_sleep(1000000); } #ifdef USE_CLOCAL if (tcgetattr(fd, &termios) < 0) { br_error("br_cmd", "tcgetattr"); return -1; } tmp_termios = termios; tmp_termios.c_cflag |= CLOCAL; if (tcsetattr(fd, TCSANOW, &tmp_termios) < 0) { br_error("br_cmd", "tcsetattr"); return -1; } #endif /* * Save current state of bits we don't want to touch in serial * register */ if (ioctl(fd, TIOCMGET, &serial_state) < 0) { br_error("br_cmd", "ioctl"); return -1; } /* * Just keep state of lines to be mucked with */ serial_state &= (TIOCM_FOR_0 | TIOCM_FOR_1); /* Figure out which ones we're going to want to clear * when finished (they'll both be high after the last * clock_out) */ serial_state ^= (TIOCM_FOR_0 | TIOCM_FOR_1); housecode = unit >> 4; device = unit & 0x0f; /* * Slap together the variable part of a command */ cmd_seq[2] |= housecode_table[housecode] << 4 | device_table[device][0]; cmd_seq[3] |= device_table[device][1] | cmd_table[cmd]; /* * Set lines to clock and wait, to make sure receiver is ready */ if (clock_out(fd) < 0) return -1; if (usec_sleep(br_pre_cmd_delay) < 0) return -1; if (br_verbose == 5) { printf(" -------HEAD------ -----COMMAND----- --FOOT--\n"); printf("sending bits: "); } else if (br_verbose == 4) { printf("Sending bytes: "); } for (j = 0; j < 5; j++) { byte = cmd_seq[j]; if (br_verbose == 4) printf("%02x", (unsigned int)byte); /* * Roll out the bits, following each one by a "clock". */ for (i = 0; i < 8; i++) { out = (byte & 0x80) ? 1:0; byte <<= 1; if (br_verbose == 5) printf("%d", out); if ((bits_out(fd, out) < 0) || (clock_out(fd) < 0)) return -1; } if ((br_verbose == 4) || (br_verbose == 5)) printf(" "); } if ((br_verbose == 4) || (br_verbose == 5)) { printf("\n"); fflush(stdout); } /* * Close with a clock pulse and wait a bit to allow command to complete */ if (clock_out(fd) < 0) return -1; if (usec_sleep(br_post_cmd_delay) < 0) return -1; /* * Restore the serial lines to how we found them */ if (ioctl(fd, TIOCMBIC, &serial_state) < 0) { br_error("x10_br_out", "ioctl"); return -1; } #ifdef USE_CLOCAL if (tcsetattr(fd, TCSANOW, &termios) < 0) { br_error("br_cmd", "tcsetattr"); return -1; } #endif return 0; } #ifdef __cplusplus } #endif bottlerocket-0.05b3/br_cmd.h100644 764 764 4376 6752215163 14233 0ustar tymmtymm#ifndef X10_BR_CMD_H #define X10_BR_CMD_H /* * * Header file for BottleRocket command output functions * (c) 1999 Tymm Twillman (tymm@acm.org) * * This is for interfacing with the X10 Dynamite wireless transmitter for X10 * home automation hardware. * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * */ #define DIMRANGE 12 #define ISDIMCMD(cmd) ((cmd == DIM) || (cmd == BRIGHT)) #define CMDHASDEVS(cmd) ((cmd == ON) || (cmd == OFF)) /* command need device to work on? */ #define HOUSENAME(house) (((house < 0) || (house > 15)) ? \ '?':"ABCDEFGHIJKLMNOP"[(int)house]) #define DEVNAME(dev) (((dev < 0) || (dev > 16)) ? 0 : dev + 1) /* ugly or what? */ #define HOUSECODE(val) (HOUSENAME(toupper(val) - 'A') != '?' ? (toupper(val) - 'A'):-1) /* * Commands allowed for x10_br_out */ #define ON 0 #define OFF 1 #define DIM 2 #define BRIGHT 3 #define ALL_OFF 4 #define ALL_ON 5 #define ALL_LAMPS_OFF 6 #define ALL_LAMPS_ON 7 #define PAUSE 8 extern const char *br_cmd_list[]; int br_cmd(int /* file desc */, unsigned char /* address */, int /* cmd */); void br_error(char * /* where */, char * /* problem */); /* * Shouldn't need to mess with timing things, but just in case you want to... */ extern int br_pre_cmd_delay; extern int br_post_cmd_delay; extern int br_inter_bit_delay; /* * How verbose should we be? */ extern int br_verbose; /* * In case an application wants to handle the errors for itself, it can * change this to point to its own error handler. */ extern void (*br_error_handler)(char * /* where */, char * /*problem */); #endif bottlerocket-0.05b3/Makefile.in100644 764 764 3332 6747502605 14674 0ustar tymmtymm# # Makefile for BottleRocket (controller for X10 FireCracker home automation # kit) # srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ CFLAGS = @CFLAGS@ CFLAGS += -I. -Wall -O2 -DX10_PORTNAME=\"@X10PORT@\" DEFS=@DEFS@ LIBS=@LIBS@ INSTALL= @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ CC=@CC@ # # uncomment if you want to use TX instead of DTR (necessary on some # Macs and with Boca boards, etc. # # DEFS += -DTIOCM_FOR_0=TIOCM_ST bin: br lib: libbr.a br: br.o libbr.a ${CC} ${CFLAGS} ${DEFS} -o br br.o -L. -lbr br.o: ${srcdir}/br.c ${srcdir}/br_cmd.h ${srcdir}/br_cmd_engine.h ${CC} ${CFLAGS} ${DEFS} -c ${srcdir}/br.c libbr.a: br_cmd.o br_cmd_engine.o ${AR} cru libbr.a br_cmd.o br_cmd_engine.o br_cmd.o: ${srcdir}/br_cmd.c ${srcdir}/br_cmd.h ${srcdir}/br_translate.h ${CC} ${CFLAGS} ${DEFS} -c ${srcdir}/br_cmd.c br_cmd_engine.o: ${srcdir}/br_cmd_engine.c ${srcdir}/br_cmd_engine.h ${CC} ${CFLAGS} ${DEFS} -c ${srcdir}/br_cmd_engine.c install: br ${INSTALL} -d -m 755 ${bindir} ${INSTALL} -m 555 br ${bindir} lib_install: libbr.a br_cmd.h br_cmd_engine.h ${INSTALL} -d -m 755 ${libdir} ${INSTALL} -d -m 744 ${includedir} ${INSTALL} -m 644 libbr.a ${libdir} ${INSTALL} -m 644 br_cmd.h ${includedir} ${INSTALL} -m 644 br_cmd_engine.h ${includedir} clean: -rm -f *.o *.a br core really_clean: clean -rm -f config.h config.cache config.status config.log Makefile *.bak bottlerocket-0.05b3/br_translate.h100644 764 764 2705 6747527635 15475 0ustar tymmtymm#ifndef BR_TRANSLATE_H #define BR_TRANSLATE_H /* Translation tables for encoding addresses/commands for the X10 FireCracker home automation kit (c) 1999 Tymm Twillman (tymm@acm.org). Free Software. LGPL applies. No warranties expressed or implied. */ /* * (for error checking) */ #define MAX_CMD 8 #define MAX_housecode 15 #define MAX_DEVICE 15 /* * Used to create letter housecode part of a device address -- could use some * bit magic but this is less of a pain and easier to read */ static char housecode_table[] = { /* A */ 0x06, /* B */ 0x07, /* C */ 0x04, /* D */ 0x05, /* E */ 0x08, /* F */ 0x09, /* G */ 0x0a, /* H */ 0x0b, /* I */ 0x0e, /* J */ 0x0f, /* K */ 0x0c, /* L */ 0x0d, /* M */ 0x00, /* N */ 0x01, /* O */ 0x02, /* P */ 0x03 }; /* * For number part of device address */ static char device_table[][2] = { /* 1-4 */ {0x00, 0x00}, {0x00, 0x10}, {0x00, 0x08}, {0x00, 0x18}, /* 5-8 */ {0x00, 0x40}, {0x00, 0x50}, {0x00, 0x48}, {0x00, 0x58}, /* 9-12 */ {0x04, 0x00}, {0x04, 0x10}, {0x04, 0x08}, {0x04, 0x18}, /* 13-16 */ {0x04, 0x40}, {0x04, 0x50}, {0x04, 0x48}, {0x04, 0x58} }; /* * For encoding the command */ static char cmd_table[] = { /* off */ 0x00, /* on */ 0x20, /* dim */ 0x98, /* bright */ 0x88, /* all off */ 0x80, /* all on */ 0x91, /* lamps off */ 0x84, /* lamps on */ 0x94, /* (pause; shouldn't ever use this entry, "on" seems safest) */ 0x20 }; #endif bottlerocket-0.05b3/configure.in100644 764 764 2373 6747502475 15151 0ustar tymmtymmdnl dnl Autoconf script for bottlerocket dnl dnl make sure we have our files around. AC_INIT(br_cmd.h) AC_CONFIG_HEADER(config.h) AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL dnl Define the function that peeks for getopt_long AC_DEFUN(BR_CHECK_GETOPT_LONG, [ AC_EGREP_HEADER(getopt_long, getopt.h, AC_DEFINE(HAVE_GETOPT_LONG)) ]) AC_DEFUN(BR_CHECK_ISSETUGID, [ AC_EGREP_HEADER(issetugid, unistd.h, AC_DEFINE(HAVE_ISSETUGID)) ]) dnl dnl Check for some headers dnl AC_CHECK_HEADERS(features.h errno.h sys/termios.h) dnl dnl Some other custom arguments dnl AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging code], AC_DEFINE(DEBUG)) dnl dnl And find the port to use. dnl AC_DEFUN(BR_FIND_PORT, [AC_ARG_WITH(x10port, [ --with-x10port=PATH Specify the serial port for the x10 module], [ case "$withval" in *) X10PORT="$withval" ;; esac], [ X10PORT="auto" ]) if test "$X10PORT" = "auto" then echo "guessing x10 port" for port in /dev/ttyS0 /dev/cua0 /dev/cuaa0 /dev/tty00 /dev/ttya do if test -c $port then X10PORT=$port; break fi done fi echo "using $X10PORT for x10 port" ]) dnl Check for important programs, like the C compiler. BR_FIND_PORT BR_CHECK_GETOPT_LONG BR_CHECK_ISSETUGID AC_SUBST(X10PORT) AC_OUTPUT(Makefile) bottlerocket-0.05b3/configure100755 764 764 122572 6747502475 14613 0ustar tymmtymm#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.12 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-debug Enable debugging code" ac_help="$ac_help --with-x10port=PATH Specify the serial port for the x10 module" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.12" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=br_cmd.h # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:530: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:559: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" ac_prog_rejected=no for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:607: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:641: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:646: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:670: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then CFLAGS="-g -O2" else CFLAGS="-O2" fi else GCC= test "${CFLAGS+set}" = set || CFLAGS="-g" fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:698: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:788: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. for ac_prog in ginstall installbsd scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. # OSF/1 installbsd also uses dspmsg, but is usable. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' for ac_hdr in features.h errno.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:847: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:857: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" cat >> confdefs.h <<\EOF #define DEBUG 1 EOF fi # Check whether --with-x10port or --without-x10port was given. if test "${with_x10port+set}" = set; then withval="$with_x10port" case "$withval" in *) X10PORT="$withval" ;; esac else X10PORT="auto" fi if test "$X10PORT" = "auto" then echo "locating x10 port automatically" if test -c /dev/ttyS0 # Linux (some 2.1, 2.2, 2.3...) then X10PORT="/dev/ttyS0" else if test -c /dev/cua0 # NetBSD, Linux (older), others... then X10PORT="/dev/cua0" else if test -c /dev/cuaa0 # FreeBSD then X10PORT="/dev/cuaa0" else X10PORT="/dev/tty00" # Digital Unix fi fi fi fi echo "using $X10PORT for x10 port" cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "getopt_long" >/dev/null 2>&1; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_GETOPT_LONG 1 EOF fi rm -f conftest* cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "issetugid" >/dev/null 2>&1; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_ISSETUGID 1 EOF fi rm -f conftest* trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.12" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@X10PORT@%$X10PORT%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 bottlerocket-0.05b3/config.h.in100644 764 764 743 6747502475 14642 0ustar tymmtymm/* config.h.in. Generated automatically from configure.in by autoheader. */ /* * Do we have getopt_long() ? */ #undef HAVE_GETOPT_LONG /* * How about issetugid() ? */ #undef HAVE_ISSETUGID /* * Do we want debugging? */ #undef DEBUG /* Define if you have the header file. */ #undef HAVE_ERRNO_H /* Define if you have the header file. */ #undef HAVE_FEATURES_H /* Define if you have the header file. */ #undef HAVE_SYS_TERMIOS_H bottlerocket-0.05b3/install-sh100755 764 764 12736 6747502475 14670 0ustar tymmtymm#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 bottlerocket-0.05b3/LICENSE.gpl100664 764 764 43127 6752467210 14443 0ustar tymmtymm GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. bottlerocket-0.05b3/COPYING100664 764 764 631 6752474123 13642 0ustar tymmtymmThis package is now distributed partially under the GPL license and partially under the LGPL license. The library is LGPL'd (see LICENCE.lgpl for details); this includes br_cmd.c, br_cmd.h, br_cmd_engine.c, br_cmd_engine.h, br_translate.h. The br program itself is distributed under the GPL license (see LICENSE.gpl for details); this is a change from 0.04 and previous versions. This covers br.c and br.h.bottlerocket-0.05b3/INSTALL100664 764 764 3503 6752471025 13657 0ustar tymmtymmINSTALLING BottleRocket: ----------------------- ./configure make make install Note: The Makefile assumes that your make program is GNU gmake; if this is not the case, you will need to hand-edit the Makefile for your platform after running configure. If you need help, email me (my email address is in the README file). That's it! Note that BottleRocket requires access to the serial port that your FireCracker is plugged into, so you need to be root to use it, or set it up setgid (generally group "tty" under Linux, "dialers" under FreeBSD, check with someone you trust if you're not sure how to set this up) for other users to use it (this is definitely recommended over making it setuid). It's always a good idea to look over code that you're going to be running with elevated privileges (do that now!) to make sure you're comfortable with it having higher privileges. Also be aware that just making it setgid (or uid), executable by anyone, means that *anyone* on your system can use it to turn thing on/ off, and IT IS POSSIBLE TO CAUSE A MODEM PLUGGED IN THROUGH THE DYNAMITE MODULE TO LOSE CARRIER. If the process is killed at the right time, DTR and/or RTS will be set low and can remain that way. There is no way to stop a user from sending a SIGKILL to a process that they have run, even if it's setuid/gid, on at least most operating systems that I'm familiar with. YOU HAVE BEEN WARNED. You can now specify the serial port (or a link to a serial port) from configure; use ./configure --with-x10port= to do this. Use ./configure --help to get a full list of options you can pass to configure. I recommend using --with-x10port=/dev/firecracker and adding a symbolic link from /dev/firecracker to whatever device your firecracker is plugged into; this makes it easy to move the firecracker to another port if you so choose.bottlerocket-0.05b3/LICENSE.lgpl100664 764 764 57505 6747502475 14633 0ustar tymmtymm GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS bottlerocket-0.05b3/br_cmd_engine.c100664 764 764 40763 6752465774 15614 0ustar tymmtymm/* * br_cmd_engine.c -- Command processing functions for BottleRocket routines * for controlling the X10 FireCracker wireless home automation kit. * (c) 1999 by Tymm Twillman (tymm@acm.org). * * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * */ #ifdef __cplusplus extern C { #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #include #include #ifdef HAVE_ERRNO_H #include #endif #include "br_cmd.h" #include "br_cmd_engine.h" int br_default_house = 0; int br_inverse_cmd(int cmd) { switch (cmd) { case ON: return OFF; break; case OFF: return ON; break; case DIM: return BRIGHT; break; case BRIGHT: return DIM; break; case ALL_ON: return ALL_OFF; break; case ALL_OFF: return ALL_ON; break; case ALL_LAMPS_ON: return ALL_LAMPS_OFF; break; case ALL_LAMPS_OFF: return ALL_LAMPS_ON; break; } return -1; } int br_execute(int fd, br_control_info *cinfo) { /* * Run through a list of commands and execute them */ register int i; register int j; register int repeat = cinfo->repeat; int inverse = cinfo->inverse; char unit; int rv; if (cinfo == NULL) { errno = EINVAL; br_error("br_execute", "NULL control info pointer"); return -1; } if (cinfo->units == NULL) { errno = EINVAL; br_error("br_execute", "NULL unit list pointer"); return -1; } /* However many times we have to repeat this thing... */ for (; repeat > 0; repeat--) { /* Do for each command in the command list... */ for (i = 0; i < cinfo->numcmds; i++) { /* For each device in the device list for that command */ if (CMDHASDEVS(cinfo->cmds[i]) && cinfo->units[i]->devs == NULL) { errno = EINVAL; br_error("br_execute", "NULL device list"); return -1; } for (j = 0; j < (CMDHASDEVS(cinfo->cmds[i]) ? cinfo->units[i]->numunits:1); j++) { unit = ((char)cinfo->units[i]->houses[j] << 4) | (CMDHASDEVS(cinfo->cmds[i]) ? cinfo->units[i]->devs[j]:0); rv = br_cmd(fd, unit, (inverse < 0) ? br_inverse_cmd(cinfo->cmds[i]):cinfo->cmds[i]); if (rv < 0) return -1; } } if (inverse) inverse = 0 - inverse; } return 0; } br_unit_list *br_new_unit_list() { br_unit_list *units; units = malloc(sizeof(br_unit_list)); if (units == NULL) { br_error("br_new_unit_list", "malloc"); return NULL; } #ifdef MEM_DEBUG printf("br_new_unit_list: Malloced %d bytes at %lx\n", sizeof(br_unit_list), (unsigned long)units); #endif units->allocatedunits = 0; units->numunits = 0; units->devs = NULL; units->houses = NULL; return units; } int br_free_unit_list(br_unit_list *units) { if (units == NULL) return 0; if (units->devs != NULL) { #ifdef MEM_DEBUG printf("br_free_unit_list: Freeing memory at %lx\n", (unsigned long)units->devs); #endif free(units->devs); } if (units->houses != NULL) { #ifdef MEM_DEBUG printf("br_free_unit_list: Freeing memory at %lx\n", (unsigned long)units->houses); #endif free(units->houses); } #ifdef MEM_DEBUG printf("br_free_unit_list: Freeing memory at %lx\n", (unsigned long)units); #endif free(units); return 0; } int br_add_unit(br_unit_list *units, int house, int dev) { if (units == NULL) { errno = EINVAL; br_error("br_add_unit", "NULL unit list"); return -1; } if (units->numunits >= units->allocatedunits) { #ifdef MEM_DEBUG printf("br_add_unit: Reallocing memory from %lx...\n", (unsigned long)units->devs); #endif units->devs = realloc(units->devs, (units->allocatedunits + UNIT_BLKSIZE) * sizeof(int)); if (units->devs == NULL) { br_error("br_add_unit", "realloc"); return -1; } #ifdef MEM_DEBUG printf("br_add_unit: Realloced %d bytes at %lx\n", (units->allocatedunits + UNIT_BLKSIZE) * sizeof(int), (unsigned long)units->devs); printf("br_add_unit: Reallocing memory from %lx...\n", (unsigned long)units->houses); #endif units->houses = realloc(units->houses, (units->allocatedunits + UNIT_BLKSIZE) * sizeof(int)); if (units->houses == NULL) { br_error("br_add_unit", "realloc"); return -1; } #ifdef MEM_DEBUG printf("br_add_unit: Realloced %d bytes at %lx\n", (units->allocatedunits + UNIT_BLKSIZE) * sizeof(int), (unsigned long)units->houses); #endif units->allocatedunits += UNIT_BLKSIZE; } units->devs[units->numunits] = dev; units->houses[units->numunits] = house; units->numunits++; return 0; } int br_del_unit(br_unit_list *units, int house, int dev) { register int i; int moveby = 0; if (units == NULL) { errno = EINVAL; br_error("br_del_unit", "NULL unit list"); return -1; } for (i = 0; i < (units->numunits - moveby); i++) { if ( ((units->devs && (units->devs[i] == dev)) || (dev == 0)) && ((units->houses && (units->houses[i] == house)) || (house == 0)) ) { moveby++; } if (units->devs) units->devs[i] = units->devs[i + moveby]; if (units->houses) units->houses[i] = units->houses[i + moveby]; } units->numunits -= moveby; if (units->numunits == 0) { if (units->devs) { #ifdef MEM_DEBUG printf("br_del_unit: Freeing memory at %lx\n", (unsigned long)units->devs); #endif free(units->devs); units->devs = NULL; } if (units->houses) { #ifdef MEM_DEBUG printf("br_del_unit: Freeing memory at %lx\n", (unsigned long)units->houses); #endif free(units->houses); units->houses = NULL; } units->numunits = 0; units->allocatedunits = 0; } return 0; } br_control_info *br_new_control_info() { br_control_info *cinfo; cinfo = malloc(sizeof(br_control_info)); if (cinfo == NULL) { br_error("br_new_control_info", "malloc"); return NULL; } #ifdef MEM_DEBUG printf("br_new_control_info: Malloced %d bytes at %lx\n", sizeof(br_control_info), (unsigned long)cinfo); #endif cinfo->inverse = 0; cinfo->repeat = 1; cinfo->numcmds = 0; cinfo->allocatedcmds = 0; cinfo->units = NULL; cinfo->cmds = NULL; return cinfo; } int br_free_control_info(br_control_info *cinfo) { if (cinfo) { br_free_cmds(cinfo); #ifdef MEM_DEBUG printf("br_free_control_info: Freeing memory at %lx\n", (unsigned long)cinfo); #endif free(cinfo); } return 0; } int br_malloc_cmds(br_control_info *cinfo, int numcmds) { if (cinfo == NULL) { errno = EINVAL; br_error("br_malloc_cmds", "NULL control info pointer"); return -1; } cinfo->cmds = malloc(numcmds * sizeof(int)); if ((cinfo->cmds) == NULL) { br_error("br_malloc_cmds", "malloc"); return -1; } #ifdef MEM_DEBUG printf("br_malloc_cmds: Malloced %d bytes at %lx\n", numcmds * sizeof(int), (unsigned long)cinfo->cmds); #endif cinfo->units = malloc(numcmds * sizeof(br_unit_list *)); if ((cinfo->units) == NULL) { br_error("br_malloc_cmds", "malloc"); return -1; } #ifdef MEM_DEBUG printf("br_malloc_cmds: Malloced %d bytes at %lx\n", numcmds * sizeof(br_unit_list *), (unsigned long)cinfo->units); #endif cinfo->allocatedcmds = numcmds; return 0; } int br_realloc_cmds(br_control_info *cinfo, int numcmds) { if (cinfo == NULL) { errno = EINVAL; br_error("br_realloc_cmds", "NULL control info pointer"); return -1; } #ifdef MEM_DEBUG printf("br_realloc_cmds: Reallocing memory from %lx...\n", (unsigned long)cinfo->cmds); #endif cinfo->cmds = realloc(cinfo->cmds, numcmds * sizeof(int)); if ((cinfo->cmds) == NULL) { br_error("br_realloc_cmds", "realloc"); return -1; } #ifdef MEM_DEBUG printf("br_realloc_cmds: Realloced %d bytes at %lx\n", numcmds * sizeof(int), (unsigned long)cinfo->cmds); printf("br_realloc_cmds: Reallocing memory from %lx...\n", (unsigned long)cinfo->units); #endif cinfo->units = realloc(cinfo->units, numcmds * sizeof(br_unit_list *)); if ((cinfo->units) == NULL) { br_error("br_realloc_cmds", "realloc"); return -1; } #ifdef MEM_DEBUG printf("br_realloc_cmds: Realloced %d bytes at %lx\n", numcmds * sizeof(br_unit_list *), (unsigned long)cinfo->units); #endif cinfo->allocatedcmds = numcmds; return 0; } int br_free_cmds(br_control_info *cinfo) { register int i; if (cinfo == NULL) { return 0; } if (cinfo->cmds) { #ifdef MEM_DEBUG printf("br_free_cmds: Freeing memory at %lx\n", (unsigned long)cinfo->cmds); #endif free(cinfo->cmds); cinfo->cmds = NULL; } if (cinfo->units) { for (i = 0; i < cinfo->numcmds; i++) { br_free_unit_list(cinfo->units[i]); cinfo->units[i] = NULL; } #ifdef MEM_DEBUG printf("br_free_cmds: Freeing memory at %lx\n", (unsigned long)cinfo->units); #endif free(cinfo->units); cinfo->units = NULL; } cinfo->numcmds = 0; cinfo->allocatedcmds = 0; return 0; } int br_add_ul_cmd(br_control_info *cinfo, int cmd, br_unit_list *units) { /* * Add a command, plus devices for it to act on and other info, to the * list of commands to be executed */ br_unit_list *tmpunits; if (cinfo == NULL) { errno = EINVAL; br_error("br_add_ul_cmd", "NULL control info pointer"); return -1; } if (units == NULL) { errno = EINVAL; br_error("br_add_ul_cmd", "NULL unit list pointer"); return -1; } tmpunits = br_uldup(units); if (tmpunits == NULL) { br_error("br_add_ul_cmd", "malloc"); return -1; } if (cinfo->numcmds >= cinfo->allocatedcmds) { if (br_realloc_cmds(cinfo, cinfo->numcmds + CMD_BLKSIZE) < 0) { br_free_unit_list(tmpunits); return -1; } } cinfo->cmds[cinfo->numcmds] = cmd; cinfo->units[cinfo->numcmds] = tmpunits; cinfo->numcmds++; return 0; } int br_add_cmd(br_control_info *cinfo, int cmd, int house, int dev) { br_unit_list *units; int tmperrno; units = br_new_unit_list(); if (units == NULL) return -1; if (br_add_unit(units, house, dev) < 0) { tmperrno = errno; br_free_unit_list(units); errno = tmperrno; return -1; } if (br_add_ul_cmd(cinfo, cmd, units) < 0) { tmperrno = errno; br_free_unit_list(units); errno = tmperrno; return -1; } br_free_unit_list(units); return 0; } int br_del_cmd(br_control_info *cinfo, int index) { register int i; if (cinfo == NULL) { errno = EINVAL; br_error("br_del_cmd", "NULL control info pointer"); return -1; } if (index >= cinfo->numcmds) { errno = EINVAL; br_error("br_del_cmd", "invalid command index"); return -1; } if ((cinfo->numcmds - 1) == 0) { if (br_free_cmds(cinfo) < 0) return -1; return 0; } br_free_unit_list(cinfo->units[index]); cinfo->units[index] = NULL; for (i = index; i < cinfo->numcmds - 1; i++) { cinfo->cmds[i] = cinfo->cmds[i + 1]; cinfo->units[i] = cinfo->units[i + 1]; } cinfo->numcmds--; return 0; } int br_strtoul(char *ulptr, br_unit_list *units, char **endptr) { int house; int tmphouse; int dev; char *my_endptr = NULL; char *last_endptr = ulptr; house = br_default_house; if (units == NULL) { errno = EINVAL; br_error("br_strtoul", "NULL unit list"); return -1; } /* Get rid of any residue */ if (units->devs) free(units->devs); if (units->houses) free(units->houses); units->devs = NULL; units->houses = NULL; units->allocatedunits = 0; units->numunits = 0; do { while (isspace(*ulptr)) ulptr++; tmphouse = br_strtohc(ulptr, &ulptr); if (tmphouse >= 0) house = tmphouse; last_endptr = ulptr; while (isspace(*ulptr)) ulptr++; dev = (int)strtol(ulptr, &my_endptr, 0); if ((dev > 16) || (dev < 1)) { errno = EINVAL; br_error("br_strtoul", "Bad device number"); return -1; } last_endptr = ulptr; while (isspace(*my_endptr)) my_endptr++; ulptr = my_endptr; if ((*my_endptr != '\0') && (*my_endptr != ',')) { *endptr = last_endptr; return 0; } if (br_add_unit(units, house, dev - 1) < 0) return -1; } while (*ulptr++); *endptr = --ulptr; return 0; } int br_ulcat(br_unit_list *a, br_unit_list *b) { register int i; if ((a == NULL) || (b == NULL)) { errno = EINVAL; br_error("br_ulcat", "NULL unit list"); return -1; } for (i = 0; i < b->numunits; i++) { if (br_add_unit(a, b->houses[i], b->devs[i]) < 0) return -1; } return 0; } br_unit_list *br_uldup(br_unit_list *a) { br_unit_list *units; register int i; units = br_new_unit_list(); if (units == NULL) return NULL; if (a->allocatedunits) { units->devs = malloc(sizeof(int) * a->allocatedunits); if (units->devs == NULL) { br_error("br_uldup", "malloc"); return NULL; } #ifdef MEM_DEBUG printf("br_dldup: Malloced %d bytes at %lx\n", sizeof(int) * a->allocatedunits, devs->devs); #endif units->houses = malloc(sizeof(int) * a->allocatedunits); if (units->houses == NULL) { br_error("br_uldup", "malloc"); return NULL; } #ifdef MEM_DEBUG printf("br_dldup: Malloced %d bytes at %lx\n", sizeof(int) * a->allocatedunits, devs->houses); #endif for (i = 0; i < a->numunits; i++) { units->devs[i] = a->devs[i]; units->houses[i] = a->houses[i]; } } units->numunits = a->numunits; units->allocatedunits = a->allocatedunits; return units; } int br_strtohc(char *hcptr, char **endptr) { char *my_endptr = hcptr; char c; while (isspace(*my_endptr)) my_endptr++; if (!*my_endptr) { *endptr = hcptr; return -1; } c = HOUSECODE(*my_endptr); if (c < 0) { *endptr = hcptr; return -1; } *endptr = ++my_endptr; return c; } int br_get_ul_device(br_unit_list *units, int index) { if (units == NULL) return -1; if (index >= units->numunits) return -1; return units->devs[index]; } int br_get_ul_house(br_unit_list *units, int index) { if (units == NULL) return -1; if (index > units->numunits) return -1; return units->houses[index]; } int br_get_num_units(br_unit_list *units) { if (units == NULL) return 0; return units->numunits; } int br_get_num_commands(br_control_info *cinfo) { if (cinfo == NULL) return 0; return cinfo->numcmds; } #ifdef __cplusplus } #endif bottlerocket-0.05b3/br_cmd_engine.h100664 764 764 3541 6752222146 15552 0ustar tymmtymm#ifndef _CMD_HANDLING_H #define _CMD_HANDLING_H #define CMD_BLKSIZE 64 /* How many commands should we allocate space for at a time? */ #define UNIT_BLKSIZE 5 /* How many units in a command allocated at a time */ typedef struct { int numunits; int allocatedunits; int *devs; int *houses; } br_unit_list; typedef struct { int inverse; int repeat; int numcmds; int allocatedcmds; br_unit_list **units; int *cmds; } br_control_info; int br_inverse_cmd(int /* command */); int br_set_fd(br_control_info *, int /* file descriptor */); int br_execute(int fd, br_control_info *); br_unit_list *br_new_unit_list(); int br_free_unit_list(br_unit_list *); int br_add_unit(br_unit_list *, int /* house */, int /* house */); int br_del_unit(br_unit_list *, int /* house */, int /* device */); int br_malloc_cmds(br_control_info *, int /* number of commands */); int br_realloc_cmds(br_control_info *, int /* number of commands */); int br_free_cmds(br_control_info *); int br_add_ul_cmd(br_control_info *, int /* command */, br_unit_list * /* units */); int br_add_cmd(br_control_info *, int /* command */, int /* house */, int /* device */); int br_del_cmd(br_control_info *, int /* command index */); br_control_info *br_new_control_info(); int br_free_control_info(br_control_info *); int br_strtoul(char * /* dlptr */, br_unit_list * /* units */, char ** /* endptr */); int br_ulcat(br_unit_list * /* units a */, br_unit_list * /* units b */); br_unit_list *br_uldup(br_unit_list * /* units */); int br_strtohc(char * /* hcptr */, char ** /* endptr */); int br_get_num_commands(br_control_info *); int br_get_ul_device(br_unit_list * /* units */, int /* index */); int br_get_ul_house(br_unit_list * /* units */, int /* index */); int br_get_num_units(br_unit_list * /* units */); extern int br_default_house; #endifbottlerocket-0.05b3/br.h100664 764 764 2536 6752474437 13421 0ustar tymmtymm#ifndef _BR_H #define _BR_H /* * br.h -- Macros/definitions for br.c (BottleRocket program for * controlling X10 FireCracker wireless home automation * kits) * * (c) 1999 Tymm Twillman (tymm@acm.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_ISSETUGID /* * Thanks to Warner Losh for info on how to do this better */ #define ISSETID() (issetugid()) #else #define ISSETID() (getuid() != geteuid() || getgid() != getegid()) #endif #define SAFE_FILENO(fd) ((fd != STDIN_FILENO) && (fd != STDOUT_FILENO) \ && (fd != STDERR_FILENO)) #endif /* #ifdef _BR_H */