home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sources / misc / 3899 < prev    next >
Encoding:
Text File  |  1992-09-04  |  56.7 KB  |  2,737 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: cpcahil@vti.com (Conor P. Cahill)
  4. Subject:  v32i008:  dbmalloc - Debug Malloc Library PL14, Part03/10
  5. Message-ID: <1992Sep4.151829.12481@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: a13bcfeaac841047b679bf9a0d8e0ed0
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Virtual Technologies, Inc., Dulles VA
  10. References: <csm-v32i005=dbmalloc.101423@sparky.IMD.Sterling.COM>
  11. Date: Fri, 4 Sep 1992 15:18:29 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 2722
  14.  
  15. Submitted-by: cpcahil@vti.com (Conor P. Cahill)
  16. Posting-number: Volume 32, Issue 8
  17. Archive-name: dbmalloc/part03
  18. Environment: C, UNIX
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 3 (of 10)."
  27. # Contents:  calloc.c cctest.c datamc.c datams.c debug.h dgmalloc.c
  28. #   dump.c fill.c tostring.h
  29. # Wrapped by cpcahil@virtech on Thu Sep  3 18:39:18 1992
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'calloc.c' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'calloc.c'\"
  33. else
  34. echo shar: Extracting \"'calloc.c'\" \(4855 characters\)
  35. sed "s/^X//" >'calloc.c' <<'END_OF_FILE'
  36. X
  37. X/*
  38. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  39. X *
  40. X * This software may be distributed freely as long as the following conditions
  41. X * are met:
  42. X *         * the distribution, or any derivative thereof, may not be
  43. X *          included as part of a commercial product
  44. X *        * full source code is provided including this copyright
  45. X *        * there is no charge for the software itself (there may be
  46. X *          a minimal charge for the copying or distribution effort)
  47. X *        * this copyright notice is not modified or removed from any
  48. X *          source file
  49. X */
  50. X#include <stdio.h>
  51. X
  52. X#include "mallocin.h"
  53. X
  54. X#ifndef lint
  55. Xstatic char rcs_header[] = "$Id: calloc.c,v 1.17 1992/08/22 16:27:13 cpcahil Exp $";
  56. X#endif
  57. X
  58. X/*
  59. X * Function:    calloc()
  60. X *
  61. X * Purpose:    to call debug_calloc to do the allocation
  62. X *
  63. X * Arguments:    nelem    - number of elements
  64. X *        elsize    - size of each element
  65. X *
  66. X * Returns:    whatever debug_calloc returns
  67. X *
  68. X * Narrative:    call debug_calloc and return it's return
  69. X */
  70. XDATATYPE *
  71. Xcalloc(nelem,elsize)
  72. X    SIZETYPE       nelem;
  73. X    SIZETYPE      elsize;
  74. X{
  75. X    return( debug_calloc((char *)NULL,(int)-1,nelem,elsize) );
  76. X}
  77. X
  78. X/*
  79. X * Function:    debug_calloc()
  80. X *
  81. X * Purpose:    to allocate and nullify a data area
  82. X *
  83. X * Arguments:    nelem    - number of elements
  84. X *        elsize    - size of each element
  85. X *
  86. X * Returns:    NULL    - if malloc fails
  87. X *        or pointer to allocated space
  88. X *
  89. X * Narrative:    determine size of area to malloc
  90. X *        malloc area.
  91. X *        if malloc succeeds
  92. X *            fill area with nulls
  93. X *        return ptr to malloc'd region
  94. X */
  95. X
  96. XDATATYPE *
  97. Xdebug_calloc(file,line,nelem,elsize)
  98. X    CONST char    * file;
  99. X    int          line;
  100. X    SIZETYPE       nelem;
  101. X    SIZETYPE       elsize;
  102. X{
  103. X    static IDTYPE      call_counter;
  104. X
  105. X    /*
  106. X     * increment call counter
  107. X     */
  108. X    call_counter++;
  109. X
  110. X    return( DBFcalloc("calloc",M_T_CALLOC,call_counter,
  111. X               file,line,nelem,elsize) );
  112. X
  113. X}
  114. X
  115. Xchar *
  116. XDBFcalloc(func,type,call_counter,file,line,nelem,elsize)
  117. X    CONST char    * func;
  118. X    int          type;
  119. X    IDTYPE          call_counter;
  120. X    CONST char    * file;
  121. X    int          line;
  122. X    SIZETYPE       nelem;
  123. X    SIZETYPE       elsize;
  124. X{
  125. X    DATATYPE    * ptr;
  126. X    SIZETYPE      size;
  127. X
  128. X    /*
  129. X     * make sure malloc sub-system is initialized.
  130. X     */
  131. X    MALLOC_INIT();
  132. X
  133. X    /*
  134. X     * calculate the size to allocate
  135. X     */
  136. X    size = elsize * nelem;
  137. X
  138. X    /*
  139. X     * if the user wants to be warned about zero length mallocs, do so
  140. X     */
  141. X    if( ((malloc_opts & MOPT_ZERO) != 0) && (size == 0) )
  142. X    {
  143. X        malloc_errno = M_CODE_ZERO_ALLOC;
  144. X        malloc_warning(func,file,line,(struct mlist *) NULL);
  145. X    }
  146. X
  147. X    ptr = DBFmalloc(func,type,call_counter,file,line,size);
  148. X
  149. X    if( ptr != NULL )
  150. X    {
  151. X        /*
  152. X         * clear the area that was allocated
  153. X         */
  154. X        VOIDCAST memset(ptr,'\0',size);
  155. X    }
  156. X
  157. X    return(ptr);
  158. X
  159. X} /* DBFcalloc(... */
  160. X
  161. X/*
  162. X * Function:    cfree()
  163. X *
  164. X * Purpose:    to free an area allocated by calloc (actually frees any
  165. X *        allocated area)
  166. X *
  167. X * Arguments:    cptr    - pointer to area to be freed
  168. X *
  169. X * Returns:    nothing of any use
  170. X *
  171. X * Narrative:    just call the appropriate function to perform the free
  172. X *
  173. X * Note:    most systems do not have such a call, but for the few that do,
  174. X *        it is here.
  175. X */
  176. XFREETYPE
  177. Xcfree( cptr )
  178. X    DATATYPE    * cptr;
  179. X{
  180. X    debug_cfree((CONST char *)NULL,(int)-1, cptr);
  181. X}
  182. X
  183. XFREETYPE
  184. Xdebug_cfree(file,line,cptr)
  185. X    CONST char    * file;
  186. X    int          line;
  187. X    DATATYPE    * cptr;
  188. X{
  189. X    static IDTYPE      call_counter;
  190. X
  191. X    call_counter++;    
  192. X
  193. X    DBFfree("cfree",F_T_CFREE,call_counter,file,line,cptr);
  194. X}
  195. X
  196. X/*
  197. X * $Log: calloc.c,v $
  198. X * Revision 1.17  1992/08/22  16:27:13  cpcahil
  199. X * final changes for pl14
  200. X *
  201. X * Revision 1.16  1992/07/12  15:30:58  cpcahil
  202. X * Merged in Jonathan I Kamens' changes
  203. X *
  204. X * Revision 1.15  1992/07/03  00:03:25  cpcahil
  205. X * more fixes for pl13, several suggestons from Rich Salz.
  206. X *
  207. X * Revision 1.14  1992/04/22  18:17:32  cpcahil
  208. X * added support for Xt Alloc functions, linted code
  209. X *
  210. X * Revision 1.13  1992/04/13  03:06:33  cpcahil
  211. X * Added Stack support, marking of non-leaks, auto-config, auto-testing
  212. X *
  213. X * Revision 1.12  1992/01/30  12:23:06  cpcahil
  214. X * renamed mallocint.h -> mallocin.h
  215. X *
  216. X * Revision 1.11  1992/01/10  17:28:03  cpcahil
  217. X * Added support for overriding void datatype
  218. X *
  219. X * Revision 1.10  1991/12/06  17:58:42  cpcahil
  220. X * added cfree() for compatibility with some wierd systems
  221. X *
  222. X * Revision 1.9  91/12/02  19:10:08  cpcahil
  223. X * changes for patch release 5
  224. X * 
  225. X * Revision 1.8  91/11/25  14:41:51  cpcahil
  226. X * Final changes in preparation for patch 4 release
  227. X * 
  228. X * Revision 1.7  91/11/24  00:49:21  cpcahil
  229. X * first cut at patch 4
  230. X * 
  231. X * Revision 1.6  90/05/11  00:13:07  cpcahil
  232. X * added copyright statment
  233. X * 
  234. X * Revision 1.5  90/02/24  20:41:57  cpcahil
  235. X * lint changes.
  236. X * 
  237. X * Revision 1.4  90/02/24  17:25:47  cpcahil
  238. X * changed $header to $id so full path isn't included.
  239. X * 
  240. X * Revision 1.3  90/02/24  13:32:24  cpcahil
  241. X * added function header.  moved log to end of file.
  242. X * 
  243. X * Revision 1.2  90/02/22  23:08:26  cpcahil
  244. X * fixed rcs_header line
  245. X * 
  246. X * Revision 1.1  90/02/22  23:07:38  cpcahil
  247. X * Initial revision
  248. X * 
  249. X */
  250. END_OF_FILE
  251. if test 4855 -ne `wc -c <'calloc.c'`; then
  252.     echo shar: \"'calloc.c'\" unpacked with wrong size!
  253. fi
  254. # end of 'calloc.c'
  255. fi
  256. if test -f 'cctest.c' -a "${1}" != "-c" ; then 
  257.   echo shar: Will not clobber existing file \"'cctest.c'\"
  258. else
  259. echo shar: Extracting \"'cctest.c'\" \(10577 characters\)
  260. sed "s/^X//" >'cctest.c' <<'END_OF_FILE'
  261. X/*
  262. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  263. X *
  264. X * This software may be distributed freely as long as the following conditions
  265. X * are met:
  266. X *         * the distribution, or any derivative thereof, may not be
  267. X *          included as part of a commercial product
  268. X *        * full source code is provided including this copyright
  269. X *        * there is no charge for the software itself (there may be
  270. X *          a minimal charge for the copying or distribution effort)
  271. X *        * this copyright notice is not modified or removed from any
  272. X *          source file
  273. X */
  274. X#if __STDC__ || __cplusplus
  275. X# define __stdcargs(s) s
  276. X#else
  277. X# define __stdcargs(s) ()
  278. X#endif
  279. X
  280. X#ifdef USE_STDLIB
  281. X#include <stdlib.h>
  282. X#endif
  283. X#ifdef USE_UNISTD
  284. X#include <unistd.h>
  285. X#endif
  286. X#ifdef USE_MALLOC
  287. X#include <malloc.h>
  288. X#endif
  289. X#ifdef USE_MEMORY_H
  290. X#include <memory.h>
  291. X#endif
  292. X#ifdef USE_STRING_H
  293. X#include <string.h>
  294. X#endif
  295. X#ifdef USE_SYSENT
  296. X#include <sysent.h>
  297. X#endif
  298. X
  299. X
  300. X/*
  301. X * $Id: cctest.c,v 1.12 1992/08/22 16:27:13 cpcahil Exp $
  302. X */
  303. X/*
  304. X * This file is not a real source file for the malloc library.  The
  305. X * configuration utility uses this file to test the various compiler
  306. X * settings that can be used by the library.
  307. X */
  308. X
  309. X#ifdef VOIDTEST
  310. X    /*
  311. X     * testing to see if the void datatype is used by this system
  312. X     */
  313. X    void *
  314. X    function()
  315. X    {
  316. X        static void * t;
  317. X
  318. X        return(t);
  319. X    }
  320. X#endif
  321. X
  322. X#ifdef EXITTEST
  323. X
  324. X/*
  325. X * determine the return type of exit
  326. X */
  327. X#if __cplusplus
  328. X    extern "C" {
  329. X#endif
  330. X        EXITTYPE exit __stdcargs((int));
  331. X#if __cplusplus
  332. X    }
  333. X#endif
  334. X#if __cplusplus || __STDC__
  335. X#include <stdio.h>
  336. Xmain(int argc, char *argv[])
  337. X#else
  338. Xmain(argc,argv)
  339. X    int      argc;
  340. X    char    * argv[];
  341. X#endif
  342. X{
  343. X
  344. X    /*
  345. X     * this bogus stuff is here simply to get c++ to shut-up about
  346. X      * unreferenced parameters.
  347. X     */
  348. X    if( argv[argc] == "hello" )
  349. X    {
  350. X        printf("hello\n");
  351. X    }
  352. X    return(0);
  353. X}
  354. X#endif /* EXITTEST */
  355. X
  356. X#ifdef SETENVTEST
  357. X/*
  358. X * determine if setenv is supported
  359. X */
  360. X#if __cplusplus || __STDC__
  361. X#include <stdio.h>
  362. Xmain(int argc, char *argv[])
  363. X#else
  364. Xmain(argc,argv)
  365. X    int      argc;
  366. X    char    * argv[];
  367. X#endif
  368. X{
  369. X#ifdef setenv
  370. X#undef setenv
  371. X#endif
  372. X
  373. X    setenv("TESTSYM","YES",1);
  374. X
  375. X    /*
  376. X     * this bogus stuff is here simply to get c++ to shut-up about
  377. X      * unreferenced parameters.
  378. X     */
  379. X    if( argv[argc] == "hello" )
  380. X    {
  381. X        printf("hello\n");
  382. X    }
  383. X    return(0);
  384. X}
  385. X#endif /* SETENVTEST */
  386. X
  387. X#ifdef MALLOCHTEST
  388. X#include <malloc.h>
  389. X#endif
  390. X#ifdef ANSIHEADERTEST
  391. X#include <stdlib.h>
  392. X#endif
  393. X#ifdef POSIXHEADERTEST
  394. X#include <unistd.h>
  395. X#endif
  396. X
  397. X#if defined(MALLOCHTEST) || defined(ANSIHEADERTEST) || defined(POSIXHEADERTEST)
  398. X/*
  399. X * determine if certain headers are available
  400. X */
  401. X#if __cplusplus || __STDC__
  402. Xmain(int argc, char *argv[])
  403. X#else
  404. Xmain(argc,argv)
  405. X    int      argc;
  406. X    char    * argv[];
  407. X#endif
  408. X{
  409. X    /*
  410. X     * this bogus stuff is here simply to get c++ to shut-up about
  411. X      * unreferenced parameters.
  412. X     */
  413. X    if( argv[argc] == "hello" )
  414. X    {
  415. X        printf("hello\n");
  416. X    }
  417. X    return(0);
  418. X}
  419. X#endif /* MALLOCHTEST || ANSIHEADERTEST || POSIXHEADERTEST */
  420. X
  421. X#ifdef ASM_UNDTEST
  422. X/*
  423. X * test requirement for underscores in external symbols
  424. X */
  425. X#if __cplusplus || __STDC__
  426. X#include <stdio.h>
  427. Xmain(int argc, char *argv[])
  428. X#else
  429. Xmain(argc,argv)
  430. X    int      argc;
  431. X    char    * argv[];
  432. X#endif
  433. X{
  434. X    int      myroutine();
  435. X
  436. X#if i386
  437. X    printf("OK\n", myroutine());
  438. X#else
  439. X    printf("NOT OK\n");
  440. X#endif
  441. X
  442. X}
  443. X
  444. X#ifdef i386
  445. X    asm("    .globl _myroutine");
  446. X    asm("_myroutine:");
  447. X    asm("    xor %eax");
  448. X    asm("   ret");
  449. X#endif
  450. X
  451. X
  452. X#endif /* ASM_UNDTEST */
  453. X
  454. X
  455. X#ifdef ASM_REPTEST
  456. X/*
  457. X * test requirement for underscores in external symbols
  458. X */
  459. X#if __cplusplus || __STDC__
  460. X#include <stdio.h>
  461. Xmain(int argc, char *argv[])
  462. X#else
  463. Xmain(argc,argv)
  464. X    int      argc;
  465. X    char    * argv[];
  466. X#endif
  467. X{
  468. X    int      myroutine();
  469. X
  470. X#if i386
  471. X    printf("OK\n", myroutine());
  472. X#else
  473. X    printf("NOT OK\n");
  474. X#endif
  475. X
  476. X}
  477. X
  478. X#ifdef i386
  479. X#ifdef USE_UNDERSCORE
  480. X    asm("    .globl _myroutine");
  481. X    asm("_myroutine:");
  482. X#else
  483. X    asm("    .globl myroutine");
  484. X    asm("myroutine:");
  485. X#endif
  486. X    asm("    xor %ecx");
  487. X    asm("    repe");
  488. X    asm("   ret");
  489. X#endif
  490. X
  491. X
  492. X#endif /* ASM_REPTEST */
  493. X
  494. X#ifdef CONSTTEST
  495. X    /*
  496. X     * testing to see if the void datatype is used by this system
  497. X     */
  498. X    const char *
  499. X    function()
  500. X    {
  501. X        static const char t[] = "hello";
  502. X
  503. X        return(t);
  504. X    }
  505. X#endif
  506. X
  507. X#ifdef MALLOC_COMPILETEST
  508. X
  509. X#if __cplusplus
  510. XDATATYPE * malloc( SIZETYPE size)
  511. X#else
  512. XDATATYPE *
  513. Xmalloc( size)
  514. X    SIZETYPE     size;
  515. X#endif
  516. X{
  517. X    if( size > 0 )
  518. X    {
  519. X        return(0);
  520. X    }
  521. X    
  522. X    return(0);
  523. X}
  524. X
  525. X#endif /* MALLOC_COMPILETEST */
  526. X
  527. X#ifdef FREE_COMPILETEST
  528. X
  529. X#if __cplusplus
  530. XFREETYPE free( DATATYPE *data)
  531. X#else
  532. XFREETYPE
  533. Xfree(data)
  534. X    DATATYPE *data;
  535. X#endif
  536. X{
  537. X    if( ! data )
  538. X    {
  539. X        printf("foo\n");
  540. X    }
  541. X}
  542. X
  543. X#endif /* FREE_COMPILETEST */
  544. X
  545. X#ifdef MEM_COMPILETEST
  546. X
  547. XMEMDATA *memcpy __stdcargs((MEMDATA *ptr1, CONST MEMDATA *ptr2, register MEMSIZE len));
  548. X
  549. X#if __cplusplus
  550. XMEMDATA * memccpy(
  551. X    MEMDATA        * ptr1,
  552. X    CONST MEMDATA    * ptr2,
  553. X    int          ch,
  554. X    MEMSIZE          len )
  555. X#else
  556. XMEMDATA *
  557. Xmemccpy(ptr1,ptr2,ch,len)
  558. X    MEMDATA        * ptr1;
  559. X    CONST MEMDATA    * ptr2;
  560. X    int          ch;
  561. X    MEMSIZE          len;
  562. X#endif
  563. X{
  564. X    /*
  565. X     * just make use of all the passed arguments so that we don't get bogus
  566. X     * warning messages about unused arguments.  What we do doesn't have
  567. X     * to make sense since we aren't going to run this.
  568. X     */
  569. X    if( (ptr1 == ptr2) && (ch != len) )
  570. X    {
  571. X        return(ptr1);
  572. X    }
  573. X    return(memcpy(ptr1,ptr2,len));
  574. X}
  575. X
  576. X#endif /* MEM_COMPILETEST */
  577. X
  578. X#ifdef STR_COMPILETEST
  579. X
  580. X#include <string.h>
  581. X#if __cplusplus
  582. XSTRSIZE strlen( CONST char * str1 )
  583. X#else
  584. XSTRSIZE
  585. Xstrlen(str1)
  586. X    CONST char * str1;
  587. X#endif
  588. X{
  589. X    if( str1[0] != '\0')
  590. X    {
  591. X        return(1);
  592. X    }
  593. X    return(0);
  594. X}
  595. X
  596. X#endif /* STR_COMPILETEST */
  597. X
  598. X#ifdef WRT_COMPILETEST
  599. X#if __cplusplus
  600. Xint write(int fd, CONST char * buf, WRTSIZE size)
  601. X#else
  602. Xint
  603. Xwrite(fd,buf,size)
  604. X     int          fd;
  605. X     CONST char    * buf;
  606. X     WRTSIZE      size;
  607. X#endif
  608. X{
  609. X    if( buf[fd] == (CONST char) size)
  610. X    {
  611. X        return(1);
  612. X    }
  613. X    return(0);
  614. X}
  615. X
  616. X#endif /* WRT_COMPILETEST */
  617. X
  618. X
  619. X#ifdef PRE_DEFINES
  620. X
  621. X/*
  622. X * this is used by the Configure script to get the compiler pre-defined symbol
  623. X * for this
  624. X */
  625. X#if __cplusplus
  626. X#include <stdio.h>
  627. Xmain(int argc, char *argv[])
  628. X#else
  629. Xmain(argc,argv)
  630. X    int      argc;
  631. X    char    * argv[];
  632. X#endif
  633. X{
  634. X    int      varcnt = 0;
  635. X
  636. X#if __GNUC__
  637. X    if (__GNUC__ > 1)
  638. X        printf("(__GNUC__ == %d)", __GNUC__);
  639. X    else
  640. X        printf("__GNUC__");
  641. X    varcnt++;
  642. X#endif
  643. X#if __STDC__ 
  644. X    if( varcnt > 0 )
  645. X    {
  646. X        printf(" && ");
  647. X    }
  648. X    printf("__STDC__");
  649. X    varcnt++;
  650. X#endif
  651. X#if __HIGHC__ 
  652. X    if( varcnt > 0 )
  653. X    {
  654. X        printf(" && ");
  655. X    }
  656. X    printf("__HIGHC__");
  657. X    varcnt++;
  658. X#endif
  659. X#if __C89__ 
  660. X    if( varcnt > 0 )
  661. X    {
  662. X        printf(" && ");
  663. X    }
  664. X    printf("__C89__");
  665. X    varcnt++;
  666. X#endif
  667. X#if __cplusplus
  668. X    if( varcnt > 0 )
  669. X    {
  670. X        printf(" && ");
  671. X    }
  672. X    /*
  673. X     * this bogus stuff is here simply to get c++ to shut-up about
  674. X      * unreferenced parameters.
  675. X     */
  676. X    if( argv[argc] == "hello" )
  677. X    {
  678. X        printf("hello\n");
  679. X    }
  680. X    printf("__cplusplus");
  681. X    varcnt++;
  682. X#endif
  683. X
  684. X    /*
  685. X     * if we found no pre-defines, print out the word none, so we can tell the
  686. X     * difference between compilation failures and no pre-defs.
  687. X     */
  688. X    if( varcnt == 0 )
  689. X    {
  690. X        printf("none");
  691. X        varcnt++;
  692. X    }
  693. X
  694. X    if( varcnt > 0 )
  695. X    {
  696. X        printf("\n");
  697. X    }
  698. X    return(0);
  699. X}
  700. X
  701. X#endif /* PRE_DEFINES */
  702. X    
  703. X
  704. X#ifdef SIGIOTTEST
  705. X#include <sys/types.h>
  706. X#include <signal.h>
  707. X    int
  708. X    function()
  709. X    {
  710. X        int signal = SIGIOT;
  711. X        return(signal);
  712. X    }
  713. X#endif
  714. X#ifdef SIGABRTTEST
  715. X#include <sys/types.h>
  716. X#include <signal.h>
  717. X    int
  718. X    function()
  719. X    {
  720. X        int signal = SIGABRT;
  721. X        return(signal);
  722. X    }
  723. X#endif
  724. X
  725. X#ifdef CHANGESTR
  726. X
  727. X#include <stdio.h>
  728. X
  729. X#define FILEBUFSIZE    (50*1024)
  730. X
  731. Xchar iobuffer[FILEBUFSIZE];
  732. X
  733. Xmain(argc,argv)
  734. X    int          argc;
  735. X    char        * argv[];
  736. X{
  737. X    unsigned int      cnt;
  738. X    FILE        * fp;
  739. X    unsigned int      i;
  740. X    int          len;
  741. X    char        * src;
  742. X    char        * tgt;
  743. X
  744. X    if( argc != 4 )
  745. X    {
  746. X        fprintf(stderr,"Usage: changestr file oldstr newstr\n");
  747. X        exit(1);
  748. X    }
  749. X    src = argv[2];
  750. X    tgt = argv[3];
  751. X
  752. X    /*
  753. X     * get length of strings (note that we don't ensure that both strings
  754. X     * are the same length and
  755. X     */
  756. X    len = strlen(src);
  757. X    i   = strlen(tgt);
  758. X    if( i > len )
  759. X    {
  760. X        fprintf(stderr,"Error: second string cannot be longer %s\n",
  761. X                "than first string");
  762. X        exit(2);
  763. X    }
  764. X
  765. X    fp = fopen(argv[1],"r+");
  766. X
  767. X    if( fp == NULL )
  768. X    {
  769. X        fprintf(stderr,"Can't open %s\n",argv[1]);
  770. X        exit(3);
  771. X    }
  772. X
  773. X    /*
  774. X     * read the entire file in (note that if the file is bigger
  775. X     * than the specified blocksize, we won't be able to
  776. X     * process it.
  777. X     */
  778. X
  779. X    cnt = fread(iobuffer,1,FILEBUFSIZE,fp);
  780. X    if( cnt <= 0 )
  781. X    {
  782. X        fprintf(stderr,"Read error when reading %s\n",argv[1]);
  783. X        exit(4);
  784. X    }
  785. X
  786. X    for(i=0; i < (cnt-len); i++)
  787. X    {
  788. X        if( memcmp(iobuffer+i,src,len) == 0 )
  789. X        {
  790. X            memcpy(iobuffer+i,tgt,len);
  791. X            i += len-1;
  792. X        }
  793. X    }
  794. X
  795. X    if( fseek(fp,0L,0) != 0 )
  796. X    {
  797. X        fprintf(stderr,"Failed to seek to correct location\n");
  798. X        exit(5);
  799. X    }
  800. X
  801. X    if( fwrite(iobuffer,1,cnt,fp) != cnt )
  802. X    {
  803. X        fprintf(stderr,"Failed to write new data\n");
  804. X        exit(6);
  805. X    }
  806. X
  807. X    fclose(fp);
  808. X    
  809. X    exit(0);
  810. X} 
  811. X
  812. X
  813. X#endif /* CHNAGESTR */
  814. X
  815. X
  816. X#ifdef TESTDATAMC
  817. X
  818. X#include <stdio.h>
  819. X
  820. Xmain(argc,argv)
  821. X    int          argc;
  822. X    char        * argv[];
  823. X{
  824. X    char          buffer[30];
  825. X
  826. X    buffer[0] = '\0';
  827. X    buffer[1] = '\0';
  828. X    buffer[2] = '\0';
  829. X    buffer[3] = '\0';
  830. X    buffer[4] = '\0';
  831. X    buffer[5] = '\0';
  832. X    buffer[6] = '\0';
  833. X    buffer[7] = '\0';
  834. X    buffer[8] = '\0';
  835. X
  836. X    DataMC(buffer, "   y",5);
  837. X    DataMC(buffer+4, "yy",3);
  838. X
  839. X    DataMC(buffer+1, buffer,7);
  840. X    DataMC(buffer,   "x",1);
  841. X
  842. X    printf("%s\n",buffer);
  843. X
  844. X    return(0);
  845. X}
  846. X
  847. X/*
  848. X * we need to have our own memcpy here in order to find out if there will be
  849. X * some problem where the kludged version of memcpy (now should be named 
  850. X * DataMC) at least one system (SGI) has gotten into an infinite loop
  851. X * when the modified DataMC ended up calling the library's memcpy
  852. X */
  853. Xmemcpy()
  854. X{
  855. X    write(1,"Infinite loop\n",14);
  856. X    exit(1);
  857. X}
  858. X
  859. X#endif /* TESTDATAMC */
  860. X
  861. X#ifdef TESTDATAMS
  862. X#include <stdio.h>
  863. X
  864. Xmain(argc,argv)
  865. X    int          argc;
  866. X    char        * argv[];
  867. X{
  868. X    char          buffer[30];
  869. X
  870. X    buffer[0] = '\0';
  871. X    buffer[1] = '\0';
  872. X    buffer[2] = '\0';
  873. X    buffer[3] = '\0';
  874. X    buffer[4] = '\0';
  875. X    buffer[5] = '\0';
  876. X    buffer[6] = '\0';
  877. X    buffer[7] = '\0';
  878. X    buffer[8] = '\0';
  879. X    buffer[9] = '\0';
  880. X    buffer[10] = '\0';
  881. X
  882. X    DataMS(buffer,  'x',1);
  883. X    DataMS(buffer+1,' ',3);
  884. X    DataMS(buffer+4,'y',3);
  885. X
  886. X    printf("%s\n",buffer);
  887. X}
  888. X
  889. Xmemset()
  890. X{
  891. X    write(1,"Infinite loop\n",14);
  892. X    exit(1);
  893. X}
  894. X
  895. X#endif /* TESTDATAMS */
  896. X
  897. X#ifdef COMPARETEST 
  898. X
  899. X#include <stdio.h>
  900. X#include <string.h>
  901. X
  902. X#if __cplusplus
  903. X#include <stdlib.h>
  904. Xmain(int argc, char *argv[])
  905. X#else
  906. Xmain(argc,argv)
  907. X    int      argc;
  908. X    char    * argv[];
  909. X#endif
  910. X{
  911. X    char          buffer[10];
  912. X    char          buf2[10];
  913. X    int          result;
  914. X
  915. X    buffer[0] = 'a';
  916. X    buffer[1] = '\0';
  917. X    buf2[0]   = 0xff;
  918. X    buf2[1] = '\0';
  919. X
  920. X    /*
  921. X     * just to get c++ and some ANSI C compilers to shutup.  argc will
  922. X     * be more than 1 when running this test.
  923. X     */
  924. X    if( argc > 10 )
  925. X    {
  926. X        result = strcmp(argv[0],"junkstr");
  927. X    }
  928. X    else
  929. X    {
  930. X        result = COMPARETEST (buffer,buf2,1);
  931. X    }
  932. X
  933. X#ifdef TESTCHAR
  934. X    result = -result;
  935. X#endif
  936. X
  937. X    if( result < 0 )
  938. X    {
  939. X        exit(0);
  940. X    }
  941. X    else
  942. X    {
  943. X        exit(1);
  944. X    }
  945. X
  946. X}
  947. X    
  948. X
  949. X#endif /* COMPARETEST */
  950. END_OF_FILE
  951. if test 10577 -ne `wc -c <'cctest.c'`; then
  952.     echo shar: \"'cctest.c'\" unpacked with wrong size!
  953. fi
  954. # end of 'cctest.c'
  955. fi
  956. if test -f 'datamc.c' -a "${1}" != "-c" ; then 
  957.   echo shar: Will not clobber existing file \"'datamc.c'\"
  958. else
  959. echo shar: Extracting \"'datamc.c'\" \(6395 characters\)
  960. sed "s/^X//" >'datamc.c' <<'END_OF_FILE'
  961. X
  962. X/*
  963. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  964. X *
  965. X * This software may be distributed freely as long as the following conditions
  966. X * are met:
  967. X *         * the distribution, or any derivative thereof, may not be
  968. X *          included as part of a commercial product
  969. X *        * full source code is provided including this copyright
  970. X *        * there is no charge for the software itself (there may be
  971. X *          a minimal charge for the copying or distribution effort)
  972. X *        * this copyright notice is not modified or removed from any
  973. X *          source file
  974. X */
  975. X
  976. X/*
  977. X * datamc.c - this module contains functions designed to efficiently 
  978. X *          copy memory areas in a portable fasion
  979. X *
  980. X * The configure script will usually override this module with a copy
  981. X * of the system suplied memcpy() utility if it can figure out how to
  982. X * convert the module name to DataMS.
  983. X */
  984. X#ifndef lint
  985. Xstatic
  986. Xchar rcs_hdr[] = "$Id: datamc.c,v 1.7 1992/08/22 16:27:13 cpcahil Exp $";
  987. X#endif
  988. X
  989. X#include <stdio.h>
  990. X#include "mallocin.h"
  991. X
  992. Xtypedef int word;
  993. X
  994. X#define wordmask (sizeof(word)-1)
  995. X
  996. X#ifndef DONT_USE_ASM
  997. X#ifdef i386
  998. X#define ASM_MEMCPY    1
  999. X
  1000. X/*
  1001. X * DataMemcpy() - asm version of memcpy for use on 386 architecture systems.
  1002. X *          This is much faster than performing the operation directly.
  1003. X *          Note that the operation is performed by the use of word
  1004. X *          moves followed by byte moves and it doesn't matter that
  1005. X *          the word moves are not on a word aligned offset.
  1006. X *
  1007. X * This function differs from the system memcpy in that it correcly handles
  1008. X * overlapping memory regions.  This is a requirement here because this is
  1009. X * the same function that is called from memmove, memcpy, and bcopy.
  1010. X */
  1011. X/*
  1012. X * DataMemcpy(tgt,src,len)
  1013. X */
  1014. X    asm("    .text");
  1015. X    asm("    .align 4");
  1016. X#ifdef USE_UNDERSCORE
  1017. X    asm("    .globl _DataMC");
  1018. X    asm("_DataMC:");
  1019. X#else
  1020. X    asm("    .globl DataMC");
  1021. X    asm("DataMC:");
  1022. X#endif
  1023. X    asm("    pushl  %edi");
  1024. X    asm("    pushl  %esi");
  1025. X    asm("    pushl  %ebx");
  1026. X
  1027. X    /*
  1028. X     * get tgt -> edi
  1029. X     *     src -> esi
  1030. X     *     len -> ecx
  1031. X     */
  1032. X    asm("    movl   16(%esp),%edi");
  1033. X    asm("    movl   20(%esp),%esi");
  1034. X    asm("    movl   24(%esp),%ecx");
  1035. X
  1036. X    /*
  1037. X     * compare target to src
  1038. X     */
  1039. X     asm("    cmpl   %edi,%esi");
  1040. X    /*
  1041. X     * if( tgt == src ) nothing to do, so return
  1042. X     */
  1043. X    asm("   je     .memdone"); 
  1044. X    /*
  1045. X     * if(    (tgt > src)
  1046. X     */
  1047. X    asm("    jg     .movenorm");
  1048. X    /*
  1049. X     *     &&  tgt < (src + len)
  1050. X     */
  1051. X    asm("    movl    %esi,%eax");
  1052. X    asm("    addl    %ecx,%eax");
  1053. X    asm("    cmpl    %edi,%eax");
  1054. X    asm("   jl    .movenorm");
  1055. X
  1056. X    /*
  1057. X     * {
  1058. X     */
  1059. X        /*
  1060. X         * move the pointers to the end of the data area to be 
  1061. X         * moved and set the direction flag so that 
  1062. X         */
  1063. X
  1064. X        /*
  1065. X         *     && ( len >= 4 ) )
  1066. X         */
  1067. X        asm("    cmpl    $4,%ecx");
  1068. X        asm("    jl    .moveshort");
  1069. X        /*
  1070. X         * {
  1071. X         */
  1072. X
  1073. X            asm("    addl    %ecx,%edi");
  1074. X            asm("    subl    $4,%edi");
  1075. X            asm("    addl    %ecx,%esi");
  1076. X            asm("    subl    $4,%esi");
  1077. X            asm("    xor    %ebx,%ebx");
  1078. X            asm("    jmp    .moveback");
  1079. X        /* 
  1080. X          * }
  1081. X         * else
  1082. X         * {
  1083. X          */
  1084. X            asm("    addl    %ecx,%edi");
  1085. X            asm("    addl    %ecx,%esi");
  1086. X            asm(".moveshort:");
  1087. X            asm("    movl    $1,%ebx");
  1088. X        /* 
  1089. X         * }
  1090. X          */
  1091. X        asm(".moveback:");
  1092. X        asm("    std");
  1093. X        asm("    jmp    .movedata");
  1094. X    /*
  1095. X     * }
  1096. X     * else
  1097. X     * {
  1098. X      */
  1099. X        asm(".movenorm:");
  1100. X        asm("    mov    $1,%ebx");
  1101. X
  1102. X    /*
  1103. X     * }
  1104. X     */
  1105. X
  1106. X    /*
  1107. X     * now go move the data
  1108. X     */
  1109. X    asm(".movedata:");
  1110. X    asm("    movl   %edi,%eax");
  1111. X    asm("    movl   %ecx,%edx");
  1112. X    asm("    shrl   $02,%ecx");
  1113. X#ifdef USE_REPE
  1114. X    asm("    repe");
  1115. X#else
  1116. X    asm("    repz");
  1117. X#endif
  1118. X    asm("    movsl ");
  1119. X
  1120. X    /*
  1121. X     * if we were performing a negative move, adjust the pointer
  1122. X     * so that it points to the previous byte (right now it points
  1123. X      * to the previous word
  1124. X     */
  1125. X    asm("    cmpl    $0,%ebx");
  1126. X    asm("   jnz    .movedata2");
  1127. X    /*
  1128. X     * {
  1129. X     */
  1130. X        asm("    addl    $3,%edi");
  1131. X        asm("    addl    $3,%esi");
  1132. X    /* 
  1133. X     * }
  1134. X     */
  1135. X
  1136. X    asm(".movedata2:");    
  1137. X    asm("    movl   %edx,%ecx");
  1138. X    asm("    andl   $03,%ecx");
  1139. X#ifdef USE_REPE
  1140. X    asm("    repe");
  1141. X#else
  1142. X    asm("    repz");
  1143. X#endif
  1144. X    asm("    movsb ");
  1145. X
  1146. X    asm("    cld");
  1147. X
  1148. X    /*
  1149. X     * return
  1150. X     */
  1151. X    asm(".memdone:");
  1152. X    asm("    popl    %ebx");
  1153. X    asm("    popl    %esi");
  1154. X    asm("    popl    %edi");
  1155. X    asm("    ret");
  1156. X
  1157. X
  1158. X#endif /* i386 */
  1159. X#endif /* DONT_USE_ASM */
  1160. X
  1161. X#ifndef ASM_MEMCPY
  1162. X
  1163. Xvoid
  1164. XDataMC(ptr1,ptr2,len)
  1165. X    MEMDATA            * ptr1;
  1166. X    CONST MEMDATA        * ptr2;
  1167. X    MEMSIZE              len;
  1168. X{
  1169. X    register MEMSIZE      i;
  1170. X    register char        * myptr1;
  1171. X    register CONST char    * myptr2;
  1172. X
  1173. X    if( len <= 0 )
  1174. X    {
  1175. X        return;
  1176. X    }
  1177. X
  1178. X    myptr1 = ptr1;
  1179. X    myptr2 = ptr2;
  1180. X
  1181. X    /*
  1182. X     * while the normal memcpy does not guarrantee that it will 
  1183. X     * handle overlapping memory correctly, we will try...
  1184. X     */
  1185. X    if( (myptr1 > myptr2) && (myptr1 < (myptr2+len)) )
  1186. X    {
  1187. X        myptr1 += len;
  1188. X        myptr2 += len;
  1189. X
  1190. X        if( (((long)myptr1)&wordmask) == (((long)myptr2)&wordmask))
  1191. X        {
  1192. X            /*
  1193. X             * if the pointer is not on an even word boundary
  1194. X             */
  1195. X            if( (i = (((long)myptr1) & wordmask)) != 0 )
  1196. X            {
  1197. X                /*
  1198. X                 * process an extra byte at the word boundary
  1199. X                 * itself
  1200. X                 */
  1201. X                while( (i-- > 0) && (len > 0) )
  1202. X                {
  1203. X                    *(--myptr1) = *(--myptr2);
  1204. X                    len--;
  1205. X                }
  1206. X            }
  1207. X
  1208. X            /*
  1209. X             * convert remaining number of bytes to number of words
  1210. X             */
  1211. X            i = len >> (sizeof(word)/2);
  1212. X
  1213. X            /*
  1214. X             * and copy them
  1215. X             */
  1216. X            while( i-- > 0 )
  1217. X            {
  1218. X                myptr1 -= sizeof(word);
  1219. X                myptr2 -= sizeof(word);
  1220. X                *(word *)myptr1 = *(CONST word *)myptr2;
  1221. X            }
  1222. X
  1223. X            /*
  1224. X             * and now handle any trailing bytes
  1225. X             */
  1226. X            if( (i = (len & wordmask)) != 0 )
  1227. X            {
  1228. X                while( i-- > 0 )
  1229. X                {
  1230. X                    *(--myptr1) = *(--myptr2);
  1231. X                }
  1232. X            }
  1233. X        }
  1234. X        /*
  1235. X         * else we have to do it on a byte by byte basis
  1236. X         */
  1237. X        else
  1238. X        {
  1239. X            while( len-- > 0 )
  1240. X            {
  1241. X                *(--myptr1) = *(--myptr2);
  1242. X            }
  1243. X        }
  1244. X    }
  1245. X    else
  1246. X    {
  1247. X        /*
  1248. X         * if we can make this move on even boundaries
  1249. X         */
  1250. X        if( (((long)myptr1)&wordmask) == (((long)myptr2)&wordmask) )
  1251. X        {
  1252. X            /*
  1253. X             * if the pointer is not on an even word boundary
  1254. X             */
  1255. X            if( (i = (((long)myptr1) & wordmask)) != 0 )
  1256. X            {
  1257. X                while( (i++ < sizeof(word)) && (len > 0) )
  1258. X                {
  1259. X                    *(myptr1++) = *(myptr2++);
  1260. X                    len--;
  1261. X                }
  1262. X            }
  1263. X
  1264. X            /*
  1265. X             * convert remaining number of bytes to number of words
  1266. X             */
  1267. X            i = len >> (sizeof(word)/2);
  1268. X
  1269. X            /*
  1270. X             * and copy them
  1271. X             */
  1272. X            while( i-- > 0 )
  1273. X            {
  1274. X                *(word *)myptr1 = *(CONST word *)myptr2;
  1275. X                myptr1 += sizeof(word);
  1276. X                myptr2 += sizeof(word);
  1277. X            }
  1278. X
  1279. X            /*
  1280. X             * and now handle any trailing bytes
  1281. X             */
  1282. X            if( (i = (len & wordmask)) != 0 )
  1283. X            {
  1284. X                while( i-- > 0 )
  1285. X                {
  1286. X                    *(myptr1++) = *(myptr2++);
  1287. X                }
  1288. X            }
  1289. X        }
  1290. X        /*
  1291. X         * else we have to handle it a byte at a time
  1292. X         */
  1293. X        else
  1294. X        {
  1295. X            while( len-- > 0 )
  1296. X            {
  1297. X                *(myptr1++) = *(myptr2++);
  1298. X            }
  1299. X        }
  1300. X    }
  1301. X    
  1302. X    return;
  1303. X
  1304. X} /* DataMC(... */
  1305. X
  1306. X#endif /* ASM_MEMCPY */
  1307. X
  1308. END_OF_FILE
  1309. if test 6395 -ne `wc -c <'datamc.c'`; then
  1310.     echo shar: \"'datamc.c'\" unpacked with wrong size!
  1311. fi
  1312. # end of 'datamc.c'
  1313. fi
  1314. if test -f 'datams.c' -a "${1}" != "-c" ; then 
  1315.   echo shar: Will not clobber existing file \"'datams.c'\"
  1316. else
  1317. echo shar: Extracting \"'datams.c'\" \(2609 characters\)
  1318. sed "s/^X//" >'datams.c' <<'END_OF_FILE'
  1319. X
  1320. X/*
  1321. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  1322. X *
  1323. X * This software may be distributed freely as long as the following conditions
  1324. X * are met:
  1325. X *         * the distribution, or any derivative thereof, may not be
  1326. X *          included as part of a commercial product
  1327. X *        * full source code is provided including this copyright
  1328. X *        * there is no charge for the software itself (there may be
  1329. X *          a minimal charge for the copying or distribution effort)
  1330. X *        * this copyright notice is not modified or removed from any
  1331. X *          source file
  1332. X */
  1333. X
  1334. X/*
  1335. X * datams.c - this module contains functions designed to efficiently 
  1336. X *          set memory areas to specified values in a portable fasion.
  1337. X *
  1338. X * The configure script will usually override this module with a copy
  1339. X * of the system suplied memset() utility if it can figure out how to
  1340. X * convert the module name to DataMS.
  1341. X */
  1342. X#ifndef lint
  1343. Xstatic
  1344. Xchar rcs_hdr[] = "$Id: datams.c,v 1.4 1992/08/22 16:27:13 cpcahil Exp $";
  1345. X#endif
  1346. X
  1347. X#include <stdio.h>
  1348. X#include "mallocin.h"
  1349. X
  1350. Xtypedef int word;
  1351. X
  1352. X#define wordmask (sizeof(word)-1)
  1353. X#define FILL_ARRSIZ     256
  1354. X
  1355. Xvoid
  1356. XDataMS(ptr1,ch, len)
  1357. X    MEMDATA            * ptr1;
  1358. X    int              ch;
  1359. X    register MEMSIZE      len;
  1360. X{
  1361. X    MEMSIZE              i;
  1362. X    register unsigned char    * ptr;
  1363. X    word              fillword;
  1364. X    static word          fillwords[FILL_ARRSIZ] = { -1 };
  1365. X
  1366. X    /*
  1367. X     * if nothing to do, return immediatly.
  1368. X     */
  1369. X    if( len <= 0 )
  1370. X    {
  1371. X        return;
  1372. X    }
  1373. X
  1374. X    /*
  1375. X     * if we haven't filled the fillwords array
  1376. X     */
  1377. X    if( fillwords[0] == -1 )
  1378. X    {
  1379. X        int          j;
  1380. X        int          k;
  1381. X
  1382. X        /*
  1383. X         * fill em all at this time.
  1384. X         */
  1385. X        for(k=0; k < FILL_ARRSIZ; k++)
  1386. X        {
  1387. X            ptr = (unsigned char *) &fillwords[k];
  1388. X            for(j=0; j < sizeof(word); j++)
  1389. X            {
  1390. X                *(ptr++) = (unsigned char) k;
  1391. X            }
  1392. X        }
  1393. X    }
  1394. X
  1395. X    /*
  1396. X     * if the character is outside of the proper range, use 255
  1397. X      */
  1398. X    if( ((unsigned)ch) > 0xFF )
  1399. X    {
  1400. X        ch = ((unsigned)ch) & 0xFF;
  1401. X    }
  1402. X
  1403. X    /*
  1404. X     * save the word we will use for filling
  1405. X     */
  1406. X    fillword = fillwords[(unsigned)ch];
  1407. X            
  1408. X
  1409. X    /*
  1410. X     * get the original pointer
  1411. X     */
  1412. X    ptr = (unsigned char *) ptr1;
  1413. X
  1414. X    /*
  1415. X     * if we are not at a word offset, handle the single bytes at the
  1416. X     * begining of the set
  1417. X     */
  1418. X    if( (i = (((long)ptr) & wordmask)) != 0 )
  1419. X    {
  1420. X        i = sizeof(word) - i;
  1421. X        while( (i-- > 0) && (len > 0) )
  1422. X        {
  1423. X            *(ptr++) = ch;
  1424. X            len--;
  1425. X        }
  1426. X    }
  1427. X
  1428. X    /*
  1429. X     * convert remaining number of bytes to number of words
  1430. X     */
  1431. X    i = len >> (sizeof(word)/2);
  1432. X
  1433. X    /*
  1434. X     * and fill them
  1435. X     */
  1436. X    while( i-- )
  1437. X    {
  1438. X        *(word *)ptr = fillword;
  1439. X        ptr += sizeof(word);
  1440. X    }
  1441. X
  1442. X    /*
  1443. X     * and now handle any trailing bytes
  1444. X     */
  1445. X    if( (i = (len & wordmask)) != 0 )
  1446. X    {
  1447. X        while(i-- > 0 )
  1448. X        {
  1449. X            *(ptr++) = ch;
  1450. X        }
  1451. X    }
  1452. X
  1453. X    return;
  1454. X
  1455. X} /* DataMS(... */
  1456. X
  1457. END_OF_FILE
  1458. if test 2609 -ne `wc -c <'datams.c'`; then
  1459.     echo shar: \"'datams.c'\" unpacked with wrong size!
  1460. fi
  1461. # end of 'datams.c'
  1462. fi
  1463. if test -f 'debug.h' -a "${1}" != "-c" ; then 
  1464.   echo shar: Will not clobber existing file \"'debug.h'\"
  1465. else
  1466. echo shar: Extracting \"'debug.h'\" \(3307 characters\)
  1467. sed "s/^X//" >'debug.h' <<'END_OF_FILE'
  1468. X/*
  1469. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  1470. X *
  1471. X * This software may be distributed freely as long as the following conditions
  1472. X * are met:
  1473. X *         * the distribution, or any derivative thereof, may not be
  1474. X *          included as part of a commercial product
  1475. X *        * full source code is provided including this copyright
  1476. X *        * there is no charge for the software itself (there may be
  1477. X *          a minimal charge for the copying or distribution effort)
  1478. X *        * this copyright notice is not modified or removed from any
  1479. X *          source file
  1480. X */
  1481. X/************************************************************************/
  1482. X/*                                    */
  1483. X/* this include sets up some macro functions which can be used while    */
  1484. X/* debugging the program, and then left in the code, but turned of by    */
  1485. X/* just not defining "DEBUG".  This way your production version of     */
  1486. X/* the program will not be filled with bunches of debugging junk    */
  1487. X/*                                    */
  1488. X/************************************************************************/
  1489. X/*
  1490. X * $Id: debug.h,v 1.5 1992/08/22 16:27:13 cpcahil Exp $
  1491. X */
  1492. X
  1493. X#ifdef DEBUG
  1494. X
  1495. X#if DEBUG == 1            /* if default level            */
  1496. X#undef DEBUG
  1497. X#define DEBUG    100        /*   use level 100            */
  1498. X#endif
  1499. X
  1500. X#include <stdio.h>
  1501. X
  1502. X#define DEBUG0(val,str)\
  1503. X                {\
  1504. X                  if( DEBUG > val ) \
  1505. X                    fprintf(stderr,"%s(%d): %s\n",\
  1506. X                        __FILE__,__LINE__,str);\
  1507. X                }
  1508. X#define DEBUG1(val,str,a1)\
  1509. X                    {\
  1510. X                  char _debugbuf[100];\
  1511. X                  if( DEBUG > val )\
  1512. X                   {\
  1513. X                    sprintf(_debugbuf,str,a1);\
  1514. X                    fprintf(stderr,"%s(%d): %s\n",\
  1515. X                        __FILE__,__LINE__,_debugbuf);\
  1516. X                   }\
  1517. X                       }
  1518. X
  1519. X#define DEBUG2(val,str,a1,a2)\
  1520. X                    {\
  1521. X                 char _debugbuf[100];\
  1522. X                  if( DEBUG > val )\
  1523. X                   {\
  1524. X                    sprintf(_debugbuf,str,a1,a2);\
  1525. X                    fprintf(stderr,"%s(%d): %s\n",\
  1526. X                        __FILE__,__LINE__,_debugbuf);\
  1527. X                   }\
  1528. X                       }
  1529. X
  1530. X#define DEBUG3(val,str,a1,a2,a3)\
  1531. X                    {\
  1532. X                  char _debugbuf[100];\
  1533. X                  if( DEBUG > val )\
  1534. X                   {\
  1535. X                    sprintf(_debugbuf,str,a1,a2,a3);\
  1536. X                    fprintf(stderr,"%s(%d): %s\n",\
  1537. X                        __FILE__,__LINE__,_debugbuf);\
  1538. X                   }\
  1539. X                       }
  1540. X
  1541. X#define DEBUG4(val,str,a1,a2,a3,a4)\
  1542. X                     {\
  1543. X                  char _debugbuf[100];\
  1544. X                  if( DEBUG > val )\
  1545. X                   {\
  1546. X                    sprintf(_debugbuf,str,a1,a2,a3,a4);\
  1547. X                    fprintf(stderr,"%s(%d): %s\n",\
  1548. X                        __FILE__,__LINE__,_debugbuf);\
  1549. X                   }\
  1550. X                       }
  1551. X
  1552. X#define DEBUG5(val,str,a1,a2,a3,a4,a5)\
  1553. X                     {\
  1554. X                  char _debugbuf[100];\
  1555. X                  if( DEBUG > val )\
  1556. X                   {\
  1557. X                    sprintf(_debugbuf,str,a1,a2,a3,a4,a5);\
  1558. X                    fprintf(stderr,"%s(%d): %s\n",\
  1559. X                        __FILE__,__LINE__,_debugbuf);\
  1560. X                   }\
  1561. X                       }
  1562. X
  1563. X#else
  1564. X
  1565. X#define DEBUG0(val,s)
  1566. X#define DEBUG1(val,s,a1)
  1567. X#define DEBUG2(val,s,a1,a2)
  1568. X#define DEBUG3(val,s,a1,a2,a3)
  1569. X#define DEBUG4(val,s,a1,a2,a3,a4)
  1570. X#define DEBUG5(val,s,a1,a2,a3,a4,a5)
  1571. X
  1572. X#endif /* DEBUG */
  1573. X
  1574. X
  1575. X/*
  1576. X * $Log: debug.h,v $
  1577. X * Revision 1.5  1992/08/22  16:27:13  cpcahil
  1578. X * final changes for pl14
  1579. X *
  1580. X * Revision 1.4  1992/04/13  03:06:33  cpcahil
  1581. X * Added Stack support, marking of non-leaks, auto-config, auto-testing
  1582. X *
  1583. X * Revision 1.3  1991/11/25  14:41:51  cpcahil
  1584. X * Final changes in preparation for patch 4 release
  1585. X *
  1586. X * Revision 1.2  90/05/11  00:13:08  cpcahil
  1587. X * added copyright statment
  1588. X * 
  1589. X * Revision 1.1  90/02/23  07:09:01  cpcahil
  1590. X * Initial revision
  1591. X * 
  1592. X */
  1593. END_OF_FILE
  1594. if test 3307 -ne `wc -c <'debug.h'`; then
  1595.     echo shar: \"'debug.h'\" unpacked with wrong size!
  1596. fi
  1597. # end of 'debug.h'
  1598. fi
  1599. if test -f 'dgmalloc.c' -a "${1}" != "-c" ; then 
  1600.   echo shar: Will not clobber existing file \"'dgmalloc.c'\"
  1601. else
  1602. echo shar: Extracting \"'dgmalloc.c'\" \(2724 characters\)
  1603. sed "s/^X//" >'dgmalloc.c' <<'END_OF_FILE'
  1604. X
  1605. X/*
  1606. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  1607. X *
  1608. X * This software may be distributed freely as long as the following conditions
  1609. X * are met:
  1610. X *         * the distribution, or any derivative thereof, may not be
  1611. X *          included as part of a commercial product
  1612. X *        * full source code is provided including this copyright
  1613. X *        * there is no charge for the software itself (there may be
  1614. X *          a minimal charge for the copying or distribution effort)
  1615. X *        * this copyright notice is not modified or removed from any
  1616. X *          source file
  1617. X */
  1618. X/*
  1619. X * Author(s):
  1620. X *  pds - Paul D. Smith (paul_smith@dg.com)
  1621. X */
  1622. X/*
  1623. X * This module defines several libc internal interfaces to the allocation
  1624. X * and/or memory routines under DG/UX.
  1625. X */
  1626. X
  1627. X/*
  1628. X * Added "_" components to make sure that libc versions of other
  1629. X * malloc interfaces called by various libc routines (eg. getcwd) that
  1630. X * must be used from libc do not have competing malloc implementations.
  1631. X */
  1632. X#include <stdio.h>
  1633. X#include "mallocin.h"
  1634. X
  1635. XDATATYPE *
  1636. X_malloc(size)
  1637. X    SIZETYPE size;
  1638. X{
  1639. X    return( debug_malloc(NULL,-1,size) );
  1640. X}
  1641. X
  1642. XDATATYPE *
  1643. X_realloc(cptr,size)
  1644. X    DATATYPE  * cptr;
  1645. X    SIZETYPE    size;
  1646. X{
  1647. X    return( debug_realloc(NULL,-1,cptr,size) );
  1648. X}
  1649. X
  1650. XDATATYPE *
  1651. X_calloc(nelem,elsize)
  1652. X    SIZETYPE       nelem;
  1653. X    SIZETYPE       elsize;
  1654. X{
  1655. X    return( debug_calloc(NULL,-1,nelem,elsize) );
  1656. X}
  1657. X
  1658. Xvoid
  1659. X_free(cptr)
  1660. X    DATATYPE    * cptr;
  1661. X{
  1662. X    debug_free(NULL,0,cptr);
  1663. X}
  1664. X
  1665. Xint
  1666. X_mallopt(cmd,value)
  1667. X    int                    cmd;
  1668. X    union dbmalloptarg    value;
  1669. X{
  1670. X    return( dbmallopt(cmd,&value) );
  1671. X}
  1672. X
  1673. XMEMDATA  *
  1674. X_bcopy(ptr2, ptr1, len)
  1675. X    CONST MEMDATA    * ptr2;
  1676. X    MEMDATA        * ptr1;
  1677. X    MEMSIZE          len;
  1678. X{
  1679. X    return( DBbcopy((char *)NULL,0,ptr2,ptr1,len) );
  1680. X}
  1681. X
  1682. XMEMDATA  *
  1683. X_bzero(ptr1, len)
  1684. X    MEMDATA        * ptr1;
  1685. X    MEMSIZE          len;
  1686. X{
  1687. X    return( DBbzero((char *)NULL,0,ptr1,len) );
  1688. X}
  1689. X
  1690. Xint
  1691. X_bcmp(ptr2, ptr1, len)
  1692. X    CONST MEMDATA    * ptr1;
  1693. X    CONST MEMDATA    * ptr2;
  1694. X    MEMSIZE          len;
  1695. X{
  1696. X    return( DBbcmp((char *)NULL,0,ptr2, ptr1, len) );
  1697. X}
  1698. X
  1699. XMEMDATA  *
  1700. X__dg_bcopy(ptr2, ptr1, len)
  1701. X    CONST MEMDATA    * ptr2;
  1702. X    MEMDATA        * ptr1;
  1703. X    MEMSIZE          len;
  1704. X{
  1705. X    return( DBbcopy((char *)NULL,0,ptr2,ptr1,len) );
  1706. X}
  1707. X
  1708. XMEMDATA  *
  1709. X__dg_bzero(ptr1, len)
  1710. X    MEMDATA        * ptr1;
  1711. X    MEMSIZE          len;
  1712. X{
  1713. X    return( DBbzero((char *)NULL,0,ptr1,len) );
  1714. X}
  1715. X
  1716. Xint
  1717. X__dg_bcmp(ptr2, ptr1, len)
  1718. X    CONST MEMDATA    * ptr1;
  1719. X    CONST MEMDATA    * ptr2;
  1720. X    MEMSIZE          len;
  1721. X{
  1722. X    return( DBbcmp((char *)NULL,0,ptr2, ptr1, len) );
  1723. X}
  1724. X
  1725. X
  1726. X/*
  1727. X * $Log: dgmalloc.c,v $
  1728. X * Revision 1.4  1992/08/22  16:27:13  cpcahil
  1729. X * final changes for pl14
  1730. X *
  1731. X * Revision 1.3  1992/07/03  00:03:25  cpcahil
  1732. X * more fixes for pl13, several suggestons from Rich Salz.
  1733. X *
  1734. X * Revision 1.2  1992/07/02  15:35:52  cpcahil
  1735. X * misc cleanups for PL13
  1736. X *
  1737. X * Revision 1.1  1992/05/06  04:53:29  cpcahil
  1738. X * performance enhancments
  1739. X *
  1740. X */
  1741. END_OF_FILE
  1742. if test 2724 -ne `wc -c <'dgmalloc.c'`; then
  1743.     echo shar: \"'dgmalloc.c'\" unpacked with wrong size!
  1744. fi
  1745. # end of 'dgmalloc.c'
  1746. fi
  1747. if test -f 'dump.c' -a "${1}" != "-c" ; then 
  1748.   echo shar: Will not clobber existing file \"'dump.c'\"
  1749. else
  1750. echo shar: Extracting \"'dump.c'\" \(11008 characters\)
  1751. sed "s/^X//" >'dump.c' <<'END_OF_FILE'
  1752. X
  1753. X/*
  1754. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  1755. X *
  1756. X * This software may be distributed freely as long as the following conditions
  1757. X * are met:
  1758. X *         * the distribution, or any derivative thereof, may not be
  1759. X *          included as part of a commercial product
  1760. X *        * full source code is provided including this copyright
  1761. X *        * there is no charge for the software itself (there may be
  1762. X *          a minimal charge for the copying or distribution effort)
  1763. X *        * this copyright notice is not modified or removed from any
  1764. X *          source file
  1765. X */
  1766. X#include <stdio.h>
  1767. X#include "mallocin.h"
  1768. X#include "tostring.h"
  1769. X
  1770. X#ifndef lint
  1771. Xstatic
  1772. Xchar rcs_hdr[] = "$Id: dump.c,v 1.20 1992/08/22 16:27:13 cpcahil Exp $";
  1773. X#endif
  1774. X
  1775. X/*
  1776. X * various macro definitions used within this module.
  1777. X */
  1778. X
  1779. X#define WRITEOUT(fd,str,len)    if( write(fd,str,(WRTSIZE)(len)) != (len) ) \
  1780. X                { \
  1781. X                    VOIDCAST write(2,ERRSTR,\
  1782. X                             (WRTSIZE)strlen(ERRSTR));\
  1783. X                    exit(120); \
  1784. X                }
  1785. X
  1786. X#define DETAIL_NONE         0
  1787. X#define DETAIL_NOT_SET_YET    -1
  1788. X#define DETAIL_ST_COL        (sizeof(DETAIL_HDR_3)-1)
  1789. X#define ERRSTR    "I/O Error on malloc dump file descriptor\n"
  1790. X#define FILE_LEN        20
  1791. X#define LIST_ALL        1
  1792. X#define LIST_SOME        2
  1793. X#define NUM_BYTES        7
  1794. X#define TITLE            " Dump of Malloc Chain "
  1795. X
  1796. X#define DETAIL_HDR_1 \
  1797. X     "                             FREE     FREE                  ACTUAL SIZE    "
  1798. X#define DETAIL_HDR_2 \
  1799. X     "  PTR      NEXT     PREV     NEXT     PREV      FLAGS       INT    HEX     "
  1800. X#define DETAIL_HDR_3 \
  1801. X     "-------- -------- -------- -------- -------- ---------- -------- --------- "
  1802. X
  1803. X#define NORMAL_HDR_1 \
  1804. X "POINTER     FILE  WHERE         LINE      ALLOC        DATA     HEX DUMP   \n"
  1805. X#define NORMAL_HDR_2 \
  1806. X "TO DATA      ALLOCATED         NUMBER     FUNCT       LENGTH  OF BYTES 1-7 \n"
  1807. X#define NORMAL_HDR_3 \
  1808. X "-------- -------------------- ------- -------------- ------- --------------\n"
  1809. X
  1810. X#define THISBUFSIZE (sizeof(NORMAL_HDR_3)+sizeof(DETAIL_HDR_3))
  1811. X
  1812. X
  1813. X/*
  1814. X * Function:    malloc_dump()
  1815. X *
  1816. X * Purpose:    to dump a printed copy of the malloc chain and
  1817. X *        associated data elements
  1818. X *
  1819. X * Arguments:    fd    - file descriptor to write data to
  1820. X *
  1821. X * Returns:    nothing of any use
  1822. X *
  1823. X * Narrative:    Just print out all the junk
  1824. X *
  1825. X */
  1826. XVOIDTYPE
  1827. Xmalloc_dump(fd)
  1828. X    int        fd;
  1829. X{
  1830. X    malloc_list_items(fd,LIST_ALL,0L,0L);
  1831. X}
  1832. X
  1833. X/*
  1834. X * Function:    malloc_list()
  1835. X *
  1836. X * Purpose:    to dump a printed copy of the malloc chain and
  1837. X *        associated data elements
  1838. X *
  1839. X * Arguments:    fd    - file descriptor to write data to
  1840. X *        histid1 - id of the first record to display
  1841. X *        histid2 - id one above the last record to display
  1842. X *
  1843. X * Returns:    nothing of any use
  1844. X *
  1845. X * Narrative:    Just call malloc_list_items to display the junk
  1846. X *
  1847. X */
  1848. XVOIDTYPE
  1849. Xmalloc_list(fd,histid1,histid2)
  1850. X    int        fd;
  1851. X    IDTYPE        histid1;
  1852. X    IDTYPE        histid2;
  1853. X{
  1854. X    malloc_list_items(fd, LIST_SOME, histid1, histid2);
  1855. X}
  1856. X
  1857. X/*
  1858. X * Function:    malloc_list_items()
  1859. X *
  1860. X * Purpose:    to dump a printed copy of the malloc chain and
  1861. X *        associated data elements
  1862. X *
  1863. X * Arguments:    fd      - file descriptor to write data to
  1864. X *        list_type - type of list (all records, or a selected list)
  1865. X *        histid1      - first id to list (if type is some)
  1866. X *        histid2   - one above last id to list
  1867. X *
  1868. X * Returns:    nothing of any use
  1869. X *
  1870. X * Narrative:    Just print out all the junk
  1871. X *
  1872. X * Notes:    This function is implemented using low level calls because
  1873. X *         of the likelyhood that the malloc tree is damaged when it
  1874. X *        is called.  (Lots of things in the c library use malloc and
  1875. X *        we don't want to get into a catch-22).
  1876. X *
  1877. X */
  1878. XVOIDTYPE
  1879. Xmalloc_list_items(fd,list_type,histid1,histid2)
  1880. X    int              fd;
  1881. X    int              list_type;
  1882. X    IDTYPE              histid1;
  1883. X    IDTYPE              histid2;
  1884. X{
  1885. X    char              buffer[THISBUFSIZE];
  1886. X    int              detail;
  1887. X    int              first_time = 1;
  1888. X    CONST char        * func;
  1889. X    int              i;
  1890. X    int              loc;
  1891. X    struct mlist         * ptr;
  1892. X
  1893. X    MALLOC_INIT();
  1894. X
  1895. X    if( (malloc_opts & MOPT_DETAIL) != 0 )
  1896. X    {
  1897. X        detail = DETAIL_ST_COL;
  1898. X    }
  1899. X    else
  1900. X    {
  1901. X        detail = DETAIL_NONE;
  1902. X    }
  1903. X
  1904. X    /*
  1905. X     * for each element in the trace
  1906. X     */
  1907. X    for(ptr = &malloc_start; ptr; ptr = ptr->next)
  1908. X    {
  1909. X        /*
  1910. X         * if this item is not in use or it is a stack element
  1911. X         *     and we are not in detail mode or list-all mode.
  1912. X         */
  1913. X        if(  ( ((ptr->flag & M_INUSE)==0) || (GETTYPE(ptr)==M_T_STACK) )
  1914. X            && ((detail == DETAIL_NONE) || (list_type != LIST_ALL)) )
  1915. X        {
  1916. X            continue;
  1917. X        }
  1918. X        /*
  1919. X         * else if we are only listing a range of items, check to see
  1920. X         * if this item is in the correct range and is not marked. 
  1921. X         * if not, skip it
  1922. X          */
  1923. X        else if(   (list_type == LIST_SOME)
  1924. X            && (    (ptr->hist_id < histid1)
  1925. X                 || (ptr->hist_id >= histid2)
  1926. X                 || ((ptr->flag & M_MARKED) != 0) ) )
  1927. X        {
  1928. X            continue;
  1929. X        }
  1930. X
  1931. X        /*
  1932. X         * if this is the first time, put out the headers.
  1933. X         */
  1934. X        if( first_time )
  1935. X        {
  1936. X            /*
  1937. X             * fill the title line with asterisks
  1938. X             */
  1939. X            for(i=0; i < (detail + sizeof(NORMAL_HDR_3)-1); i++)
  1940. X            {
  1941. X                buffer[i] = '*';
  1942. X            }
  1943. X            buffer[i] = '\n';
  1944. X            buffer[i+1] = EOS;
  1945. X
  1946. X            /*
  1947. X             * add in the title  (centered, of course)
  1948. X             */
  1949. X            loc = (i - sizeof(TITLE)) / 2;
  1950. X            for(i=0; i < (sizeof(TITLE)-1); i++)
  1951. X            {
  1952. X                buffer[loc+i] = TITLE[i];
  1953. X            }
  1954. X
  1955. X            /*
  1956. X             * and write it out
  1957. X             */
  1958. X            WRITEOUT(fd,buffer,strlen(buffer));
  1959. X
  1960. X            /*
  1961. X             * write out the column headers
  1962. X             */
  1963. X            if( detail != DETAIL_NONE )
  1964. X            {
  1965. X                WRITEOUT(fd,DETAIL_HDR_1,
  1966. X                        sizeof(DETAIL_HDR_1)-1);
  1967. X                WRITEOUT(fd,NORMAL_HDR_1,
  1968. X                        sizeof(NORMAL_HDR_1)-1);
  1969. X                WRITEOUT(fd,DETAIL_HDR_2,
  1970. X                        sizeof(DETAIL_HDR_2)-1);
  1971. X                WRITEOUT(fd,NORMAL_HDR_2,
  1972. X                        sizeof(NORMAL_HDR_2)-1);
  1973. X                WRITEOUT(fd,DETAIL_HDR_3,
  1974. X                        sizeof(DETAIL_HDR_3)-1);
  1975. X                WRITEOUT(fd,NORMAL_HDR_3,
  1976. X                        sizeof(NORMAL_HDR_3)-1);
  1977. X            }
  1978. X            else
  1979. X            {
  1980. X                WRITEOUT(fd,NORMAL_HDR_1,
  1981. X                        sizeof(NORMAL_HDR_1)-1);
  1982. X                WRITEOUT(fd,NORMAL_HDR_2,
  1983. X                        sizeof(NORMAL_HDR_2)-1);
  1984. X                WRITEOUT(fd,NORMAL_HDR_3,
  1985. X                        sizeof(NORMAL_HDR_3)-1);
  1986. X            }
  1987. X
  1988. X            first_time = 0;
  1989. X        }
  1990. X
  1991. X        /*
  1992. X         * fill in the string with blanks
  1993. X         */
  1994. X        for(i=0; i < (sizeof(DETAIL_HDR_3)+sizeof(NORMAL_HDR_3)); i++)
  1995. X        {
  1996. X            buffer[i] = ' ';
  1997. X        }
  1998. X
  1999. X        /*
  2000. X          * handle detail output
  2001. X         */
  2002. X        if( detail != DETAIL_NONE )
  2003. X        {
  2004. X            VOIDCAST tostring(buffer,
  2005. X                    (ULONG)ptr,8,B_HEX,'0');
  2006. X            VOIDCAST tostring(buffer+9,
  2007. X                    (ULONG)ptr->next,8,B_HEX,'0');
  2008. X            VOIDCAST tostring(buffer+18,
  2009. X                    (ULONG)ptr->prev,8,B_HEX,'0');
  2010. X            VOIDCAST tostring(buffer+27,
  2011. X                    (ULONG)ptr->freenext,8,B_HEX,'0');
  2012. X            VOIDCAST tostring(buffer+36,
  2013. X                    (ULONG)ptr->freeprev,8,B_HEX,'0');
  2014. X            VOIDCAST tostring(buffer+45,
  2015. X                    (ULONG)ptr->flag,10,B_HEX,'0');
  2016. X            VOIDCAST tostring(buffer+56,
  2017. X                    (ULONG)ptr->s.size,8,B_DEC,' ');
  2018. X            VOIDCAST tostring(buffer+65,
  2019. X                    (ULONG)ptr->s.size,8,B_HEX,'0');
  2020. X            buffer[64] = '(';
  2021. X            buffer[74] = ')';
  2022. X        }
  2023. X
  2024. X        /*
  2025. X         * and now add in the normal stuff
  2026. X         */
  2027. X         VOIDCAST tostring(buffer+detail,
  2028. X                (ULONG) ptr->data, 8, B_HEX, '0');
  2029. X
  2030. X        /*
  2031. X         * if a file has been specified
  2032. X         */
  2033. X        if( (ptr->file != NULL)     && (ptr->file[0] != EOS) )
  2034. X        {
  2035. X
  2036. X            for(i=0; (i < FILE_LEN) && (ptr->file[i] != EOS); i++)
  2037. X            {
  2038. X                buffer[detail+9+i] = ptr->file[i];
  2039. X            }
  2040. X
  2041. X            VOIDCAST tostring(buffer+detail+30,
  2042. X                        (ULONG)ptr->line,7,B_DEC, ' ');
  2043. X        }
  2044. X        else
  2045. X        {
  2046. X            for(i=0; i < (sizeof("unknown")-1); i++)
  2047. X            {
  2048. X                buffer[detail+9+i] = "unknown"[i];
  2049. X            }
  2050. X        }
  2051. X            
  2052. X        func = MallocFuncName(ptr);
  2053. X        /*
  2054. X         * copy the function name into the string.
  2055. X         */
  2056. X        for( i=0; func[i] != EOS; i++)
  2057. X        {
  2058. X            buffer[detail+38+i] = func[i];
  2059. X        }
  2060. X
  2061. X        /*
  2062. X         * add the call number
  2063. X         */
  2064. X        buffer[detail+38+ i++] = '(';
  2065. X        i += tostring(buffer+detail+38+i,(ULONG)ptr->id,0,B_DEC,' ');
  2066. X        buffer[detail+38+i] = ')';
  2067. X    
  2068. X        /*
  2069. X         * display the length of the segment
  2070. X         */
  2071. X        VOIDCAST tostring(buffer+detail+53,
  2072. X                (ULONG)ptr->r_size,7,B_DEC,' ');
  2073. X
  2074. X        /* 
  2075. X         * display the first seven bytes of data
  2076. X         */
  2077. X        for( i=0; (i < NUM_BYTES) && (i < ptr->r_size); i++)
  2078. X        {
  2079. X            VOIDCAST tostring(buffer+detail + 61 + (i * 2),
  2080. X                    (ULONG)ptr->data[i], 2, B_HEX, '0');
  2081. X        }
  2082. X
  2083. X        buffer[detail + sizeof(NORMAL_HDR_3)] = '\n';
  2084. X        WRITEOUT(fd,buffer,detail+sizeof(NORMAL_HDR_3)+1);
  2085. X
  2086. X        /*
  2087. X         * and dump any stack info (if it was specified by the user)
  2088. X         */
  2089. X        StackDump(fd,(char *) NULL,ptr->stack);
  2090. X
  2091. X    }
  2092. X
  2093. X    if( detail != DETAIL_NONE )
  2094. X    {
  2095. X        WRITEOUT(fd,"Malloc start:      ",19);
  2096. X        VOIDCAST tostring(buffer, (ULONG)&malloc_start, 10, B_HEX, '0');
  2097. X        buffer[10] = '\n';
  2098. X        WRITEOUT(fd,buffer,11);
  2099. X
  2100. X        WRITEOUT(fd,"Malloc end:        ", 19);
  2101. X        VOIDCAST tostring(buffer, (ULONG) malloc_end, 10, B_HEX, '0');
  2102. X        buffer[10] = '\n';
  2103. X        WRITEOUT(fd,buffer,11);
  2104. X
  2105. X        WRITEOUT(fd,"Malloc data start: ", 19);
  2106. X        VOIDCAST tostring(buffer,(ULONG)malloc_data_start,10,B_HEX,'0');
  2107. X        buffer[10] = '\n';
  2108. X        WRITEOUT(fd,buffer,11);
  2109. X
  2110. X        WRITEOUT(fd,"Malloc data end:   ", 19);
  2111. X        VOIDCAST tostring(buffer,(ULONG)malloc_data_end, 10,B_HEX, '0');
  2112. X        buffer[10] = '\n';
  2113. X        WRITEOUT(fd,buffer,11);
  2114. X
  2115. X        WRITEOUT(fd,"Malloc free list:  ", 19);
  2116. X        VOIDCAST tostring(buffer, (ULONG)malloc_freelist, 10,B_HEX,'0');
  2117. X        buffer[10] = '\n';
  2118. X        WRITEOUT(fd,buffer,11);
  2119. X
  2120. X        for(ptr=malloc_freelist->freenext; ptr!=NULL; ptr=ptr->freenext)
  2121. X        {
  2122. X            WRITEOUT(fd,"                -> ", 19);
  2123. X            VOIDCAST tostring(buffer, (ULONG) ptr, 10, B_HEX, '0');
  2124. X            buffer[10] = '\n';
  2125. X            WRITEOUT(fd,buffer,11);
  2126. X        }
  2127. X
  2128. X    }
  2129. X
  2130. X    WRITEOUT(fd,"\n",1);
  2131. X    
  2132. X} /* malloc_dump(... */
  2133. X
  2134. X
  2135. X/*
  2136. X * $Log: dump.c,v $
  2137. X * Revision 1.20  1992/08/22  16:27:13  cpcahil
  2138. X * final changes for pl14
  2139. X *
  2140. X * Revision 1.19  1992/06/30  13:06:39  cpcahil
  2141. X * added support for aligned allocations
  2142. X *
  2143. X * Revision 1.18  1992/06/22  23:40:10  cpcahil
  2144. X * many fixes for working on small int systems
  2145. X *
  2146. X * Revision 1.17  1992/05/08  02:30:35  cpcahil
  2147. X * minor cleanups from minix/atari port
  2148. X *
  2149. X * Revision 1.16  1992/04/24  12:09:13  cpcahil
  2150. X * (hopefully) final cleanup for patch 10
  2151. X *
  2152. X * Revision 1.15  1992/04/22  18:17:32  cpcahil
  2153. X * added support for Xt Alloc functions, linted code
  2154. X *
  2155. X * Revision 1.14  1992/04/15  12:51:06  cpcahil
  2156. X * fixes per testing of patch 8
  2157. X *
  2158. X * Revision 1.13  1992/04/14  02:27:30  cpcahil
  2159. X * adjusted output of pointes so that values that had the high bit
  2160. X * set would print correctly.
  2161. X *
  2162. X * Revision 1.12  1992/04/13  19:57:15  cpcahil
  2163. X * more patch 8 fixes
  2164. X *
  2165. X * Revision 1.11  1992/04/13  03:06:33  cpcahil
  2166. X * Added Stack support, marking of non-leaks, auto-config, auto-testing
  2167. X *
  2168. X * Revision 1.10  1992/01/30  12:23:06  cpcahil
  2169. X * renamed mallocint.h -> mallocin.h
  2170. X *
  2171. X * Revision 1.9  1992/01/10  17:28:03  cpcahil
  2172. X * Added support for overriding void datatype
  2173. X *
  2174. X * Revision 1.8  1991/12/04  09:23:36  cpcahil
  2175. X * several performance enhancements including addition of free list
  2176. X *
  2177. X * Revision 1.7  91/11/25  14:41:52  cpcahil
  2178. X * Final changes in preparation for patch 4 release
  2179. X * 
  2180. X * Revision 1.6  91/11/24  00:49:25  cpcahil
  2181. X * first cut at patch 4
  2182. X * 
  2183. X * Revision 1.5  90/08/29  21:22:37  cpcahil
  2184. X * miscellaneous lint fixes
  2185. X * 
  2186. X * Revision 1.4  90/05/11  00:13:08  cpcahil
  2187. X * added copyright statment
  2188. X * 
  2189. X * Revision 1.3  90/02/24  21:50:07  cpcahil
  2190. X * lots of lint fixes
  2191. X * 
  2192. X * Revision 1.2  90/02/24  17:27:48  cpcahil
  2193. X * changed $header to $Id to remove full path from rcs id string
  2194. X * 
  2195. X * Revision 1.1  90/02/22  23:17:43  cpcahil
  2196. X * Initial revision
  2197. X * 
  2198. X */
  2199. END_OF_FILE
  2200. if test 11008 -ne `wc -c <'dump.c'`; then
  2201.     echo shar: \"'dump.c'\" unpacked with wrong size!
  2202. fi
  2203. # end of 'dump.c'
  2204. fi
  2205. if test -f 'fill.c' -a "${1}" != "-c" ; then 
  2206.   echo shar: Will not clobber existing file \"'fill.c'\"
  2207. else
  2208. echo shar: Extracting \"'fill.c'\" \(7792 characters\)
  2209. sed "s/^X//" >'fill.c' <<'END_OF_FILE'
  2210. X/*
  2211. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  2212. X *
  2213. X * This software may be distributed freely as long as the following conditions
  2214. X * are met:
  2215. X *         * the distribution, or any derivative thereof, may not be
  2216. X *          included as part of a commercial product
  2217. X *        * full source code is provided including this copyright
  2218. X *        * there is no charge for the software itself (there may be
  2219. X *          a minimal charge for the copying or distribution effort)
  2220. X *        * this copyright notice is not modified or removed from any
  2221. X *          source file
  2222. X */
  2223. X#include <stdio.h>
  2224. X#include "mallocin.h"
  2225. X
  2226. Xstatic long     fillmalloc = -1;
  2227. Xstatic long     fillfree   = -1;
  2228. X
  2229. X#define FILLINIT() if( fillmalloc == -1 )  FillInit()
  2230. X
  2231. X
  2232. X/*
  2233. X * Fill check types
  2234. X */
  2235. X#define FILL_UNDER     1
  2236. X#define FILL_OVER    2
  2237. X#define FILL_FREED    3
  2238. X
  2239. X/*
  2240. X * FillInit() - fill initialization routine
  2241. X */
  2242. XVOIDTYPE
  2243. XFillInit()
  2244. X{
  2245. X    char    * ptr;
  2246. X    int      i;
  2247. X    
  2248. X    ptr = (char *) &fillmalloc;
  2249. X
  2250. X    for( i=0; i < sizeof(long); i++)
  2251. X    {
  2252. X        *ptr++ = M_FILL;
  2253. X    }
  2254. X
  2255. X    ptr = (char *) &fillfree;
  2256. X
  2257. X    for( i=0; i < sizeof(long); i++)
  2258. X    {
  2259. X        *ptr++ = M_FREE_FILL;
  2260. X    }
  2261. X
  2262. X} /* FillInit(... */
  2263. X
  2264. X/*
  2265. X * FillCheck()    check for overflow and/or underflow using the filled regions
  2266. X *        in the specified malloc segment.
  2267. X */
  2268. Xint
  2269. XFillCheck(func,file,line,ptr,showerrors)
  2270. X    CONST char    * func;
  2271. X    CONST char    * file;
  2272. X    int          line;
  2273. X    struct mlist    * ptr;
  2274. X    int          showerrors;
  2275. X{
  2276. X    int          rtn = -1;
  2277. X
  2278. X    FILLINIT();
  2279. X
  2280. X    /*
  2281. X     * if this block has no filling
  2282. X     */
  2283. X    if( (ptr->flag & (M_FILLED|M_DFILLED)) == 0 )
  2284. X    {
  2285. X        rtn = 0;
  2286. X    }
  2287. X    /*
  2288. X     * else if this block is in use or it was not free-filled
  2289. X     */
  2290. X    else if(    ((ptr->flag & M_INUSE)  != 0) 
  2291. X         || ((ptr->flag & M_FILLED) == 0) )
  2292. X    {
  2293. X        /*
  2294. X         * check for data underflow and data overflow
  2295. X         */
  2296. X        rtn =   FillCheckData(func,file,line,ptr,FILL_UNDER,showerrors)
  2297. X              + FillCheckData(func,file,line,ptr,FILL_OVER, showerrors);
  2298. X    }
  2299. X    /*
  2300. X     * else the block must have been freed
  2301. X     */
  2302. X    else
  2303. X    {
  2304. X        /*
  2305. X         * check for data underflow and free filling
  2306. X         */
  2307. X        rtn =   FillCheckData(func,file,line,ptr,FILL_UNDER,showerrors)
  2308. X              + FillCheckData(func,file,line,ptr,FILL_FREED,showerrors);
  2309. X    }
  2310. X
  2311. X    return(rtn);
  2312. X
  2313. X} /* FillCheck(... */
  2314. X
  2315. X/*
  2316. X * FillCheckData() - routine to check the data areas to ensure that they
  2317. X *          are filled with the appropriate fill characters.
  2318. X */
  2319. Xint
  2320. XFillCheckData(func,file,line,ptr,checktype,showerrors)
  2321. X    CONST char    * func;
  2322. X    CONST char    * file;
  2323. X    int          line;
  2324. X    struct mlist    * ptr;
  2325. X    int          checktype;
  2326. X    int          showerrors;
  2327. X{
  2328. X    register char        * data = NULL;
  2329. X    int              errcode = 0;
  2330. X    char              filler = '\0';
  2331. X    long              fillword = 0;
  2332. X    register SIZETYPE      i = 0;
  2333. X    register long        * ldata;
  2334. X    SIZETYPE          limit = ptr->s.size;
  2335. X    int              rtn = -1;
  2336. X
  2337. X    if( (ptr->flag & (M_DFILLED | M_FILLED)) == 0 )
  2338. X    {
  2339. X        return(0);
  2340. X    }
  2341. X
  2342. X    switch(checktype)
  2343. X    {
  2344. X        case FILL_UNDER:
  2345. X            if(    ((ptr->flag & M_DFILLED) == 0 )
  2346. X                || (ptr->s.filler[LONGFILL-1] == fillmalloc) )
  2347. X            {
  2348. X                rtn = 0;
  2349. X            }
  2350. X            else
  2351. X            {
  2352. X
  2353. X                /*
  2354. X                 * if showing errors
  2355. X                  */
  2356. X                if( showerrors )
  2357. X                {
  2358. X                    /*
  2359. X                     * give the underrun error message
  2360. X                     */
  2361. X                    malloc_errno = M_CODE_UNDERRUN;
  2362. X                    malloc_warning(func,file,line,ptr);
  2363. X                    /*
  2364. X                     * fix the problem
  2365. X                     */
  2366. X                    ptr->s.filler[LONGFILL-1] = fillmalloc;
  2367. X                }
  2368. X                rtn = 1;
  2369. X            }
  2370. X            break;
  2371. X
  2372. X        case FILL_OVER:
  2373. X            if( (ptr->flag & M_DFILLED) == 0)
  2374. X            {
  2375. X                rtn = 0;
  2376. X            }
  2377. X            else
  2378. X            {
  2379. X                i        = ptr->r_size;
  2380. X                errcode  = M_CODE_OVERRUN;
  2381. X                filler   = M_FILL;
  2382. X                fillword = fillmalloc;
  2383. X                data     = ptr->data;
  2384. X            }
  2385. X            break;
  2386. X
  2387. X        case FILL_FREED:
  2388. X            if( (ptr->flag & M_FILLED) == 0)
  2389. X            {
  2390. X                rtn = 0;
  2391. X            }
  2392. X            else
  2393. X            {
  2394. X                i        = 0;
  2395. X                errcode  = M_CODE_REUSE;
  2396. X                filler   = M_FREE_FILL;
  2397. X                fillword = fillfree;
  2398. X                data     = ptr->data;
  2399. X            }
  2400. X            break;
  2401. X
  2402. X        default:
  2403. X            i = 0; 
  2404. X            limit = 0;
  2405. X            break;
  2406. X    }
  2407. X
  2408. X    /*
  2409. X     * if there is nothing to check, just return 
  2410. X     */
  2411. X    if( rtn != -1 )
  2412. X    {
  2413. X        return(rtn);
  2414. X    }
  2415. X            
  2416. X    rtn = 0;
  2417. X    data += i;
  2418. X    i = limit - i;
  2419. X    while( ((long)data) & (sizeof(long)-1) )
  2420. X    {
  2421. X        if( *data != filler )
  2422. X        {
  2423. X            if( showerrors )
  2424. X            {
  2425. X                malloc_errno = errcode;
  2426. X                malloc_warning(func,file,line,ptr);
  2427. X
  2428. X                /*
  2429. X                 * fix the underrun so we only get this
  2430. X                 * message once
  2431. X                 */
  2432. X                while( i-- > 0 )
  2433. X                {
  2434. X                    *(data++) = filler;
  2435. X                }
  2436. X            }
  2437. X
  2438. X            rtn++;
  2439. X                    
  2440. X            break;
  2441. X        }
  2442. X        data++;
  2443. X        i--;
  2444. X    }
  2445. X
  2446. X    /*
  2447. X     * if we haven't found an error yet
  2448. X     */
  2449. X    if( rtn == 0 )
  2450. X    {
  2451. X        /*
  2452. X         * convert to use longword pointer
  2453. X         */
  2454. X        ldata = (long *) data;
  2455. X        i >>= 2;
  2456. X
  2457. X        /*
  2458. X         * while more longwords to check
  2459. X         */    
  2460. X        while( i > 0 )
  2461. X        {
  2462. X            if( *ldata != fillword )
  2463. X            {
  2464. X                if( showerrors )
  2465. X                {
  2466. X                    malloc_errno = errcode;
  2467. X                    malloc_warning(func,file,line,ptr);
  2468. X    
  2469. X                    /*
  2470. X                     * fix the underrun so we only get this
  2471. X                     * message once
  2472. X                     */
  2473. X                    while( i-- > 0 )
  2474. X                    {
  2475. X                        *(ldata++) = fillword;
  2476. X                    }
  2477. X                }
  2478. X    
  2479. X                rtn++;
  2480. X                break;
  2481. X            }
  2482. X
  2483. X            ldata++;
  2484. X            i--;
  2485. X        
  2486. X        }
  2487. X        
  2488. X    }
  2489. X
  2490. X    return(rtn);
  2491. X
  2492. X} /* FillCheckData(... */
  2493. X
  2494. X/*
  2495. X * FillData()    fill in the needed areas in the specified segment.  This is used
  2496. X *        to place non-zero data in new malloc segments, setup boundary
  2497. X *        areas to catch under/overflow, and overwrite freed segments so 
  2498. X *        that they can't be usefully re-used.
  2499. X */
  2500. Xvoid
  2501. XFillData(ptr,alloctype,start,nextptr)
  2502. X    register struct mlist    * ptr;
  2503. X    int              alloctype;
  2504. X    SIZETYPE          start;
  2505. X    struct mlist        * nextptr;
  2506. X{
  2507. X    int          fills;
  2508. X    int          filler = 0;
  2509. X    SIZETYPE      limit = ptr->s.size;
  2510. X    
  2511. X    FILLINIT();
  2512. X
  2513. X    if( (malloc_opts & (MOPT_MFILL|MOPT_DFILL|MOPT_FFILL)) == 0)
  2514. X    {
  2515. X        ptr->flag &= ~(M_FILLED|M_DFILLED);
  2516. X        return;
  2517. X    }
  2518. X
  2519. X    switch(alloctype)
  2520. X    {
  2521. X        case FILL_MALLOC:
  2522. X            fills = MOPT_MFILL | MOPT_DFILL;
  2523. X            filler = M_FILL;
  2524. X            break;
  2525. X
  2526. X        case FILL_FREE:
  2527. X            fills = MOPT_FFILL;
  2528. X            filler = M_FREE_FILL;
  2529. X            break;
  2530. X
  2531. X        case FILL_SPLIT:
  2532. X            fills = MOPT_FFILL;
  2533. X            filler = M_FREE_FILL;
  2534. X            break;
  2535. X
  2536. X        case FILL_JOIN:
  2537. X            if( (ptr->flag&M_INUSE) != 0 )
  2538. X            {
  2539. X                if( ptr->flag & M_FILLED )
  2540. X                {
  2541. X                    fills = MOPT_MFILL;
  2542. X                    filler = M_FILL;
  2543. X                }
  2544. X                else if(  ptr->flag & M_DFILLED )
  2545. X                {
  2546. X                    fills = MOPT_MFILL;
  2547. X                    filler = M_FILL;
  2548. X                    start = ptr->r_size;;
  2549. X                }
  2550. X                else
  2551. X                {
  2552. X                    fills = 0;
  2553. X                }
  2554. X            }
  2555. X            else /* not in use */
  2556. X            {
  2557. X                /*
  2558. X                 * if this segment has bee free-filled
  2559. X                 */
  2560. X                if( ptr->flag & M_FILLED )
  2561. X                {
  2562. X                    fills = MOPT_MFILL;
  2563. X                    filler = M_FREE_FILL;
  2564. X
  2565. X                    /*
  2566. X                     * if the next segment is already filled
  2567. X                     */
  2568. X                    if( (nextptr->flag & M_FILLED) != 0 )
  2569. X                    {
  2570. X                        limit = start + M_SIZE;
  2571. X                    }
  2572. X                }
  2573. X                /*
  2574. X                 * else if this segment has overflow filling
  2575. X                 * enabled, fill the next segment since it is
  2576. X                 * now overflow of this segment.
  2577. X                 */
  2578. X                else if( (ptr->flag & M_DFILLED) != 0 )
  2579. X                {
  2580. X                    fills = MOPT_DFILL;
  2581. X                    filler = M_FILL;
  2582. X                    start = ptr->r_size;;
  2583. X                }
  2584. X                else
  2585. X                {
  2586. X                    fills = 0;
  2587. X                }
  2588. X            }
  2589. X            break;
  2590. X
  2591. X        case FILL_REALLOC:
  2592. X            if( ptr->flag & M_FILLED )
  2593. X            {
  2594. X                fills = MOPT_MFILL;
  2595. X                filler = M_FILL;
  2596. X            }
  2597. X            else if( ptr->flag & M_DFILLED )
  2598. X            {
  2599. X                fills = MOPT_MFILL;
  2600. X                filler = M_FILL;
  2601. X                start = ptr->r_size;;
  2602. X            }
  2603. X            else
  2604. X            {
  2605. X                fills = 0;
  2606. X            }
  2607. X            break;
  2608. X
  2609. X        case FILL_CALLOC:
  2610. X            fills = MOPT_DFILL;
  2611. X            break;
  2612. X
  2613. X        default:
  2614. X            fills = 0;
  2615. X    }
  2616. X
  2617. X
  2618. X    if( (fills & MOPT_DFILL) != 0 )
  2619. X    {
  2620. X        if( (malloc_opts & MOPT_DFILL) != 0 )
  2621. X        {
  2622. X            ptr->s.filler[LONGFILL-1] = fillmalloc;
  2623. X            ptr->flag |= M_DFILLED;
  2624. X        }
  2625. X        else if( alloctype != FILL_FREE ) 
  2626. X        {
  2627. X            ptr->flag &= ~M_DFILLED;
  2628. X        }
  2629. X    }
  2630. X
  2631. X    if( (malloc_opts & (MOPT_MFILL|MOPT_FFILL) & fills) != 0 )
  2632. X    {
  2633. X        /*
  2634. X         * fill in the data
  2635. X         */
  2636. X        DataMS(ptr->data+start, filler, (MEMSIZE) (limit - start));
  2637. X
  2638. X        ptr->flag |= M_FILLED;
  2639. X    }
  2640. X    else 
  2641. X    {
  2642. X        ptr->flag &= ~M_FILLED;
  2643. X
  2644. X        /*
  2645. X         * if we still have to fill the boundry area and this isn't 
  2646. X         * a free-fill, go do it
  2647. X         */
  2648. X        if( ((ptr->flag & M_DFILLED) != 0) && (filler == M_FILL) )
  2649. X        {
  2650. X            DataMS(ptr->data+ptr->r_size, M_FILL, 
  2651. X                    (MEMSIZE) (limit - ptr->r_size));
  2652. X        }
  2653. X
  2654. X    }
  2655. X
  2656. X} /* FillData(... */
  2657. X
  2658. END_OF_FILE
  2659. if test 7792 -ne `wc -c <'fill.c'`; then
  2660.     echo shar: \"'fill.c'\" unpacked with wrong size!
  2661. fi
  2662. # end of 'fill.c'
  2663. fi
  2664. if test -f 'tostring.h' -a "${1}" != "-c" ; then 
  2665.   echo shar: Will not clobber existing file \"'tostring.h'\"
  2666. else
  2667. echo shar: Extracting \"'tostring.h'\" \(1170 characters\)
  2668. sed "s/^X//" >'tostring.h' <<'END_OF_FILE'
  2669. X/*
  2670. X * (c) Copyright 1990, 1991, 1992 Conor P. Cahill (cpcahil@virtech.vti.com)
  2671. X *
  2672. X * This software may be distributed freely as long as the following conditions
  2673. X * are met:
  2674. X *         * the distribution, or any derivative thereof, may not be
  2675. X *          included as part of a commercial product
  2676. X *        * full source code is provided including this copyright
  2677. X *        * there is no charge for the software itself (there may be
  2678. X *          a minimal charge for the copying or distribution effort)
  2679. X *        * this copyright notice is not modified or removed from any
  2680. X *          source file
  2681. X */
  2682. X/*
  2683. X * $Id: tostring.h,v 1.5 1992/08/22 16:27:13 cpcahil Exp $
  2684. X */
  2685. X#define B_BIN     2
  2686. X#define B_DEC    10
  2687. X#define B_HEX    16
  2688. X#define B_OCTAL     8
  2689. X
  2690. X/* 
  2691. X * $Log: tostring.h,v $
  2692. X * Revision 1.5  1992/08/22  16:27:13  cpcahil
  2693. X * final changes for pl14
  2694. X *
  2695. X * Revision 1.4  1992/04/13  03:06:33  cpcahil
  2696. X * Added Stack support, marking of non-leaks, auto-config, auto-testing
  2697. X *
  2698. X * Revision 1.3  1991/11/25  14:42:07  cpcahil
  2699. X * Final changes in preparation for patch 4 release
  2700. X *
  2701. X * Revision 1.2  90/05/11  00:13:11  cpcahil
  2702. X * added copyright statment
  2703. X * 
  2704. X * Revision 1.1  90/02/23  07:09:05  cpcahil
  2705. X * Initial revision
  2706. X * 
  2707. X */
  2708. END_OF_FILE
  2709. if test 1170 -ne `wc -c <'tostring.h'`; then
  2710.     echo shar: \"'tostring.h'\" unpacked with wrong size!
  2711. fi
  2712. # end of 'tostring.h'
  2713. fi
  2714. echo shar: End of archive 3 \(of 10\).
  2715. cp /dev/null ark3isdone
  2716. MISSING=""
  2717. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  2718.     if test ! -f ark${I}isdone ; then
  2719.     MISSING="${MISSING} ${I}"
  2720.     fi
  2721. done
  2722. if test "${MISSING}" = "" ; then
  2723.     echo You have unpacked all 10 archives.
  2724.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2725. else
  2726.     echo You still need to unpack the following archives:
  2727.     echo "        " ${MISSING}
  2728. fi
  2729. ##  End of shell archive.
  2730. exit 0
  2731. *** SENTINEL(tm) The ultimate Debugging Environment - email for more info ***
  2732.  
  2733. Conor P. Cahill              (703)430-9247            cpcahil@virtech.vti.com
  2734. Virtual Technologies, Inc.  46030 Manekin Plaza          Dulles, VA 21066 
  2735.  
  2736. exit 0 # Just in case...
  2737.