home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / ecu / patch01c < prev    next >
Encoding:
Text File  |  1991-08-16  |  38.1 KB  |  1,291 lines

  1. Newsgroups: comp.sources.misc
  2. From: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
  3. Subject:  v22i021:  ecu - ECU async comm package rev 3.10, Patch01c/3
  4. Message-ID: <1991Aug16.020630.13124@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: b5862a2d56bb6ddb891388a0a3f301e4
  6. Date: Fri, 16 Aug 1991 02:06:30 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Warren Tucker <wht@n4hgf.Mt-Park.GA.US>
  10. Posting-number: Volume 22, Issue 21
  11. Archive-name: ecu/patch01c
  12. Environment: SCO, XENIX, ISC
  13. Patch-To: ecu: Volume 21, Issue 53-89
  14.  
  15. #!/bin/sh
  16. # This is part 03 of ecu310-p1
  17. if touch 2>&1 | fgrep 'amc' > /dev/null
  18.  then TOUCH=touch
  19.  else TOUCH=true
  20. fi
  21. # ============= PATCH1.03 ==============
  22. echo 'x - extracting PATCH1.03 (Text)'
  23. sed 's/^X//' << 'SHAR_EOF' > 'PATCH1.03' &&
  24. X:
  25. X#-------------------------------------------------------
  26. X# PATCH1.03
  27. X# Fixes and ISC Compatibility
  28. X# created by gendiff x1.03 on 12 Aug 1991 08:02 UTC
  29. X#-------------------------------------------------------
  30. X*** /u1/src/ecu310/makedirs.c    Thu Jul 25 12:58:00 1991
  31. X--- makedirs.c    Fri Aug  9 02:13:16 1991
  32. X***************
  33. X*** 2,7
  34. X      makedirs.c
  35. X  --------------------------------------------------------------------------*/
  36. X  /*+:EDITS:*/
  37. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  38. X  /*:07-15-1991-14:24-wht@n4hgf-creation */
  39. X  
  40. X
  41. X--- 2,8 -----
  42. X      makedirs.c
  43. X  --------------------------------------------------------------------------*/
  44. X  /*+:EDITS:*/
  45. X+ /*:08-09-1991-02:13-root@n4hgf-need smart_fork for XENIX */
  46. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  47. X  /*:07-15-1991-14:24-wht@n4hgf-creation */
  48. X  
  49. X***************
  50. X*** 69,74
  51. X      }
  52. X      exit(0);
  53. X  }    /* end of main */
  54. X  
  55. X  /* vi: set tabstop=4 shiftwidth=4: */
  56. X  /* end of makedirs.c */
  57. X
  58. X--- 70,96 -----
  59. X      }
  60. X      exit(0);
  61. X  }    /* end of main */
  62. X+ 
  63. X+ /*+-------------------------------------------------------------------------
  64. X+     smart_fork() - needed for mkdirs.c under XENIX
  65. X+ --------------------------------------------------------------------------*/
  66. X+ #if defined(M_XENIX)
  67. X+ int
  68. X+ smart_fork()
  69. X+ {
  70. X+ register int count = 5;
  71. X+ register int pid;
  72. X+ 
  73. X+     while(count--)
  74. X+     {
  75. X+         if((pid = fork()) >= 0)
  76. X+             return(pid);
  77. X+         if(count)
  78. X+             nap(40L);
  79. X+     }
  80. X+     return(-1);
  81. X+ }    /* end of smart_fork */
  82. X+ #endif
  83. X  
  84. X  /* vi: set tabstop=4 shiftwidth=4: */
  85. X  /* end of makedirs.c */
  86. X*** /u1/src/ecu310/mkdirs.c    Thu Jul 25 12:58:00 1991
  87. X--- mkdirs.c    Fri Aug  9 02:11:31 1991
  88. X***************
  89. X*** 4,9
  90. X      wht@n4hgf.Mt-Park.GA.US
  91. X  --------------------------------------------------------------------------*/
  92. X  /*+:EDITS:*/
  93. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  94. X  /*:07-15-1991-14:20-wht@n4hgf-creation */
  95. X  
  96. X
  97. X--- 4,11 -----
  98. X      wht@n4hgf.Mt-Park.GA.US
  99. X  --------------------------------------------------------------------------*/
  100. X  /*+:EDITS:*/
  101. X+ /*:08-09-1991-00:30-wht@n4hgf-no need for sys/wait.h + XENIX doesn't have it */
  102. X+ /*:08-06-1991-02:37-root@n4hgf-how did compile succeed without signal.h? */
  103. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  104. X  /*:07-15-1991-14:20-wht@n4hgf-creation */
  105. X  
  106. X***************
  107. X*** 7,12
  108. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  109. X  /*:07-15-1991-14:20-wht@n4hgf-creation */
  110. X  
  111. X  #include <string.h>
  112. X  #if defined(ISC22)
  113. X  #define _POSIX_SOURCE    /* yetch - for crock in types.h to
  114. X
  115. X--- 9,15 -----
  116. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  117. X  /*:07-15-1991-14:20-wht@n4hgf-creation */
  118. X  
  119. X+ #include <signal.h>
  120. X  #include <string.h>
  121. X  #if defined(ISC22)
  122. X  #define _POSIX_SOURCE    /* yetch - for crock in types.h to
  123. X***************
  124. X*** 16,22
  125. X  #include <sys/types.h>
  126. X  #include <sys/stat.h>
  127. X  #include <sys/errno.h>
  128. X- #include <sys/wait.h>
  129. X  
  130. X  extern int errno;
  131. X  
  132. X
  133. X--- 19,24 -----
  134. X  #include <sys/types.h>
  135. X  #include <sys/stat.h>
  136. X  #include <sys/errno.h>
  137. X  
  138. X  extern int errno;
  139. X  
  140. X*** /u1/src/ecu310/models/nonansikeys    Thu Jul 18 07:21:00 1991
  141. X--- models/nonansikeys    Sat Aug 10 16:07:37 1991
  142. X***************
  143. X*** 1,5
  144. X  #+------------------------------------------------------------------------
  145. X! # ECU 3.0 nonansikeys
  146. X  #
  147. X  # This file contains mapping information to convert non-ANSI
  148. X  # keyboard function keys to an internal ECU function key
  149. X
  150. X--- 1,5 -----
  151. X  #+------------------------------------------------------------------------
  152. X! # ECU 3.10 nonansikeys
  153. X  #
  154. X  # This file contains mapping information to convert non-ANSI
  155. X  # keyboard function keys to an internal ECU function key
  156. X***************
  157. X*** 56,61
  158. X  # 
  159. X  #-------------------------------------------------------------------------
  160. X  #+:EDITS:
  161. X  #:05-06-1991-02:31-wht@n4hgf-add tandem terminal "ansi-terminal"
  162. X  #:05-05-1991-17:37-root@n4hgf-add ISC at386 tnx to dug@kd4nc
  163. X  #:05-02-1991-04:53-wht@n4hgf-document kbdtest3
  164. X
  165. X--- 56,62 -----
  166. X  # 
  167. X  #-------------------------------------------------------------------------
  168. X  #+:EDITS:
  169. X+ #:08-10-1991-16:07-wht@n4hgf-add new Metro Link server entry
  170. X  #:05-06-1991-02:31-wht@n4hgf-add tandem terminal "ansi-terminal"
  171. X  #:05-05-1991-17:37-root@n4hgf-add ISC at386 tnx to dug@kd4nc
  172. X  #:05-02-1991-04:53-wht@n4hgf-document kbdtest3
  173. X***************
  174. X*** 128,146
  175. X  #   BkTab:BackTab:  tab           # same as TAB unfortunately
  176. X      BkTab:F12:      esc [ 2 4 ~
  177. X  
  178. X! #+-------------------------------------------------------------------
  179. X! #   Metro Link X11R4 console xterm (Release 1.2)
  180. X! #
  181. X! # You need in .xinitrc or whatever
  182. X! #    xmodmap -e "keycode 22 = BackSpace"
  183. X! # and in .Xdefaults or whatever,
  184. X! # XTerm*VT100*Translations: #override\
  185. X! #      Shift <Key>Tab:   string(0x1b) string("[90~") \n \
  186. X! #      <Key>Begin:       string(0x1b) string("[98~") \n \
  187. X! #      <Key>End:         string(0x1b) string("[99~") 
  188. X! #
  189. X! # Unfortunately, the CU5 key appears to be dead, so I use F12.
  190. X! #--------------------------------------------------------------------
  191. X  #xterm
  192. X  #    BkTab:BkTab:    esc [ 9 0 ~
  193. X  #    CU5:CU5:        esc [ 2 4 ~
  194. X
  195. X--- 129,154 -----
  196. X  #   BkTab:BackTab:  tab           # same as TAB unfortunately
  197. X      BkTab:F12:      esc [ 2 4 ~
  198. X  
  199. X! ##+-------------------------------------------------------------------
  200. X! ##   Metro Link X11R4 console xterm (Release 1.2 and see below)
  201. X! ##
  202. X! ## You need in .xinitrc or whatever
  203. X! ##    xmodmap -e "keycode 22 = BackSpace"
  204. X! ## and in .Xdefaults or whatever,
  205. X! ## XTerm*VT100*Translations: #override\
  206. X! ##      Shift <Key>Tab:   string(0x1b) string("[90~") \n \
  207. X! ##      <Key>Begin:       string(0x1b) string("[98~") \n \
  208. X! ##      <Key>End:         string(0x1b) string("[99~") 
  209. X! ##
  210. X! ## Unfortunately, the CU5 key appears to be dead, so I use F12.
  211. X! ##
  212. X! ## For the most recent server I have (ML Server Version Tue Aug 6
  213. X! ## 00:43:26 EDT 1991), the Home key is mapped to <Key>Home
  214. X! ## rather than <Key>Begin, so also add this translation:
  215. X! ##      <Key>Home:        string(0x1b) string("[98~") \n \
  216. X! ## to remain compatible with this xterm nonansikeys entry of use the
  217. X! ## one below.
  218. X! ##--------------------------------------------------------------------
  219. X  #xterm
  220. X  #    BkTab:BkTab:    esc [ 9 0 ~
  221. X  #    CU5:CU5:        esc [ 2 4 ~
  222. X***************
  223. X*** 159,164
  224. X  #    Ins:Ins:        esc [ 2 ~
  225. X  #    Home:Home:      esc [ 9 8 ~
  226. X  #    End:End:        esc [ 9 9 ~
  227. X  #    PgUp:PgUp:      esc [ 5 ~
  228. X  #    PgDn:PgDn:      esc [ 6 ~
  229. X  #    CUU:CUU:        esc [ A
  230. X
  231. X--- 167,236 -----
  232. X  #    Ins:Ins:        esc [ 2 ~
  233. X  #    Home:Home:      esc [ 9 8 ~
  234. X  #    End:End:        esc [ 9 9 ~
  235. X+ #    PgUp:PgUp:      esc [ 5 ~
  236. X+ #    PgDn:PgDn:      esc [ 6 ~
  237. X+ #    CUU:CUU:        esc [ A
  238. X+ #    CUD:CUD:        esc [ B
  239. X+ #    CUL:CUL:        esc [ D
  240. X+ #    CUR:CUR:        esc [ C
  241. X+ 
  242. X+ ##+-------------------------------------------------------------------
  243. X+ ## Metro Link Server Version Tue Aug 6 00:43:26 EDT 1991
  244. X+ ##
  245. X+ ## Thanks to Metro Link for fixing EVERY BUG and anomaly I reported
  246. X+ ## over the last few months.  You cannot go wrong with this X11R4!
  247. X+ ##
  248. X+ ## 1. xmodmap for BackSpace no longer needed.
  249. X+ ## 2. Unshifted Keypad 5 no longer dead, but maps to the <Key>Begin
  250. X+ ##    event.  This means you can use Keypad 5 for screen dump just
  251. X+ ##    like you do with native multiscreen or virtual consoles.
  252. X+ ##    A translation remains necessary because ECU does not like nulls
  253. X+ ##    and the default binding is for generating key codes 1B 5b 00.
  254. X+ ##    The choice I made causes Keypad 5 to generate the same code
  255. X+ ##    as does the SCO keyboard driver.
  256. X+ ## 3. The Home key now maps to <Key>Home rather than <Key>Begin
  257. X+ ## 4. Shift-Tab still needs and override translation (I missed reporting
  258. X+ ##    that one.
  259. X+ ##
  260. X+ ## With this server, you may use exactly the same keys for ECU
  261. X+ ## functions on the ML xterm as on multiscreen and virtual consoles.
  262. X+ ##
  263. X+ ## In .Xdefaults use:
  264. X+ ## XTerm*VT100*Translations: #override\
  265. X+ ##      Shift <Key>Tab:   string(0x1b) string("[90~") \n \
  266. X+ ##      <Key>Begin:       string(0x1b) string("[E")
  267. X+ ##
  268. X+ ## nonansikey definition for TERM='xterm'
  269. X+ ## built by kbdtest3 1.01 Wed Aug  7 18:56:05 1991
  270. X+ ## keyboard parity required = even
  271. X+ ## stty -a at kbdtest3 execution time:
  272. X+ ## speed 38400 baud;   ispeed 38400 baud;   ospeed 38400 baud; 
  273. X+ ## line = 0; intr = ^C; quit = ^@; erase = ^H; kill = ^U; eof =  ; eol = ^B; 
  274. X+ ## swtch = ^@;susp <undef>;
  275. X+ ## parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -ctsflow -rtsflow 
  276. X+ ## -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -iuclc 
  277. X+ ## ixon -ixany -ixoff 
  278. X+ ## -isig -icanon min = 32 time = 2 -xcase -echo echoe echok -echonl -noflsh -iexten -tostop 
  279. X+ ## opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel 
  280. X+ ##--------------------------------------------------------------------
  281. X+ #xterm
  282. X+ #    BkTab:BkTab:    esc [ 9 0 ~
  283. X+ #    CU5:CU5:        esc [ E
  284. X+ #    F1:F1:          esc [ 1 1 ~
  285. X+ #    F2:F2:          esc [ 1 2 ~
  286. X+ #    F3:F3:          esc [ 1 3 ~
  287. X+ #    F4:F4:          esc [ 1 4 ~
  288. X+ #    F5:F5:          esc [ 1 5 ~
  289. X+ #    F6:F6:          esc [ 1 7 ~
  290. X+ #    F7:F7:          esc [ 1 8 ~
  291. X+ #    F8:F8:          esc [ 1 9 ~
  292. X+ #    F9:F9:          esc [ 2 0 ~
  293. X+ #    F10:F10:        esc [ 2 1 ~
  294. X+ #    F11:F11:        esc [ 2 3 ~
  295. X+ #    F12:F12:        esc [ 2 4 ~
  296. X+ #    Ins:Ins:        esc [ 2 ~
  297. X+ #    Home:Home:      esc [ 8
  298. X+ #    End:End:        esc [ 9
  299. X  #    PgUp:PgUp:      esc [ 5 ~
  300. X  #    PgDn:PgDn:      esc [ 6 ~
  301. X  #    CUU:CUU:        esc [ A
  302. X*** /u1/src/ecu310/nonansikey.c    Thu Jul 25 12:58:00 1991
  303. X--- nonansikey.c    Mon Aug 12 00:08:14 1991
  304. X***************
  305. X*** 11,16
  306. X  
  307. X  ------------------------------------------------------------------*/
  308. X  /*+:EDITS:*/
  309. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  310. X  /*:03-20-1991-03:06-root@n4hgf-no Metro Link problems here */
  311. X  /*:03-20-1991-01:04-root@n4hgf-diagnose Metro Link xterm differences */
  312. X
  313. X--- 11,18 -----
  314. X  
  315. X  ------------------------------------------------------------------*/
  316. X  /*+:EDITS:*/
  317. X+ /*:08-06-1991-13:19-wht@n4hgf-allow any code as first in key sequence */
  318. X+ /*:08-03-1991-14:44-wht@n4hgf-look for nonansikeys in ECULIBDIR too */
  319. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  320. X  /*:03-20-1991-03:06-root@n4hgf-no Metro Link problems here */
  321. X  /*:03-20-1991-01:04-root@n4hgf-diagnose Metro Link xterm differences */
  322. X***************
  323. X*** 71,77
  324. X  char *token;
  325. X  char *arg_token();
  326. X  char *str_token();
  327. X! char *strip_ld_break();
  328. X  
  329. X      while(!done && (token = (token_number < 2) ? str_token(bufptr,":")
  330. X                                                 : arg_token(bufptr," \t")))
  331. X
  332. X--- 73,79 -----
  333. X  char *token;
  334. X  char *arg_token();
  335. X  char *str_token();
  336. X! char *skip_ld_break();
  337. X  
  338. X      while(!done && (token = (token_number < 2) ? str_token(bufptr,":")
  339. X                                                 : arg_token(bufptr," \t")))
  340. X***************
  341. X*** 104,109
  342. X              case 2:        /* third field is first token of sequence */
  343. X                  if(*token == '#')
  344. X                      goto MISSING_SEQUENCE;
  345. X                  if(((itmp = ascii_to_hex(token)) < 1) || (itmp >= SPACE))
  346. X                  {    /* make sure it is escape */
  347. X                      ff(se,
  348. X
  349. X--- 106,112 -----
  350. X              case 2:        /* third field is first token of sequence */
  351. X                  if(*token == '#')
  352. X                      goto MISSING_SEQUENCE;
  353. X+ #ifdef notdef    /* allow any char as first */
  354. X                  if(((itmp = ascii_to_hex(token)) < 1) || (itmp >= SPACE))
  355. X                  {    /* make sure it is non-printable */
  356. X                      ff(se,
  357. X***************
  358. X*** 105,111
  359. X                  if(*token == '#')
  360. X                      goto MISSING_SEQUENCE;
  361. X                  if(((itmp = ascii_to_hex(token)) < 1) || (itmp >= SPACE))
  362. X!                 {    /* make sure it is escape */
  363. X                      ff(se,
  364. X  "  %s: first char in sequence must be in the range 0x01 to 0x1F not '%s'\r\n",
  365. X                          keyset_idstr(KDEt),token);
  366. X
  367. X--- 108,114 -----
  368. X                      goto MISSING_SEQUENCE;
  369. X  #ifdef notdef    /* allow any char as first */
  370. X                  if(((itmp = ascii_to_hex(token)) < 1) || (itmp >= SPACE))
  371. X!                 {    /* make sure it is non-printable */
  372. X                      ff(se,
  373. X  "  %s: first char in sequence must be in the range 0x01 to 0x1F not '%s'\r\n",
  374. X                          keyset_idstr(KDEt),token);
  375. X***************
  376. X*** 111,116
  377. X                          keyset_idstr(KDEt),token);
  378. X                      return(-1);
  379. X                  }
  380. X  
  381. X              default:    /* third and subsequent to define key */
  382. X                  if(*token == '#')
  383. X
  384. X--- 114,120 -----
  385. X                          keyset_idstr(KDEt),token);
  386. X                      return(-1);
  387. X                  }
  388. X+ #endif
  389. X  
  390. X              default:    /* third and subsequent to define key */
  391. X                  if(*token == '#')
  392. X***************
  393. X*** 182,188
  394. X          strcat(ecukeys_name,"/.ecu/nonansikeys");
  395. X      }
  396. X  
  397. X!     if((fp_keys = fopen(ecukeys_name,"r")) == NULL)
  398. X      {
  399. X          ff(se,"%s not found; unable to proceed\r\n",ecukeys_name);
  400. X          termecu(TERMECU_CONFIG_ERROR);
  401. X
  402. X--- 186,192 -----
  403. X          strcat(ecukeys_name,"/.ecu/nonansikeys");
  404. X      }
  405. X  
  406. X!     if(!(fp_keys = fopen(ecukeys_name,"r")))
  407. X      {
  408. X      char * eculibdir = ECULIBDIR;
  409. X          strcpy(ecukeys_name,eculibdir);
  410. X***************
  411. X*** 184,191
  412. X  
  413. X      if((fp_keys = fopen(ecukeys_name,"r")) == NULL)
  414. X      {
  415. X!         ff(se,"%s not found; unable to proceed\r\n",ecukeys_name);
  416. X!         termecu(TERMECU_CONFIG_ERROR);
  417. X      }
  418. X  
  419. X  /* find nonansi_key name */
  420. X
  421. X--- 188,202 -----
  422. X  
  423. X      if(!(fp_keys = fopen(ecukeys_name,"r")))
  424. X      {
  425. X!     char * eculibdir = ECULIBDIR;
  426. X!         strcpy(ecukeys_name,eculibdir);
  427. X!         strcat(ecukeys_name,"/.ecu/nonansikeys");
  428. X!         if(!(fp_keys = fopen(ecukeys_name,"r")))
  429. X!         {
  430. X!             ff(se,"'nonansikeys' not in ~/.ecu or %s; unable to proceed\r\n",
  431. X!                 eculibdir);
  432. X!             termecu(TERMECU_CONFIG_ERROR);
  433. X!         }
  434. X      }
  435. X  
  436. X  /* find nonansi_key name */
  437. X*** /u1/src/ecu310/pcmd.c    Thu Jul 25 12:58:00 1991
  438. X--- pcmd.c    Tue Aug  6 21:18:22 1991
  439. X***************
  440. X*** 37,42
  441. X  
  442. X  --------------------------------------------------------------------------*/
  443. X  /*+:EDITS:*/
  444. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  445. X  /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */
  446. X  /*:06-05-1991-22:50-wht@n4hgf-fix parity cmd not taking alpha str */
  447. X
  448. X--- 37,44 -----
  449. X  
  450. X  --------------------------------------------------------------------------*/
  451. X  /*+:EDITS:*/
  452. X+ /*:08-06-1991-21:18-wht@n4hgf-nap -m test wrong sense ... old bug! */
  453. X+ /*:08-05-1991-16:22-wht@n4hgf-add nap -1 return and proctrace */
  454. X  /*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  455. X  /*:07-17-1991-07:04-wht@n4hgf-avoid SCO UNIX nap bug */
  456. X  /*:06-05-1991-22:50-wht@n4hgf-fix parity cmd not taking alpha str */
  457. X***************
  458. X*** 684,690
  459. X          return(erc);
  460. X      if(interval)
  461. X      {
  462. X!         if(strchr(switches,'m'))
  463. X              interval *= 100L;
  464. X          if(interval < hzmsec)                /* SCO nap bug */
  465. X              interval = hzmsec;                /* SCO nap bug */
  466. X
  467. X--- 686,692 -----
  468. X          return(erc);
  469. X      if(interval)
  470. X      {
  471. X!         if(!strchr(switches,'m'))
  472. X              interval *= 100L;
  473. X          if(interval < hzmsec)        /* SCO nap bug */
  474. X              interval = hzmsec;        /* SCO nap bug */
  475. X***************
  476. X*** 686,694
  477. X      {
  478. X          if(strchr(switches,'m'))
  479. X              interval *= 100L;
  480. X!         if(interval < hzmsec)                /* SCO nap bug */
  481. X!             interval = hzmsec;                /* SCO nap bug */
  482. X!         nap(interval);
  483. X      }
  484. X      return(0);
  485. X  }    /* end of pcmd_nap */
  486. X
  487. X--- 688,702 -----
  488. X      {
  489. X          if(!strchr(switches,'m'))
  490. X              interval *= 100L;
  491. X!         if(interval < hzmsec)        /* SCO nap bug */
  492. X!             interval = hzmsec;        /* SCO nap bug */
  493. X!         if(proctrace && (interval > 100))    /* short naps hurt by pprintf */
  494. X!             pprintf("nap %ld msec\n",interval);
  495. X!         if(nap(interval) == -1)        /* EINTR is the only error returned ... */
  496. X!         {                            /* but check anyway */
  497. X!             if(errno == EINTR)
  498. X!                 erc = eCONINT;
  499. X!         }
  500. X      }
  501. X      return(erc);
  502. X  }    /* end of pcmd_nap */
  503. X***************
  504. X*** 690,696
  505. X              interval = hzmsec;                /* SCO nap bug */
  506. X          nap(interval);
  507. X      }
  508. X!     return(0);
  509. X  }    /* end of pcmd_nap */
  510. X  
  511. X  /*+-------------------------------------------------------------------------
  512. X
  513. X--- 698,704 -----
  514. X                  erc = eCONINT;
  515. X          }
  516. X      }
  517. X!     return(erc);
  518. X  }    /* end of pcmd_nap */
  519. X  
  520. X  /*+-------------------------------------------------------------------------
  521. X*** /u1/src/ecu310/utmpstat.c    Thu Jul 25 12:59:00 1991
  522. X--- utmpstat.c    Sat Aug 10 19:38:38 1991
  523. X***************
  524. X*** 11,16
  525. X  
  526. X  --------------------------------------------------------------------------*/
  527. X  /*+:EDITS:*/
  528. X  /*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
  529. X  /*:02-13-1991-02:00-ache@hq.demos.su-swap patch 5 US_ return values */
  530. X  /*:02-07-1991-00:28-wht@n4hgf-utmp_status() was really messed up */
  531. X
  532. X--- 11,17 -----
  533. X  
  534. X  --------------------------------------------------------------------------*/
  535. X  /*+:EDITS:*/
  536. X+ /*:08-10-1991-17:39-wht@n4hgf-US_WEGOTIT handling */
  537. X  /*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
  538. X  /*:02-13-1991-02:00-ache@hq.demos.su-swap patch 5 US_ return values */
  539. X  /*:02-07-1991-00:28-wht@n4hgf-utmp_status() was really messed up */
  540. X***************
  541. X*** 74,80
  542. X  char *line;
  543. X  {
  544. X  register ufd;
  545. X! register itmp;
  546. X  register status = US_NOTFOUND;
  547. X  #if defined(LOG_UTMP)
  548. X  char logstr[128];
  549. X
  550. X--- 75,81 -----
  551. X  char *line;
  552. X  {
  553. X  register ufd;
  554. X! int itmp;
  555. X  register status = US_NOTFOUND;
  556. X  #if defined(LOG_UTMP)
  557. X  char logstr[128];
  558. X***************
  559. X*** 111,117
  560. X          if(!strcmp(namecopy,"LOGIN"))
  561. X              status = US_LOGIN;
  562. X          else if(!strcmp(namecopy,"DIALOUT"))
  563. X!             status = US_DIALOUT;
  564. X          else if((!strcmp(namecopy,"uugetty") || !strcmp(namecopy,"getty")))
  565. X          {
  566. X              if(itmp = line_locked(line))
  567. X
  568. X--- 112,118 -----
  569. X          if(!strcmp(namecopy,"LOGIN"))
  570. X              status = US_LOGIN;
  571. X          else if(!strcmp(namecopy,"DIALOUT"))
  572. X!             status = (last_utmp.ut_pid,0 == xmtr_pid) ? US_WEGOTIT : US_DIALOUT;
  573. X          else if((!strcmp(namecopy,"uugetty") || !strcmp(namecopy,"getty")))
  574. X          {
  575. X              if(itmp = line_locked(line))
  576. X***************
  577. X*** 115,121
  578. X          else if((!strcmp(namecopy,"uugetty") || !strcmp(namecopy,"getty")))
  579. X          {
  580. X              if(itmp = line_locked(line))
  581. X!                 status = US_DIALOUT;
  582. X              else
  583. X                  status = US_LOGIN;
  584. X          }
  585. X
  586. X--- 116,127 -----
  587. X          else if((!strcmp(namecopy,"uugetty") || !strcmp(namecopy,"getty")))
  588. X          {
  589. X              if(itmp = line_locked(line))
  590. X!             {
  591. X!                 if(itmp == LOPEN_WE_GOT_IT)
  592. X!                     status = US_WEGOTIT;
  593. X!                 else
  594. X!                     status = US_DIALOUT;
  595. X!             }
  596. X              else
  597. X                  status = US_LOGIN;
  598. X          }
  599. X***************
  600. X*** 120,126
  601. X                  status = US_LOGIN;
  602. X          }
  603. X          else if(!kill(last_utmp.ut_pid,0) || (errno != ESRCH))
  604. X!             status = US_LOGGEDIN;
  605. X      }
  606. X  
  607. X  #if defined(LOG_UTMP)
  608. X
  609. X--- 126,132 -----
  610. X                  status = US_LOGIN;
  611. X          }
  612. X          else if(!kill(last_utmp.ut_pid,0) || (errno != ESRCH))
  613. X!             status = (last_utmp.ut_pid == xmtr_pid) ? US_WEGOTIT : US_LOGGEDIN;
  614. X      }
  615. X  
  616. X  #if defined(LOG_UTMP)
  617. X***************
  618. X*** 129,138
  619. X      else
  620. X      {
  621. X      char *ctime();
  622. X!         sprintf(logstr,"UTMP %s:%s:%s:%d:status=%d:%s",
  623. X!             namecopy,idcopy,last_utmp.ut_line,
  624. X!             last_utmp.ut_pid,status,ctime(&last_utmp.ut_time));
  625. X!         logstr[strlen(logstr) - 1] = 0;    /* kill NL from ctime() */
  626. X      }
  627. X      ecu_log_event(getpid(),logstr);
  628. X  #endif
  629. X
  630. X--- 135,142 -----
  631. X      else
  632. X      {
  633. X      char *ctime();
  634. X!         sprintf(logstr,"UTMP %s:%s:%s:%d",
  635. X!             namecopy,idcopy,last_utmp.ut_line,last_utmp.ut_pid,status);
  636. X      }
  637. X      ecu_log_event(getpid(),logstr);
  638. X  #endif
  639. X*** /u1/src/ecu310/z/Make.src    Thu Jul 25 12:59:00 1991
  640. X--- z/Make.src    Tue Aug  6 15:28:55 1991
  641. X***************
  642. X*** 3,9
  643. X  # Makefile for ecurz/ecusz (ecu file transfer)
  644. X  # wht@n4hgf.Mt-Park.GA.US
  645. X  #--------------------------------------------------------------------
  646. X! #+:EDITS:*/
  647. X  #:07-25-1991-12:59-wht@n4hgf-ECU release 3.10
  648. X  #:04-21-1991-12:05-wht@n4hgf-convert to Make.src
  649. X  
  650. X
  651. X--- 3,10 -----
  652. X  # Makefile for ecurz/ecusz (ecu file transfer)
  653. X  # wht@n4hgf.Mt-Park.GA.US
  654. X  #--------------------------------------------------------------------
  655. X! #+:EDITS:
  656. X! #:08-06-1991-15:28-wht@n4hgf-neat used wrong rm args
  657. X  #:07-25-1991-12:59-wht@n4hgf-ECU release 3.10
  658. X  #:04-21-1991-12:05-wht@n4hgf-convert to Make.src
  659. X  
  660. X***************
  661. X*** 70,76
  662. X      -rm -f *~ *# *.orig *.rej make.log a.out
  663. X  
  664. X  clean: neat
  665. X!     rm -f $(OBJ)
  666. X  
  667. X  clobber: clean
  668. X      rm -f ecusz ecurz
  669. X
  670. X--- 71,77 -----
  671. X      -rm -f *~ *# *.orig *.rej make.log a.out
  672. X  
  673. X  clean: neat
  674. X!     rm -f *.o
  675. X  
  676. X  clobber: clean
  677. X      rm -f ecusz ecurz
  678. SHAR_EOF
  679. $TOUCH -am 0812040391 'PATCH1.03' &&
  680. chmod 0644 PATCH1.03 ||
  681. echo 'restore of PATCH1.03 failed'
  682. Wc_c="`wc -c < 'PATCH1.03'`"
  683. test 19884 -eq "$Wc_c" ||
  684.     echo 'PATCH1.03: original size 19884, current size' "$Wc_c"
  685. # ============= Configure ==============
  686. echo 'x - extracting Configure (Text)'
  687. sed 's/^X//' << 'SHAR_EOF' > 'Configure' &&
  688. X:
  689. X#+---------------------------------------------------------------------
  690. X# ECU Configure
  691. X#
  692. X# PEDANTIC not recommended unless you want to do extensive
  693. X# vendor-supplied header file hacking.
  694. X#----------------------------------------------------------------------
  695. X#+:EDITS:
  696. X#:08-06-1991-05:05-wht@n4hgf-change FASI_IN_USE to FASI
  697. X#:07-12-1991-14:05-wht@n4hgf-ensure config.c compiles properly
  698. X#:04-29-1991-02:39-wht@n4hgf-document/clean
  699. X
  700. X# --> add any of the following (99% of everybody will want to leave alone)
  701. X# -DFASI     if you have installed and want to exploit the features
  702. X#            of my FAS instrumentation extensions
  703. X# -DMORSE if you have installed and want to use the n4hgf morse driver
  704. X# -DPEDANTIC if you want to use -ansi -pedantic with gcc (not
  705. X#            necessary or recommended unless you anticipate heavy
  706. X#            code modification)
  707. X# -DMETROLINK_X11R4_PTS if you have early 'pts-using' Metro Link
  708. X#            xterms
  709. XCFLAGS=
  710. X
  711. X# a bit of self indulgence for me (ignore it or be inspired)
  712. XSYSTEM=
  713. X[ -f /etc/systemid ] && SYSTEM=`cat /etc/systemid`
  714. X[ "$SYSTEM" = "n4hgf" ] && CFLAGS='-DWHT -DPEDANTIC -DMORSE -DFASI'
  715. X
  716. Xecho Please wait while I compile the config program.
  717. Xrm -rf ./config
  718. Xcc $CFLAGS config.c -o config > /tmp/config.cc.log 2>&1
  719. X./config
  720. Xrm -rf /tmp/config.cc.log
  721. X
  722. X#end of Configure
  723. SHAR_EOF
  724. $TOUCH -am 0806150591 'Configure' &&
  725. chmod 0755 Configure ||
  726. echo 'restore of Configure failed'
  727. Wc_c="`wc -c < 'Configure'`"
  728. test 1322 -eq "$Wc_c" ||
  729.     echo 'Configure: original size 1322, current size' "$Wc_c"
  730. # ============= eculock.c ==============
  731. echo 'x - extracting eculock.c (Text)'
  732. sed 's/^X//' << 'SHAR_EOF' > 'eculock.c' &&
  733. X#define HONEYDANBER /* means use ASCII pids in lock files */
  734. X#if defined(SHARE_DEBUG)
  735. X#define LOG_LOCKS
  736. X#endif
  737. X/*+-----------------------------------------------------------------------
  738. X    eculock.c -- lock file management
  739. X    wht@n4hgf.Mt-Park.GA.US
  740. X
  741. X  Defined functions:
  742. X    check_utmp()
  743. X    create_lock_file(name)
  744. X    lock_tty()
  745. X    unlock_tty()
  746. X
  747. XLock files under SCO are supposed to use the direct line name
  748. X(lower-case last letter); we create only the lower-case case, but
  749. Xcheck for both.  I have most definitely seen somebody create an
  750. Xupper-case lock file (somebody named getty).  But that was on a middle-
  751. Xaged XENIX revision.
  752. X------------------------------------------------------------------------*/
  753. X/*+:EDITS:*/
  754. X/*:08-10-1991-17:39-wht@n4hgf-US_WEGOTIT handling */
  755. X/*:08-09-1991-11:07-wht@n4hgf-configurable lock directory */
  756. X/*:07-25-1991-12:56-wht@n4hgf-ECU release 3.10 */
  757. X/*:10-16-1990-20:43-wht@n4hgf-add SHARE_DEBUG */
  758. X/*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */
  759. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  760. X
  761. X#include "ecu.h"
  762. X#include "utmpstatus.h"
  763. X
  764. Xextern int errno;
  765. Xextern char ungetty_ttyname[];
  766. Xextern char lopen_err_str[];
  767. X
  768. X/*+-------------------------------------------------------------------------
  769. X    check_utmp()
  770. Xreturn 0 if line available, else LOPEN code
  771. X--------------------------------------------------------------------------*/
  772. Xint
  773. Xcheck_utmp()
  774. X{
  775. Xregister utstatus;
  776. Xregister status = 0;
  777. X
  778. X    switch(utstatus = utmp_status(shm->Lline))
  779. X    {
  780. X        case US_DIALOUT:    /* enabled for login, currently dialout */
  781. X            status = LOPEN_DIALOUT_IN_USE;
  782. X            break;
  783. X        case US_LOGGEDIN:    /* enabled for login, in use */
  784. X            status = LOPEN_ENABLED_IN_USE;
  785. X            break;
  786. X        case US_NOTFOUND:    /* not in utmp, or getty dead */
  787. X            status = LOPEN_WE_GOT_IT;    /* not really an error */
  788. X            break;
  789. X        case US_WEGOTIT:    /* we own the line */
  790. X            break;
  791. X        case US_LOGIN:        /* enabled for login, idle */
  792. X            status = ungetty_get_line();
  793. X            break;
  794. X    }
  795. X
  796. X#if defined(LOG_LOCKS)
  797. X{ char s64[64];
  798. X    sprintf(s64,"UTMPCHK %s st=%d ut=%d",shm->Lline,status,utstatus);
  799. X    ecu_log_event(getpid(),s64);
  800. X}
  801. X#endif
  802. X
  803. X    return(status);
  804. X
  805. X}    /* end of check_utmp */
  806. X
  807. X/*+-----------------------------------------------------------------------
  808. X    void unlock_tty()
  809. X------------------------------------------------------------------------*/
  810. Xvoid
  811. Xunlock_tty()
  812. X{
  813. X    ungetty_return_line();
  814. X    if(LLCKname[0])
  815. X        unlink(LLCKname);
  816. X    LLCKname[0] = 0;
  817. X
  818. X}    /* end of unlock_tty */
  819. X
  820. X/*+-------------------------------------------------------------------------
  821. X    create_lock_file(name)
  822. X--------------------------------------------------------------------------*/
  823. Xint
  824. Xcreate_lock_file(name)
  825. Xchar *name;
  826. X{
  827. Xregister fd;
  828. Xint pid = getpid();
  829. Xchar LTMP_fname[64];
  830. X#if defined(HONEYDANBER)
  831. Xchar pid10str[12];
  832. X#endif
  833. X
  834. X    errno = 0;
  835. X    strcpy(LTMP_fname,lock_dir_name);
  836. X    sprintf(LTMP_fname + strlen(LTMP_fname),"/LTMP.%05d",pid);
  837. X    if((fd = creat(LTMP_fname,0444)) < 0)
  838. X    {
  839. X        if(errno == EACCES)
  840. X        {
  841. X            strcpy(lopen_err_str,"lock error - try chmod 0777 ");
  842. X            strcat(lopen_err_str,lock_dir_name);
  843. X        }
  844. X        unlink(LTMP_fname);
  845. X        return(-1);
  846. X    }
  847. X#if defined(HONEYDANBER)
  848. X    sprintf(pid10str,"%10d\n",getpid());
  849. X    write(fd,pid10str,11);
  850. X#else
  851. X    write(fd,(char *)&pid,sizeof(int));
  852. X#endif
  853. X
  854. X    chmod(LTMP_fname,0444);    /* some programs seem to think writable
  855. X                             * lock file is game for killing
  856. X                             */
  857. X    close(fd);
  858. X
  859. X    fd = link(LTMP_fname,name);        /* use 'fd' for link return code */
  860. X    unlink(LTMP_fname);
  861. X    chmod(name,0444);
  862. X
  863. X#if defined(LOG_LOCKS)
  864. X{ char s128[128];
  865. X  extern char *errno_text();
  866. X    sprintf(s128,"CRLOCK %s status=%d errno=%s",name,fd,errno_text(errno));
  867. X    ecu_log_event(getpid(),s128);
  868. X}
  869. X#endif
  870. X
  871. X    return(fd);
  872. X}    /* end of create_lock_file */
  873. X
  874. X/*+-------------------------------------------------------------------------
  875. X    lock_tty() - create lock files for tty name in 'shm->Lline'
  876. X--------------------------------------------------------------------------*/
  877. Xlock_tty()
  878. X{
  879. Xregister itmp;
  880. X
  881. X    if(itmp = make_lock_name(shm->Lline,LLCKname))
  882. X        return(itmp);
  883. X
  884. X    if(itmp = check_utmp())
  885. X    {
  886. X        if(itmp == LOPEN_WE_GOT_IT)        /* if we already have the line ... */
  887. X            return(0);                    /* ... no need to re-lock */
  888. X        if(itmp != LOPEN_ENABLED)        /* if other than enabled idle ... */
  889. X            return(itmp);                /* ... return the error */
  890. X    }
  891. X
  892. X#if defined(GETTY_LOCKS_TTY)
  893. X    if(!ungetty_ttyname[0])    /* if getty did not lock line */
  894. X    {
  895. X#endif
  896. X        if(create_lock_file(LLCKname))
  897. X        {
  898. X            if(itmp = is_active_lock(LLCKname))
  899. X            {
  900. X                ungetty_return_line();
  901. X                errno = EACCES; /* for termecu() */
  902. X                return(itmp);
  903. X            }
  904. X            if(create_lock_file(LLCKname))
  905. X            {
  906. X                ungetty_return_line();
  907. X                errno = EACCES; /* for termecu() */
  908. X                return(LOPEN_LCKERR);
  909. X            }
  910. X        }
  911. X#if defined(GETTY_LOCKS_TTY)
  912. X    }
  913. X#endif
  914. X
  915. X    return(0);
  916. X}    /* end of lock_tty */
  917. X
  918. X/* end of eculock.c */
  919. X/* vi: set tabstop=4 shiftwidth=4: */
  920. SHAR_EOF
  921. $TOUCH -am 0812015091 'eculock.c' &&
  922. chmod 0644 eculock.c ||
  923. echo 'restore of eculock.c failed'
  924. Wc_c="`wc -c < 'eculock.c'`"
  925. test 4817 -eq "$Wc_c" ||
  926.     echo 'eculock.c: original size 4817, current size' "$Wc_c"
  927. # ============= ecuungetty/ecuungetty.c ==============
  928. if test ! -d 'ecuungetty'; then
  929.     echo 'x - creating directory ecuungetty'
  930.     mkdir 'ecuungetty'
  931. fi
  932. echo 'x - extracting ecuungetty/ecuungetty.c (Text)'
  933. sed 's/^X//' << 'SHAR_EOF' > 'ecuungetty/ecuungetty.c' &&
  934. X#ifndef lint
  935. Xchar *revision = "ecuungetty 3.10";
  936. X#endif
  937. X/*+-------------------------------------------------------------------------
  938. X    ecuungetty.c - ecu "ungetty" program
  939. X    wht@n4hgf.Mt-Park.GA.US
  940. X
  941. XGet a line:
  942. Xecuungetty /dev/ttyxx <bamboozle-str>
  943. Xecuungetty -g /dev/ttyxx <bamboozle-str>
  944. X
  945. XTest a line's atatus:
  946. Xecuungetty -t /dev/ttyxx <bamboozle-str>
  947. X
  948. XReturn a line:
  949. Xecuungetty -r /dev/ttyxx <bamboozle-str>
  950. X
  951. X  Defined functions:
  952. X    ecu_log_event(pid,logstr)
  953. X    errno_text(errnum)
  954. X    hangup()
  955. X    main(argc,argv,envp)
  956. X
  957. X--------------------------------------------------------------------------*/
  958. X/*+:EDITS:*/
  959. X/*:08-10-1991-17:39-wht@n4hgf-US_WEGOIT handling */
  960. X/*:08-07-1991-14:15-wht@n4hgf-add debug log event code */
  961. X/*:07-25-1991-12:57-wht@n4hgf-ECU release 3.10 */
  962. X/*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */
  963. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  964. X
  965. X#include <stdio.h>
  966. X#include <ctype.h>
  967. X#include <fcntl.h>
  968. X#include <errno.h>
  969. X#include <signal.h>
  970. X#include <sys/types.h>
  971. X#include <sys/stat.h>
  972. X#include <utmp.h>
  973. X#include <sys/locking.h>
  974. X#include "../stdio_lint.h"
  975. X#include "../ecuungetty.h"
  976. X#include "../utmpstatus.h"
  977. X
  978. Xextern struct utmp last_utmp;
  979. X
  980. Xint xmtr_pid;
  981. X
  982. X/*+-------------------------------------------------------------------------
  983. X    ecu_log_event(pid,event_note)
  984. X--------------------------------------------------------------------------*/
  985. Xvoid
  986. Xecu_log_event(pid,event_note)
  987. Xint pid;
  988. Xchar *event_note;
  989. X{
  990. X#if defined(WHT) && defined(SHARE_DEBUG)
  991. XFILE *ecu_log_fp;
  992. Xstatic char logname[128] = "/u1/wht/.ecu/log";
  993. X
  994. X    if((ecu_log_fp = fopen(logname,"a")) != NULL)
  995. X    {
  996. X        locking(fileno(ecu_log_fp),LK_LOCK,0L);
  997. X        fputs("ECUUNGET",ecu_log_fp);
  998. X        fprintf(ecu_log_fp,"-%05d-(%05d) ",getppid(),pid);
  999. X        fputs(event_note,ecu_log_fp);
  1000. X        fputs("\n",ecu_log_fp);
  1001. X        fflush(ecu_log_fp);
  1002. X        locking(fileno(ecu_log_fp),LK_UNLCK,0L);
  1003. X        fclose(ecu_log_fp);
  1004. X    }
  1005. X#endif
  1006. X}    /* end of ecu_log_event */
  1007. X
  1008. X/*+-------------------------------------------------------------------------
  1009. X    termecu() - "dummy" for utmpstat.c
  1010. XThis particular incantation will only be called if utmp is non-existent
  1011. Xor not readable.......
  1012. X--------------------------------------------------------------------------*/
  1013. Xtermecu()
  1014. X{
  1015. X    exit(UGE_NOTROOT);
  1016. X}    /* end of hangup */
  1017. X
  1018. X/*+-------------------------------------------------------------------------
  1019. X    errno_text(errnum)
  1020. X--------------------------------------------------------------------------*/
  1021. Xchar *
  1022. Xerrno_text(errnum)
  1023. Xint errnum;
  1024. X{
  1025. Xstatic char errstr[12];
  1026. X    sprintf(errstr,"%d",errnum);
  1027. X    return(errstr);
  1028. X}    /* end of errno_text */
  1029. X
  1030. X/*+-------------------------------------------------------------------------
  1031. X    main(argc,argv,envp)
  1032. X--------------------------------------------------------------------------*/
  1033. Xmain(argc,argv,envp)
  1034. Xint argc;
  1035. Xchar **argv;
  1036. Xchar **envp;
  1037. X{
  1038. Xint op = 'g';    /* assume "get" operation */
  1039. Xint status;
  1040. Xint itmp;
  1041. Xchar *tty = argv[1];
  1042. Xchar *bamboozlement = argv[2];
  1043. Xchar *bamboozle();
  1044. X
  1045. X    if(geteuid() != 0)
  1046. X        exit(UGE_NOTROOT);
  1047. X
  1048. X    if(*argv[1] == '-')
  1049. X    {
  1050. X        switch(op = *(argv[1] + 1))
  1051. X        {
  1052. X            case 'r':
  1053. X            case 't':
  1054. X                break;
  1055. X            default:
  1056. X                exit(UGE_BADSWITCH);
  1057. X        }
  1058. X        if(argc < 3)
  1059. X            exit(UGE_BADARGC);
  1060. X        tty = argv[2];
  1061. X        bamboozlement = argv[3];
  1062. X    }
  1063. X    else if(argc <= 2)
  1064. X        exit(UGE_BADARGC);
  1065. X
  1066. X    if(getuid() != 0)
  1067. X    {
  1068. X        if(strcmp(bamboozlement,bamboozle(getppid())))
  1069. X            exit(UGE_CALLER);
  1070. X    }
  1071. X
  1072. X    xmtr_pid = getppid();
  1073. X    status = utmp_status(tty);
  1074. X#if defined(WHT) && defined(SHARE_DEBUG)
  1075. X    { char s128[128];
  1076. X        sprintf(s128,"-%c utmp status=%d",op,status);
  1077. X        ecu_log_event(getpid(),s128);
  1078. X    }
  1079. X#endif
  1080. X
  1081. X    switch(op)
  1082. X    {
  1083. X        case 'g':
  1084. X            switch(status)
  1085. X            {
  1086. X                case US_NOTFOUND:    /* not in utmp, or getty dead */
  1087. X                    exit(UG_NOTENAB);
  1088. X                case US_LOGIN:        /* enabled for login, idle */
  1089. X                    kill(last_utmp.ut_pid,SIGUSR1);
  1090. X                    nap(200L);
  1091. X                    exit(UG_ENAB);
  1092. X                case US_DIALOUT:    /* enabled for login, currently dialout */
  1093. X                case US_LOGGEDIN:    /* enabled for login, in use */
  1094. X                    exit(UG_FAIL);
  1095. X                case US_WEGOTIT:    /* we on it */
  1096. X                    if(!kill(last_utmp.ut_pid))    /* is there a getty? */
  1097. X                        exit(UG_ENAB);            /* yes */
  1098. X                    else
  1099. X                        exit(UG_NOTENAB);
  1100. X            }
  1101. X            break;
  1102. X
  1103. X        case 't':
  1104. X            switch(status)
  1105. X            {
  1106. X                case US_NOTFOUND:    /* not in utmp, or getty dead */
  1107. X                    exit(UGE_T_NOTFOUND);
  1108. X                case US_LOGIN:        /* enabled for login, idle */
  1109. X                    exit(UGE_T_LOGIN);
  1110. X                case US_LOGGEDIN:    /* enabled for login, in use */
  1111. X                    exit(UGE_T_LOGGEDIN);
  1112. X                case US_WEGOTIT:    /* we have he line */
  1113. X                case US_DIALOUT:    /* enabled for login, currently dialout */
  1114. X                    exit(UG_RESTART);
  1115. X            }
  1116. X            break;
  1117. X
  1118. X        case 'r':
  1119. X            switch(status)
  1120. X            {
  1121. X                case US_NOTFOUND:    /* not in utmp, or getty dead */
  1122. X                case US_LOGIN:        /* enabled for login, idle */
  1123. X                case US_LOGGEDIN:    /* enabled for login, in use */
  1124. X                    exit(0);
  1125. X                case US_WEGOTIT:    /* we own it */
  1126. X                case US_DIALOUT:    /* enabled for login, currently dialout */
  1127. X                    itmp = 5;
  1128. X                    while(itmp--)
  1129. X                    {
  1130. X                        if(kill(last_utmp.ut_pid,SIGUSR2))
  1131. X                            break;
  1132. X                        nap(100L);
  1133. X                    }
  1134. X                    exit(0);
  1135. X            }
  1136. X            break;
  1137. X    }
  1138. X    exit(0);
  1139. X}    /* end of main */
  1140. X
  1141. X/* vi: set tabstop=4 shiftwidth=4: */
  1142. X/* end of ecuungetty.c */
  1143. SHAR_EOF
  1144. $TOUCH -am 0810194991 'ecuungetty/ecuungetty.c' &&
  1145. chmod 0644 ecuungetty/ecuungetty.c ||
  1146. echo 'restore of ecuungetty/ecuungetty.c failed'
  1147. Wc_c="`wc -c < 'ecuungetty/ecuungetty.c'`"
  1148. test 5101 -eq "$Wc_c" ||
  1149.     echo 'ecuungetty/ecuungetty.c: original size 5101, current size' "$Wc_c"
  1150. # ============= logevent.c ==============
  1151. echo 'x - extracting logevent.c (Text)'
  1152. sed 's/^X//' << 'SHAR_EOF' > 'logevent.c' &&
  1153. X/*+-------------------------------------------------------------------------
  1154. X    logevent.c - log ecu event
  1155. X    wht@n4hgf.Mt-Park.GA.US
  1156. X--------------------------------------------------------------------------*/
  1157. X/*+:EDITS:*/
  1158. X/*:08-07-1991-14:23-wht@n4hgf-use static logname */
  1159. X/*:07-25-1991-12:58-wht@n4hgf-ECU release 3.10 */
  1160. X/*:09-19-1990-19:36-wht@n4hgf-ecu_log_event now gets pid for log from caller */
  1161. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  1162. X
  1163. X#include <stdio.h>
  1164. X#include <sys/locking.h>
  1165. X#include "stdio_lint.h"
  1166. X#include "lint_args.h"
  1167. X
  1168. X/*+-------------------------------------------------------------------------
  1169. X    ecu_log_event(pid,event_note)
  1170. X--------------------------------------------------------------------------*/
  1171. Xvoid
  1172. Xecu_log_event(pid,event_note)
  1173. Xint pid;
  1174. Xchar *event_note;
  1175. X{
  1176. Xchar tstr256[256];
  1177. XFILE *ecu_log_fp;
  1178. Xstatic char logname[128] = "";
  1179. X
  1180. X    if(!logname[0])
  1181. X    {
  1182. X        get_home_dir(logname);
  1183. X        strcat(logname,"/.ecu/log");
  1184. X    }
  1185. X    if((ecu_log_fp = fopen(logname,"a")) != NULL)
  1186. X    {
  1187. X        locking(fileno(ecu_log_fp),LK_LOCK,0L);
  1188. X        get_tod(2,tstr256);
  1189. X        tstr256[10] = '-';
  1190. X        fputs(tstr256,ecu_log_fp);
  1191. X        fprintf(ecu_log_fp,"-%05d-",pid);
  1192. X        fputs(event_note,ecu_log_fp);
  1193. X        fputs("\n",ecu_log_fp);
  1194. X        fflush(ecu_log_fp);
  1195. X        locking(fileno(ecu_log_fp),LK_UNLCK,0L);
  1196. X        fclose(ecu_log_fp);
  1197. X    }
  1198. X}    /* end of ecu_log_event */
  1199. X
  1200. X
  1201. X/* vi: set tabstop=4 shiftwidth=4: */
  1202. X/* end of logevent.c */
  1203. SHAR_EOF
  1204. $TOUCH -am 0807142391 'logevent.c' &&
  1205. chmod 0644 logevent.c ||
  1206. echo 'restore of logevent.c failed'
  1207. Wc_c="`wc -c < 'logevent.c'`"
  1208. test 1397 -eq "$Wc_c" ||
  1209.     echo 'logevent.c: original size 1397, current size' "$Wc_c"
  1210. # ============= patchlevel.h ==============
  1211. echo 'x - extracting patchlevel.h (Text)'
  1212. sed 's/^X//' << 'SHAR_EOF' > 'patchlevel.h' &&
  1213. X#define PATCHLEVEL 11
  1214. SHAR_EOF
  1215. $TOUCH -am 0806150591 'patchlevel.h' &&
  1216. chmod 0644 patchlevel.h ||
  1217. echo 'restore of patchlevel.h failed'
  1218. Wc_c="`wc -c < 'patchlevel.h'`"
  1219. test 22 -eq "$Wc_c" ||
  1220.     echo 'patchlevel.h: original size 22, current size' "$Wc_c"
  1221. # ============= utmpstatus.h ==============
  1222. echo 'x - extracting utmpstatus.h (Text)'
  1223. sed 's/^X//' << 'SHAR_EOF' > 'utmpstatus.h' &&
  1224. X/*+-------------------------------------------------------------------------
  1225. X    utmpstatus.h
  1226. X    wht@n4hgf.Mt-Park.GA.US
  1227. X--------------------------------------------------------------------------*/
  1228. X/*+:EDITS:*/
  1229. X/*:08-10-1991-17:19-wht@n4hgf-add US_WEGOTIT */
  1230. X/*:07-25-1991-12:59-wht@n4hgf-ECU release 3.10 */
  1231. X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
  1232. X
  1233. X/* utmp_status defines */
  1234. X#define US_NOTFOUND    100    /* not in utmp, or getty dead */
  1235. X#define US_LOGIN    101    /* enabled for login, idle */
  1236. X#define US_DIALOUT    102    /* enabled for login, currently dialout */
  1237. X#define US_LOGGEDIN    103    /* enabled for login, in use */
  1238. X#define US_WEGOTIT    104    /* we own the line */
  1239. X
  1240. X/* vi: set tabstop=4 shiftwidth=4: */
  1241. X/* end of utmpstatus.h */
  1242. SHAR_EOF
  1243. $TOUCH -am 0810171991 'utmpstatus.h' &&
  1244. chmod 0644 utmpstatus.h ||
  1245. echo 'restore of utmpstatus.h failed'
  1246. Wc_c="`wc -c < 'utmpstatus.h'`"
  1247. test 735 -eq "$Wc_c" ||
  1248.     echo 'utmpstatus.h: original size 735, current size' "$Wc_c"
  1249. # ============= zgcc ==============
  1250. echo 'x - extracting zgcc (Text)'
  1251. sed 's/^X//' << 'SHAR_EOF' > 'zgcc' &&
  1252. X#!/bin/csh
  1253. X#+:EDITS:
  1254. X#:08-11-1991-23:47-wht@n4hgf-thanks for the -p1 suggestion to sef@kithrup.com
  1255. X#zgcc -- build prototyping "LINT_ARGS"
  1256. Xecho C sources in $1';' result file $2
  1257. Xunset noclobber
  1258. Xrm -f zg.t
  1259. Xif (-e /unix)
  1260. X    echo 'building old-style prototypes for XENIX compiler compatibility'
  1261. X    echo 'unnamed struct/union as parameter warning probably about FILE :-('
  1262. Xendif
  1263. Xforeach i(`cat $1`)
  1264. Xif (-e /unix)
  1265. X    cc -DBUILDING_LINT_ARGS -p1 /lib/p1 -Zg $argv[3-] $i | mkoldproto > zg1.t
  1266. Xelse
  1267. X    cc -DBUILDING_LINT_ARGS -Zg $argv[3-] $i > zg1.t
  1268. Xendif
  1269. Xsort zg1.t > zg2.t
  1270. Xecho '/*' $i '*/' >> zg.t
  1271. Xcat zg2.t >> zg.t
  1272. Xend
  1273. Xafterlint zg.t $2
  1274. Xrm -f zg.t zg?.t
  1275. Xecho Output in $2
  1276. SHAR_EOF
  1277. $TOUCH -am 0811234791 'zgcc' &&
  1278. chmod 0755 zgcc ||
  1279. echo 'restore of zgcc failed'
  1280. Wc_c="`wc -c < 'zgcc'`"
  1281. test 659 -eq "$Wc_c" ||
  1282.     echo 'zgcc: original size 659, current size' "$Wc_c"
  1283. exit 0
  1284.  
  1285. exit 0 # Just in case...
  1286. -- 
  1287. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1288. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1289. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1290. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1291.