home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume36 / chiaro / part04 < prev    next >
Text File  |  1993-03-25  |  56KB  |  1,670 lines

  1. Newsgroups: comp.sources.misc
  2. From: jwbirdsa@picarefy.picarefy.com (James W. Birdsall)
  3. Subject: v36i074:  chiaro - Image Utilities, Part04/18
  4. Message-ID: <1993Mar25.181018.20080@sparky.imd.sterling.com>
  5. X-Md4-Signature: 52e8144a10e01088d59cb559750cccb7
  6. Date: Thu, 25 Mar 1993 18:10:18 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: jwbirdsa@picarefy.picarefy.com (James W. Birdsall)
  10. Posting-number: Volume 36, Issue 74
  11. Archive-name: chiaro/part04
  12. Environment: UNIX, Sun, DECstation, 3B1
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  src/depend.c templates/linux-gcc.h templates/template.h
  19. # Wrapped by kent@sparky on Thu Mar 25 11:20:02 1993
  20. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  21. echo If this archive is complete, you will see the following message:
  22. echo '          "shar: End of archive 4 (of 18)."'
  23. if test -f 'src/depend.c' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'src/depend.c'\"
  25. else
  26.   echo shar: Extracting \"'src/depend.c'\" \(42953 characters\)
  27.   sed "s/^X//" >'src/depend.c' <<'END_OF_FILE'
  28. X/***************************************************************************
  29. X*   depend.c                                                               *
  30. X*   MODULE:  -                                                             *
  31. X*   OS:      UNIX                                                          *
  32. X*                                                                          *
  33. X*   Copyright (c) 1993 James W. Birdsall. All Rights Reserved.             *
  34. X*                                                                          *
  35. X*   $Id: depend.c,v 1.11 1993/02/15 01:57:13 jwbirdsa Exp $
  36. X*                                                                          *
  37. X*   Hardware and OS dependent functions; basic services that depend on     *
  38. X*   the OS and/or hardware.                                                *
  39. X*                                                                          *
  40. X***************************************************************************/
  41. X
  42. X#include "config.h"
  43. X
  44. X/*
  45. X** system includes <>
  46. X*/
  47. X
  48. X#include <stdio.h>
  49. X#include <ctype.h>
  50. X#include <sys/types.h>
  51. X#include <sys/stat.h>
  52. X#ifndef NO_MALLOCHDR
  53. X#include <malloc.h>
  54. X#endif
  55. X#ifndef NO_STR_INC
  56. X#ifdef STRING_PLURAL
  57. X#include <strings.h>
  58. X#else
  59. X#include <string.h>
  60. X#endif
  61. X#endif
  62. X#ifdef DIR_READDIR
  63. X#include <dirent.h>
  64. X#else /* ! DIR_READDIR */
  65. X#include <fcntl.h>
  66. X#endif
  67. X#ifdef DIR_GETDENTS
  68. X#include <sys/dirent.h>
  69. X#endif
  70. X#ifdef DIR_NODIR
  71. X#include <sys/dir.h>
  72. X#include <errno.h>
  73. X#endif
  74. X#ifdef USTAT
  75. X#include <ustat.h>
  76. X#endif
  77. X#ifdef STATFS
  78. X#include <sys/vfs.h>
  79. X#endif
  80. X#ifdef STATFS_FSDATA
  81. X#include <sys/param.h>
  82. X#include <sys/mount.h>
  83. X#endif
  84. X
  85. X
  86. X/*
  87. X** custom includes ""
  88. X*/
  89. X
  90. X#include "depend.h"
  91. X
  92. X
  93. X/*
  94. X** local #defines
  95. X*/
  96. X
  97. X#define MASK_PATTERN       1
  98. X#define MASK_DIREC         2
  99. X#define MASK_FILE          3
  100. X
  101. X
  102. X/*
  103. X** misc: copyright strings, version macros, etc.
  104. X*/
  105. X
  106. Xstatic char CONST rcsid[] = "$Id: depend.c,v 1.11 1993/02/15 01:57:13 jwbirdsa Exp $";
  107. X
  108. X
  109. X/*
  110. X** typedefs
  111. X*/
  112. X
  113. X#ifdef DIR_GETDIRENT
  114. Xstruct dirent
  115. X{
  116. X    unsigned long d_fileno;
  117. X    unsigned short d_reclen;
  118. X    unsigned short d_namlen;
  119. X    char d_name[256];
  120. X};
  121. X
  122. Xtypedef struct tagDIR
  123. X{
  124. X    int fd;
  125. X    long totsize;
  126. X    long blocksize;
  127. X    struct dirent *buffer;
  128. X    struct dirent *nextentry;
  129. X    struct dirent *lastentry;
  130. X} DIR;
  131. X#endif /* DIR_GETDIRENT */
  132. X
  133. X#ifdef DIR_GETDENTS
  134. Xtypedef struct tagDIR
  135. X{
  136. X    int fd;
  137. X} DIR;
  138. X#endif /* DIR_GETDENTS */
  139. X
  140. X#ifdef DIR_NODIR
  141. X#define dirent direct
  142. X
  143. Xtypedef struct tagDIR
  144. X{
  145. X    int fd;
  146. X    char d_name[256];
  147. X} DIR;
  148. X#endif /* DIR_NODIR */
  149. X
  150. X
  151. X/*
  152. X** global variables
  153. X*/
  154. X
  155. X#ifdef DIR_NODIR
  156. X#ifdef NO_ERRNO
  157. Xextern int errno;
  158. X#endif
  159. X#endif
  160. X
  161. X
  162. X/*
  163. X** static globals
  164. X*/
  165. X
  166. X/*
  167. X** function prototypes
  168. X*/
  169. X
  170. X#ifdef  __STDC__
  171. X# define P_(s) s
  172. X#else
  173. X# define P_(s) ()
  174. X#endif
  175. X
  176. Xstatic char *strdp P_((char *dupee1, char *dupee2));
  177. X
  178. X#ifndef DIR_READDIR
  179. Xstatic DIR *opendir P_((char *dirname));
  180. Xstatic struct dirent *readdir P_((DIR *dirp));
  181. Xstatic int closedir P_((DIR *dirp));
  182. X#endif
  183. X#ifdef DIR_NODIR
  184. Xstatic int getdents P_((int fd, char *buf, int nbytes));
  185. X#endif
  186. X
  187. X#undef P_
  188. X
  189. X#ifdef NO_STR_INC
  190. Xextern int strlen();
  191. Xextern char *strncpy();
  192. Xextern char *strcpy();
  193. Xextern char *strcat();
  194. X#ifndef NO_STRDUP
  195. Xextern char *strdup();
  196. X#endif
  197. X#endif
  198. X
  199. X
  200. X/*
  201. X** functions
  202. X*/
  203. X
  204. X/***************************************************************************
  205. X*   FUNCTION: scand                                                        *
  206. X*                                                                          *
  207. X*   DESCRIPTION:                                                           *
  208. X*                                                                          *
  209. X*       This function returns a pointer to an array of strings (i.e. an    *
  210. X*       array of character pointers) which contain the filenames to be     *
  211. X*       processed, including path as necessary. The last pointer           *
  212. X*       in the array is NULL.                                              *
  213. X*                                                                          *
  214. X*       The argument MASK may be a directory name or a filename. Wildcards *
  215. X*       will never get here, as they are expanded by the shell. A filename *
  216. X*       can include a path. If MASK is a directory, it will be expanded to *
  217. X*       a list of the filenames in that directory. If MASK is a file, the  *
  218. X*       filename will be returned.                                         *
  219. X*                                                                          *
  220. X*   ENTRY:                                                                 *
  221. X*                                                                          *
  222. X*       mask - see above                                                   *
  223. X*                                                                          *
  224. X*   EXIT:                                                                  *
  225. X*                                                                          *
  226. X*       Returns a pointer to an array of character pointers, or NULL on    *
  227. X*       error.                                                             *
  228. X*                                                                          *
  229. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  230. X*                                                                          *
  231. X***************************************************************************/
  232. Xchar **
  233. X#ifdef __STDC__
  234. Xscand(char *mask)
  235. X#else
  236. Xscand(mask)
  237. Xchar *mask;
  238. X#endif
  239. X{
  240. X    int masktype;
  241. X    struct stat statbuf;
  242. X    char *temp;
  243. X    char *candidate;
  244. X    DIR *dirhandle;
  245. X    struct dirent *data;
  246. X    int loop;
  247. X    int dirsize;
  248. X    char **buffer;
  249. X    char **tmpbuf;
  250. X#ifdef DIR_NODIR
  251. X    char holdname[DIRSIZ + 1];
  252. X#endif
  253. X
  254. X    /* FIRST: We need to find out if the mask is a directory or a filename. */
  255. X
  256. X    if (stat(mask, &statbuf) == -1)
  257. X    {
  258. X        /* Error in mask. */
  259. X
  260. X        return NULL;
  261. X    }
  262. X    masktype = (statbuf.st_mode & S_IFDIR) ? MASK_DIREC : MASK_FILE;
  263. X
  264. X    /* SECOND: if filename, return the easy way. */
  265. X
  266. X    if (masktype == MASK_FILE)
  267. X    {
  268. X        /* Allocate memory. */
  269. X
  270. X        if ((buffer = (char **) calloc(2, sizeof(char *))) == NULL)
  271. X        {
  272. X            return NULL;
  273. X        }
  274. X        if ((buffer[0] = strdup(mask)) == NULL)
  275. X        {
  276. X            free(buffer);
  277. X            return NULL;
  278. X        }
  279. X        buffer[1] = NULL;
  280. X        return buffer;
  281. X    }
  282. X
  283. X    /* THIRD: search for regular files in the directory and put in buffer. */
  284. X
  285. X    dirsize = 0;
  286. X
  287. X    /* Open the directory. */
  288. X
  289. X    if ((dirhandle = opendir(mask)) == NULL)
  290. X    {
  291. X        return NULL;
  292. X    }
  293. X
  294. X    /* Prepare a modified mask for append. */
  295. X
  296. X    if (mask[strlen(mask) - 1] == '/')
  297. X    {
  298. X        /* If trailing slash already, just copy. */
  299. X
  300. X        if ((temp = strdup(mask)) == NULL)
  301. X        {
  302. X            closedir(dirhandle);
  303. X            return NULL;
  304. X        }
  305. X    }
  306. X    else
  307. X    {
  308. X        /* Otherwise add one. */
  309. X
  310. X        if ((temp = strdp(mask, "/")) == NULL)
  311. X        {
  312. X            closedir(dirhandle);
  313. X            return NULL;
  314. X        }
  315. X    }
  316. X
  317. X    /* Allocate buffer first time. */
  318. X
  319. X    if ((buffer = (char **) malloc(sizeof(char *))) == (char **) NULL)
  320. X    {
  321. X        closedir(dirhandle);
  322. X        free(temp);
  323. X        return NULL;
  324. X    }
  325. X
  326. X    /* Start reading. */
  327. X
  328. X    while ((data = readdir(dirhandle)) != (struct dirent *) NULL)
  329. X    {
  330. X        /* Check for file type. */
  331. X
  332. X#ifdef DIR_NODIR
  333. X        strncpy(holdname, data->d_name, DIRSIZ);
  334. X        holdname[DIRSIZ] = '\0';
  335. X        if ((candidate = strdp(temp, holdname)) == NULL)
  336. X#else
  337. X        if ((candidate = strdp(temp, data->d_name)) == NULL)
  338. X#endif
  339. X        {
  340. X            closedir(dirhandle);
  341. X            free(temp);
  342. X            for (loop = 0; loop < dirsize; loop++)
  343. X            {
  344. X                free(buffer[loop]);
  345. X            }
  346. X            free(buffer);
  347. X            return NULL;
  348. X        }
  349. X        if (stat(candidate, &statbuf) == -1)
  350. X        {
  351. X            /* Error in filename. */
  352. X
  353. X            closedir(dirhandle);
  354. X            free(temp);
  355. X            for (loop = 0; loop < dirsize; loop++)
  356. X            {
  357. X                free(buffer[loop]);
  358. X            }
  359. X            free(buffer);
  360. X            free(candidate);
  361. X            return NULL;
  362. X        }
  363. X        if (statbuf.st_mode & S_IFREG)
  364. X        {
  365. X            /* Only include if regular file. */
  366. X
  367. X            buffer[dirsize++] = candidate;
  368. X            tmpbuf = (char **) realloc(buffer, ((dirsize + 1)*sizeof(char *)));
  369. X            if (tmpbuf == (char **) NULL)
  370. X            {
  371. X                closedir(dirhandle);
  372. X                free(temp);
  373. X                for (loop = 0; loop < (dirsize - 1); loop++)
  374. X                {
  375. X                    free(buffer[loop]);
  376. X                }
  377. X                free(buffer);
  378. X                free(candidate);
  379. X                return NULL;
  380. X            }
  381. X            buffer = tmpbuf;
  382. X        }
  383. X        else
  384. X        {
  385. X            free(candidate);
  386. X        }
  387. X    }
  388. X    buffer[dirsize] = NULL;
  389. X
  390. X    /* FOURTH: clean up, return. */
  391. X
  392. X    closedir(dirhandle);
  393. X    free(temp);
  394. X
  395. X    return buffer;
  396. X} /* end of function scand() */
  397. X
  398. X
  399. X/***************************************************************************
  400. X*   FUNCTION: dfree                                                        *
  401. X*                                                                          *
  402. X*   DESCRIPTION:                                                           *
  403. X*                                                                          *
  404. X*       Returns free space on drive specified in TEMPPATH, or default      *
  405. X*       drive if none specified.                                           *
  406. X*                                                                          *
  407. X*   ENTRY:                                                                 *
  408. X*                                                                          *
  409. X*       temppath - possible drive specifier                                *
  410. X*                                                                          *
  411. X*   EXIT:                                                                  *
  412. X*                                                                          *
  413. X*       Returns free space on drive, or -1 on error.                       *
  414. X*                                                                          *
  415. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  416. X*                                                                          *
  417. X***************************************************************************/
  418. Xlong
  419. X#ifdef __STDC__
  420. Xdfree(char *temppath)
  421. X#else
  422. Xdfree(temppath)
  423. Xchar *temppath;
  424. X#endif
  425. X{
  426. X    long free;
  427. X    char *usepath;
  428. X    char *dummypath = ".";
  429. X#ifdef USTAT
  430. X    struct stat buf;
  431. X    struct ustat ubuf;
  432. X#endif
  433. X#ifdef STATFS
  434. X    struct statfs fbuf;
  435. X#endif
  436. X#ifdef STATFS_FSDATA
  437. X    struct fs_data fbuf;
  438. X#endif
  439. X
  440. X    /* Use supplied path by default. */
  441. X
  442. X    usepath = temppath;
  443. X
  444. X    /* If temppath is NULL or null string, use dummypath instead. */
  445. X
  446. X    if ((temppath == (char *) NULL) || (temppath[0] == '\0'))
  447. X    {
  448. X        usepath = dummypath;
  449. X    }
  450. X
  451. X#ifdef USTAT
  452. X    if (stat(usepath, &buf) == -1)
  453. X    {
  454. X        return -1;
  455. X    }
  456. X    if (ustat(buf.st_dev, &ubuf) == -1)
  457. X    {
  458. X        return -1;
  459. X    }
  460. X    free = ubuf.f_tfree * SYS_BLOCKSIZE;
  461. X#endif /* USTAT */
  462. X
  463. X#ifdef STATFS
  464. X    if (statfs(usepath, &fbuf) == -1)
  465. X    {
  466. X        return -1;
  467. X    }
  468. X    free = fbuf.f_bavail * fbuf.f_bsize;
  469. X#endif /* STATFS */
  470. X
  471. X#ifdef STATFS_FSDATA
  472. X    if (statfs(usepath, &fbuf) != 1)
  473. X    {
  474. X        return -1;
  475. X    }
  476. X    free = fbuf.fd_req.bfreen * 1024;
  477. X#endif /* STATFS_FSDATA */
  478. X
  479. X    return free;
  480. X} /* end of dfree() */
  481. X
  482. X
  483. X/***************************************************************************
  484. X*   FUNCTION: tempname                                                     *
  485. X*                                                                          *
  486. X*   DESCRIPTION:                                                           *
  487. X*                                                                          *
  488. X*       Verifies that the supplied directory is one we can use, and        *
  489. X*       fakes the operation of tempnam() on systems that don't have it.    *
  490. X*                                                                          *
  491. X*   ENTRY:                                                                 *
  492. X*                                                                          *
  493. X*       dir    - Directory in which to place temporary file.               *
  494. X*       prefix - Characters to start temp name with.                       *
  495. X*                                                                          *
  496. X*   EXIT:                                                                  *
  497. X*                                                                          *
  498. X*       Returns a pointer to a malloc()'ed buffer containing name.         *
  499. X*                                                                          *
  500. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  501. X*                                                                          *
  502. X***************************************************************************/
  503. Xchar *
  504. X#ifdef __STDC__
  505. Xtempname(char *dir, char *prefix)
  506. X#else
  507. Xtempname(dir, prefix)
  508. Xchar *dir;
  509. Xchar *prefix;
  510. X#endif
  511. X{
  512. X    struct stat statbuf;
  513. X    char name[128];
  514. X    char *pref;
  515. X    char sep;
  516. X
  517. X    static long namecount = 0;
  518. X
  519. X    if (dir != NULL)
  520. X    {
  521. X        /* Is dir a directory? */
  522. X
  523. X        if (stat(dir, &statbuf) == -1)
  524. X        {
  525. X            return NULL;
  526. X        }
  527. X        if ((statbuf.st_mode & S_IFDIR) == 0)
  528. X        {
  529. X            return NULL;
  530. X        }
  531. X    
  532. X        /* Can we create a file in that directory? */
  533. X
  534. X        if (access(dir, 02) == -1)
  535. X        {
  536. X            return NULL;
  537. X        }
  538. X    }
  539. X
  540. X#ifdef TEMPNAM
  541. X    return tempnam(dir, prefix);
  542. X#else
  543. X    if (dir == NULL)
  544. X    {
  545. X        /* If no directory specified, use tmpnam(). */
  546. X
  547. X        tmpnam(name);
  548. X    }
  549. X    else
  550. X    {
  551. X        while (1)
  552. X        {
  553. X            /* Create a name. */
  554. X
  555. X            pref = ((prefix != NULL) ? prefix : "CHI");
  556. X            sep = ((dir[strlen(dir)-1] == '/') ? '_' : '/');
  557. X            sprintf(name, "%s%c%s%05lX", dir, sep, pref, namecount++);
  558. X            if (access(name, 00) == -1)
  559. X            {
  560. X                /* No such file, OK to use. */
  561. X
  562. X                break;
  563. X            }
  564. X            namecount &= 0xFFFFF;
  565. X        }
  566. X    }
  567. X    
  568. X    return (strdup(name));
  569. X#endif /* TEMPNAM */
  570. X} /* end of tempname() */
  571. X
  572. X
  573. X/***************************************************************************
  574. X*   FUNCTION: strdp  STATIC                                                *
  575. X*                                                                          *
  576. X*   DESCRIPTION:                                                           *
  577. X*                                                                          *
  578. X*       This function returns a pointer to a new string which is the       *
  579. X*       concatenation of the two arguments.                                *
  580. X*                                                                          *
  581. X*   ENTRY:                                                                 *
  582. X*                                                                          *
  583. X*       dupee1 - first string                                              *
  584. X*       dupee2 - second string                                             *
  585. X*                                                                          *
  586. X*   EXIT:                                                                  *
  587. X*                                                                          *
  588. X*       Returns pointer to new string, or NULL on error.                   *
  589. X*                                                                          *
  590. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  591. X*                                                                          *
  592. X***************************************************************************/
  593. Xstatic char *
  594. X#ifdef __STDC__
  595. Xstrdp(char *dupee1, char *dupee2)
  596. X#else
  597. Xstrdp(dupee1, dupee2)
  598. Xchar *dupee1;
  599. Xchar *dupee2;
  600. X#endif
  601. X{
  602. X    int len;
  603. X    char *wholename, *temp;
  604. X
  605. X    /* Determine necessary length. Add one to allow for null terminator. */
  606. X
  607. X    len = strlen(dupee1) + strlen(dupee2) + 1;
  608. X
  609. X    /* Allocate memory. */
  610. X
  611. X    if ((wholename = (char *) calloc(len, sizeof(char))) == (char *) NULL)
  612. X    {
  613. X        return NULL;
  614. X    }
  615. X
  616. X    /* Copy first argument into result memory. */
  617. X
  618. X    for (temp = wholename; (*temp = *dupee1) != '\0'; temp++, dupee1++) ;
  619. X
  620. X    /* Copy second argument into result memory. */
  621. X
  622. X    for (; (*temp = *dupee2) != '\0'; temp++, dupee2++) ;
  623. X
  624. X    /* Return pointer to string. */
  625. X
  626. X    return wholename;
  627. X} /* end of static function strdp */
  628. X
  629. X
  630. X/***************************************************************************
  631. X*   FUNCTION: coreleft                                                     *
  632. X*                                                                          *
  633. X*   DESCRIPTION:                                                           *
  634. X*                                                                          *
  635. X*       Determines whether the requested amount of memory is available.    *
  636. X*       Must be MINRAM bytes still available after request is filled.      *
  637. X*                                                                          *
  638. X*   ENTRY:                                                                 *
  639. X*                                                                          *
  640. X*       needed - Number of bytes of memory needed.                         *
  641. X*                                                                          *
  642. X*   EXIT:                                                                  *
  643. X*                                                                          *
  644. X*       Returns 1 if memory is available, 0 if not.                        *
  645. X*                                                                          *
  646. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  647. X*                                                                          *
  648. X***************************************************************************/
  649. Xint
  650. X#ifdef __STDC__
  651. Xcoreleft(long needed)
  652. X#else
  653. Xcoreleft(needed)
  654. Xlong needed;
  655. X#endif
  656. X{
  657. X    char *big;
  658. X    char *leftover;
  659. X
  660. X    /* If SMALL_MEM and asking for more than 64K, forget it. */
  661. X
  662. X#ifdef SMALL_MEM
  663. X    if (needed > MKLONG(65535))
  664. X    {
  665. X        return 0;
  666. X    }
  667. X#endif
  668. X
  669. X    /* Otherwise, attempt to allocate needed amount. */
  670. X
  671. X    if ((big = (char *) malloc(needed)) == NULL)
  672. X    {
  673. X        /* Not available. */
  674. X
  675. X        return 0;
  676. X    }
  677. X
  678. X    /* OK, managed to allocate amount needed, is enough left? */
  679. X
  680. X    if ((leftover = (char *) malloc(MINRAM)) == NULL)
  681. X    {
  682. X        /* Not enough. */
  683. X
  684. X        free(big);
  685. X        return 0;
  686. X    }
  687. X
  688. X    /* Clean up and return. */
  689. X
  690. X    free(big);
  691. X    free(leftover);
  692. X
  693. X    return 1;
  694. X} /* end of coreleft() */
  695. X
  696. X
  697. X/***************************************************************************
  698. X*   FUNCTION: stricmp                                                      *
  699. X*                                                                          *
  700. X*   DESCRIPTION:                                                           *
  701. X*                                                                          *
  702. X*       Provides case-insensitive string compare, which doesn't seem to    *
  703. X*       exist on any system.                                               *
  704. X*                                                                          *
  705. X*   ENTRY:                                                                 *
  706. X*                                                                          *
  707. X*       s1 - First string to compare.                                      *
  708. X*       s2 - Second string to compare.                                     *
  709. X*                                                                          *
  710. X*   EXIT:                                                                  *
  711. X*                                                                          *
  712. X*       As strcmp().                                                       *
  713. X*                                                                          *
  714. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  715. X*                                                                          *
  716. X***************************************************************************/
  717. Xint
  718. X#ifdef __STDC__
  719. Xstricmp(char *s1, char *s2)
  720. X#else
  721. Xstricmp(s1, s2)
  722. Xchar *s1;
  723. Xchar *s2;
  724. X#endif
  725. X{
  726. X    int i;
  727. X
  728. X    /* Search forward for terminator or first mismatch. */
  729. X
  730. X    for (i = 0; (s1[i] != '\0') && (toupper(s1[i]) == toupper(s2[i])); i++) ;
  731. X    
  732. X    return (((int)(s1[i])) - ((int)(s2[i])));
  733. X} /* end of stricmp() */
  734. X
  735. X
  736. X/***************************************************************************
  737. X*   FUNCTION: strnicmp                                                     *
  738. X*                                                                          *
  739. X*   DESCRIPTION:                                                           *
  740. X*                                                                          *
  741. X*       Provides case-insensitive string compare with limit, which doesn't *
  742. X*       seem to exist on any system.                                       *
  743. X*                                                                          *
  744. X*   ENTRY:                                                                 *
  745. X*                                                                          *
  746. X*       s1  - First string to compare.                                     *
  747. X*       s2  - Second string to compare.                                    *
  748. X*       len - Maximum length to compare.                                   *
  749. X*                                                                          *
  750. X*   EXIT:                                                                  *
  751. X*                                                                          *
  752. X*       As strncmp().                                                      *
  753. X*                                                                          *
  754. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  755. X*                                                                          *
  756. X***************************************************************************/
  757. Xint
  758. X#ifdef __STDC__
  759. Xstrnicmp(char *s1, char *s2, int len)
  760. X#else
  761. Xstrnicmp(s1, s2, len)
  762. Xchar *s1;
  763. Xchar *s2;
  764. Xint len;
  765. X#endif
  766. X{
  767. X    int i;
  768. X
  769. X    /* Search forward for terminator, limit, or first mismatch. */
  770. X
  771. X    for (i = 0; (s1[i] != '\0') && (toupper(s1[i]) == toupper(s2[i])) &&
  772. X                (i < len); i++) ;
  773. X    
  774. X    return ((i == len) ? 0 : (((int)(s1[i])) - ((int)(s2[i]))));
  775. X} /* end of strnicmp() */
  776. X
  777. X
  778. X#ifdef NO_MEMOP
  779. X
  780. X/***************************************************************************
  781. X*   FUNCTION: memcpy                                                       *
  782. X*                                                                          *
  783. X*   DESCRIPTION:                                                           *
  784. X*                                                                          *
  785. X*       Copies bytes from src to dest, provided for systems which don't    *
  786. X*       have it.                                                           *
  787. X*                                                                          *
  788. X*   ENTRY:                                                                 *
  789. X*                                                                          *
  790. X*       dest - pointer to destination of copy                              *
  791. X*       src  - pointer to source of copy                                   *
  792. X*       n    - number of bytes to copy                                     *
  793. X*                                                                          *
  794. X*   EXIT:                                                                  *
  795. X*                                                                          *
  796. X*       Returns dest.                                                      *
  797. X*                                                                          *
  798. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  799. X*                                                                          *
  800. X***************************************************************************/
  801. XVOID *
  802. X#ifdef __STDC__
  803. Xmemcpy(VOID *dest, VOID *src, unsigned int n)
  804. X#else
  805. Xmemcpy(dest, src, n)
  806. XVOID *dest;
  807. XVOID *src;
  808. Xunsigned int n;
  809. X#endif
  810. X{
  811. X    UCHAR *t1, *t2;
  812. X
  813. X    for (t2 = (UCHAR *) dest, t1 = (UCHAR *) src; n != 0; n--)
  814. X    {
  815. X        t2[n - 1] = t1[n - 1];
  816. X    }
  817. X    return dest;
  818. X} /* end of memcpy() */
  819. X
  820. X
  821. X/***************************************************************************
  822. X*   FUNCTION: memcmp                                                       *
  823. X*                                                                          *
  824. X*   DESCRIPTION:                                                           *
  825. X*                                                                          *
  826. X*       Compares two regions in memory. Provided for systems which don't   *
  827. X*       have it.                                                           *
  828. X*                                                                          *
  829. X*   ENTRY:                                                                 *
  830. X*                                                                          *
  831. X*       s1 - pointer to first region to compare                            *
  832. X*       s2 - pointer to second region to compare                           *
  833. X*       n  - number of bytes to compare                                    *
  834. X*                                                                          *
  835. X*   EXIT:                                                                  *
  836. X*                                                                          *
  837. X*       Returns 0 if same, -1 or 1 otherwise.                              *
  838. X*                                                                          *
  839. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  840. X*                                                                          *
  841. X***************************************************************************/
  842. Xint
  843. X#ifdef __STDC__
  844. Xmemcmp(VOID *s1, VOID *s2, unsigned int n)
  845. X#else
  846. Xmemcmp(s1, s2, n)
  847. XVOID *s1;
  848. XVOID *s2;
  849. Xunsigned int n;
  850. X#endif
  851. X{
  852. X    unsigned int i;
  853. X    UCHAR *t1, *t2;
  854. X
  855. X    t1 = (UCHAR *) s1;
  856. X    t2 = (UCHAR *) s2;
  857. X    for (i = 0; i < n; i++)
  858. X    {
  859. X        if (t1[i] != t2[i])
  860. X        {
  861. X            break;
  862. X        }
  863. X    }
  864. X    if (i != n)
  865. X    {
  866. X        return ((t1[i] < t2[i]) ? -1 : 1);
  867. X    }
  868. X    return 0;
  869. X} /* end of memcmp() */
  870. X
  871. X#endif /* NO_MEMOP */
  872. X
  873. X
  874. X#ifdef NO_STRDUP
  875. X
  876. X/***************************************************************************
  877. X*   FUNCTION: strdup                                                       *
  878. X*                                                                          *
  879. X*   DESCRIPTION:                                                           *
  880. X*                                                                          *
  881. X*       Duplicates a string. Provided for systems which don't have it.     *
  882. X*                                                                          *
  883. X*   ENTRY:                                                                 *
  884. X*                                                                          *
  885. X*       s1 - string to be duplicated                                       *
  886. X*                                                                          *
  887. X*   EXIT:                                                                  *
  888. X*                                                                          *
  889. X*       Returns a pointer to a malloc()'ed duplicate.                      *
  890. X*                                                                          *
  891. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  892. X*                                                                          *
  893. X***************************************************************************/
  894. Xchar *
  895. X#ifdef __STDC__
  896. Xstrdup(char *s1)
  897. X#else
  898. Xstrdup(s1)
  899. Xchar *s1;
  900. X#endif
  901. X{
  902. X    char *temp;
  903. X
  904. X    if ((temp = (char *) malloc((strlen(s1) + 1))) == NULL)
  905. X    {
  906. X        return NULL;
  907. X    }
  908. X    strcpy(temp, s1);
  909. X    return temp;
  910. X} /* end of strdup() */
  911. X
  912. X#endif /* NO_STRDUP */
  913. X
  914. X#ifndef DIR_READDIR
  915. X
  916. X/***************************************************************************
  917. X*   FUNCTION: opendir                                                      *
  918. X*                                                                          *
  919. X*   DESCRIPTION:                                                           *
  920. X*                                                                          *
  921. X*       Opens a directory for reading. Provided for systems which don't    *
  922. X*       have it.                                                           *
  923. X*                                                                          *
  924. X*   ENTRY:                                                                 *
  925. X*                                                                          *
  926. X*       dirname - Name of directory to open.                               *
  927. X*                                                                          *
  928. X*   EXIT:                                                                  *
  929. X*                                                                          *
  930. X*       Returns a pointer to a directory handle, NULL on error.            *
  931. X*                                                                          *
  932. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  933. X*                                                                          *
  934. X***************************************************************************/
  935. Xstatic DIR *
  936. X#ifdef __STDC__
  937. Xopendir(char *dirname)
  938. X#else
  939. Xopendir(dirname)
  940. Xchar *dirname;
  941. X#endif
  942. X{
  943. X    DIR *sendback;
  944. X    int handle;
  945. X    struct stat statbuf;
  946. X
  947. X    /* Check to make sure dirname is a directory. */
  948. X
  949. X    if (stat(dirname, &statbuf) == -1)
  950. X    {
  951. X        return (DIR *) NULL;
  952. X    }
  953. X    if ((statbuf.st_mode & S_IFDIR) == 0)
  954. X    {
  955. X        return (DIR *) NULL;
  956. X    }
  957. X
  958. X    /* Try to open it. */
  959. X
  960. X    handle = open(dirname, O_RDONLY);
  961. X    if (handle == -1)
  962. X    {
  963. X        return (DIR *) NULL;
  964. X    }
  965. X
  966. X    /* Found and opened, so return. */
  967. X
  968. X    if ((sendback = (DIR *) malloc(sizeof(DIR))) == (DIR *) NULL)
  969. X    {
  970. X        close(handle);
  971. X        return (DIR *) NULL;
  972. X    }
  973. X    sendback->fd = handle;
  974. X#ifdef DIR_GETDIRENT
  975. X    sendback->totsize = statbuf.st_size;
  976. X    sendback->blocksize = statbuf.st_blksize;
  977. X    sendback->buffer = (struct dirent *) NULL;
  978. X#endif
  979. X#ifdef DIR_NODIR
  980. X    strcpy(sendback->d_name, dirname);
  981. X    if (dirname[strlen(dirname) - 1] != '/')
  982. X    {
  983. X        strcat(sendback->d_name, "/");
  984. X    }
  985. X#endif
  986. X    
  987. X    return sendback;
  988. X} /* end of opendir() */
  989. X
  990. X
  991. X/***************************************************************************
  992. X*   FUNCTION: readdir                                                      *
  993. X*                                                                          *
  994. X*   DESCRIPTION:                                                           *
  995. X*                                                                          *
  996. X*       Read an entry from an open directory. Provided for systems which   *
  997. X*       don't have it.                                                     *
  998. X*                                                                          *
  999. X*   ENTRY:                                                                 *
  1000. X*                                                                          *
  1001. X*       dirp - pointer to directory handle of directory to read from       *
  1002. X*                                                                          *
  1003. X*   EXIT:                                                                  *
  1004. X*                                                                          *
  1005. X*       Pointer to directory entry, NULL on error or end of directory.     *
  1006. X*                                                                          *
  1007. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  1008. X*                                                                          *
  1009. X***************************************************************************/
  1010. Xstatic struct dirent *
  1011. X#ifdef __STDC__
  1012. Xreaddir(DIR *dirp)
  1013. X#else
  1014. Xreaddir(dirp)
  1015. XDIR *dirp;
  1016. X#endif
  1017. X{
  1018. X    int nbytes;
  1019. X
  1020. X#ifdef DIR_GETDENTS
  1021. X    static struct dirent holding;
  1022. X
  1023. X    /* Attempt to read from directory. */
  1024. X
  1025. X    if ((nbytes = getdents(dirp->fd, &holding, sizeof(struct dirent))) == -1)
  1026. X    {
  1027. X        return (struct dirent *) NULL;
  1028. X    }
  1029. X
  1030. X    /* Is end of directory? */
  1031. X
  1032. X    if (nbytes == 0)
  1033. X    {
  1034. X        return (struct dirent *) NULL;
  1035. X    }
  1036. X
  1037. X    /* Read OK, so set pointer for next time (in case we read more than one). */
  1038. X
  1039. X    if (lseek(dirp->fd, holding.d_off, SEEK_SET) == -1)
  1040. X    {
  1041. X        return (struct dirent *) NULL;
  1042. X    }
  1043. X
  1044. X    /* Return pointer to holding. */
  1045. X
  1046. X    return &holding;
  1047. X#endif /* DIR_GETDENTS */
  1048. X
  1049. X#ifdef DIR_GETDIRENT
  1050. X    int allocsize;
  1051. X    long basep;
  1052. X    struct dirent *current;
  1053. X
  1054. X    /* If buffer hasn't been filled, allocate it and fill. */
  1055. X
  1056. X    if (dirp->buffer == (struct dirent *) NULL)
  1057. X    {
  1058. X        /* Allocate memory to hold the entire directory (we hope). */
  1059. X
  1060. X        allocsize = ((dirp->totsize > dirp->blocksize) ? dirp->totsize :
  1061. X                                                         dirp->blocksize);
  1062. X        dirp->buffer = (struct dirent *) malloc(allocsize);
  1063. X        if (dirp->buffer == (struct dirent *) NULL)
  1064. X        {
  1065. X            return (struct dirent *) NULL;
  1066. X        }
  1067. X
  1068. X        /* Try to read the directory in. */
  1069. X
  1070. X        if ((nbytes = getdirentries(dirp->fd, (char *) dirp->buffer,
  1071. X                                    allocsize, &basep)) == -1)
  1072. X        {
  1073. X            free(dirp->buffer);
  1074. X            dirp->buffer = (struct dirent *) NULL;
  1075. X            return (struct dirent *) NULL;
  1076. X        }
  1077. X
  1078. X        /* Read again -- should return 0 (end of directory). */
  1079. X
  1080. X        if (getdirentries(dirp->fd, (char *) dirp->buffer, allocsize, &basep)
  1081. X            != 0)
  1082. X        {
  1083. X            free(dirp->buffer);
  1084. X            dirp->buffer = (struct dirent *) NULL;
  1085. X            return (struct dirent *) NULL;
  1086. X        }
  1087. X
  1088. X        /* Initialize position pointers. */
  1089. X
  1090. X        for (current = dirp->buffer;
  1091. X             (((char *)current) - ((char *)dirp->buffer)) < nbytes;
  1092. X             current = (struct dirent *)(((char *)current)+current->d_reclen)) ;
  1093. X        dirp->lastentry = current;
  1094. X        dirp->nextentry = dirp->buffer;
  1095. X    }
  1096. X
  1097. X    /* Have we run off end? */
  1098. X
  1099. X    if (dirp->nextentry == (struct dirent *) NULL)
  1100. X    {
  1101. X        return dirp->nextentry;
  1102. X    }
  1103. X
  1104. X    current = dirp->nextentry;
  1105. X    if (dirp->nextentry == dirp->lastentry)
  1106. X    {
  1107. X        /* This was the last one, so set nextentry to NULL. */
  1108. X
  1109. X        dirp->nextentry = (struct dirent *) NULL;
  1110. X    }
  1111. X    else
  1112. X    {
  1113. X        /* Otherwise increment. */
  1114. X
  1115. X        dirp->nextentry = (struct dirent *)(((char *)dirp->nextentry) +
  1116. X                                            dirp->nextentry->d_reclen);
  1117. X    }
  1118. X
  1119. X    return current;
  1120. X#endif /* DIR_GETDIRENT */
  1121. X
  1122. X#ifdef DIR_NODIR
  1123. X    static struct dirent holding;
  1124. X    char namebuf[DIRSIZ + 1];
  1125. X    char *testname;
  1126. X    struct stat statbuf;
  1127. X
  1128. X    while (1)
  1129. X    {
  1130. X        /* Attempt to read from directory. */
  1131. X
  1132. X        if ((nbytes = getdents(dirp->fd, &holding, sizeof(struct dirent))) ==
  1133. X            -1)
  1134. X        {
  1135. X            return (struct dirent *) NULL;
  1136. X        }
  1137. X
  1138. X        /* Is end of directory? */
  1139. X
  1140. X        if (nbytes == 0)
  1141. X        {
  1142. X            return (struct dirent *) NULL;
  1143. X        }
  1144. X
  1145. X        /* Does this file actually still exist? */
  1146. X
  1147. X        strncpy(namebuf, holding.d_name, DIRSIZ);
  1148. X        namebuf[DIRSIZ] = '\0';
  1149. X        if ((testname = strdp(dirp->d_name, namebuf)) == NULL)
  1150. X        {
  1151. X            return (struct dirent *) NULL;
  1152. X        }
  1153. X        if (stat(testname, &statbuf) != -1)
  1154. X        {
  1155. X            /*
  1156. X            ** File still exists, but is this a phantom with the same
  1157. X            ** same as another file? Check inode numbers to be sure.
  1158. X            */
  1159. X
  1160. X            if (statbuf.st_ino == holding.d_ino)
  1161. X            {
  1162. X                /* Is a real file, break out and return OK. */
  1163. X
  1164. X                free(testname);
  1165. X                break;
  1166. X            }
  1167. X
  1168. X            /* Is a phantom -- keep going. */
  1169. X
  1170. X        }
  1171. X        else if (errno != ENOENT)
  1172. X        {
  1173. X            /* Serious error. */
  1174. X
  1175. X            free(testname);
  1176. X            return (struct dirent *) NULL;
  1177. X        }
  1178. X
  1179. X        /* File does not exist, but may be more so keep going. */
  1180. X        free(testname);
  1181. X    }
  1182. X
  1183. X    /* Return pointer to holding. */
  1184. X
  1185. X    return &holding;
  1186. X#endif /* DIR_NODIR */
  1187. X} /* end of readdir() */
  1188. X
  1189. X
  1190. X/***************************************************************************
  1191. X*   FUNCTION: closedir                                                     *
  1192. X*                                                                          *
  1193. X*   DESCRIPTION:                                                           *
  1194. X*                                                                          *
  1195. X*       Closes a directory previously opened with opendir. Provided for    *
  1196. X*       systems which don't have it.                                       *
  1197. X*                                                                          *
  1198. X*   ENTRY:                                                                 *
  1199. X*                                                                          *
  1200. X*       dirp - pointer to handle of directory to be closed                 *
  1201. X*                                                                          *
  1202. X*   EXIT:                                                                  *
  1203. X*                                                                          *
  1204. X*       Returns 0 on success, -1 on error.                                 *
  1205. X*                                                                          *
  1206. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  1207. X*                                                                          *
  1208. X***************************************************************************/
  1209. Xstatic int
  1210. X#ifdef __STDC__
  1211. Xclosedir(DIR *dirp)
  1212. X#else
  1213. Xclosedir(dirp)
  1214. XDIR *dirp;
  1215. X#endif
  1216. X{
  1217. X    int handle = dirp->fd;
  1218. X
  1219. X#ifdef DIR_GETDIRENT
  1220. X    if (dirp->buffer != (struct dirent *) NULL)
  1221. X    {
  1222. X        free(dirp->buffer);
  1223. X    }
  1224. X#endif
  1225. X
  1226. X    /* Attempt to close directory. */
  1227. X
  1228. X    return (close(handle));
  1229. X} /* end of closedir() */
  1230. X
  1231. X
  1232. X#ifdef DIR_NODIR
  1233. X
  1234. X/***************************************************************************
  1235. X*   FUNCTION: getdents  STATIC                                             *
  1236. X*                                                                          *
  1237. X*   DESCRIPTION:                                                           *
  1238. X*                                                                          *
  1239. X*       Reads a directory entry on a system which has no directory         *
  1240. X*       functions at all. Makes the life of readdir() on such systems      *
  1241. X*       easier.                                                            *
  1242. X*                                                                          *
  1243. X*   ENTRY:                                                                 *
  1244. X*                                                                          *
  1245. X*       fd     - file descriptor from which to read                        *
  1246. X*       buf    - buffer into which to read                                 *
  1247. X*       nbytes - maximum number of bytes to be read                        *
  1248. X*                                                                          *
  1249. X*   EXIT:                                                                  *
  1250. X*                                                                          *
  1251. X*       Returns number of bytes actually read, -1 on error.                *
  1252. X*                                                                          *
  1253. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  1254. X*                                                                          *
  1255. X***************************************************************************/
  1256. Xstatic int
  1257. X#ifdef __STDC__
  1258. Xgetdents(int fd, char *buf, int nbytes)
  1259. X#else
  1260. Xgetdents(fd, buf, nbytes)
  1261. Xint fd;
  1262. Xchar *buf;
  1263. Xint nbytes;
  1264. X#endif
  1265. X{
  1266. X    int readbytes;
  1267. X
  1268. X    /* enough room? */
  1269. X    if (nbytes < sizeof(struct dirent))
  1270. X    {
  1271. X        return -1;
  1272. X    }
  1273. X
  1274. X    /* read */
  1275. X    if ((readbytes = read(fd, buf, nbytes)) == -1)
  1276. X    {
  1277. X        return -1;
  1278. X    }
  1279. X
  1280. X    if ((readbytes != nbytes) && (readbytes != 0))
  1281. X    {
  1282. X        /* oops */
  1283. X        return -1;
  1284. X    }
  1285. X
  1286. X    return readbytes;
  1287. X} /* end of static getdents() */
  1288. X
  1289. X#endif /* DIR_NODIR */
  1290. X
  1291. X#endif /* ! DIR_READDIR */
  1292. X
  1293. X
  1294. X#ifdef NO_RENAME
  1295. X
  1296. X/***************************************************************************
  1297. X*   FUNCTION: rename                                                       *
  1298. X*                                                                          *
  1299. X*   DESCRIPTION:                                                           *
  1300. X*                                                                          *
  1301. X*       Renames a file. Provided for systems which don't have it.          *
  1302. X*                                                                          *
  1303. X*   ENTRY:                                                                 *
  1304. X*                                                                          *
  1305. X*       path1 - current name of file                                       *
  1306. X*       path2 - new name for file                                          *
  1307. X*                                                                          *
  1308. X*   EXIT:                                                                  *
  1309. X*                                                                          *
  1310. X*       Returns 0 on success, -1 on error.                                 *
  1311. X*                                                                          *
  1312. X*   CONSTRAINTS/SIDE EFFECTS:                                              *
  1313. X*                                                                          *
  1314. X***************************************************************************/
  1315. Xint
  1316. X#ifdef __STDC__
  1317. Xrename(char *path1, char *path2)
  1318. X#else
  1319. Xrename(path1, path2)
  1320. Xchar *path1;
  1321. Xchar *path2;
  1322. X#endif
  1323. X{
  1324. X    /* create new link to file first */
  1325. X    if (link(path1, path2) == -1)
  1326. X    {
  1327. X        return -1;
  1328. X    }
  1329. X    /* now try to unlink old name */
  1330. X    if (unlink(path1) == -1)
  1331. X    {
  1332. X        return -1;
  1333. X    }
  1334. X    return 0;
  1335. X} /* end of rename() */
  1336. X
  1337. X#endif /* NO_RENAME */
  1338. X
  1339. END_OF_FILE
  1340.   if test 42953 -ne `wc -c <'src/depend.c'`; then
  1341.     echo shar: \"'src/depend.c'\" unpacked with wrong size!
  1342.   fi
  1343.   # end of 'src/depend.c'
  1344. fi
  1345. if test -f 'templates/linux-gcc.h' -a "${1}" != "-c" ; then 
  1346.   echo shar: Will not clobber existing file \"'templates/linux-gcc.h'\"
  1347. else
  1348.   echo shar: Extracting \"'templates/linux-gcc.h'\" \(393 characters\)
  1349.   sed "s/^X//" >'templates/linux-gcc.h' <<'END_OF_FILE'
  1350. X/*
  1351. X** Configuration for Linux 0.99p5 (and possibly other versions) with GCC.
  1352. X** Provided by Peter Couvares (pfcouvar@unix.amherst.edu).
  1353. X*/
  1354. X
  1355. X#define CONFIG_H
  1356. X
  1357. X/* statfs() function present */
  1358. X#define STATFS
  1359. X
  1360. X/* readdir() et al. functions present */
  1361. X#define DIR_READDIR
  1362. X
  1363. X/* tempnam() function present */
  1364. X#define TEMPNAM
  1365. X
  1366. X/* Only superuser can give away a file with chown() */
  1367. X#define ROOT_CHOWN
  1368. X
  1369. END_OF_FILE
  1370.   if test 393 -ne `wc -c <'templates/linux-gcc.h'`; then
  1371.     echo shar: \"'templates/linux-gcc.h'\" unpacked with wrong size!
  1372.   fi
  1373.   # end of 'templates/linux-gcc.h'
  1374. fi
  1375. if test -f 'templates/template.h' -a "${1}" != "-c" ; then 
  1376.   echo shar: Will not clobber existing file \"'templates/template.h'\"
  1377. else
  1378.   echo shar: Extracting \"'templates/template.h'\" \(8705 characters\)
  1379.   sed "s/^X//" >'templates/template.h' <<'END_OF_FILE'
  1380. X/*
  1381. X** This is the template configuration header. It contains all possible
  1382. X** options and their explanations. To configure this file for a particular
  1383. X** system, edit it, setting the various options as necessary for your
  1384. X** system.
  1385. X*/
  1386. X
  1387. X/* to let other files know this one has been included -- DO NOT CHANGE! */
  1388. X#define CONFIG_H
  1389. X
  1390. X
  1391. X
  1392. X/*********************************************
  1393. X** HEADER FILES
  1394. X** Configuration options having to do with the presence or absence
  1395. X** of various header files.
  1396. X*/
  1397. X
  1398. X/*
  1399. X** STDLIB: Define this symbol if there is no stdlib.h include file for
  1400. X** your compiler.
  1401. X*/
  1402. X/* #define NO_STDLIB */
  1403. X
  1404. X/*
  1405. X** MALLOCHDR: Define this symbol if there is no malloc.h include file
  1406. X** for your compiler.
  1407. X*/
  1408. X/* #define NO_MALLOCHDR */
  1409. X
  1410. X/*
  1411. X** UTIME: define this symbol if there is a utime.h include file for
  1412. X** your compiler.
  1413. X*/
  1414. X/* #define UTIME_HDR */
  1415. X
  1416. X/*
  1417. X** ERRNO: Define this symbol if your errno.h include file does not
  1418. X** declare the external variable "int errno".
  1419. X*/
  1420. X/* #define NO_ERRNO */
  1421. X
  1422. X/*
  1423. X** STRING: Some systems have an include file string.h; others have
  1424. X** strings.h; and some don't have either. Define NO_STR_INC if your
  1425. X** system does not have either file; define STRING_PLURAL if your
  1426. X** system has strings.h instead of string.h.
  1427. X*/
  1428. X/* #define NO_STR_INC */
  1429. X/* #define STRING_PLURAL */
  1430. X
  1431. X
  1432. X
  1433. X/*********************************************
  1434. X** TYPES
  1435. X** Configuration options having to do with the ability of the compiler
  1436. X** to handle various data types.
  1437. X*/
  1438. X
  1439. X/*
  1440. X** UNSIGNED CHAR: Define this symbol if your compiler does not support
  1441. X** the type "unsigned char".
  1442. X*/
  1443. X/* #define NO_UCHAR */
  1444. X
  1445. X/*
  1446. X** VOID: Define this symbol if your compiler does not support the type
  1447. X** "void". Some compilers may only partially support this type -- if you
  1448. X** get errors about bad types even though the compiler claims to support
  1449. X** the void type, try defining this symbol.
  1450. X*/
  1451. X/* #define NO_VOID */
  1452. X
  1453. X/*
  1454. X** UNSIGNED LONG: Define this symbol if your compiler does not support
  1455. X** the type "unsigned long".
  1456. X*/
  1457. X/* #define NO_ULONG */
  1458. X
  1459. X/*
  1460. X** INT16: Define this symbol if type "int" is 16 bits on your system
  1461. X** instead of 32.
  1462. X*/
  1463. X/* #define INT16 */
  1464. X
  1465. X/*
  1466. X** CONST: Define this symbol if your compiler does not recognize the
  1467. X** type modifier "const".
  1468. X*/
  1469. X/* #define NO_CONST */
  1470. X
  1471. X
  1472. X
  1473. X/*********************************************
  1474. X** FUNCTIONS
  1475. X** Configuration options having to do with the presence or absence of
  1476. X** various functions in the libraries supplied with the compiler.
  1477. X*/
  1478. X
  1479. X/*
  1480. X** MEMORY OPERATIONS: Define this symbol if your compiler's standard
  1481. X** library does not have the functions memcpy() or memcmp(). In the
  1482. X** manual pages, these functions are typically listed under "memory" in
  1483. X** section 3, if they are present.
  1484. X*/
  1485. X/* #define NO_MEMOP */
  1486. X
  1487. X/*
  1488. X** DISKFREE: If your system has the function statfs() and it returns data
  1489. X** in a "struct statfs", define the symbol STATFS. If your system has the
  1490. X** function statfs() and it returns data in a "struct fs_data" (Ultrix
  1491. X** systems), define the symbol STATFS_FSDATA. If your system has the function
  1492. X** ustat(), define the symbols USTAT and SYS_BLOCKSIZE. SYS_BLOCKSIZE is the
  1493. X** size, in bytes, of a disk block on your system. If you don't know this,
  1494. X** just leave it at 512, which is its default value. One of STATFS,
  1495. X** STATFS_FSDATA, or USTAT _must_ be defined.
  1496. X*/
  1497. X/* #define STATFS */
  1498. X/* #define STATFS_FSDATA */
  1499. X/*
  1500. X** #define USTAT
  1501. X** #define SYS_BLOCKSIZE       512
  1502. X*/
  1503. X
  1504. X/*
  1505. X** STRDUP: define this symbol if your compiler's standard library
  1506. X** does not have the function strdup(). In the manual pages, this function
  1507. X** is typically listed under "string" in section 3, if it is present.
  1508. X*/
  1509. X/* #define NO_STRDUP */
  1510. X
  1511. X/*
  1512. X** DIRECTORY ACCESS: Define one of these symbols according to which
  1513. X** functions your system has. If your system has the opendir()/readdir()
  1514. X** set of functions, define DIR_READDIR. Modern systems have these
  1515. X** functions. Older systems may have getdents(); if so, define
  1516. X** DIR_GETDENTS. Old Sun systems may have getdirentries(); if so,
  1517. X** define DIR_GETDIRENT. If your system has none of these functions,
  1518. X** define DIR_NODIR. One of these symbols _must_ be defined.
  1519. X** NOTE: if your system supports long filenames (>14 characters), it will
  1520. X** almost certainly have one of the functions listed above.
  1521. X*/
  1522. X/* #define DIR_READDIR */
  1523. X/* #define DIR_GETDENTS */
  1524. X/* #define DIR_GETDIRENT */
  1525. X/* #define DIR_NODIR */
  1526. X
  1527. X/*
  1528. X** TEMPORARY FILENAMES: Define this symbol if your compiler's standard
  1529. X** library has the function tempnam().
  1530. X*/
  1531. X/* #define TEMPNAM */
  1532. X
  1533. X/*
  1534. X** RENAME: Define this symbol if your compiler's standard library does
  1535. X** not have the function rename().
  1536. X*/
  1537. X/* #define NO_RENAME */
  1538. X
  1539. X
  1540. X
  1541. X/*********************************************
  1542. X** SYSTEM and MISC
  1543. X** Configuration options about the system in general, capabilities of
  1544. X** standard library functions, etc.
  1545. X*/
  1546. X
  1547. X/*
  1548. X** TERMINFO or TERMCAP: Most systems have information about terminals which
  1549. X** may be accessed via terminfo (newer), termcap (older), or both. Chils
  1550. X** uses this information to determine the width of the terminal in columns.
  1551. X** If your system has terminfo, define HAS_TERMINFO and define TERMINFO_PATH
  1552. X** as the fully-qualified name of the tput program used with terminfo
  1553. X** (see the example below). If your system has termcap, define HAS_TERMCAP. 
  1554. X** If your system has neither, the width is assumed to be 80 columns. In any
  1555. X** case, the width may be overridden with the -w option. If your system
  1556. X** has both, you can use both with no ill effects. Note that some systems
  1557. X** with both may have information on more terminals in one or the other.
  1558. X** Also note that if you use termcap, you will probably need to modify the
  1559. X** makefile template to include the termcap library in the link.
  1560. X*/
  1561. X/*
  1562. X** #define HAS_TERMINFO
  1563. X** #define TERMINFO_PATH       "/usr/5bin/tput"
  1564. X*/
  1565. X/* #define HAS_TERMCAP */
  1566. X
  1567. X/*
  1568. X** FOPEN: Most systems do not distinguish between binary and text files, so
  1569. X** the defaults of "r" for reading a file and "w" for writing a file are
  1570. X** OK. If your system requires a different string to open a file in raw
  1571. X** (binary) mode, define the appropriate symbol to be the appropriate
  1572. X** string (for example, "rb" and "wb").
  1573. X*/
  1574. X/* #define FOPEN_READ_BINARY   "rb" */
  1575. X/* #define FOPEN_WRITE_BINARY  "wb" */
  1576. X
  1577. X/*
  1578. X** FSEEK: These three symbols are usually already defined in standard
  1579. X** include files. If they are not defined in the standard include files,
  1580. X** they will default to the values shown. If your system requires different
  1581. X** values for the function fseek(), define them here.
  1582. X*/
  1583. X/*
  1584. X** #define SEEK_SET            0
  1585. X** #define SEEK_CUR            1
  1586. X** #define SEEK_END            2
  1587. X*/
  1588. X
  1589. X/*
  1590. X** MEMORY SIZE: Define this symbol if your system limits the maximum size
  1591. X** of a process to 128K or less. In general, only very old systems have
  1592. X** this sort of restriction.
  1593. X*/
  1594. X/* #define SMALL_MEM */
  1595. X
  1596. X/*
  1597. X** MINIMUM MEMORY: This symbol determines the minimum amount of memory
  1598. X** that should be left free after allocating large buffers. It defaults
  1599. X** to 10K bytes. If you experience "out of memory" problems, try increasing
  1600. X** this value. Insufficient memory can also manifest as failures when
  1601. X** opening files and other seemingly-unrelated problems. If you get
  1602. X** inexplicable errors, try increasing this value.
  1603. X*/
  1604. X/* #define MINRAM              10240 */
  1605. X
  1606. X/*
  1607. X** CHOWN USE: Define this symbol if only root (the superuser) can give
  1608. X** away a file with the function chown(). This is true for most BSD-based
  1609. X** systems, and false for most SysIII/SysV-based systems. If you don't
  1610. X** know, leave it undefined -- it won't hurt anything.
  1611. X*/
  1612. X/* #define ROOT_CHOWN */
  1613. X
  1614. X/*
  1615. X** NULL DEVICE: This symbol is the full path to the null device. It
  1616. X** defaults to "/dev/null", which is correct for most systems. If the
  1617. X** null device on your system has a different name, define this symbol
  1618. X** to be the full path to it.
  1619. X*/
  1620. X/* #define NULL_DEVICE          "/dev/null" */
  1621. X
  1622. X
  1623. X
  1624. X/*********************************************
  1625. X** PREFERENCES
  1626. X** Configuration options which are a matter of user preference, affecting
  1627. X** the user interface.
  1628. X*/
  1629. X
  1630. X/*
  1631. X** PROGRESS INDICATOR: If this symbol is defined, it enables a small
  1632. X** progress indicator in the program gifcheck, which is displayed when
  1633. X** a GIF image is being decompressed. On fast systems, the decompression
  1634. X** does take very long, and the progress indicator may become invisible
  1635. X** or appear not to be moving at all. In general, it is only worth
  1636. X** enabling the progress indicator on very slow systems.
  1637. X*/
  1638. X/* #define PROGRESS_IND */
  1639. X
  1640. X/*
  1641. X** COMPLEX SEARCH: If you prefer the DOS symbol usage when specifying
  1642. X** complex patterns to chils, define this symbol. See the manual page
  1643. X** for chils for information on the symbols used.
  1644. X*/
  1645. X/* #define DOS_COMSRCH */
  1646. X
  1647. END_OF_FILE
  1648.   if test 8705 -ne `wc -c <'templates/template.h'`; then
  1649.     echo shar: \"'templates/template.h'\" unpacked with wrong size!
  1650.   fi
  1651.   # end of 'templates/template.h'
  1652. fi
  1653. echo shar: End of archive 4 \(of 18\).
  1654. cp /dev/null ark4isdone
  1655. MISSING=""
  1656. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  1657.     if test ! -f ark${I}isdone ; then
  1658.     MISSING="${MISSING} ${I}"
  1659.     fi
  1660. done
  1661. if test "${MISSING}" = "" ; then
  1662.     echo You have unpacked all 18 archives.
  1663.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1664. else
  1665.     echo You still must unpack the following archives:
  1666.     echo "        " ${MISSING}
  1667. fi
  1668. exit 0
  1669. exit 0 # Just in case...
  1670.