home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / c / condor40.zip / CONDOR / src / ckpt_lib / printer.c < prev    next >
C/C++ Source or Header  |  1989-09-08  |  2KB  |  90 lines

  1. /* 
  2. ** Copyright 1986, 1987, 1988, 1989 University of Wisconsin
  3. ** 
  4. ** Permission to use, copy, modify, and distribute this software and its
  5. ** documentation for any purpose and without fee is hereby granted,
  6. ** provided that the above copyright notice appear in all copies and that
  7. ** both that copyright notice and this permission notice appear in
  8. ** supporting documentation, and that the name of the University of
  9. ** Wisconsin not be used in advertising or publicity pertaining to
  10. ** distribution of the software without specific, written prior
  11. ** permission.  The University of Wisconsin makes no representations about
  12. ** the suitability of this software for any purpose.  It is provided "as
  13. ** is" without express or implied warranty.
  14. ** 
  15. ** THE UNIVERSITY OF WISCONSIN DISCLAIMS ALL WARRANTIES WITH REGARD TO
  16. ** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. ** FITNESS. IN NO EVENT SHALL THE UNIVERSITY OF WISCONSIN  BE LIABLE FOR
  18. ** ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  19. ** WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  20. ** ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  21. ** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  22. ** 
  23. ** Authors:  Allan Bricker and Michael J. Litzkow,
  24. **              University of Wisconsin, Computer Sciences Dept.
  25. ** 
  26. */ 
  27.  
  28.  
  29. #include <sys/file.h>
  30. #include <stdio.h>
  31.  
  32. #include "debug.h"
  33.  
  34. extern int    DebugFlags;
  35.  
  36. main( argc, argv )
  37. int argc;
  38. char **argv;
  39. {
  40.     int i, j;
  41.     register int k;
  42.     char buf[ 1024 ];
  43.     int fd;
  44.     extern char CWD[];
  45.     char *curbrk, *oldbrk, *sbrk();
  46.  
  47.     if( argc > 1 ) {
  48.         DebugFlags |= D_CKPT;
  49.     }
  50.  
  51.     fprintf( stderr, "CWD = '%s'\n", CWD);
  52.  
  53.     fd = open( "results", O_CREAT|O_RDWR, 0666);
  54.     if( fd < 0 ) {
  55.         perror("results");
  56.         exit( 1 );
  57.     }
  58.  
  59.     oldbrk = sbrk(0);
  60.  
  61.     for( i = 0; ; i++ ) {
  62.         sprintf(buf, "set i = %d\n", i);
  63.         write(fd, buf, strlen(buf));
  64.         lseek(fd , 0, L_SET);
  65.  
  66.         /*
  67.         fprintf(stderr, buf);
  68.         */
  69.  
  70.         curbrk = sbrk(0);
  71.         if( oldbrk != curbrk ) {
  72.             fprintf(stderr, "Current break is now 0x%x, old was 0x%x\n",
  73.                 curbrk, oldbrk);
  74.         }
  75.  
  76.         oldbrk = curbrk;
  77.  
  78.         for(k=j=0; j < 100000; k++,j++ );
  79.         if( j != k ) {
  80.             sprintf(buf, "j = %d, k (register) = %d\n", j, k);
  81.             fprintf(stderr,"%s", buf);
  82.             write(fileno(stderr), buf, strlen(buf));
  83.         }
  84.  
  85.         ckpt();
  86.         /*
  87.         */
  88.     }
  89. }
  90.