home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Other / upsd / ups_folder / patch01.script < prev    next >
Encoding:
Text File  |  1991-05-01  |  6.6 KB  |  247 lines

  1. #! /bin/sh
  2. # This is a shell archive.  Remove anything before this line, then unpack
  3. # it by saving it into a file and typing "sh file".  To overwrite existing
  4. # files, type "sh file -c".  You can also feed this as standard input via
  5. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  6. # will see the following message at the end:
  7. #        "End of shell archive."
  8. # Contents:  HISTORY MANIFEST Patch01 version.h
  9. # Wrapped by root@pilikia on Tue Apr  9 22:03:27 1991
  10. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  11. if test -f 'HISTORY' -a "${1}" != "-c" ; then 
  12.   echo shar: Will not clobber existing file \"'HISTORY'\"
  13. else
  14. echo shar: Extracting \"'HISTORY'\" \(304 characters\)
  15. sed "s/^X//" >'HISTORY' <<'END_OF_FILE'
  16. XRELEASE HISTORY
  17. X
  18. XDate      Release  Patch  Description
  19. X-------------------------------------------------------------------------------
  20. X03/30/91  1.0      0      Initial release to net
  21. X04/09/91  1.0      1      Fixed stupidity with ups_time alarm setting and
  22. X                          added version stuff
  23. END_OF_FILE
  24. if test 304 -ne `wc -c <'HISTORY'`; then
  25.     echo shar: \"'HISTORY'\" unpacked with wrong size!
  26. fi
  27. # end of 'HISTORY'
  28. fi
  29. echo shar: Extracting \"'MANIFEST'\" \(530 characters\)
  30. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  31. X   File Name        Archive #    Description
  32. X-----------------------------------------------------------
  33. X HISTORY                    1    Program revision history
  34. X MANIFEST                   1    This shipping list
  35. X Makefile                   1    Upsd makefile    
  36. X README                     1    Documentation
  37. X common.h                   1    Common program header
  38. X funcs.c                    1    Functions 
  39. X main.c                     1    Main program
  40. X ups                        1    Init.d startup script
  41. X version.h                  1    Version control header
  42. END_OF_FILE
  43. if test 530 -ne `wc -c <'MANIFEST'`; then
  44.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  45. fi
  46. # end of 'MANIFEST'
  47. if test -f 'Patch01' -a "${1}" != "-c" ; then 
  48.   echo shar: Will not clobber existing file \"'Patch01'\"
  49. else
  50. echo shar: Extracting \"'Patch01'\" \(3233 characters\)
  51. sed "s/^X//" >'Patch01' <<'END_OF_FILE'
  52. X*** common.h.orig    Tue Apr  9 21:47:26 1991
  53. X--- common.h    Tue Apr  9 21:47:36 1991
  54. X***************
  55. X*** 17,22 ****
  56. X--- 17,24 ----
  57. X  #include <sys/signal.h>
  58. X  #include <sys/stat.h>
  59. X  
  60. X+ #include "version.h"
  61. X+ 
  62. X  #define ERR        -1        /* error return value */
  63. X  #define SH        "/bin/sh"    /* shell to exec shutdown command */
  64. X  #define ROOT        "/"        /* root directory for chdir */
  65. X*** funcs.c.orig    Tue Apr  9 21:47:26 1991
  66. X--- funcs.c    Tue Apr  9 21:47:42 1991
  67. X***************
  68. X*** 27,33 ****
  69. X      if ((s = getenv(UPSLOG)) != NULL)
  70. X          ups_log = s;
  71. X      if ((s = getenv(UPSTIME)) != NULL)
  72. X!         ups_time = atoi(s) * SECS_PER_MIN;
  73. X  }
  74. X  
  75. X  /*
  76. X--- 27,33 ----
  77. X      if ((s = getenv(UPSLOG)) != NULL)
  78. X          ups_log = s;
  79. X      if ((s = getenv(UPSTIME)) != NULL)
  80. X!         ups_time = atoi(s);
  81. X  }
  82. X  
  83. X  /*
  84. X***************
  85. X*** 42,52 ****
  86. X--- 42,56 ----
  87. X  {
  88. X      int     c;
  89. X  
  90. X+     void    version();
  91. X      void    usage();
  92. X  
  93. X      extern char *optarg;
  94. X      extern int optind, opterr;
  95. X  
  96. X+     /* display program version */
  97. X+     version(av[0]);
  98. X+ 
  99. X      /* parse the command line */
  100. X      while ((c = getopt(ac, av, "d:c:l:t:")) != EOF)
  101. X          switch (c) {
  102. X***************
  103. X*** 60,66 ****
  104. X              ups_log = optarg;
  105. X              break;
  106. X          case 't':    /* time option */
  107. X!             ups_time = atoi(optarg) * SECS_PER_MIN;
  108. X              break;
  109. X          case '\?':    /* illegal option */
  110. X              usage(av[0]);
  111. X--- 64,70 ----
  112. X              ups_log = optarg;
  113. X              break;
  114. X          case 't':    /* time option */
  115. X!             ups_time = atoi(optarg);
  116. X              break;
  117. X          case '\?':    /* illegal option */
  118. X              usage(av[0]);
  119. X***************
  120. X*** 158,164 ****
  121. X          }
  122. X          writelog(BATTERY_MSG);
  123. X  
  124. X!         alarm(ups_time);/* set the alarm clock */
  125. X  
  126. X          /* read blocks on UPS switch to online */
  127. X          if (read(ups_fd, &c, 1) == ERR)
  128. X--- 162,169 ----
  129. X          }
  130. X          writelog(BATTERY_MSG);
  131. X  
  132. X!         /* set the alarm clock */
  133. X!         alarm(ups_time * SECS_PER_MIN);
  134. X  
  135. X          /* read blocks on UPS switch to online */
  136. X          if (read(ups_fd, &c, 1) == ERR)
  137. X***************
  138. X*** 258,263 ****
  139. X--- 263,304 ----
  140. X  }
  141. X  
  142. X  /*
  143. X+ **    b a s e n a m e
  144. X+ **
  145. X+ **    remove absolute path from filename
  146. X+ **
  147. X+ */
  148. X+ char   *
  149. X+ basename(s)
  150. X+ char   *s;
  151. X+ {
  152. X+     register char *p;
  153. X+ 
  154. X+     /* point to char after last '/' */
  155. X+     if ((p = strrchr(s, '/')) != NULL)
  156. X+         return (++p);
  157. X+ 
  158. X+     return (s);
  159. X+ }
  160. X+ 
  161. X+ /*
  162. X+ **    v e r s i o n
  163. X+ **
  164. X+ **    display program version
  165. X+ */
  166. X+ void
  167. X+ version(s)
  168. X+ char   *s;
  169. X+ {
  170. X+     char   *basename();
  171. X+ 
  172. X+     /* display version if foreground */
  173. X+     if (signal(SIGINT, SIG_IGN) != SIG_IGN)
  174. X+         fprintf(stderr, "%s v%d.%d patchlevel %d\n", basename(s),
  175. X+             RELEASE, REVISION, PATCHLEVEL);
  176. X+ }
  177. X+ 
  178. X+ /*
  179. X  **    u s a g e
  180. X  **
  181. X  **    display program usage
  182. X***************
  183. X*** 266,272 ****
  184. X  usage(s)
  185. X  char   *s;
  186. X  {
  187. X!     fprintf(stderr, "usage: %s [-d tty][-c cmd][-l log][-t min]\n", s);
  188. X      fprintf(stderr, "\t-d tty\t\tpathname of UPS device\n");
  189. X      fprintf(stderr, "\t-c cmd\t\tpathname of shutdown command\n");
  190. X      fprintf(stderr, "\t-l log\t\tpathname of UPS log file\n");
  191. X--- 307,316 ----
  192. X  usage(s)
  193. X  char   *s;
  194. X  {
  195. X!     char   *basename();
  196. X! 
  197. X!     fprintf(stderr, "usage: %s [-d tty][-c cmd][-l log][-t min][-v]\n",
  198. X!         basename(s));
  199. X      fprintf(stderr, "\t-d tty\t\tpathname of UPS device\n");
  200. X      fprintf(stderr, "\t-c cmd\t\tpathname of shutdown command\n");
  201. X      fprintf(stderr, "\t-l log\t\tpathname of UPS log file\n");
  202. END_OF_FILE
  203. if test 3233 -ne `wc -c <'Patch01'`; then
  204.     echo shar: \"'Patch01'\" unpacked with wrong size!
  205. fi
  206. # end of 'Patch01'
  207. fi
  208. if test -f 'version.h' -a "${1}" != "-c" ; then 
  209.   echo shar: Will not clobber existing file \"'version.h'\"
  210. else
  211. echo shar: Extracting \"'version.h'\" \(234 characters\)
  212. sed "s/^X//" >'version.h' <<'END_OF_FILE'
  213. X/*
  214. X**    v e r s i o n . h
  215. X**
  216. X**    version header for version control
  217. X**
  218. X**    Arthur W. Neilson III
  219. X**    art@pilikia.pegasus.com
  220. X**    Tue Apr  9 1991
  221. X*/
  222. X
  223. X#define RELEASE_DATE    "03/30/91"
  224. X#define RELEASE        1
  225. X#define REVISION    0
  226. X#define PATCHLEVEL    1
  227. END_OF_FILE
  228. if test 234 -ne `wc -c <'version.h'`; then
  229.     echo shar: \"'version.h'\" unpacked with wrong size!
  230. fi
  231. # end of 'version.h'
  232. fi
  233. echo shar: End of shell archive.
  234. exit 0
  235. -----8<----- cut here -----8<----- cut here -----8<----- cut here -----8<-----
  236.  
  237. -- 
  238. Arthur W. Neilson III        | INET: art@pilikia.pegasus.com
  239. Bank of Hawaii Tech Support    | UUCP: uunet!ucsd!nosc!pilikia!art
  240.  
  241. exit 0 # Just in case...
  242. -- 
  243. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  244. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  245. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  246. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  247.