home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume22 / ecu / patch05e < prev    next >
Encoding:
Text File  |  1991-09-04  |  16.7 KB  |  682 lines

  1. Newsgroups: comp.sources.misc
  2. From: Warren Tucker <wht@n4hgf.GA.US>
  3. Subject:  v22i094:  ecu - ECU async comm package rev 3.10, Patch05e/5
  4. Message-ID: <1991Sep4.160303.28501@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 998c113846c0f2652c296b847d576e46
  6. Date: Wed, 4 Sep 1991 16:03:03 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: Warren Tucker <wht@n4hgf.GA.US>
  10. Posting-number: Volume 22, Issue 94
  11. Archive-name: ecu/patch05e
  12. Environment: SCO, XENIX, ISC, SUNOS4.1, SYSVR4
  13. Patch-To: ecu: Volume 21, Issue 53-89
  14.  
  15. #!/bin/sh
  16. # this is p5.05 (part 5 of ecu/patch05)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file memmove/memmove.s continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 5; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping memmove/memmove.s'
  34. else
  35. echo 'x - continuing file memmove/memmove.s'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'memmove/memmove.s' &&
  37. X    .globl    _mcount
  38. X    call    _mcount
  39. X')
  40. X    push    %edi
  41. X    push    %esi
  42. X    mov    12(%esp),%edi
  43. X    mov    16(%esp),%esi
  44. X    mov    20(%esp),%ecx
  45. X    mov    %edi,%eax        / return value: dest
  46. X    jcxz    mm_exit
  47. X
  48. X    mov    %edi,%edx
  49. X    sub    %esi,%edx
  50. X    jb    mm_simple
  51. X    cmp    %edx,%ecx
  52. X    jb    mm_simple
  53. X
  54. X    add    %ecx,%edi
  55. X    dec    %edi
  56. X    add    %ecx,%esi
  57. X    dec    %esi
  58. X    std
  59. X    rep; movsb
  60. X    cld
  61. X    jmp    mm_exit
  62. X
  63. Xmm_simple:
  64. X    cld
  65. X    mov    %ecx,%edx
  66. X    shr    $2,%ecx
  67. X    rep; movs
  68. X    mov    %edx,%ecx
  69. X    and    $3,%ecx
  70. X    rep; movsb
  71. X
  72. Xmm_exit:
  73. X    pop    %esi
  74. X    pop    %edi
  75. X    ret
  76. SHAR_EOF
  77. echo 'File memmove/memmove.s is complete' &&
  78. chmod 0664 memmove/memmove.s ||
  79. echo 'restore of memmove/memmove.s failed'
  80. Wc_c="`wc -c < 'memmove/memmove.s'`"
  81. test 1143 -eq "$Wc_c" ||
  82.     echo 'memmove/memmove.s: original size 1143, current size' "$Wc_c"
  83. rm -f _shar_wnt_.tmp
  84. fi
  85. # ============= memmove/memmove286.asm ==============
  86. if test -f 'memmove/memmove286.asm' -a X"$1" != X"-c"; then
  87.     echo 'x - skipping memmove/memmove286.asm (File already exists)'
  88.     rm -f _shar_wnt_.tmp
  89. else
  90. > _shar_wnt_.tmp
  91. echo 'x - extracting memmove/memmove286.asm (Text)'
  92. sed 's/^X//' << 'SHAR_EOF' > 'memmove/memmove286.asm' &&
  93. X;+------------------------------------------------------------------
  94. X; memmove386.asm
  95. X;
  96. X; Name
  97. X;      memmove - Copies characters between objects.
  98. X;
  99. X; Syntax
  100. X;
  101. X;      void *memmove(dest, src, count)
  102. X;      void *dest;
  103. X;      const void *src;
  104. X;      size_t count;
  105. X;
  106. X; Description
  107. X;      The memmove function copies count characters from src to
  108. X;      dest.  If some regions of src and dest overlap, memmove
  109. X;      ensures that the original src bytes in the overlapping
  110. X;      region are copied before being overwritten.
  111. X;
  112. X; Return Value
  113. X;      The value of dest, the destination object.
  114. X;
  115. X;-------------------------------------------------------------------
  116. X;+:EDITS:
  117. X;:09-01-1991-23:15-wht@n4hgf-convert Chip's memmove.s
  118. X
  119. X    TITLE   memmove286.asm
  120. X    .286p
  121. X    .287
  122. XMEMMOVE_TEXT    SEGMENT  WORD PUBLIC 'CODE'
  123. XMEMMOVE_TEXT    ENDS
  124. X_DATA    SEGMENT  WORD PUBLIC 'DATA'
  125. X_DATA    ENDS
  126. XCONST    SEGMENT  WORD PUBLIC 'CONST'
  127. XCONST    ENDS
  128. X_BSS    SEGMENT  WORD PUBLIC 'BSS'
  129. X_BSS    ENDS
  130. XDGROUP    GROUP    CONST, _BSS, _DATA
  131. X    ASSUME  CS: MEMMOVE_TEXT, DS: DGROUP, SS: DGROUP
  132. XEXTRN    __chkstk:FAR
  133. XMEMMOVE_TEXT      SEGMENT
  134. X    ASSUME    CS: MEMMOVE_TEXT
  135. X
  136. Xdest    equ    6
  137. Xsrc    equ    10
  138. Xlen    equ    14
  139. X
  140. X    PUBLIC    _memmove
  141. X_memmove    PROC FAR
  142. X    push    bp
  143. X    mov    bp,sp
  144. X    mov    ax,0
  145. X    call    FAR PTR __chkstk
  146. X    push    di
  147. X    push    si
  148. X    push    ds
  149. X
  150. X    mov    ax,WORD PTR [bp+src]
  151. X    mov    dx,WORD PTR [bp+src+2]
  152. X    mov    cx,WORD PTR [bp+len]
  153. X    mov    si,ax
  154. X    mov    ds,dx
  155. X    les    di,DWORD PTR [bp+dest]
  156. X    mov    dx,es
  157. X
  158. X; which way should the copy go?
  159. X    mov    ax,di
  160. X    sub    ax,si
  161. X    jb    short mm_ascend
  162. X    cmp    cx,ax
  163. X    jb    short mm_ascend
  164. X
  165. X; descending
  166. X    add    si,cx
  167. X    dec    si
  168. X    add    di,cx
  169. X    dec    di
  170. X    std
  171. X    rep    movsb
  172. X    cld
  173. X    jmp    short mm_exit
  174. X
  175. X; ascending
  176. Xmm_ascend:
  177. X    cld
  178. X    shr    cx,1
  179. X    rep    movsw
  180. X    adc    cx,cx
  181. X    rep    movsb
  182. X
  183. Xmm_exit:
  184. X    pop    ds
  185. X    pop    si
  186. X    pop    di
  187. X    leave    
  188. X    ret    
  189. X
  190. X_memmove  ENDP
  191. X_TEXT    ENDS
  192. X    end
  193. SHAR_EOF
  194. chmod 0644 memmove/memmove286.asm ||
  195. echo 'restore of memmove/memmove286.asm failed'
  196. Wc_c="`wc -c < 'memmove/memmove286.asm'`"
  197. test 1745 -eq "$Wc_c" ||
  198.     echo 'memmove/memmove286.asm: original size 1745, current size' "$Wc_c"
  199. rm -f _shar_wnt_.tmp
  200. fi
  201. # ============= memmove/memmove386.asm ==============
  202. if test -f 'memmove/memmove386.asm' -a X"$1" != X"-c"; then
  203.     echo 'x - skipping memmove/memmove386.asm (File already exists)'
  204.     rm -f _shar_wnt_.tmp
  205. else
  206. > _shar_wnt_.tmp
  207. echo 'x - extracting memmove/memmove386.asm (Text)'
  208. sed 's/^X//' << 'SHAR_EOF' > 'memmove/memmove386.asm' &&
  209. X;+------------------------------------------------------------------
  210. X; memmove386.asm
  211. X;
  212. X; Name
  213. X;      memmove - Copies characters between objects.
  214. X;
  215. X; Syntax
  216. X;
  217. X;      void *memmove(dest, src, count)
  218. X;      void *dest;
  219. X;      const void *src;
  220. X;      size_t count;
  221. X;
  222. X; Description
  223. X;      The memmove function copies count characters from src to
  224. X;      dest.  If some regions of src and dest overlap, memmove
  225. X;      ensures that the original src bytes in the overlapping
  226. X;      region are copied before being overwritten.
  227. X;
  228. X; Return Value
  229. X;      The value of dest, the destination object.
  230. X;
  231. X;-------------------------------------------------------------------
  232. X;+:EDITS:
  233. X;:09-01-1991-23:15-wht@n4hgf-convert Chip's memmove.s
  234. X
  235. X    TITLE    $memmove
  236. X
  237. X    .386
  238. XDGROUP    GROUP    CONST, _BSS, _DATA
  239. X_DATA    SEGMENT  DWORD USE32 PUBLIC 'DATA'
  240. X_DATA      ENDS
  241. X_BSS    SEGMENT  DWORD USE32 PUBLIC 'BSS'
  242. X_BSS      ENDS
  243. XCONST    SEGMENT  DWORD USE32 PUBLIC 'CONST'
  244. XCONST      ENDS
  245. X    ASSUME   CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
  246. X
  247. X    PUBLIC  _memmove
  248. X    PUBLIC  memmove
  249. X
  250. X_TEXT    SEGMENT  DWORD USE32 PUBLIC 'CODE'
  251. X_memmove PROC NEAR
  252. Xmemmove:
  253. X    push    edi
  254. X    push    esi
  255. X    mov    edi,[esp+12]
  256. X    mov    esi,[esp+16]
  257. X    mov    ecx,[esp+20]
  258. X    mov    eax,edi        ; return value: dest
  259. X    jcxz    mm_exit
  260. X
  261. X    mov    edx,edi
  262. X    sub    edx,esi
  263. X    jb    short mm_left_to_right
  264. X    cmp    ecx,edx
  265. X    jb    short mm_left_to_right
  266. X
  267. Xmm_right_to_left:
  268. X    add    edi,ecx
  269. X    dec    edi
  270. X    add    esi,ecx
  271. X    dec    esi
  272. X    std
  273. X    rep movsb
  274. X    cld
  275. X    jmp    short mm_exit
  276. X
  277. Xmm_left_to_right:
  278. X    cld
  279. X    mov    edx,ecx
  280. X    shr    ecx,2
  281. X    rep movsw
  282. X    mov    ecx,edx
  283. X    and    ecx,3
  284. X    rep movsb
  285. X
  286. Xmm_exit:
  287. X    pop    esi
  288. X    pop    edi
  289. X    ret
  290. X_memmove  ENDP
  291. X_TEXT    ENDES
  292. X    end
  293. SHAR_EOF
  294. chmod 0644 memmove/memmove386.asm ||
  295. echo 'restore of memmove/memmove386.asm failed'
  296. Wc_c="`wc -c < 'memmove/memmove386.asm'`"
  297. test 1587 -eq "$Wc_c" ||
  298.     echo 'memmove/memmove386.asm: original size 1587, current size' "$Wc_c"
  299. rm -f _shar_wnt_.tmp
  300. fi
  301. # ============= timetest/Makefile ==============
  302. if test ! -d 'timetest'; then
  303.     echo 'x - creating directory timetest'
  304.     mkdir 'timetest'
  305. fi
  306. if test -f 'timetest/Makefile' -a X"$1" != X"-c"; then
  307.     echo 'x - skipping timetest/Makefile (File already exists)'
  308.     rm -f _shar_wnt_.tmp
  309. else
  310. > _shar_wnt_.tmp
  311. echo 'x - extracting timetest/Makefile (Text)'
  312. sed 's/^X//' << 'SHAR_EOF' > 'timetest/Makefile' &&
  313. X
  314. XPROGS = seltest naptest naptest2 naptest3
  315. X
  316. XLIB = -lx # -linet # needed on ISC
  317. X
  318. Xall: $(PROGS)
  319. X
  320. X# -linet needed on ISC
  321. Xseltest: seltest.c
  322. X    cc -o $@ $@.c
  323. X
  324. Xnaptest: seltest.c
  325. X    cc -o $@ $@.c $(LIB)
  326. X
  327. Xnaptest2: seltest.c
  328. X    cc -o $@ $@.c $(LIB)
  329. X
  330. Xnaptest3: seltest.c
  331. X    cc -o $@ $@.c $(LIB)
  332. X
  333. Xclean:
  334. X    rm -f $(PROGS)
  335. SHAR_EOF
  336. chmod 0664 timetest/Makefile ||
  337. echo 'restore of timetest/Makefile failed'
  338. Wc_c="`wc -c < 'timetest/Makefile'`"
  339. test 304 -eq "$Wc_c" ||
  340.     echo 'timetest/Makefile: original size 304, current size' "$Wc_c"
  341. rm -f _shar_wnt_.tmp
  342. fi
  343. # ============= timetest/naptest.c ==============
  344. if test -f 'timetest/naptest.c' -a X"$1" != X"-c"; then
  345.     echo 'x - skipping timetest/naptest.c (File already exists)'
  346.     rm -f _shar_wnt_.tmp
  347. else
  348. > _shar_wnt_.tmp
  349. echo 'x - extracting timetest/naptest.c (Text)'
  350. sed 's/^X//' << 'SHAR_EOF' > 'timetest/naptest.c' &&
  351. X/* CHK=0x88E6 */
  352. X/*+-------------------------------------------------------------------------
  353. X    naptest.c - nap test suite
  354. X    wht@n4hgf.Mt-Park.GA.US
  355. X
  356. XThis little program is derived from my first nap program from XENIX days.
  357. XThe M_XENIX code shows how predictable nap() behaves under XENIX 286
  358. Xand 386.  It assumes HZ is 50.  It surely was nice when UNIX came out
  359. Xwith 100 HZ for 10 msec clock ticks.  60 HZ 16.6666666666666666666667
  360. Xmsec clock ticks are a bit nauseating.
  361. X--------------------------------------------------------------------------*/
  362. X/*+:EDITS:*/
  363. X/*:06-26-1988-14:05-wht-creation */
  364. X
  365. X#include <stdio.h>
  366. X#ifdef M_UNIX
  367. X#undef M_XENIX
  368. X#endif
  369. X
  370. X#ifndef M_XENIX
  371. X#include <sys/param.h>
  372. X#endif
  373. X
  374. Xmain(argc,argv,envp)
  375. Xint argc;
  376. Xchar    **argv;
  377. Xchar    **envp;
  378. X{
  379. X    register int itmp;
  380. X    long nap(),ms;
  381. X    int cnt[8];
  382. X
  383. X    for(itmp = 0; itmp < 8; itmp++)
  384. X        cnt[itmp] = 0;
  385. X
  386. X#ifdef M_XENIX
  387. X    printf("making 1000 nap(20L) calls\n");
  388. X    for(itmp = 0; itmp < 1000; itmp++)
  389. X    {
  390. X        switch(nap((long)20))
  391. X        {
  392. X        case 0L:    cnt[0]++; break;
  393. X        case 20L:    cnt[1]++; break;
  394. X        case 40L:    cnt[2]++; break;
  395. X        case 60L:    cnt[3]++; break;
  396. X        case 80L:    cnt[4]++; break;
  397. X        case 100L:    cnt[5]++; break;
  398. X        case 120L:    cnt[6]++; break;
  399. X        default:    cnt[7]++; break;
  400. X        }
  401. X    }
  402. X    printf("return value buckets:\n");
  403. X    printf("0:%d 20:%d 40:%d 60:%d 80:%d 100:%d 120:%d other:%d\n",
  404. X        cnt[0],cnt[1],cnt[2],cnt[3],cnt[4],cnt[5],cnt[6],cnt[7]);
  405. X#else
  406. X    printf("making 1000 nap(%ldL) calls\n",(1000 / HZ) + 1);
  407. X    for(itmp = 0; itmp < 1000; itmp++)
  408. X    {
  409. X        switch(ms = nap((long)(1000 / HZ) + 1))
  410. X        {
  411. X        case 0L:
  412. X            cnt[0]++; break;
  413. X        case (((1000 / HZ)    )  * 1):
  414. X        case (((1000 / HZ) + 1)  * 1):
  415. X            cnt[1]++; break;
  416. X        case (((1000 / HZ)    )  * 2):
  417. X        case (((1000 / HZ) + 1)  * 2):
  418. X            cnt[2]++; break;
  419. X        case (((1000 / HZ)    )  * 3):
  420. X        case (((1000 / HZ) + 1)  * 3):
  421. X            cnt[3]++; break;
  422. X        case (((1000 / HZ)    )  * 4):
  423. X        case (((1000 / HZ) + 1)  * 4):
  424. X            cnt[4]++; break;
  425. X        case (((1000 / HZ)    )  * 5):
  426. X        case (((1000 / HZ) + 1)  * 5):
  427. X            cnt[5]++; break;
  428. X        case (((1000 / HZ)    )  * 6):
  429. X        case (((1000 / HZ) + 1)  * 6):
  430. X            cnt[6]++; break;
  431. X        default:
  432. X            cnt[7]++; break;
  433. X        }
  434. X    }
  435. X
  436. X    printf("return value buckets:\n");
  437. X    for(itmp = 0; itmp < 7; itmp++)
  438. X        printf("%d:%d ",(1000/HZ)*itmp,cnt[itmp]);
  439. X    printf("other:%d\n",cnt[7]);
  440. X#endif
  441. X    exit(0);
  442. X
  443. X}    /* end of main */
  444. X
  445. X/* vi: set tabstop=4 shiftwidth=4: */
  446. SHAR_EOF
  447. chmod 0644 timetest/naptest.c ||
  448. echo 'restore of timetest/naptest.c failed'
  449. Wc_c="`wc -c < 'timetest/naptest.c'`"
  450. test 2342 -eq "$Wc_c" ||
  451.     echo 'timetest/naptest.c: original size 2342, current size' "$Wc_c"
  452. rm -f _shar_wnt_.tmp
  453. fi
  454. # ============= timetest/naptest2.c ==============
  455. if test -f 'timetest/naptest2.c' -a X"$1" != X"-c"; then
  456.     echo 'x - skipping timetest/naptest2.c (File already exists)'
  457.     rm -f _shar_wnt_.tmp
  458. else
  459. > _shar_wnt_.tmp
  460. echo 'x - extracting timetest/naptest2.c (Text)'
  461. sed 's/^X//' << 'SHAR_EOF' > 'timetest/naptest2.c' &&
  462. X/* CHK=0xD254 */
  463. X/*+-------------------------------------------------------------------------
  464. X    naptest2.c - nap test suite
  465. X    wht@n4hgf.Mt-Park.GA.US
  466. X
  467. XThis test checks a number of nap features.
  468. X
  469. X1.  Does nap correctly nap a reasonable interval of time over
  470. X    a range of selected periods?
  471. X2.  Does nap correctly return the period of time it napped?
  472. X--------------------------------------------------------------------------*/
  473. X/*+:EDITS:*/
  474. X/*:09-03-1991-21:04-wht@n4hgf-make part of suite */
  475. X/*:06-26-1988-14:05-wht-creation */
  476. X
  477. X#include <stdio.h>
  478. X#include <sys/param.h>
  479. X
  480. X/*+-------------------------------------------------------------------------
  481. X    nap_test(period) - make repeated nap test for 'period'
  482. X--------------------------------------------------------------------------*/
  483. Xvoid
  484. Xnap_test(period)
  485. Xlong period;
  486. X{
  487. Xint itmp,zero_nap_count = 0;
  488. Xlong total = 0L,msec,then,now,nap();
  489. Xchar s64[64],*ctime();
  490. X#define CNT 500
  491. X
  492. X    printf("testing nap(%ldL) should take about %.2lf sec\n",
  493. X        period,(double)period * CNT / 1000.0);
  494. X    time(&then);
  495. X    printf("  started at %s",ctime(&then));
  496. X    itmp = CNT;
  497. X    while(itmp--)
  498. X    {
  499. X        msec = nap(period);
  500. X        total += msec;
  501. X        if(!msec)
  502. X            zero_nap_count++;
  503. X    }
  504. X    time(&now);
  505. X    strcpy(s64,ctime(&now));
  506. X    s64[strlen(s64) - 1] = 0;
  507. X    printf("  ended   at %s  (%ld secs)\n",s64,now - then);
  508. X    printf("  average nap return value = %.2lf msec\n",(double)total / CNT);
  509. X    printf("  reported zero length nap %d out of %d times\n\n",
  510. X        zero_nap_count,CNT);
  511. X
  512. X}   /* end of nap_test */
  513. X
  514. X/*+-------------------------------------------------------------------------
  515. X    main(argc,argv,envp)
  516. X--------------------------------------------------------------------------*/
  517. Xmain(argc,argv,envp)
  518. Xint argc;
  519. Xchar    **argv;
  520. Xchar    **envp;
  521. X{
  522. X    int hz;
  523. X    long hzmsec;
  524. X
  525. X    setbuf(stdout,NULL);
  526. X
  527. X/*
  528. X * learn tick rate for various timers
  529. X */
  530. X    if(getenv("HZ"))
  531. X        hz = atoi(getenv("HZ"));
  532. X    else
  533. X        hz = HZ;
  534. X    hzmsec = (1000 / hz) + 1; /* prevent damaged nap from not napping */
  535. X
  536. X    nap_test(5L);       /* this never naps at all unless accidental
  537. X                         * scheduling causes a delay
  538. X                         */
  539. X
  540. X    nap_test(hzmsec);
  541. X    nap_test(50L);
  542. X    exit(0);
  543. X
  544. X}   /* end of main */
  545. X
  546. X/* vi: set tabstop=4 shiftwidth=4: */
  547. SHAR_EOF
  548. chmod 0644 timetest/naptest2.c ||
  549. echo 'restore of timetest/naptest2.c failed'
  550. Wc_c="`wc -c < 'timetest/naptest2.c'`"
  551. test 2312 -eq "$Wc_c" ||
  552.     echo 'timetest/naptest2.c: original size 2312, current size' "$Wc_c"
  553. rm -f _shar_wnt_.tmp
  554. fi
  555. # ============= timetest/naptest3.c ==============
  556. if test -f 'timetest/naptest3.c' -a X"$1" != X"-c"; then
  557.     echo 'x - skipping timetest/naptest3.c (File already exists)'
  558.     rm -f _shar_wnt_.tmp
  559. else
  560. > _shar_wnt_.tmp
  561. echo 'x - extracting timetest/naptest3.c (Text)'
  562. sed 's/^X//' << 'SHAR_EOF' > 'timetest/naptest3.c' &&
  563. X/* CHK=0x83DE */
  564. X/*+-------------------------------------------------------------------------
  565. X    naptest3.c - nap test suite
  566. X    wht@n4hgf.Mt-Park.GA.US
  567. X
  568. XThis test attempts to see if small naps nap even though return value is 0,
  569. Xthus partially complying with the man page:
  570. X"The current process is suspended from execution for at least
  571. Xthe number of milliseconds specified by period ...." ^^^^^^^^
  572. X
  573. X--------------------------------------------------------------------------*/
  574. X/*+:EDITS:*/
  575. X/*:09-03-1991-20:30-wht@n4hgf-creation */
  576. X
  577. X#include <stdio.h>
  578. X#include <sys/param.h>
  579. X
  580. Xmain(argc,argv)
  581. Xint argc;
  582. Xchar **argv;
  583. X{
  584. X    int itmp,hz,expected;
  585. X    char *cptr,*getenv(),*ctime();
  586. X    long hzmsec,then,now,actual;
  587. X
  588. X    /* learn tick period */
  589. X    if((cptr = getenv("HZ")) && *cptr)
  590. X        hz = atoi(cptr);
  591. X    else
  592. X        hz = HZ;
  593. X    hzmsec = (1000 / hz) + 1; /* prevent damaged nap from not napping */
  594. X
  595. X    itmp = 1000;
  596. X    expected = (int)(hzmsec * itmp / 1000L);
  597. X    printf("This should sleep about %d seconds, %ld+ msec at a time\n",
  598. X        expected, hzmsec - 1);
  599. X    time(&then);
  600. X    printf("Nap started at %s",ctime(&then));
  601. X    while(itmp--)
  602. X        nap(hzmsec - 1);
  603. X    time(&now);
  604. X    printf("Nap ended   at %s",ctime(&now));
  605. X    printf("Napped about %ld second(s)",actual = now - then);
  606. X    if(!actual)
  607. X        printf(", not at all!");
  608. X    else if(actual == 1)
  609. X        printf(". Must be a lucky epoch tick.  Try it again!");
  610. X    printf("\n",stdout);
  611. X
  612. X    exit(0);
  613. X}   /* end of main */
  614. SHAR_EOF
  615. chmod 0644 timetest/naptest3.c ||
  616. echo 'restore of timetest/naptest3.c failed'
  617. Wc_c="`wc -c < 'timetest/naptest3.c'`"
  618. test 1469 -eq "$Wc_c" ||
  619.     echo 'timetest/naptest3.c: original size 1469, current size' "$Wc_c"
  620. rm -f _shar_wnt_.tmp
  621. fi
  622. # ============= timetest/seltest.c ==============
  623. if test -f 'timetest/seltest.c' -a X"$1" != X"-c"; then
  624.     echo 'x - skipping timetest/seltest.c (File already exists)'
  625.     rm -f _shar_wnt_.tmp
  626. else
  627. > _shar_wnt_.tmp
  628. echo 'x - extracting timetest/seltest.c (Text)'
  629. sed 's/^X//' << 'SHAR_EOF' > 'timetest/seltest.c' &&
  630. X/* CHK=0xF551 */
  631. X/*+-------------------------------------------------------------------------
  632. X    testsel.c - test timeout interval of select()
  633. X    wht@n4hgf.Mt-Park.GA.US
  634. X--------------------------------------------------------------------------*/
  635. X/*+:EDITS:*/
  636. X/*:09-03-1991-19:57-wht@n4hgf-creation */
  637. X
  638. X#include <stdio.h>
  639. X#ifdef M_SYSV /* SCO */
  640. X#include <sys/select.h>
  641. X#else
  642. X#include <sys/time.h>
  643. X#endif
  644. X
  645. X/*+-------------------------------------------------------------------------
  646. X    main(argc,argv)
  647. X--------------------------------------------------------------------------*/
  648. Xmain(argc,argv)
  649. Xint argc;
  650. Xchar **argv;
  651. X{
  652. Xstruct timeval tv;
  653. X
  654. X    setbuf(stdout,NULL);
  655. X
  656. X    while(1)
  657. X    {
  658. X        tv.tv_sec = 0;
  659. X        tv.tv_usec = 100*1000L;
  660. X        select(0,0,0,0,&tv);
  661. X        fputs("100 msec?\n",stdout);
  662. X    }
  663. X
  664. X    exit(0);
  665. X}    /* end of main */
  666. X
  667. X/* vi: set tabstop=4 shiftwidth=4: */
  668. X/* end of testsel.c */
  669. SHAR_EOF
  670. chmod 0644 timetest/seltest.c ||
  671. echo 'restore of timetest/seltest.c failed'
  672. Wc_c="`wc -c < 'timetest/seltest.c'`"
  673. test 863 -eq "$Wc_c" ||
  674.     echo 'timetest/seltest.c: original size 863, current size' "$Wc_c"
  675. rm -f _shar_wnt_.tmp
  676. fi
  677. rm -f _shar_seq_.tmp
  678. echo You have unpacked the last part
  679. exit 0
  680.  
  681. exit 0 # Just in case...
  682.