home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2614 < prev    next >
Encoding:
Internet Message Format  |  1991-01-26  |  23.5 KB

  1. From: pgd@bbt.se
  2. Newsgroups: alt.sources
  3. Subject: Xenixshlib - Shared libraries for xenix (part 3 of 3)
  4. Message-ID: <1991Jan25.145717.25674@bbt.se>
  5. Date: 25 Jan 91 14:57:17 GMT
  6.  
  7. ---- Cut Here and unpack ----
  8. #!/bin/sh
  9. # This is part 03 of Xenixshlib
  10. if touch 2>&1 | fgrep 'amc' > /dev/null
  11.  then TOUCH=touch
  12.  else TOUCH=true
  13. fi
  14. # ============= xcc.c ==============
  15. echo "x - extracting xcc.c (Text)"
  16. sed 's/^X//' << 'SHAR_EOF' > xcc.c &&
  17. X#include <stdio.h>
  18. X
  19. X#define    MAXARGS    100
  20. X
  21. Xchar *output, **outp;
  22. Xint coffflag;
  23. Xint vflag;
  24. Xint sflag;
  25. X
  26. Xchar *args[MAXARGS];
  27. Xint argcnt;
  28. X
  29. X
  30. X
  31. Xmain(argc, argv)
  32. X    int argc;
  33. X    char **argv;
  34. X{
  35. X    int i, s;
  36. X
  37. X    for (i = 0; i < argc; i++) {
  38. X        if (argv[i][0] == '-') {
  39. X            switch (argv[i][1]) {
  40. X            case 'o':
  41. X                output = argv[++i];
  42. X                outp = &argv[i];
  43. X                break;
  44. X            case 'L':
  45. X                argv[i][1] = 'l';
  46. X                coffflag = 1;
  47. X                break;
  48. X            case 'v':
  49. X                vflag = 1;
  50. X                break;
  51. X            case 's':
  52. X                sflag = 1;
  53. X                break;
  54. X            }
  55. X        }
  56. X    }
  57. X    if (coffflag) {
  58. X        *outp = "a.out";
  59. X        args[0] = "gcc";
  60. X        args[1] = "-nostdlib";
  61. X        args[2] = "/lib/386/Scrt0_s.o";
  62. X        args[3] = "/lib/386/Sseg.o";
  63. X        argcnt = 4;
  64. X        for (i = 1; i < argc; i++) {
  65. X            if (argv[i][0] == '-') {
  66. X                switch (argv[i][1]) {
  67. X                case 's':
  68. X                    continue;
  69. X                }
  70. X            }
  71. X            args[argcnt++] = argv[i];
  72. X        }
  73. X        args[argcnt++] = NULL;
  74. X        if (vflag) {
  75. X            for (i = 0; args[i]; i++)
  76. X                printf("%s ", args[i]);
  77. X            putchar('\n');
  78. X            fflush(stdout);
  79. X        }
  80. X        if (fork() == 0) {
  81. X            execvp("gcc", args);
  82. X            perror("exec error");
  83. X            exit(1);
  84. X        }
  85. X        if (wait(&s) == -1 || s != 0)
  86. X            exit(s);
  87. X        if (vflag) {
  88. X            printf("convcoff a.out %s\n", output);
  89. X            fflush(stdout);
  90. X        }
  91. X        if (sflag)
  92. X            s = execlp("convcoff", "convcoff", "-s", "a.out", output, NULL);
  93. X        else
  94. X            s = execlp("convcoff", "convcoff", "a.out", output, NULL);
  95. X    } else {
  96. X        argv[0] = "gcc";
  97. X        if (vflag) {
  98. X            for (i = 0; argv[i]; i++)
  99. X                printf("%s ", argv[i]);
  100. X            putchar('\n');
  101. X            fflush(stdout);
  102. X        }
  103. X        execvp("gcc", argv);
  104. X        perror("exec error");
  105. X    }
  106. X    exit(s);
  107. X}
  108. SHAR_EOF
  109. $TOUCH -am 0118092191 xcc.c &&
  110. chmod 0660 xcc.c ||
  111. echo "restore of xcc.c failed"
  112. set `wc -c xcc.c`;Wc_c=$1
  113. if test "$Wc_c" != "1516"; then
  114.     echo original size 1516, current size $Wc_c
  115. fi
  116. # ============= coffstrip.c ==============
  117. echo "x - extracting coffstrip.c (Text)"
  118. sed 's/^X//' << 'SHAR_EOF' > coffstrip.c &&
  119. X/*
  120. X * coff strip utility
  121. X */
  122. X
  123. X#include <stdio.h>
  124. X#include <sys/types.h>
  125. X#include <sys/fcntl.h>
  126. X#include <sys/coff.h>
  127. X
  128. Xstruct filehdr fhdr;
  129. Xstruct scnhdr shdr;
  130. Xint nsyms;
  131. Xlong symptr;
  132. X
  133. X
  134. Xmain(argc, argv)
  135. X    int argc;
  136. X    char **argv;
  137. X{
  138. X    char *fname, **argp;
  139. X    int fd, n;
  140. X    char buf[80];
  141. X
  142. X    for (argp = argv; fname = *++argp; ) {
  143. X        fd = open(fname, O_RDWR);
  144. X        if (fd == -1) {
  145. X            perror(fname); continue;
  146. X        }
  147. X        n = read(fd, (char *)&fhdr, sizeof fhdr);
  148. X        if (fhdr.f_magic != I386MAGIC || n != sizeof fhdr) {
  149. X            close(fd);
  150. X            sprintf(buf, "strip %s\n", fname);
  151. X            if (system(buf) == -1)
  152. X                perror(fname);
  153. X            continue;
  154. X        }
  155. X        if (fhdr.f_nsyms == 0) {
  156. X            fprintf(stderr, "%s: already stripped\n", fname);
  157. X            close(fd);
  158. X            continue;
  159. X        }
  160. X        if (chsize(fd, (long)fhdr.f_symptr) == -1)
  161. X            perror(fname);
  162. X        else {
  163. X            fhdr.f_nsyms = 0;
  164. X            fhdr.f_flags |= F_LNNO|F_LSYMS;
  165. X            lseek(fd, 0L, 0);
  166. X            n = write(fd, (char *)&fhdr, sizeof fhdr);
  167. X            if (n != sizeof fhdr)
  168. X                perror(fname);
  169. X        }
  170. X        close(fd);
  171. X    }
  172. X    exit(0);
  173. X}
  174. X
  175. SHAR_EOF
  176. $TOUCH -am 0118145291 coffstrip.c &&
  177. chmod 0660 coffstrip.c ||
  178. echo "restore of coffstrip.c failed"
  179. set `wc -c coffstrip.c`;Wc_c=$1
  180. if test "$Wc_c" != "993"; then
  181.     echo original size 993, current size $Wc_c
  182. fi
  183. # ============= malloc.c ==============
  184. echo "x - extracting malloc.c (Text)"
  185. sed 's/^X//' << 'SHAR_EOF' > malloc.c &&
  186. X/*
  187. X * Copyright (c) 1983 Regents of the University of California.
  188. X * All rights reserved.
  189. X *
  190. X * Redistribution and use in source and binary forms are permitted
  191. X * provided that: (1) source distributions retain this entire copyright
  192. X * notice and comment, and (2) distributions including binaries display
  193. X * the following acknowledgement:  ``This product includes software
  194. X * developed by the University of California, Berkeley and its contributors''
  195. X * in the documentation or other materials provided with the distribution
  196. X * and in all advertising materials mentioning features or use of this
  197. X * software. Neither the name of the University nor the names of its
  198. X * contributors may be used to endorse or promote products derived
  199. X * from this software without specific prior written permission.
  200. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  201. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  202. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  203. X */
  204. X
  205. X#if defined(LIBC_SCCS) && !defined(lint)
  206. Xstatic char sccsid[] = "@(#)malloc.c    5.9 (Berkeley) 6/1/90";
  207. X#endif /* LIBC_SCCS and not lint */
  208. X
  209. X/*
  210. X * malloc.c (Caltech) 2/21/82
  211. X * Chris Kingsley, kingsley@cit-20.
  212. X *
  213. X * This is a very fast storage allocator.  It allocates blocks of a small 
  214. X * number of different sizes, and keeps free lists of each size.  Blocks that
  215. X * don't exactly fit are passed up to the next larger size.  In this 
  216. X * implementation, the available sizes are 2^n-4 (or 2^n-10) bytes long.
  217. X * This is designed for use in a virtual memory environment.
  218. X */
  219. X
  220. X#include <sys/types.h>
  221. X#ifdef M_XENIX
  222. X#include <sys/param.h>
  223. X#include <sys/sysmacros.h>
  224. X#include <sys/page.h>
  225. X#define    u_char    uchar_t
  226. X#define    u_int    uint
  227. X#define    getpagesize()    PGSIZE
  228. X#define    bcopy(S, D, L)    memcpy(D, S, L)
  229. X#endif
  230. X
  231. X#define    NULL 0
  232. X
  233. X/*
  234. X * The overhead on a block is at least 4 bytes.  When free, this space
  235. X * contains a pointer to the next free block, and the bottom two bits must
  236. X * be zero.  When in use, the first byte is set to MAGIC, and the second
  237. X * byte is the size index.  The remaining bytes are for alignment.
  238. X * If range checking is enabled then a second word holds the size of the
  239. X * requested block, less 1, rounded up to a multiple of sizeof(RMAGIC).
  240. X * The order of elements is critical: ov_magic must overlay the low order
  241. X * bits of ov_next, and ov_magic can not be a valid ov_next bit pattern.
  242. X */
  243. Xunion    overhead {
  244. X    union    overhead *ov_next;    /* when free */
  245. X    struct {
  246. X        u_char    ovu_magic;    /* magic number */
  247. X        u_char    ovu_index;    /* bucket # */
  248. X#ifdef RCHECK
  249. X        u_short    ovu_rmagic;    /* range magic number */
  250. X        u_int    ovu_size;    /* actual block size */
  251. X#endif
  252. X    } ovu;
  253. X#define    ov_magic    ovu.ovu_magic
  254. X#define    ov_index    ovu.ovu_index
  255. X#define    ov_rmagic    ovu.ovu_rmagic
  256. X#define    ov_size        ovu.ovu_size
  257. X};
  258. X
  259. X#define    MAGIC        0xef        /* magic # on accounting info */
  260. X#define RMAGIC        0x5555        /* magic # on range info */
  261. X
  262. X#ifdef RCHECK
  263. X#define    RSLOP        sizeof (u_short)
  264. X#else
  265. X#define    RSLOP        0
  266. X#endif
  267. X
  268. X/*
  269. X * nextf[i] is the pointer to the next free block of size 2^(i+3).  The
  270. X * smallest allocatable block is 8 bytes.  The overhead information
  271. X * precedes the data area returned to the user.
  272. X */
  273. X#define    NBUCKETS 30
  274. Xstatic    union overhead *nextf[NBUCKETS];
  275. Xextern    char *sbrk();
  276. X
  277. Xstatic    int pagesz;            /* page size */
  278. Xstatic    int pagebucket;            /* page size bucket */
  279. X
  280. X#ifdef MSTATS
  281. X/*
  282. X * nmalloc[i] is the difference between the number of mallocs and frees
  283. X * for a given block size.
  284. X */
  285. Xstatic    u_int nmalloc[NBUCKETS];
  286. X#include <stdio.h>
  287. X#endif
  288. X
  289. X#if defined(DEBUG) || defined(RCHECK)
  290. X#define    ASSERT(p)   if (!(p)) botch("p")
  291. X#include <stdio.h>
  292. Xstatic
  293. Xbotch(s)
  294. X    char *s;
  295. X{
  296. X    fprintf(stderr, "\r\nassertion botched: %s\r\n", s);
  297. X     (void) fflush(stderr);        /* just in case user buffered it */
  298. X    abort();
  299. X}
  300. X#else
  301. X#define    ASSERT(p)
  302. X#endif
  303. X
  304. Xchar *
  305. Xmalloc(nbytes)
  306. X    unsigned nbytes;
  307. X{
  308. X      register union overhead *op;
  309. X      register int bucket, n;
  310. X    register unsigned amt;
  311. X
  312. X    /*
  313. X     * First time malloc is called, setup page size and
  314. X     * align break pointer so all data will be page aligned.
  315. X     */
  316. X    if (pagesz == 0) {
  317. X        pagesz = n = getpagesize();
  318. X        op = (union overhead *)sbrk(0);
  319. X          n = n - sizeof (*op) - ((int)op & (n - 1));
  320. X        if (n < 0)
  321. X            n += pagesz;
  322. X          if (n) {
  323. X              if (sbrk(n) == (char *)-1)
  324. X                return (NULL);
  325. X        }
  326. X        bucket = 0;
  327. X        amt = 8;
  328. X        while (pagesz > amt) {
  329. X            amt <<= 1;
  330. X            bucket++;
  331. X        }
  332. X        pagebucket = bucket;
  333. X    }
  334. X    /*
  335. X     * Convert amount of memory requested into closest block size
  336. X     * stored in hash buckets which satisfies request.
  337. X     * Account for space used per block for accounting.
  338. X     */
  339. X    if (nbytes <= (n = pagesz - sizeof (*op) - RSLOP)) {
  340. X#ifndef RCHECK
  341. X        amt = 8;    /* size of first bucket */
  342. X        bucket = 0;
  343. X#else
  344. X        amt = 16;    /* size of first bucket */
  345. X        bucket = 1;
  346. X#endif
  347. X        n = -(sizeof (*op) + RSLOP);
  348. X    } else {
  349. X        amt = pagesz;
  350. X        bucket = pagebucket;
  351. X    }
  352. X    while (nbytes > amt + n) {
  353. X        amt <<= 1;
  354. X        if (amt == 0)
  355. X            return (NULL);
  356. X        bucket++;
  357. X    }
  358. X    /*
  359. X     * If nothing in hash bucket right now,
  360. X     * request more memory from the system.
  361. X     */
  362. X      if ((op = nextf[bucket]) == NULL) {
  363. X          morecore(bucket);
  364. X          if ((op = nextf[bucket]) == NULL)
  365. X              return (NULL);
  366. X    }
  367. X    /* remove from linked list */
  368. X      nextf[bucket] = op->ov_next;
  369. X    op->ov_magic = MAGIC;
  370. X    op->ov_index = bucket;
  371. X#ifdef MSTATS
  372. X      nmalloc[bucket]++;
  373. X#endif
  374. X#ifdef RCHECK
  375. X    /*
  376. X     * Record allocated size of block and
  377. X     * bound space with magic numbers.
  378. X     */
  379. X    op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
  380. X    op->ov_rmagic = RMAGIC;
  381. X      *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
  382. X#endif
  383. X      return ((char *)(op + 1));
  384. X}
  385. X
  386. X/*
  387. X * Allocate more memory to the indicated bucket.
  388. X */
  389. Xmorecore(bucket)
  390. X    int bucket;
  391. X{
  392. X      register union overhead *op;
  393. X    register int sz;        /* size of desired block */
  394. X      int amt;            /* amount to allocate */
  395. X      int nblks;            /* how many blocks we get */
  396. X
  397. X    /*
  398. X     * sbrk_size <= 0 only for big, FLUFFY, requests (about
  399. X     * 2^30 bytes on a VAX, I think) or for a negative arg.
  400. X     */
  401. X    sz = 1 << (bucket + 3);
  402. X#ifdef DEBUG
  403. X    ASSERT(sz > 0);
  404. X#else
  405. X    if (sz <= 0)
  406. X        return;
  407. X#endif
  408. X    if (sz < pagesz) {
  409. X        amt = pagesz;
  410. X          nblks = amt / sz;
  411. X    } else {
  412. X        amt = sz + pagesz;
  413. X        nblks = 1;
  414. X    }
  415. X    op = (union overhead *)sbrk(amt);
  416. X    /* no more room! */
  417. X      if ((int)op == -1)
  418. X          return;
  419. X    /*
  420. X     * Add new memory allocated to that on
  421. X     * free list for this hash bucket.
  422. X     */
  423. X      nextf[bucket] = op;
  424. X      while (--nblks > 0) {
  425. X        op->ov_next = (union overhead *)((caddr_t)op + sz);
  426. X        op = (union overhead *)((caddr_t)op + sz);
  427. X      }
  428. X}
  429. X
  430. Xfree(cp)
  431. X    char *cp;
  432. X{   
  433. X      register int size;
  434. X    register union overhead *op;
  435. X
  436. X      if (cp == NULL)
  437. X          return;
  438. X    op = (union overhead *)((caddr_t)cp - sizeof (union overhead));
  439. X#ifdef DEBUG
  440. X      ASSERT(op->ov_magic == MAGIC);        /* make sure it was in use */
  441. X#else
  442. X    if (op->ov_magic != MAGIC)
  443. X        return;                /* sanity */
  444. X#endif
  445. X#ifdef RCHECK
  446. X      ASSERT(op->ov_rmagic == RMAGIC);
  447. X    ASSERT(*(u_short *)((caddr_t)(op + 1) + op->ov_size) == RMAGIC);
  448. X#endif
  449. X      size = op->ov_index;
  450. X      ASSERT(size < NBUCKETS);
  451. X    op->ov_next = nextf[size];    /* also clobbers ov_magic */
  452. X      nextf[size] = op;
  453. X#ifdef MSTATS
  454. X      nmalloc[size]--;
  455. X#endif
  456. X}
  457. X
  458. X/*
  459. X * When a program attempts "storage compaction" as mentioned in the
  460. X * old malloc man page, it realloc's an already freed block.  Usually
  461. X * this is the last block it freed; occasionally it might be farther
  462. X * back.  We have to search all the free lists for the block in order
  463. X * to determine its bucket: 1st we make one pass thru the lists
  464. X * checking only the first block in each; if that fails we search
  465. X * ``realloc_srchlen'' blocks in each list for a match (the variable
  466. X * is extern so the caller can modify it).  If that fails we just copy
  467. X * however many bytes was given to realloc() and hope it's not huge.
  468. X */
  469. Xint realloc_srchlen = 4;    /* 4 should be plenty, -1 =>'s whole list */
  470. X
  471. Xchar *
  472. Xrealloc(cp, nbytes)
  473. X    char *cp; 
  474. X    unsigned nbytes;
  475. X{   
  476. X      register u_int onb;
  477. X    register int i;
  478. X    union overhead *op;
  479. X      char *res;
  480. X    int was_alloced = 0;
  481. X
  482. X      if (cp == NULL)
  483. X          return (malloc(nbytes));
  484. X    op = (union overhead *)((caddr_t)cp - sizeof (union overhead));
  485. X    if (op->ov_magic == MAGIC) {
  486. X        was_alloced++;
  487. X        i = op->ov_index;
  488. X    } else {
  489. X        /*
  490. X         * Already free, doing "compaction".
  491. X         *
  492. X         * Search for the old block of memory on the
  493. X         * free list.  First, check the most common
  494. X         * case (last element free'd), then (this failing)
  495. X         * the last ``realloc_srchlen'' items free'd.
  496. X         * If all lookups fail, then assume the size of
  497. X         * the memory block being realloc'd is the
  498. X         * largest possible (so that all "nbytes" of new
  499. X         * memory are copied into).  Note that this could cause
  500. X         * a memory fault if the old area was tiny, and the moon
  501. X         * is gibbous.  However, that is very unlikely.
  502. X         */
  503. X        if ((i = findbucket(op, 1)) < 0 &&
  504. X            (i = findbucket(op, realloc_srchlen)) < 0)
  505. X            i = NBUCKETS;
  506. X    }
  507. X    onb = 1 << (i + 3);
  508. X    if (onb < pagesz)
  509. X        onb -= sizeof (*op) + RSLOP;
  510. X    else
  511. X        onb += pagesz - sizeof (*op) - RSLOP;
  512. X    /* avoid the copy if same size block */
  513. X    if (was_alloced) {
  514. X        if (i) {
  515. X            i = 1 << (i + 2);
  516. X            if (i < pagesz)
  517. X                i -= sizeof (*op) + RSLOP;
  518. X            else
  519. X                i += pagesz - sizeof (*op) - RSLOP;
  520. X        }
  521. X        if (nbytes <= onb && nbytes > i) {
  522. X#ifdef RCHECK
  523. X            op->ov_size = (nbytes + RSLOP - 1) & ~(RSLOP - 1);
  524. X            *(u_short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
  525. X#endif
  526. X            return(cp);
  527. X        } else
  528. X            free(cp);
  529. X    }
  530. X      if ((res = malloc(nbytes)) == NULL)
  531. X          return (NULL);
  532. X      if (cp != res)        /* common optimization if "compacting" */
  533. X        bcopy(cp, res, (nbytes < onb) ? nbytes : onb);
  534. X      return (res);
  535. X}
  536. X
  537. X/*
  538. X * Search ``srchlen'' elements of each free list for a block whose
  539. X * header starts at ``freep''.  If srchlen is -1 search the whole list.
  540. X * Return bucket number, or -1 if not found.
  541. X */
  542. Xstatic
  543. Xfindbucket(freep, srchlen)
  544. X    union overhead *freep;
  545. X    int srchlen;
  546. X{
  547. X    register union overhead *p;
  548. X    register int i, j;
  549. X
  550. X    for (i = 0; i < NBUCKETS; i++) {
  551. X        j = 0;
  552. X        for (p = nextf[i]; p && j != srchlen; p = p->ov_next) {
  553. X            if (p == freep)
  554. X                return (i);
  555. X            j++;
  556. X        }
  557. X    }
  558. X    return (-1);
  559. X}
  560. X
  561. X#ifdef MSTATS
  562. X/*
  563. X * mstats - print out statistics about malloc
  564. X * 
  565. X * Prints two lines of numbers, one showing the length of the free list
  566. X * for each size category, the second showing the number of mallocs -
  567. X * frees for each size category.
  568. X */
  569. Xmstats(s)
  570. X    char *s;
  571. X{
  572. X      register int i, j;
  573. X      register union overhead *p;
  574. X      int totfree = 0,
  575. X      totused = 0;
  576. X
  577. X      fprintf(stderr, "Memory allocation statistics %s\nfree:\t", s);
  578. X      for (i = 0; i < NBUCKETS; i++) {
  579. X          for (j = 0, p = nextf[i]; p; p = p->ov_next, j++)
  580. X              ;
  581. X          fprintf(stderr, " %d", j);
  582. X          totfree += j * (1 << (i + 3));
  583. X      }
  584. X      fprintf(stderr, "\nused:\t");
  585. X      for (i = 0; i < NBUCKETS; i++) {
  586. X          fprintf(stderr, " %d", nmalloc[i]);
  587. X          totused += nmalloc[i] * (1 << (i + 3));
  588. X      }
  589. X      fprintf(stderr, "\n\tTotal in use: %d, total free: %d\n",
  590. X        totused, totfree);
  591. X}
  592. X#endif
  593. X
  594. SHAR_EOF
  595. $TOUCH -am 0113162191 malloc.c &&
  596. chmod 0600 malloc.c ||
  597. echo "restore of malloc.c failed"
  598. set `wc -c malloc.c`;Wc_c=$1
  599. if test "$Wc_c" != "10837"; then
  600.     echo original size 10837, current size $Wc_c
  601. fi
  602. # ============= libX11_ver.c ==============
  603. echo "x - extracting libX11_ver.c (Text)"
  604. sed 's/^X//' << 'SHAR_EOF' > libX11_ver.c &&
  605. Xint libX11_version = VERSION;
  606. SHAR_EOF
  607. $TOUCH -am 0112133391 libX11_ver.c &&
  608. chmod 0660 libX11_ver.c ||
  609. echo "restore of libX11_ver.c failed"
  610. set `wc -c libX11_ver.c`;Wc_c=$1
  611. if test "$Wc_c" != "30"; then
  612.     echo original size 30, current size $Wc_c
  613. fi
  614. # ============= libXaw_s.c ==============
  615. echo "x - extracting libXaw_s.c (Text)"
  616. sed 's/^X//' << 'SHAR_EOF' > libXaw_s.c &&
  617. X/*
  618. X * Prefix file and jump table for Xaw shared library
  619. X *
  620. X * Author: P.Garbha pgd@compuram.bbt.se
  621. X */
  622. X
  623. X/*
  624. X * Identifier to autload library
  625. X */
  626. Xchar __SHLIB__libXaw_s;
  627. X
  628. X__JumpTabEnd()
  629. X{
  630. X}
  631. X
  632. Xextern void (*_shlib_exit)();
  633. X
  634. X/*
  635. X * exit routine to use from within library
  636. X */
  637. Xexit(status)
  638. X    int status;
  639. X{
  640. X    _shlib_exit(status);
  641. X}
  642. X
  643. SHAR_EOF
  644. $TOUCH -am 0116154591 libXaw_s.c &&
  645. chmod 0660 libXaw_s.c ||
  646. echo "restore of libXaw_s.c failed"
  647. set `wc -c libXaw_s.c`;Wc_c=$1
  648. if test "$Wc_c" != "323"; then
  649.     echo original size 323, current size $Wc_c
  650. fi
  651. # ============= xenix.cf ==============
  652. echo "x - extracting xenix.cf (Text)"
  653. sed 's/^X//' << 'SHAR_EOF' > xenix.cf &&
  654. X/*
  655. X * SET VERSION NUMBERS BEFORE MAKING MAKEFILES; also, you'll need to install
  656. X * util/scripts/bsdinstall.sh before doing a "make install"
  657. X */
  658. X#define SystemV            YES
  659. X#define OSName            Xenix/386 System V Release 2.3.3
  660. X#define OSMajorVersion        3
  661. X#define OSMinorVersion        2
  662. X#define OPERATING_SYSTEM    sysV
  663. X/**/# platform:  $XConsortium: xenix.cf,v 1.0 90/03/10 15:39:46 jim Exp $
  664. X/**/# operating system:  OSName
  665. X/*****************************************************************************
  666. X *              Platform-specfic parameters                        *
  667. X *****************************************************************************/
  668. X#define RemoveTargetProgramByMoving YES
  669. X#define BootstrapCFlags        -Dxenix -DSYSV
  670. X#define StandardDefines        /* -Datt */ -Dxenix -DSYSV -DUSG /* -DUSE_ASM */
  671. X#define StandardCppDefines    /* -Datt */ -Dxenix -DSYSV -DUSG /* -DUSE_ASM */
  672. X#define ExecableScripts        NO
  673. X#define ExtraLibraries             -lcfp -lgnu -lx -lXc
  674. X#define    Server_Extra_Libraries    -levent -lsocket -lcfp -lgnu -lx
  675. X#define    ExtraLoadFlags        -g 
  676. X#define    Server_Extra_Load_Flags    -g
  677. X#define HasVoidSignalReturn    YES
  678. X#define NeedBerklibInXlib    YES
  679. X#define ConnectionFlags        -DUNIXCONN -DLOCALCONN
  680. X#define HasNdbm            NO
  681. X#define    HasSdbm            YES
  682. X#define HasGcc            YES
  683. X#define HasRcc            NO
  684. X#define CcCmd            xcc
  685. X#define CppCmd            /lib/cpp
  686. X#define LdCombineFlags        -r
  687. X#define ManDir            /usr/man/man.X
  688. X#define ManDirectoryRoot    /usr/man
  689. X#define ManSuffix        X
  690. X#define UNCOMPRESSPATH        /usr/bin/uncompress
  691. X#define DefaultUserPath        .:/bin:/usr/bin:/usr/bin/X11:/usr/local
  692. X#define DefaultSystemPath    .:/bin:/usr/bin:/usr/bin/X11:/usr/local:/etc
  693. X#define StripInstalledPrograms    YES
  694. X/* #define LibraryCCOptions    -DATTSHLIB */
  695. X#define LibraryCCOptions
  696. X#define RanlibCmd        ranlib
  697. X#define FontDefines        -DFONT_SNF -DFONT_BDF -DCOMPRESSED_FONTS StandardDefines
  698. X#define BuildExamples        NO
  699. X#define XibmServer        Xibm
  700. X#define ibmIncludeVGA        YES
  701. X#define BuildServer        YES
  702. X#define ServerCDebugFlags    -DTRACE_X -DDEBUG
  703. X#define ServerDefines        StandardDefines ExtensionDefines -DNO_FUNCTION_PROTOTYPES
  704. X#define InstallCmd        $(SCRIPTSRC)/install.sh
  705. X#define    AsCmd            gas
  706. X#define    DefaultFontPath        $(FONTDIR)/misc/,$(FONTDIR)/75dpi/
  707. X#define    UsrLibDir        /lib/386
  708. X#define LibDir                  /usr/lib/X11
  709. X#define LintlibDir         /usr/lib/lint
  710. X#define    InstallLibrary(libname,dest)                    @@\
  711. Xinstall:: lib/**/libname.a                        @@\
  712. X    rm -f Slib/**/libname.a                        @@\
  713. X    ln lib/**/libname.a Slib/**/libname.a                @@\
  714. X    $(INSTALL) -c $(INSTLIBFLAGS) Slib/**/libname.a dest        @@\
  715. X    $(RANLIB) $(RANLIBINSTFLAGS) dest/Slib/**/libname.a
  716. X#define    Xenix386
  717. X#define    Xenix
  718. X#define    NdbmDefines    -DSDBM
  719. X#define    HasSockets
  720. X#define    InstallXinitConfig    YES
  721. X#define    InstallXdmConfig    YES
  722. X#define    ManSuffix    X
  723. X
  724. X/*
  725. X * Define if you have shared library
  726. X */
  727. X#define    HasSharedLibraries YES
  728. X#if HasSharedLibraries
  729. X#define    SharedLibXext    NO
  730. X#define    SharedLibX    YES
  731. X#define    SharedLibXmu    NO
  732. X#define    SharedLibXt    YES
  733. X#define    SharedLibXaw    YES
  734. X
  735. X/*
  736. X * Nulling of these functions is because the xenix library are using
  737. X * the normal library for the build.
  738. X */
  739. X#define SharedLibraryObjectRule()
  740. X#define SharedAndDebuggedLibraryObjectRule()
  741. X#define    SpecialSharedAndDebuggedObjectRule(objs,depends,options)
  742. X#define    SpecialSharedObjectRule(objs,depends,options)
  743. X#define    InstallSharedLibrary(libname,rev,dest)
  744. X#define    InstallSharedLibraryData(libname,rev,dest)
  745. X#define NormalSharedLibraryTarget(libname,rev,solist)
  746. X#define NormalSharedLibraryDataTarget(libname,rev,salist)
  747. X
  748. X#if 1
  749. X#if SharedLibXext
  750. X#define    EXTENSIONLIB_Defined
  751. X     EXTENSIONLIB = -LXext_s
  752. X#endif
  753. X#if SharedLibX
  754. X#define    XLIB_Defined
  755. X             XLIB = $(EXTENSIONLIB) -LX11_s
  756. X#endif
  757. X#if SharedLibXmu
  758. X#define    XMULIB_Defined
  759. X           XMULIB = -LXmu_s
  760. X#endif
  761. X#if SharedLibXt
  762. X#define    XTOOLLIB_Defined
  763. X         XTOOLLIB = -LXt_s
  764. X#endif
  765. X#if SharedLibX
  766. X#define    XAWLIB_Defined
  767. X           XAWLIB = -LXaw_s
  768. X#endif
  769. X#endif
  770. X
  771. X#define XawClientLibs $(XAWLIB) $(XMULIB) $(XLIB)
  772. X#endif
  773. X
  774. X/*
  775. X * ServerTarget - generate rules to compile, link, and relink an X server.
  776. X */
  777. X#define    ServerTarget(server,subdirs,objects,libs,syslibs)        @@\
  778. Xserver: subdirs objects libs                        @@\
  779. X    -@if [ -f server ]; then echo "    $(MV) server server.bak"; \    @@\
  780. X        $(MV) server server.bak; else exit 0; fi        @@\
  781. X    gcc $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs Server_Extra_Libraries syslibs Server_Extra_Load_Flags @@\
  782. X                                    @@\
  783. Xload/**/server:                                @@\
  784. X    -@if [ -f server ]; then echo "    $(MV) server server.bak"; \    @@\
  785. X        $(MV) server server.bak; else exit 0; fi        @@\
  786. X    $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS)
  787. X#define FilesToClean *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut a.out
  788. SHAR_EOF
  789. $TOUCH -am 0122195191 xenix.cf &&
  790. chmod 0660 xenix.cf ||
  791. echo "restore of xenix.cf failed"
  792. set `wc -c xenix.cf`;Wc_c=$1
  793. if test "$Wc_c" != "4678"; then
  794.     echo original size 4678, current size $Wc_c
  795. fi
  796. # ============= Project.example ==============
  797. echo "x - extracting Project.example (Text)"
  798. sed 's/^X//' << 'SHAR_EOF' > Project.example &&
  799. X#if SharedLibXext
  800. X  DEPEXTENSIONLIB = /* _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.so.$(SOXEXTREV) */
  801. X#ifndef EXTENSIONLIB_Defined
  802. X     EXTENSIONLIB = _Use(-lXext,-L$(EXTENSIONSRC) -lXext)
  803. X#endif
  804. X#else
  805. X  DEPEXTENSIONLIB = _Use($(USRLIBDIR),$(EXTENSIONSRC)/lib)/libXext.a
  806. X     EXTENSIONLIB = LoaderLibPrefix _Use(-lXext, $(DEPEXTENSIONLIB))
  807. X#endif
  808. X#if SharedLibX
  809. X          DEPXLIB = $(DEPEXTENSIONLIB) /* _Use($(USRLIBDIR),$(XLIBSRC))/libX11.so.$(SOXLIBREV) */
  810. X#ifndef XLIB_Defined
  811. X             XLIB = $(EXTENSIONLIB) _Use(-lX11,-L$(XLIBSRC) -lX11)
  812. X#endif
  813. X#else
  814. X          DEPXLIB = $(DEPEXTENSIONLIB) _Use($(USRLIBDIR),$(XLIBSRC))/libX11.a 
  815. X             XLIB = $(EXTENSIONLIB) LoaderLibPrefix _Use(-lX11,$(XLIBSRC)/libX11.a)
  816. X#endif
  817. X      DEPXAUTHLIB = _Use($(USRLIBDIR),$(XAUTHSRC))/libXau.a
  818. X#ifndef XAUTHLIB_Defined
  819. X         XAUTHLIB = LoaderLibPrefix _Use(-lXau,$(DEPXAUTHLIB))
  820. X#endif
  821. X#if SharedLibXmu
  822. X        DEPXMULIB = /* _Use($(USRLIBDIR),$(XMUSRC))/libXmu.so.$(SOXMUREV) */
  823. X#ifndef XMULIB_Defined
  824. X           XMULIB = _Use(-lXmu,-L$(XMUSRC) -lXmu)
  825. X#endif
  826. X#else
  827. X        DEPXMULIB = _Use($(USRLIBDIR),$(XMUSRC))/libXmu.a
  828. X           XMULIB = LoaderLibPrefix _Use(-lXmu,$(DEPXMULIB))
  829. X#endif
  830. X#if SharedOldLibX
  831. X       DEPOLDXLIB = /* _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.so.$(SOOLDXREV) */
  832. X#ifndef OLDXLIB_Defined
  833. X          OLDXLIB = _Use(-loldX,-L$(OLDXLIBSRC) -loldX)
  834. X#endif
  835. X#else
  836. X       DEPOLDXLIB = _Use($(USRLIBDIR),$(OLDXLIBSRC))/liboldX.a
  837. X          OLDXLIB = LoaderLibPrefix _Use(-loldX,$(DEPOLDXLIB))
  838. X#endif
  839. X#if SharedLibXt
  840. X      DEPXTOOLLIB = /* _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.so.$(SOXTREV) */
  841. X#ifndef XTOOLLIB_Defined
  842. X         XTOOLLIB = _Use(-lXt,-L$(TOOLKITSRC) -lXt)
  843. X#endif
  844. X#else
  845. X      DEPXTOOLLIB = _Use($(USRLIBDIR),$(TOOLKITSRC))/libXt.a
  846. X         XTOOLLIB = LoaderLibPrefix _Use(-lXt,$(DEPXTOOLLIB))
  847. X#endif
  848. X#if SharedLibXaw
  849. X        DEPXAWLIB = /* _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.so.$(SOXAWREV) */
  850. X#ifndef XAWLIB_Defined
  851. X           XAWLIB = _Use(-lXaw,-L$(AWIDGETSRC) -lXaw)
  852. X#endif
  853. X#else
  854. X        DEPXAWLIB = _Use($(USRLIBDIR),$(AWIDGETSRC))/libXaw.a
  855. X           XAWLIB = LoaderLibPrefix _Use(-lXaw,$(DEPXAWLIB)) 
  856. X#endif
  857. SHAR_EOF
  858. $TOUCH -am 0122180791 Project.example &&
  859. chmod 0660 Project.example ||
  860. echo "restore of Project.example failed"
  861. set `wc -c Project.example`;Wc_c=$1
  862. if test "$Wc_c" != "2158"; then
  863.     echo original size 2158, current size $Wc_c
  864. fi
  865. exit 0
  866.