home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: HISTORY MANIFEST Patch01 version.h
- # Wrapped by root@pilikia on Tue Apr 9 22:03:27 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'HISTORY' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'HISTORY'\"
- else
- echo shar: Extracting \"'HISTORY'\" \(304 characters\)
- sed "s/^X//" >'HISTORY' <<'END_OF_FILE'
- XRELEASE HISTORY
- X
- XDate Release Patch Description
- X-------------------------------------------------------------------------------
- X03/30/91 1.0 0 Initial release to net
- X04/09/91 1.0 1 Fixed stupidity with ups_time alarm setting and
- X added version stuff
- END_OF_FILE
- if test 304 -ne `wc -c <'HISTORY'`; then
- echo shar: \"'HISTORY'\" unpacked with wrong size!
- fi
- # end of 'HISTORY'
- fi
- echo shar: Extracting \"'MANIFEST'\" \(530 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- X File Name Archive # Description
- X-----------------------------------------------------------
- X HISTORY 1 Program revision history
- X MANIFEST 1 This shipping list
- X Makefile 1 Upsd makefile
- X README 1 Documentation
- X common.h 1 Common program header
- X funcs.c 1 Functions
- X main.c 1 Main program
- X ups 1 Init.d startup script
- X version.h 1 Version control header
- END_OF_FILE
- if test 530 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- if test -f 'Patch01' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Patch01'\"
- else
- echo shar: Extracting \"'Patch01'\" \(3233 characters\)
- sed "s/^X//" >'Patch01' <<'END_OF_FILE'
- X*** common.h.orig Tue Apr 9 21:47:26 1991
- X--- common.h Tue Apr 9 21:47:36 1991
- X***************
- X*** 17,22 ****
- X--- 17,24 ----
- X #include <sys/signal.h>
- X #include <sys/stat.h>
- X
- X+ #include "version.h"
- X+
- X #define ERR -1 /* error return value */
- X #define SH "/bin/sh" /* shell to exec shutdown command */
- X #define ROOT "/" /* root directory for chdir */
- X*** funcs.c.orig Tue Apr 9 21:47:26 1991
- X--- funcs.c Tue Apr 9 21:47:42 1991
- X***************
- X*** 27,33 ****
- X if ((s = getenv(UPSLOG)) != NULL)
- X ups_log = s;
- X if ((s = getenv(UPSTIME)) != NULL)
- X! ups_time = atoi(s) * SECS_PER_MIN;
- X }
- X
- X /*
- X--- 27,33 ----
- X if ((s = getenv(UPSLOG)) != NULL)
- X ups_log = s;
- X if ((s = getenv(UPSTIME)) != NULL)
- X! ups_time = atoi(s);
- X }
- X
- X /*
- X***************
- X*** 42,52 ****
- X--- 42,56 ----
- X {
- X int c;
- X
- X+ void version();
- X void usage();
- X
- X extern char *optarg;
- X extern int optind, opterr;
- X
- X+ /* display program version */
- X+ version(av[0]);
- X+
- X /* parse the command line */
- X while ((c = getopt(ac, av, "d:c:l:t:")) != EOF)
- X switch (c) {
- X***************
- X*** 60,66 ****
- X ups_log = optarg;
- X break;
- X case 't': /* time option */
- X! ups_time = atoi(optarg) * SECS_PER_MIN;
- X break;
- X case '\?': /* illegal option */
- X usage(av[0]);
- X--- 64,70 ----
- X ups_log = optarg;
- X break;
- X case 't': /* time option */
- X! ups_time = atoi(optarg);
- X break;
- X case '\?': /* illegal option */
- X usage(av[0]);
- X***************
- X*** 158,164 ****
- X }
- X writelog(BATTERY_MSG);
- X
- X! alarm(ups_time);/* set the alarm clock */
- X
- X /* read blocks on UPS switch to online */
- X if (read(ups_fd, &c, 1) == ERR)
- X--- 162,169 ----
- X }
- X writelog(BATTERY_MSG);
- X
- X! /* set the alarm clock */
- X! alarm(ups_time * SECS_PER_MIN);
- X
- X /* read blocks on UPS switch to online */
- X if (read(ups_fd, &c, 1) == ERR)
- X***************
- X*** 258,263 ****
- X--- 263,304 ----
- X }
- X
- X /*
- X+ ** b a s e n a m e
- X+ **
- X+ ** remove absolute path from filename
- X+ **
- X+ */
- X+ char *
- X+ basename(s)
- X+ char *s;
- X+ {
- X+ register char *p;
- X+
- X+ /* point to char after last '/' */
- X+ if ((p = strrchr(s, '/')) != NULL)
- X+ return (++p);
- X+
- X+ return (s);
- X+ }
- X+
- X+ /*
- X+ ** v e r s i o n
- X+ **
- X+ ** display program version
- X+ */
- X+ void
- X+ version(s)
- X+ char *s;
- X+ {
- X+ char *basename();
- X+
- X+ /* display version if foreground */
- X+ if (signal(SIGINT, SIG_IGN) != SIG_IGN)
- X+ fprintf(stderr, "%s v%d.%d patchlevel %d\n", basename(s),
- X+ RELEASE, REVISION, PATCHLEVEL);
- X+ }
- X+
- X+ /*
- X ** u s a g e
- X **
- X ** display program usage
- X***************
- X*** 266,272 ****
- X usage(s)
- X char *s;
- X {
- X! fprintf(stderr, "usage: %s [-d tty][-c cmd][-l log][-t min]\n", s);
- X fprintf(stderr, "\t-d tty\t\tpathname of UPS device\n");
- X fprintf(stderr, "\t-c cmd\t\tpathname of shutdown command\n");
- X fprintf(stderr, "\t-l log\t\tpathname of UPS log file\n");
- X--- 307,316 ----
- X usage(s)
- X char *s;
- X {
- X! char *basename();
- X!
- X! fprintf(stderr, "usage: %s [-d tty][-c cmd][-l log][-t min][-v]\n",
- X! basename(s));
- X fprintf(stderr, "\t-d tty\t\tpathname of UPS device\n");
- X fprintf(stderr, "\t-c cmd\t\tpathname of shutdown command\n");
- X fprintf(stderr, "\t-l log\t\tpathname of UPS log file\n");
- END_OF_FILE
- if test 3233 -ne `wc -c <'Patch01'`; then
- echo shar: \"'Patch01'\" unpacked with wrong size!
- fi
- # end of 'Patch01'
- fi
- if test -f 'version.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'version.h'\"
- else
- echo shar: Extracting \"'version.h'\" \(234 characters\)
- sed "s/^X//" >'version.h' <<'END_OF_FILE'
- X/*
- X** v e r s i o n . h
- X**
- X** version header for version control
- X**
- X** Arthur W. Neilson III
- X** art@pilikia.pegasus.com
- X** Tue Apr 9 1991
- X*/
- X
- X#define RELEASE_DATE "03/30/91"
- X#define RELEASE 1
- X#define REVISION 0
- X#define PATCHLEVEL 1
- END_OF_FILE
- if test 234 -ne `wc -c <'version.h'`; then
- echo shar: \"'version.h'\" unpacked with wrong size!
- fi
- # end of 'version.h'
- fi
- echo shar: End of shell archive.
- exit 0
- -----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----
-
- --
- Arthur W. Neilson III | INET: art@pilikia.pegasus.com
- Bank of Hawaii Tech Support | UUCP: uunet!ucsd!nosc!pilikia!art
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-