dreid       99/12/15 04:20:41

  Modified:    src/lib/apr/test htdigest.c testmmap.c
  Log:
  Get the mmap test working again and tidy up in htdigest.
  
  Revision  Changes    Path
  1.10      +9 -0      apache-2.0/src/lib/apr/test/htdigest.c
  
  Index: htdigest.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/htdigest.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- htdigest.c        1999/12/03 16:12:27     1.9
  +++ htdigest.c        1999/12/15 12:20:40     1.10
  @@ -66,12 +66,21 @@
    * by Alexei Kosut, based on htpasswd.c, by Rob McCool
    */
   
  +#include "apr_config.h"
   #include "apr_lib.h"
   #include "apr_md5.h"
  +#ifdef HAVE_SYS_TYPES_H
   #include <sys/types.h>
  +#endif
  +#ifdef HAVE_SYS_SIGNAL_H
   #include <sys/signal.h>
  +#endif
  +#ifdef HAVE_SIGNAL_H
   #include <signal.h>
  +#endif
  +#ifdef HAVE_STDLIB_H
   #include <stdlib.h>
  +#endif
   
   #ifdef WIN32
   #include <conio.h>
  
  
  
  1.4       +11 -8     apache-2.0/src/lib/apr/test/testmmap.c
  
  Index: testmmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testmmap.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- testmmap.c        1999/12/03 15:18:36     1.3
  +++ testmmap.c        1999/12/15 12:20:40     1.4
  @@ -73,6 +73,7 @@
       ap_file_t *thefile;
       ap_int32_t flag = APR_READ;
       char *file1;
  +    ap_ssize_t filesize;
       
       fprintf (stdout,"APR MMAP Test\n*************\n\n");
       
  @@ -87,13 +88,6 @@
       getcwd(file1, PATH_LEN);
       strncat(file1,"/testmmap.c",11);  
   
  -    fprintf(stdout,"Trying to delete the mmap file......");
  -    if (ap_mmap_delete(themmap) != APR_SUCCESS) {
  -        fprintf(stderr,"Failed!\n");
  -        exit (-1);
  -    }
  -    fprintf(stdout,"OK\n\n");
  -
       fprintf(stdout, "Opening file........................");
       if (ap_open(&thefile, file1, flag, APR_UREAD | APR_GREAD, context) != 
APR_SUCCESS) {
           perror("Didn't open file");
  @@ -102,9 +96,18 @@
       else {
           fprintf(stdout, "OK\n");
       }
  +    
  +    fprintf(stderr, "Getting file size...................");
  +    if (ap_get_filesize(&filesize, thefile) != APR_SUCCESS) {
  +        perror("Didn't open file");
  +        exit(-1);
  +    }
  +    else {
  +        fprintf(stdout, "%d bytes\n", filesize);
  +    }  
   
       fprintf(stdout,"Trying to mmap the open file........");
  -    if (ap_mmap_create(&themmap, thefile, 0, 0, context) != APR_SUCCESS) {
  +    if (ap_mmap_create(&themmap, thefile, 0, filesize, context) != 
APR_SUCCESS) {
           fprintf(stderr,"Failed!\n");
           exit(-1);
       }
  
  
  

Reply via email to