home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume27 / clc / part03 < prev    next >
Encoding:
Text File  |  1993-11-28  |  33.6 KB  |  1,364 lines

  1. Newsgroups: comp.sources.unix
  2. From: panos@anchor.cs.colorado.edu (Panos Tsirigotis)
  3. Subject: v27i109: clc - C Libraries Collection, Part03/20
  4. References: <1.754527080.23891@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: panos@anchor.cs.colorado.edu (Panos Tsirigotis)
  9. Posting-Number: Volume 27, Issue 109
  10. Archive-Name: clc/part03
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 3 (of 20)."
  19. # Contents:  libs/src/dict/bst.h libs/src/dict/bsttest.out
  20. #   libs/src/dict/dictimpl.h libs/src/dict/htest.c
  21. #   libs/src/dict/htimpl.h libs/src/pq/hpq.h libs/src/pset/psi.3
  22. #   libs/src/sio/suite/README libs/src/str/ss_bmh.c
  23. #   libs/src/str/ss_sbm.c libs/src/str/strparse.h
  24. #   libs/src/str/strutil.3 libs/src/timer/impl.h libs/src/xlog/xlog.h
  25. #   sysinc
  26. # Wrapped by panos@eclipse on Sun Nov 28 14:48:15 1993
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'libs/src/dict/bst.h' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'libs/src/dict/bst.h'\"
  30. else
  31. echo shar: Extracting \"'libs/src/dict/bst.h'\" \(1413 characters\)
  32. sed "s/^X//" >'libs/src/dict/bst.h' <<'END_OF_FILE'
  33. X/*
  34. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  35. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  36. X * and conditions for redistribution.
  37. X */
  38. X
  39. X#ifndef __BST_H
  40. X#define __BST_H
  41. X
  42. X/*
  43. X * $Id: bst.h,v 3.1 93/04/23 17:47:42 panos Exp $
  44. X */
  45. X
  46. X#include "dict.h"
  47. X
  48. Xdict_h bst_create            __ARGS( (
  49. X                                                dict_function oo_compare,
  50. X                                                dict_function ko_compare,
  51. X                                                int flags,
  52. X                                                int *errnop
  53. X                                        ) ) ;
  54. Xvoid    bst_destroy            __ARGS( ( dict_h bh ) ) ;
  55. Xint    bst_insert            __ARGS( ( dict_h bh, dict_obj obj ) ) ;
  56. Xint    bst_insert_uniq    __ARGS( ( dict_h bh, dict_obj obj, dict_obj *objp ) ) ;
  57. Xint    bst_delete            __ARGS( ( dict_h bh, dict_obj obj ) ) ;
  58. Xdict_obj bst_search        __ARGS( ( dict_h bh, dict_key key ) ) ;
  59. Xdict_obj bst_minimum        __ARGS( ( dict_h bh ) ) ;
  60. Xdict_obj bst_maximum        __ARGS( ( dict_h bh ) ) ;
  61. Xdict_obj bst_successor    __ARGS( ( dict_h bh, dict_obj obj ) ) ;
  62. Xdict_obj bst_predecessor __ARGS( ( dict_h bh, dict_obj obj ) ) ;
  63. Xvoid        bst_iterate        __ARGS( ( dict_h bh, enum dict_direction ) ) ;
  64. Xdict_obj    bst_nextobj        __ARGS( ( dict_h bh ) ) ;
  65. X
  66. X
  67. X#ifdef BST_DEBUG
  68. X
  69. Xtypedef enum { BST_PREORDER, BST_INORDER, BST_POSTORDER } bst_order_e ;
  70. X
  71. Xstruct bst_depth
  72. X{
  73. X    int depth_min ;
  74. X    int depth_max ;
  75. X} ;
  76. X
  77. Xvoid        bst_getdepth        __ARGS( ( dict_h bh, struct bst_depth * ) ) ;
  78. Xvoid        bst_traverse        __ARGS( ( dict_h bh, bst_order_e, void (*)() ) ) ;
  79. X
  80. X#endif    /* BST_DEBUG */
  81. X
  82. X#endif     /* __BST_H */
  83. X
  84. END_OF_FILE
  85. if test 1413 -ne `wc -c <'libs/src/dict/bst.h'`; then
  86.     echo shar: \"'libs/src/dict/bst.h'\" unpacked with wrong size!
  87. fi
  88. # end of 'libs/src/dict/bst.h'
  89. fi
  90. if test -f 'libs/src/dict/bsttest.out' -a "${1}" != "-c" ; then 
  91.   echo shar: Will not clobber existing file \"'libs/src/dict/bsttest.out'\"
  92. else
  93. echo shar: Extracting \"'libs/src/dict/bsttest.out'\" \(1548 characters\)
  94. sed "s/^X//" >'libs/src/dict/bsttest.out' <<'END_OF_FILE'
  95. X1
  96. X2
  97. X3
  98. X4
  99. X5
  100. X6
  101. X7
  102. X8
  103. X9
  104. X10
  105. X11
  106. X12
  107. X13
  108. X14
  109. X15
  110. X16
  111. X17
  112. X18
  113. X19
  114. X20
  115. X21
  116. X22
  117. X23
  118. X24
  119. X25
  120. X26
  121. X27
  122. X28
  123. X29
  124. X30
  125. X31
  126. X32
  127. X33
  128. X34
  129. X35
  130. X36
  131. X37
  132. X38
  133. X39
  134. X40
  135. X41
  136. X42
  137. X43
  138. X44
  139. X45
  140. X46
  141. X47
  142. X48
  143. X49
  144. X50
  145. X51
  146. X52
  147. X53
  148. X54
  149. X55
  150. X56
  151. X57
  152. X58
  153. X59
  154. X60
  155. X61
  156. X62
  157. X63
  158. X64
  159. X65
  160. X66
  161. X67
  162. X68
  163. X69
  164. X70
  165. X71
  166. X72
  167. X73
  168. X74
  169. X75
  170. X76
  171. X77
  172. X78
  173. X79
  174. X80
  175. X81
  176. X82
  177. X83
  178. X84
  179. X85
  180. X86
  181. X87
  182. X88
  183. X89
  184. X90
  185. X91
  186. X92
  187. X93
  188. X94
  189. X95
  190. X96
  191. X97
  192. X98
  193. X99
  194. X100
  195. X
  196. XSuccessor test
  197. X1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 
  198. XPredecessor test
  199. X100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 
  200. XSearch/delete test
  201. XSuccessor test 2
  202. X1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 
  203. XPredecessor test 2
  204. X100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 6 5 4 3 2 1 
  205. END_OF_FILE
  206. if test 1548 -ne `wc -c <'libs/src/dict/bsttest.out'`; then
  207.     echo shar: \"'libs/src/dict/bsttest.out'\" unpacked with wrong size!
  208. fi
  209. # end of 'libs/src/dict/bsttest.out'
  210. fi
  211. if test -f 'libs/src/dict/dictimpl.h' -a "${1}" != "-c" ; then 
  212.   echo shar: Will not clobber existing file \"'libs/src/dict/dictimpl.h'\"
  213. else
  214. echo shar: Extracting \"'libs/src/dict/dictimpl.h'\" \(1428 characters\)
  215. sed "s/^X//" >'libs/src/dict/dictimpl.h' <<'END_OF_FILE'
  216. X/*
  217. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  218. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  219. X * and conditions for redistribution.
  220. X */
  221. X
  222. X
  223. X#ifndef __DICTIMPL_H
  224. X#define __DICTIMPL_H
  225. X
  226. X/*
  227. X * $Id: dictimpl.h,v 3.2 93/09/28 21:08:37 panos Exp $
  228. X */
  229. X
  230. X#include "dict.h"
  231. X
  232. Xstruct dict_header
  233. X{
  234. X    dict_function    oo_comp ;
  235. X    dict_function    ko_comp ;
  236. X    int                flags ;
  237. X    int                *errnop ;
  238. X} ;
  239. X
  240. Xtypedef struct dict_header dheader_s ;
  241. X
  242. Xtypedef int bool_int ;
  243. X
  244. X#define ERRNO( dhp )                    (*((dhp)->errnop))
  245. X
  246. X#ifndef NULL
  247. X#define NULL 0
  248. X#endif
  249. X
  250. X#define INT_NULL                            ((int *)0)
  251. X
  252. X#define NULL_OBJ                            ((dict_obj)NULL)
  253. X#define NULL_HANDLE                        ((dict_h)NULL)
  254. X#define NULL_FUNC                            ((dict_function)NULL)
  255. X
  256. X#define PRIVATE                     static
  257. X
  258. X#ifndef FALSE
  259. X#define FALSE                       0
  260. X#define TRUE                        1
  261. X#endif
  262. X
  263. X#define ORDER_FLAGS                        ( DICT_ORDERED + DICT_UNORDERED )
  264. X
  265. X#define BAD_ORDER( flags )                ( ( flags & ORDER_FLAGS ) == ORDER_FLAGS )
  266. X
  267. X
  268. X#define HANDLE_ERROR( dhp, id, errval, retval )                    \
  269. X                if ( (dhp)->flags & DICT_RETURN_ERROR )            \
  270. X                {                                                                \
  271. X                    ERRNO( dhp ) = errval ;                                \
  272. X                    return( retval ) ;                                    \
  273. X                }                                                                \
  274. X                else                                                            \
  275. X                    __dict_fatal_error( id, errval )
  276. X
  277. Xvoid __dict_terminate() ;
  278. Xvoid __dict_fatal_error() ;
  279. Xvoid __dict_init_header() ;
  280. Xdict_h __dict_create_error() ;
  281. X
  282. Xchar *malloc() ;
  283. X
  284. X
  285. X#endif    /* __DICTIMPL_H */
  286. X
  287. END_OF_FILE
  288. if test 1428 -ne `wc -c <'libs/src/dict/dictimpl.h'`; then
  289.     echo shar: \"'libs/src/dict/dictimpl.h'\" unpacked with wrong size!
  290. fi
  291. # end of 'libs/src/dict/dictimpl.h'
  292. fi
  293. if test -f 'libs/src/dict/htest.c' -a "${1}" != "-c" ; then 
  294.   echo shar: Will not clobber existing file \"'libs/src/dict/htest.c'\"
  295. else
  296. echo shar: Extracting \"'libs/src/dict/htest.c'\" \(1946 characters\)
  297. sed "s/^X//" >'libs/src/dict/htest.c' <<'END_OF_FILE'
  298. X/*
  299. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  300. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  301. X * and conditions for redistribution.
  302. X */
  303. X
  304. Xstatic char RCSid[] = "$Id: htest.c,v 3.2 93/09/17 00:22:07 panos Exp $" ;
  305. X
  306. X#ifndef NULL
  307. X#define NULL 0
  308. X#endif
  309. X
  310. X#include "dict.h"
  311. X#include "ht.h"
  312. X
  313. X
  314. X#define COMPARE( i1, i2 )                                                \
  315. X                                        if ( i1 < i2 )                        \
  316. X                                            return( -1 ) ;                    \
  317. X                                        else if ( i1 == i2 )                \
  318. X                                            return( 0 ) ;                    \
  319. X                                        else                                    \
  320. X                                            return( 1 ) ;
  321. X
  322. X
  323. X#define INTP( p )                    ((int *)(p))
  324. X
  325. Xstatic int int_comp( p1, p2 )
  326. X    char *p1, *p2 ;
  327. X{
  328. X    int i1 = *INTP( p1 ) ;
  329. X    int i2 = *INTP( p2 ) ;
  330. X
  331. X    COMPARE( i1, i2 ) ;
  332. X}
  333. X
  334. X
  335. Xstatic unsigned getval( p )
  336. X    char *p ;
  337. X{
  338. X    return ( *INTP( p ) ) ;
  339. X}
  340. X
  341. X
  342. X
  343. X#define N 10
  344. Xint nums[ N ] ;
  345. X
  346. Xmain()
  347. X{
  348. X    dict_h lh ;
  349. X    int i ;
  350. X    int *ip ;
  351. X    struct ht_args args ;
  352. X
  353. X    args.ht_bucket_entries = 2 ;
  354. X    args.ht_table_entries = 2 ;
  355. X    args.ht_objvalue = getval ;
  356. X    args.ht_keyvalue = getval ;
  357. X
  358. X    lh = ht_create( int_comp, int_comp, 0, NULL, &args ) ;
  359. X
  360. X    for ( i = 0 ; i < N ; i++ )
  361. X    {
  362. X        nums[ i ] = 10-i ;
  363. X        if ( ht_insert( lh, &nums[ i ] ) != DICT_OK )
  364. X        {
  365. X            printf( "Failed at %d\n", i ) ;
  366. X            exit( 1 ) ;
  367. X        }
  368. X    }
  369. X        
  370. X    printf( "Search/delete test\n" ) ;
  371. X    i = 7 ;
  372. X    ip = INTP( ht_search( lh, &i ) ) ;
  373. X    if ( ip == NULL )
  374. X        printf( "Search failed\n" ) ;
  375. X    else
  376. X        if ( ht_delete( lh, ip ) != DICT_OK )
  377. X        {
  378. X            printf( "Delete failed\n" ) ;
  379. X            exit( 0 ) ;
  380. X        }
  381. X    
  382. X    for ( i = 0 ; i < N ; i++ )
  383. X        if ( ip = INTP( ht_search( lh, &nums[ i ] ) ) )
  384. X            printf( "%d found\n", nums[ i ] ) ;
  385. X        else
  386. X            printf( "%d not found\n", nums[ i ] ) ;
  387. X        
  388. X    ht_iterate( lh ) ;
  389. X    while ( ip = INTP( ht_nextobj( lh ) ) )
  390. X        printf( "Object = %d\n", *ip ) ;
  391. X    
  392. X    for ( ip = INTP(ht_minimum( lh )) ; ip ; ip = INTP(ht_successor( lh, ip )) )
  393. X        printf( "Object = %d\n", *ip ) ;
  394. X
  395. X    for ( ip=INTP(ht_maximum( lh )) ; ip ; ip=INTP(ht_predecessor( lh, ip )) )
  396. X        printf( "Object = %d\n", *ip ) ;
  397. X
  398. X    exit( 0 ) ;
  399. X}
  400. END_OF_FILE
  401. if test 1946 -ne `wc -c <'libs/src/dict/htest.c'`; then
  402.     echo shar: \"'libs/src/dict/htest.c'\" unpacked with wrong size!
  403. fi
  404. # end of 'libs/src/dict/htest.c'
  405. fi
  406. if test -f 'libs/src/dict/htimpl.h' -a "${1}" != "-c" ; then 
  407.   echo shar: Will not clobber existing file \"'libs/src/dict/htimpl.h'\"
  408. else
  409. echo shar: Extracting \"'libs/src/dict/htimpl.h'\" \(1838 characters\)
  410. sed "s/^X//" >'libs/src/dict/htimpl.h' <<'END_OF_FILE'
  411. X/*
  412. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  413. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  414. X * and conditions for redistribution.
  415. X */
  416. X
  417. X
  418. X/*
  419. X * $Id: htimpl.h,v 3.1 93/04/23 17:47:42 panos Exp $
  420. X */
  421. X
  422. X#include "dictimpl.h"
  423. X#include "ht.h"
  424. X
  425. X#include "fsma.h"
  426. X
  427. X
  428. X
  429. X/*
  430. X * The following definition is a little deceptive.
  431. X * The bucket really looks like this:
  432. X *
  433. X *        -------------
  434. X *   |    next     |
  435. X *   |-------------|
  436. X *   |             |
  437. X *   |    data     |
  438. X *   | (variable)  |
  439. X *   |   (size)    |
  440. X *   |             |
  441. X *   |             |
  442. X *   |             |
  443. X *   |_____________|
  444. X *
  445. X * This definition provides for the chain operations. 
  446. X */
  447. Xstruct bucket
  448. X{
  449. X    struct bucket *next ;
  450. X} ;
  451. X
  452. Xtypedef struct bucket bucket_s ;
  453. X
  454. X#define BP( p )                        ((bucket_s *)(p))
  455. X
  456. X#define BUCKET_NULL                    BP(0)
  457. X
  458. X#define BUCKET_OBJECTS( bp )        ((dict_obj *)(&((bucket_s *)(&(bp)->next))[1]))
  459. X
  460. X/*
  461. X * Defaults
  462. X */
  463. X#define DEFAULT_TABLE_ENTRIES       8191
  464. X#define DEFAULT_BUCKET_ENTRIES      15
  465. X
  466. X
  467. X
  468. Xstruct table_entry
  469. X{
  470. X    bucket_s        *head_bucket ;
  471. X    unsigned        n_free ;
  472. X} ;
  473. X
  474. Xtypedef struct table_entry tabent_s ;
  475. X
  476. X#define TEP( p )                            ((tabent_s *)(p))
  477. X
  478. X
  479. X#define ENTRY_HAS_CHAIN( tep )        ( (tep)->head_bucket != NULL )
  480. X#define ENTRY_IS_FULL( tep )            ( (tep)->n_free == 0 )
  481. X
  482. X
  483. Xstruct ht_iter
  484. X{
  485. X    int             current_table_entry ;
  486. X    bucket_s        *current_bucket ;
  487. X    int             next_bucket_offset ;
  488. X} ;
  489. X
  490. X
  491. X/*
  492. X * A hash table is implemented as an array of table entries, each
  493. X * pointing to a linked list of buckets containing the actual data
  494. X */
  495. Xstruct ht_header
  496. X{
  497. X    dheader_s                 dh ;
  498. X    fsma_h                     alloc ;
  499. X    struct table_entry    *table ;
  500. X    struct ht_args         args ;
  501. X    struct ht_iter         iter ;
  502. X} ;
  503. X
  504. Xtypedef struct ht_header header_s ;
  505. X
  506. X
  507. X#define HHP( p )                            ((header_s *)p)
  508. X#define DHP( hp )                            (&(hp->dh))
  509. X
  510. Xtypedef enum { KEY_SEARCH, OBJECT_SEARCH } search_e ;
  511. X
  512. END_OF_FILE
  513. if test 1838 -ne `wc -c <'libs/src/dict/htimpl.h'`; then
  514.     echo shar: \"'libs/src/dict/htimpl.h'\" unpacked with wrong size!
  515. fi
  516. # end of 'libs/src/dict/htimpl.h'
  517. fi
  518. if test -f 'libs/src/pq/hpq.h' -a "${1}" != "-c" ; then 
  519.   echo shar: Will not clobber existing file \"'libs/src/pq/hpq.h'\"
  520. else
  521. echo shar: Extracting \"'libs/src/pq/hpq.h'\" \(1635 characters\)
  522. sed "s/^X//" >'libs/src/pq/hpq.h' <<'END_OF_FILE'
  523. X/*
  524. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  525. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  526. X * and conditions for redistribution.
  527. X */
  528. X
  529. X#ifndef __HPQ_H
  530. X#define __HPQ_H
  531. X
  532. X/*
  533. X * $Id: hpq.h,v 1.2 1993/04/01 02:15:32 panos Exp $
  534. X */
  535. X
  536. X/*
  537. X * Implementation of the PQ interface
  538. X */
  539. X
  540. X#define pq_create                __hpq_create
  541. X#define pq_destroy            __hpq_destroy
  542. X#define pq_insert                __hpq_insert
  543. X#define pq_delete                __hpq_delete
  544. X#define pq_head                __hpq_head
  545. X#define pq_extract_head        __hpq_extract_head
  546. X
  547. X/*
  548. X * The is_better function takes 2 arguments which are pointers to objects
  549. X * and returns:
  550. X *       1     if the first object is "better" than the second
  551. X *       0     otherwise
  552. X */
  553. X
  554. Xstruct __hpq_header
  555. X{
  556. X    int (*is_better)() ;
  557. X    int *errnop ;
  558. X    int flags ;
  559. X    pq_obj *objects ;            /* array of objects */
  560. X    unsigned cur_size ;        /* # of objects in array */
  561. X    unsigned max_size ;        /* max # of objects that can fit in array */
  562. X} ;
  563. X
  564. X
  565. X#ifndef __ARGS
  566. X#  ifdef PROTOTYPES
  567. X#     define __ARGS( s )               s
  568. X#  else
  569. X#     define __ARGS( s )               ()
  570. X#  endif
  571. X#endif
  572. X
  573. Xpq_h __hpq_create            __ARGS( ( int (*func)(), int flags, int *errnop ) ) ;
  574. Xvoid __hpq_destroy        __ARGS( ( pq_h handle ) ) ;
  575. Xint  __hpq_insert            __ARGS( ( pq_h handle, pq_obj object ) ) ;
  576. Xpq_obj __hpq_extract_head __ARGS( ( pq_h handle ) ) ;
  577. Xint  __hpq_delete         __ARGS( ( pq_h handle, pq_obj object ) ) ;
  578. X
  579. X#define __hpq_head( handle )                                                                \
  580. X                (                                                                                    \
  581. X                    ((struct __hpq_header *)(handle))->cur_size                        \
  582. X                            ? ((struct __hpq_header *)(handle))->objects[ 0 ]         \
  583. X                            : (pq_obj) 0                                                        \
  584. X                )
  585. X
  586. X#endif __HPQ_H
  587. X
  588. END_OF_FILE
  589. if test 1635 -ne `wc -c <'libs/src/pq/hpq.h'`; then
  590.     echo shar: \"'libs/src/pq/hpq.h'\" unpacked with wrong size!
  591. fi
  592. # end of 'libs/src/pq/hpq.h'
  593. fi
  594. if test -f 'libs/src/pset/psi.3' -a "${1}" != "-c" ; then 
  595.   echo shar: Will not clobber existing file \"'libs/src/pset/psi.3'\"
  596. else
  597. echo shar: Extracting \"'libs/src/pset/psi.3'\" \(1810 characters\)
  598. sed "s/^X//" >'libs/src/pset/psi.3' <<'END_OF_FILE'
  599. X.\"(c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  600. X.\"All rights reserved.  The file named COPYRIGHT specifies the terms 
  601. X.\"and conditions for redistribution.
  602. X.\"
  603. X.\" $Id: psi.3,v 3.1 93/03/06 18:46:38 panos Exp $
  604. X.TH PSET 3X "25 September 1992"
  605. X.SH NAME
  606. Xpsi_create, psi_destroy, psi_reset, psi_start, psi_next, psi_remove - pointer set iterator functions
  607. X.SH SYNOPSIS
  608. X.LP
  609. X.nf
  610. X.ft B
  611. X#include "pset.h"
  612. X.LP
  613. X.ft B
  614. Xpsi_h psi_create( pset )
  615. Xpset_h pset ;
  616. X.LP
  617. X.ft B
  618. Xvoid psi_destroy( iter )
  619. Xpsi_h iter ;
  620. X.LP
  621. X.ft B
  622. Xvoid psi_reset( iter, pset )
  623. Xpsi_h iter ;
  624. Xpset_h pset ;
  625. X.LP
  626. X.ft B
  627. Xvoid *psi_start( iter )
  628. Xpsi_h iter ;
  629. X.LP
  630. X.ft B
  631. Xvoid *psi_next( iter )
  632. Xpsi_h iter ;
  633. X.LP
  634. X.ft B
  635. Xvoid psi_remove( iter )
  636. Xpsi_h iter ;
  637. X.SH DESCRIPTION
  638. XThese functions provide a means to iterate over psets (pointer sets).
  639. X.LP
  640. X.B psi_create()
  641. Xcreates an iterator. The only operation that should be applied to
  642. Xan iterator after it is created is
  643. X.B psi_start().
  644. X.LP
  645. X.B psi_destroy()
  646. Xdestroys the iterator.
  647. X.LP
  648. X.B psi_reset()
  649. Xchanges the pset that is being iterated to
  650. X.I pset.
  651. X.LP
  652. X.B psi_start()
  653. Xstarts an iteration and returns the first pointer
  654. Xin the pointer set.
  655. X.LP
  656. X.B psi_next()
  657. Xreturns the next pointer in the set.
  658. X.LP
  659. X.B psi_remove()
  660. Xremoves the current pointer from the set. The current pointer is
  661. Xthe one returned most recently from either
  662. X.B psi_start()
  663. Xor
  664. X.B psi_next().
  665. X.SH "RETURN VALUES"
  666. X.LP
  667. X.B psi_create()
  668. Xreturns an iterator handle on success or
  669. X.SM NULL
  670. Xon failure.
  671. X.LP
  672. X.B psi_start()
  673. Xreturns the first pointer from the set or
  674. X.SM NULL
  675. Xif the set is empty.
  676. X.LP
  677. X.B psi_next()
  678. Xreturns a pointer or
  679. X.SM NULL
  680. Xif the end of the set is reached.
  681. X.SH WARNINGS
  682. X.B psi_create()
  683. Xis the only function in this library. The rest of the interface is macros.
  684. X.LP
  685. XThis interface may be eliminated in a future release of the
  686. X.I pset
  687. Xlibrary.
  688. END_OF_FILE
  689. if test 1810 -ne `wc -c <'libs/src/pset/psi.3'`; then
  690.     echo shar: \"'libs/src/pset/psi.3'\" unpacked with wrong size!
  691. fi
  692. # end of 'libs/src/pset/psi.3'
  693. fi
  694. if test -f 'libs/src/sio/suite/README' -a "${1}" != "-c" ; then 
  695.   echo shar: Will not clobber existing file \"'libs/src/sio/suite/README'\"
  696. else
  697. echo shar: Extracting \"'libs/src/sio/suite/README'\" \(1753 characters\)
  698. sed "s/^X//" >'libs/src/sio/suite/README' <<'END_OF_FILE'
  699. X
  700. XThe 'testlib' script will exercise most of the functions in the SIO
  701. Xlibrary.  It invokes the 'tester' script which does the real work.
  702. X'tester' is a Bourne shell script. However, it expects that the shell
  703. Xsupports functions and /bin/sh does not support functions on all
  704. Xoperating systems. Therefore, 'testlib' decides what shell to use to
  705. Xexecute 'tester'. On Suns, it uses /bin/sh. On DECstations, it uses
  706. X/usr/bin/ksh. The decision is made by checking the ARCH environment
  707. Xvariable.
  708. X
  709. XExercising some of the SIO functions in an automatic fashion is a
  710. Xdifficult task, so you will have to do it manually by visually
  711. Xinspecting the results of programs that exercise them.  The following
  712. Xis a list of functions and programs testing them (with a description of
  713. Xthe expected behavior):
  714. X
  715. X1. Sbuftype
  716. X
  717. X    PROGRAM: buftest.c
  718. X    DESCRIPTION:
  719. X        This program prints two groups of lines. The first group is printed
  720. X        using line-buffering while the second group is printed using
  721. X        full-buffering.
  722. X        The first group of lines should appear one line at a time every
  723. X        3 seconds. The second group of lines should appear all lines together
  724. X        after about 10 seconds.
  725. X
  726. X2. Stie, Suntie
  727. X    
  728. X    PROGRAM: tietest.c
  729. X    DESCRIPTION:
  730. X        This program ties stdin to stdout and then prompts for input.
  731. X        The prompts do *not* include a NEWLINE. Since the stdout is
  732. X        *line buffered* when connected to a terminal, the Stie call
  733. X        is what causes the prompt to appear.
  734. X        The first 2 prompts happen with tied stdin, stdout. For the
  735. X        3rd prompt, stdin is untied from stdout. This will cause
  736. X        the prompt to appear *after* you type something and hit RETURN.
  737. X
  738. X
  739. X
  740. XPS. If you can make testing of these functions automatic, please send
  741. X     me your code so that I can include in a future SIO distribution.
  742. X
  743. END_OF_FILE
  744. if test 1753 -ne `wc -c <'libs/src/sio/suite/README'`; then
  745.     echo shar: \"'libs/src/sio/suite/README'\" unpacked with wrong size!
  746. fi
  747. # end of 'libs/src/sio/suite/README'
  748. fi
  749. if test -f 'libs/src/str/ss_bmh.c' -a "${1}" != "-c" ; then 
  750.   echo shar: Will not clobber existing file \"'libs/src/str/ss_bmh.c'\"
  751. else
  752. echo shar: Extracting \"'libs/src/str/ss_bmh.c'\" \(1721 characters\)
  753. sed "s/^X//" >'libs/src/str/ss_bmh.c' <<'END_OF_FILE'
  754. X/*
  755. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  756. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  757. X * and conditions for redistribution.
  758. X */
  759. X
  760. Xstatic char RCSid[] = "$Id" ;
  761. X
  762. Xchar *malloc() ;
  763. X
  764. X#include "ss_impl.h"
  765. X
  766. XPRIVATE int bmh_setup() ;
  767. XPRIVATE char *bmh_match() ;
  768. XPRIVATE void bmh_done() ;
  769. X
  770. Xstruct ss_ops __strs_bmhops = { bmh_setup, bmh_match, bmh_done } ;
  771. X
  772. X
  773. XPRIVATE int bmh_setup( hp )
  774. X    header_s *hp ;
  775. X{
  776. X    register int    patlen    = SS_PATLEN( hp ) ;
  777. X    register int    limit        = patlen - 1 ;            /* patlen is > 0 */
  778. X    register char    *pattern = SS_PATTERN( hp ) ;
  779. X    register int    i ;
  780. X    shift_int        *shift ;
  781. X
  782. X    shift = (shift_int *) malloc( ALPHABET_SIZE * sizeof( shift_int ) ) ;
  783. X    if ( shift == (shift_int *)NULL )
  784. X        return( SS_ERR ) ;
  785. X
  786. X    for ( i = 0 ; i < ALPHABET_SIZE ; i++ )
  787. X        shift[ i ] = patlen ;
  788. X    
  789. X    for ( i = 0 ; i < limit ; i++ )
  790. X        shift[ (unsigned char) pattern[ i ] ] = limit - i ;
  791. X
  792. X    BMH_HEADER( hp )->shift = shift ;
  793. X    return( SS_OK ) ;
  794. X}
  795. X
  796. X
  797. XPRIVATE char *bmh_match( hp, str, len )
  798. X    header_s            *hp ;
  799. X    register char    *str ;
  800. X    int                len ;
  801. X{
  802. X    register int    i ;
  803. X    int                patlen    = SS_PATLEN( hp ) ;
  804. X    char                *pattern = SS_PATTERN( hp ) ;
  805. X    register char    lpc        = pattern[ patlen-1 ] ;    /* last pattern character */
  806. X    shift_int        *shift    = BMH_HEADER( hp )->shift ;
  807. X
  808. X    i = patlen - 1 ;
  809. X    while ( i < len )
  810. X    {
  811. X        char c = SS_MAP( hp, str[ i ] ) ;
  812. X
  813. X        if ( c == lpc )
  814. X        {
  815. X            int j, k ;
  816. X
  817. X            for ( j = patlen-1, k = i ;; )
  818. X            {
  819. X                if ( j == 0 )
  820. X                    return( &str[ k ] ) ;
  821. X                j--, k-- ;
  822. X                if ( pattern[ j ] != SS_MAP( hp, str[ k ] ) )
  823. X                    break ;
  824. X            }
  825. X        }
  826. X        i += shift[ (unsigned char) c ] ;
  827. X    }
  828. X    return( CHAR_NULL ) ;
  829. X}
  830. X
  831. X
  832. XPRIVATE void bmh_done( hp )
  833. X    header_s *hp ;
  834. X{
  835. X    (void) free( (char *)BMH_HEADER( hp )->shift ) ;
  836. X}
  837. X
  838. END_OF_FILE
  839. if test 1721 -ne `wc -c <'libs/src/str/ss_bmh.c'`; then
  840.     echo shar: \"'libs/src/str/ss_bmh.c'\" unpacked with wrong size!
  841. fi
  842. # end of 'libs/src/str/ss_bmh.c'
  843. fi
  844. if test -f 'libs/src/str/ss_sbm.c' -a "${1}" != "-c" ; then 
  845.   echo shar: Will not clobber existing file \"'libs/src/str/ss_sbm.c'\"
  846. else
  847. echo shar: Extracting \"'libs/src/str/ss_sbm.c'\" \(1825 characters\)
  848. sed "s/^X//" >'libs/src/str/ss_sbm.c' <<'END_OF_FILE'
  849. X/*
  850. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  851. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  852. X * and conditions for redistribution.
  853. X */
  854. X
  855. Xstatic char RCSid[] = "$Id: ss_sbm.c,v 3.1 1993/06/13 02:45:45 panos Exp $" ;
  856. X
  857. Xchar *malloc() ;
  858. X
  859. X#include "ss_impl.h"
  860. X#include "ss_sbm.h"
  861. X
  862. XPRIVATE int sbm_setup() ;
  863. XPRIVATE char *sbm_match() ;
  864. XPRIVATE void sbm_done() ;
  865. X
  866. X
  867. Xstruct ss_ops __strs_sbmops = { sbm_setup, sbm_match, sbm_done } ;
  868. X
  869. X
  870. XPRIVATE int sbm_setup( hp )
  871. X    header_s *hp ;
  872. X{
  873. X    last_int            *last_occurrence ;
  874. X    register int    i ;
  875. X    int                patlen    = SS_PATLEN( hp ) ;
  876. X    char                *pattern = SS_PATTERN( hp ) ;
  877. X
  878. X    last_occurrence = (last_int *) malloc( ALPHABET_SIZE * sizeof( last_int ) ) ;
  879. X    if ( last_occurrence == (last_int *)0 )
  880. X        return( SS_ERR ) ;
  881. X    
  882. X    for ( i = 0 ; i < ALPHABET_SIZE ; i++ )
  883. X        last_occurrence[ i ] = -1 ;
  884. X    for ( i = 0 ; i < patlen ; i++ )
  885. X        last_occurrence[ (unsigned char) pattern[ i ] ] = i ;
  886. X
  887. X    SBM_HEADER( hp )->last_occurrence = last_occurrence ;
  888. X    return( SS_OK ) ;
  889. X}
  890. X
  891. X
  892. X
  893. XPRIVATE char *sbm_match( hp, str, len )
  894. X    header_s        *hp ;
  895. X    char            *str ;
  896. X    int            len ;
  897. X{
  898. X    register int    j ;
  899. X    register int    s                        = 0 ;
  900. X    char                *pattern                = SS_PATTERN( hp ) ;
  901. X    int                patlen                = SS_PATLEN( hp ) ;
  902. X    last_int            *last_occurrence    = SBM_HEADER( hp )->last_occurrence ;
  903. X
  904. X    while ( s <= len - patlen )
  905. X    {
  906. X        register char c ;
  907. X        last_int lo ;
  908. X
  909. X        /*
  910. X         * Try matching pattern right-to-left
  911. X         */
  912. X        for ( j = patlen-1 ;; )
  913. X        {
  914. X            c = SS_MAP( hp, str[ s+j ] ) ;
  915. X            if ( pattern[ j ] == c )
  916. X                if ( j )
  917. X                    j-- ;
  918. X                else
  919. X                    return( &str[ s ] ) ;
  920. X            else
  921. X                break ;
  922. X        }
  923. X        lo = last_occurrence[ (unsigned char) c ] ;
  924. X        if ( j > lo )
  925. X            s += j - lo ;
  926. X        else
  927. X            s++ ;
  928. X    }
  929. X    return( CHAR_NULL ) ;
  930. X}
  931. X
  932. X
  933. XPRIVATE void sbm_done( hp )
  934. X    header_s *hp ;
  935. X{
  936. X    (void) free( (char *) SBM_HEADER( hp )->last_occurrence ) ;
  937. X}
  938. X
  939. END_OF_FILE
  940. if test 1825 -ne `wc -c <'libs/src/str/ss_sbm.c'`; then
  941.     echo shar: \"'libs/src/str/ss_sbm.c'\" unpacked with wrong size!
  942. fi
  943. # end of 'libs/src/str/ss_sbm.c'
  944. fi
  945. if test -f 'libs/src/str/strparse.h' -a "${1}" != "-c" ; then 
  946.   echo shar: Will not clobber existing file \"'libs/src/str/strparse.h'\"
  947. else
  948. echo shar: Extracting \"'libs/src/str/strparse.h'\" \(1514 characters\)
  949. sed "s/^X//" >'libs/src/str/strparse.h' <<'END_OF_FILE'
  950. X/*
  951. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  952. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  953. X * and conditions for redistribution.
  954. X */
  955. X
  956. X
  957. X/*
  958. X * $Id: strparse.h,v 3.1 1993/06/13 02:48:35 panos Exp $
  959. X */
  960. X
  961. Xstruct str_handle
  962. X{
  963. X   char *string ;
  964. X   char *separator ;
  965. X   char *pos ;
  966. X   int flags ;
  967. X   int *errnop ;
  968. X   int no_more ;
  969. X} ;
  970. X
  971. Xint str_errno ;
  972. X
  973. X#ifndef NULL
  974. X#define NULL         0
  975. X#endif
  976. X
  977. X#ifndef FALSE
  978. X#define FALSE        0
  979. X#define TRUE         1
  980. X#endif
  981. X
  982. X#define PRIVATE        static
  983. X
  984. X#define TERMINATE( msg )   {                                         \
  985. X                              char *s = msg ;                        \
  986. X                                                                     \
  987. X                              (void) write( 2, s, strlen( s ) ) ;    \
  988. X                              (void) abort() ;                       \
  989. X                              _exit( 1 ) ;                           \
  990. X                              /* NOTREACHED */                       \
  991. X                           }
  992. X
  993. X
  994. X#define HANDLE_ERROR( flags, retval, errp, errval, msg )    \
  995. X            if ( flags & STR_RETURN_ERROR )                 \
  996. X            {                                               \
  997. X               *errp = errval ;                             \
  998. X               return( retval ) ;                           \
  999. X            }                                               \
  1000. X            else                                            \
  1001. X               TERMINATE( msg )
  1002. X
  1003. X
  1004. END_OF_FILE
  1005. if test 1514 -ne `wc -c <'libs/src/str/strparse.h'`; then
  1006.     echo shar: \"'libs/src/str/strparse.h'\" unpacked with wrong size!
  1007. fi
  1008. # end of 'libs/src/str/strparse.h'
  1009. fi
  1010. if test -f 'libs/src/str/strutil.3' -a "${1}" != "-c" ; then 
  1011.   echo shar: Will not clobber existing file \"'libs/src/str/strutil.3'\"
  1012. else
  1013. echo shar: Extracting \"'libs/src/str/strutil.3'\" \(1367 characters\)
  1014. sed "s/^X//" >'libs/src/str/strutil.3' <<'END_OF_FILE'
  1015. X.\"(c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  1016. X.\"All rights reserved.  The file named COPYRIGHT specifies the terms 
  1017. X.\"and conditions for redistribution.
  1018. X.\"
  1019. X.\" $Id: strutil.3,v 3.1 1993/06/13 02:49:23 panos Exp $
  1020. X.TH STRUTIL 3X "30 September 1992"
  1021. X.SH NAME
  1022. Xstr_find, str_casefind, str_fill, str_lower, str_upper -- string utility functions
  1023. X.SH SYNOPSIS
  1024. X.LP
  1025. X.nf
  1026. X.ft B
  1027. X#include "str.h"
  1028. X.LP
  1029. X.ft B
  1030. Xchar *str_find( s1, s2 )
  1031. Xchar *s1, *s2 ;
  1032. X.LP
  1033. X.ft B
  1034. Xchar *str_casefind( s1, s2 )
  1035. Xchar *s1, *s2 ;
  1036. X.LP
  1037. X.ft B
  1038. Xvoid str_fill( s, c )
  1039. Xchar *s ;
  1040. Xchar c ;
  1041. X.LP
  1042. X.ft B
  1043. Xchar *str_lower( s )
  1044. Xchar *s ;
  1045. X.LP
  1046. X.ft B
  1047. Xchar *str_upper( s )
  1048. Xchar *s ;
  1049. X.SH DESCRIPTION
  1050. X.B str_find()
  1051. Xreturns a pointer to the first instance of string \fIs2\fR in string \fIs1\fR.
  1052. XIf \fIs2\fR is the empty string a pointer to \fIs1\fR is returned.
  1053. X.LP
  1054. X.B str_casefind()
  1055. Xperforms the same function as
  1056. X.B str_find()
  1057. Xexcept that it performs case insensitive character comparisons.
  1058. X.LP
  1059. X.B str_fill()
  1060. Xfills the string \fIs\fR with the character \fIc\fR.
  1061. X.LP
  1062. X.B str_lower()
  1063. Xand
  1064. X.B str_upper()
  1065. Xconvert their argument in place to a lower or upper case string respectively.
  1066. X.SH "RETURN VALUES"
  1067. X.LP
  1068. X\fBstr_find()\fR 
  1069. Xand
  1070. X.B str_casefind()
  1071. Xreturn a pointer to the first occurrence of \fIs2\fR
  1072. Xin \fIs1\fR or
  1073. X.SM NULL
  1074. Xif \fIs2\fR does not exist in \fIs1\fR.
  1075. X.LP
  1076. X\fBstr_lower()\fR and \fBstr_upper()\fR return \fIs\fR.
  1077. END_OF_FILE
  1078. if test 1367 -ne `wc -c <'libs/src/str/strutil.3'`; then
  1079.     echo shar: \"'libs/src/str/strutil.3'\" unpacked with wrong size!
  1080. fi
  1081. # end of 'libs/src/str/strutil.3'
  1082. fi
  1083. if test -f 'libs/src/timer/impl.h' -a "${1}" != "-c" ; then 
  1084.   echo shar: Will not clobber existing file \"'libs/src/timer/impl.h'\"
  1085. else
  1086. echo shar: Extracting \"'libs/src/timer/impl.h'\" \(1736 characters\)
  1087. sed "s/^X//" >'libs/src/timer/impl.h' <<'END_OF_FILE'
  1088. X/*
  1089. X * (c) Copyright 1993 by Panagiotis Tsirigotis
  1090. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  1091. X * and conditions for redistribution.
  1092. X */
  1093. X
  1094. X#ifndef IMPL_H
  1095. X#define IMPL_H
  1096. X
  1097. X/*
  1098. X * $Id: impl.h,v 5.1 93/11/26 12:07:39 panos Exp $
  1099. X */
  1100. X
  1101. X#include <sys/time.h>
  1102. X#include <setjmp.h>
  1103. X
  1104. X#include "pq.h"
  1105. X#include "timer.h"
  1106. X#include "ostimer.h"
  1107. X
  1108. Xenum timer_state { INACTIVE, TICKING, DESTROYED } ;  
  1109. Xenum action_state { IDLE, PENDING, SCHEDULED, INVOKED } ;
  1110. X
  1111. X
  1112. Xstruct timer
  1113. X{
  1114. X    enum timer_state         t_state ;
  1115. X    enum action_state     t_act ;
  1116. X    int                        t_blocked ;
  1117. X
  1118. X    int                         t_flags ;
  1119. X    int                        *t_errnop ;
  1120. X    struct os_timer        *t_ostimer ;
  1121. X    struct timer_action    t_action ;
  1122. X
  1123. X    /*
  1124. X     * The following fields are managed by the ostimer code.
  1125. X     * t_expiration is the (absolute) time when the timer will expire.
  1126. X     * t_interval is the repeat interval for the timer.
  1127. X     * t_expirations is the number of expirations of the timer when
  1128. X     * the function associated with the timer is invoked.
  1129. X     * t_count is the number of times that the timer has expired before
  1130. X     * the function was invoked.
  1131. X     */
  1132. X    struct timeval            t_expiration ;
  1133. X    struct timeval            t_interval ;
  1134. X    unsigned                    t_count ;
  1135. X    unsigned                    t_expirations ;
  1136. X} ;
  1137. X
  1138. Xtypedef struct timer timer_s ;
  1139. X
  1140. X#define TP( p )                ( (struct timer *) (p) )
  1141. X
  1142. Xchar *malloc() ;
  1143. X
  1144. X#define TIMER_ALLOC()        TP( malloc( sizeof( timer_s ) ) )
  1145. X#define TIMER_FREE( tp )    (void) free( (char *)(tp) )
  1146. X
  1147. X/*
  1148. X * The following are masks for the expected flags of timer_create and
  1149. X * timer_start
  1150. X */
  1151. X#define TIMER_CREATE_FLAGS        TIMER_RETURN_ERROR
  1152. X#define TIMER_START_FLAGS        \
  1153. X            ( TIMER_INC_VAR + TIMER_BLOCK_SAME + TIMER_BLOCK_ALL + TIMER_LONGJMP )
  1154. X
  1155. X
  1156. Xenum timer_state __timer_invoke() ;
  1157. Xvoid __timer_terminate() ;
  1158. X
  1159. X#endif    /* IMPL_H */
  1160. X
  1161. END_OF_FILE
  1162. if test 1736 -ne `wc -c <'libs/src/timer/impl.h'`; then
  1163.     echo shar: \"'libs/src/timer/impl.h'\" unpacked with wrong size!
  1164. fi
  1165. # end of 'libs/src/timer/impl.h'
  1166. fi
  1167. if test -f 'libs/src/xlog/xlog.h' -a "${1}" != "-c" ; then 
  1168.   echo shar: Will not clobber existing file \"'libs/src/xlog/xlog.h'\"
  1169. else
  1170. echo shar: Extracting \"'libs/src/xlog/xlog.h'\" \(1967 characters\)
  1171. sed "s/^X//" >'libs/src/xlog/xlog.h' <<'END_OF_FILE'
  1172. X/*
  1173. X * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis
  1174. X * All rights reserved.  The file named COPYRIGHT specifies the terms 
  1175. X * and conditions for redistribution.
  1176. X */
  1177. X
  1178. X#ifndef __XLOG_H
  1179. X#define __XLOG_H
  1180. X
  1181. X/*
  1182. X * $Id: xlog.h,v 2.2 1993/06/15 18:07:48 panos Exp $
  1183. X */
  1184. X
  1185. X/*
  1186. X * Flags
  1187. X */
  1188. X#define XLOG_NOFLAGS                    0x0
  1189. X#define XLOG_SET_LEVEL                0x1
  1190. X#define XLOG_NO_SIZECHECK            0x2
  1191. X#define XLOG_NO_ERRNO                0x4
  1192. X/* #define XLOG_PRINT_TIMESTAMP        0x8 */
  1193. X#define XLOG_PRINT_ID                0x10
  1194. X#define XLOG_PRINT_PID                0x20
  1195. X
  1196. X/*
  1197. X * Errors
  1198. X */
  1199. X#define XLOG_ENOERROR                0
  1200. X#define XLOG_ESIZE                    1
  1201. X#define XLOG_EOPEN                    2
  1202. X#define XLOG_EFSTAT                    3
  1203. X#define XLOG_ENOMEM                    4
  1204. X#define XLOG_EBADOP                    5
  1205. X
  1206. X/*
  1207. X * Interface
  1208. X */
  1209. X
  1210. X#ifdef __ARGS
  1211. X#undef __ARGS
  1212. X#endif
  1213. X
  1214. X#ifdef PROTOTYPES
  1215. X#  define __ARGS( s )               s
  1216. X#else
  1217. X#  define __ARGS( s )               ()
  1218. X#endif
  1219. X
  1220. Xtypedef enum { XLOG_SYSLOG, XLOG_FILELOG } xlog_e ;
  1221. X
  1222. Xtypedef enum
  1223. X    {
  1224. X        XLOG_LINK,                /* generic: link this log to another log             */
  1225. X        XLOG_CALLBACK,            /* generic: call this function in case of error */
  1226. X        XLOG_GETFLAG,            /* generic:    get value of specified flag            */
  1227. X        XLOG_SETFLAG,            /* generic:    set value of specified flag            */
  1228. X        XLOG_LEVEL,                /* syslog:  set the default syslog level            */
  1229. X        XLOG_FACILITY,            /* syslog:  set the default syslog facility        */
  1230. X        XLOG_PREEXEC,            /* syslog:    prepare the log for an exec(2)        */
  1231. X        XLOG_POSTEXEC,            /* syslog:    exec(2) failed                                */
  1232. X        XLOG_SIZECHECK,        /* filelog: check file size                             */
  1233. X        XLOG_GETFD,                /* filelog: get file descriptor of log file        */
  1234. X        XLOG_LIMITS             /* filelog: set (new) soft/hard limits                */
  1235. X    } xlog_cmd_e ;
  1236. X
  1237. Xtypedef void *xlog_h ;
  1238. X
  1239. Xxlog_h xlog_create    __ARGS( ( xlog_e type, char *id, int flags, ... ) ) ;
  1240. Xvoid xlog_destroy        __ARGS( ( xlog_h ) ) ;
  1241. Xvoid xlog_write        __ARGS( ( xlog_h, char *buf, int len, int flags, ... ) ) ;
  1242. Xint xlog_control        __ARGS( ( xlog_h, xlog_cmd_e, ... ) ) ;
  1243. Xint xlog_parms            __ARGS( ( xlog_e type, ... ) ) ;
  1244. X
  1245. X#endif    /* __XLOG_H */
  1246. END_OF_FILE
  1247. if test 1967 -ne `wc -c <'libs/src/xlog/xlog.h'`; then
  1248.     echo shar: \"'libs/src/xlog/xlog.h'\" unpacked with wrong size!
  1249. fi
  1250. # end of 'libs/src/xlog/xlog.h'
  1251. fi
  1252. if test -f 'sysinc' -a "${1}" != "-c" ; then 
  1253.   echo shar: Will not clobber existing file \"'sysinc'\"
  1254. else
  1255. echo shar: Extracting \"'sysinc'\" \(1499 characters\)
  1256. sed "s/^X//" >'sysinc' <<'END_OF_FILE'
  1257. X#!/bin/sh
  1258. X
  1259. X#
  1260. X# Copyright (c) 1993 by Panagiotis Tsirigotis
  1261. X#
  1262. X
  1263. X#
  1264. X# $Id: sysinc,v 1.3 1993/10/27 17:06:11 panos Exp panos $
  1265. X#
  1266. X
  1267. X#
  1268. X# Usage: sysinc -d clone_dir *.[ch]
  1269. X#
  1270. X
  1271. Xscript_name=`basename $0`
  1272. Xusage="Usage: $script_name [-d clone_dir] *.[ch]"
  1273. X
  1274. Xif test $# -eq 0 ; then echo "$usage" ; exit ; fi
  1275. X
  1276. Xif test "X$1" = "X-d" ; then 
  1277. X    shift
  1278. X    if test $# -eq 0 ; then echo "$usage" ; exit ; fi
  1279. X    clone_dir=$1
  1280. X    shift
  1281. Xfi
  1282. X
  1283. Xprefix=/tmp/si
  1284. Xsuffix=$$
  1285. X
  1286. Xunique_names=$prefix.uniq.$suffix
  1287. Xdir_names=$prefix.dir.$suffix
  1288. X
  1289. Xfiles="$*"
  1290. X
  1291. X#
  1292. X# Step 1: find names of all system include files
  1293. X#
  1294. Xawk '/^#include/ { if ( substr( $2, 1, 1 ) == "<" ) print substr( $2, 2, length( $2 ) - 2 ) }' $files | sort | uniq > $unique_names
  1295. X
  1296. Xuniq_names=`cat $unique_names`
  1297. Xrm $unique_names
  1298. X
  1299. Xif test "$clone_dir" = "" ; then
  1300. X    echo "$uniq_names"
  1301. X    exit
  1302. Xfi
  1303. X
  1304. X#
  1305. X# Step 2: Find names of subdirectories (we assume that all include files
  1306. X#             are specified as relative pathnames)
  1307. X#
  1308. Xrm -f $dir_names
  1309. Xfor i in $uniq_names
  1310. Xdo
  1311. X    path=$i
  1312. X    dir=`expr "$path" : "\(.*\)/.*"`
  1313. X    if test "$dir" ; then echo $dir >> $dir_names ; fi
  1314. Xdone
  1315. X
  1316. Xuniq_dirs=`sort $dir_names | uniq`
  1317. Xrm $dir_names
  1318. X
  1319. X#
  1320. X# Step 3: Create clone tree
  1321. X#
  1322. Xmkdir $clone_dir
  1323. X( cd $clone_dir ; mkdir $uniq_dirs )
  1324. X
  1325. Xstd_dir=/usr/include
  1326. X
  1327. Xfor i in $uniq_names
  1328. Xdo
  1329. X    v=_XX_`echo $i | sed 's/\//_/g' | sed 's/\./_/' `
  1330. X    file=$clone_dir/$i
  1331. X    echo > $file
  1332. X    echo "#ifndef $v" >> $file
  1333. X    echo "#define $v" >> $file
  1334. X    if test -f $std_dir/$i ; then
  1335. X        echo "#include <$std_dir/$i>" >> $file
  1336. X    fi
  1337. X    echo "#endif" >> $file
  1338. Xdone
  1339. X
  1340. END_OF_FILE
  1341. if test 1499 -ne `wc -c <'sysinc'`; then
  1342.     echo shar: \"'sysinc'\" unpacked with wrong size!
  1343. fi
  1344. chmod +x 'sysinc'
  1345. # end of 'sysinc'
  1346. fi
  1347. echo shar: End of archive 3 \(of 20\).
  1348. cp /dev/null ark3isdone
  1349. MISSING=""
  1350. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do
  1351.     if test ! -f ark${I}isdone ; then
  1352.     MISSING="${MISSING} ${I}"
  1353.     fi
  1354. done
  1355. if test "${MISSING}" = "" ; then
  1356.     echo You have unpacked all 20 archives.
  1357.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1358. else
  1359.     echo You still need to unpack the following archives:
  1360.     echo "        " ${MISSING}
  1361. fi
  1362. ##  End of shell archive.
  1363. exit 0
  1364.