apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/test testflock.c
Date Sat, 04 Aug 2001 02:46:02 GMT
trawick     01/08/03 19:46:02

  Modified:    test     testflock.c
  Log:
  add optional -f parameter to set filename; this is a workaround for
  possible NFS locking bogosity
  
  Revision  Changes    Path
  1.8       +13 -5     apr/test/testflock.c
  
  Index: testflock.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testflock.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testflock.c	2001/06/08 04:49:47	1.7
  +++ testflock.c	2001/08/04 02:46:02	1.8
  @@ -81,11 +81,10 @@
   #include <stdlib.h>
   #include <stdio.h>
   
  -#define TESTFILE "testfile.tmp"
  +const char *testfile = "testfile.tmp";
   
   static apr_pool_t *pool = NULL;
   
  -
   static void errmsg(const char *msg)
   {
       if (pool != NULL)
  @@ -111,7 +110,7 @@
       apr_file_t *file;
       apr_status_t status;
   
  -    if (apr_file_open(&file, TESTFILE, APR_WRITE,
  +    if (apr_file_open(&file, testfile, APR_WRITE,
                    APR_OS_DEFAULT, pool) != APR_SUCCESS)
           errmsg("Could not open test file.\n");
       printf("Test file opened.\n");
  @@ -138,7 +137,7 @@
       apr_file_t *file;
       apr_status_t rv;
   
  -    if (apr_file_open(&file, TESTFILE, APR_WRITE|APR_CREATE, APR_OS_DEFAULT,
  +    if (apr_file_open(&file, testfile, APR_WRITE|APR_CREATE, APR_OS_DEFAULT,
                    pool) != APR_SUCCESS)
           errmsg("Could not create file.\n");
       printf("Test file created.\n");
  @@ -172,9 +171,18 @@
       if (apr_getopt_init(&opt, pool, argc, argv) != APR_SUCCESS)
           errmsg("Could not parse options.\n");
   
  -    while ((status = apr_getopt(opt, "r", &optchar, &optarg)) == APR_SUCCESS) {
  +    while ((status = apr_getopt(opt, "rf:", &optchar, &optarg)) == APR_SUCCESS)
{
           if (optchar == 'r')
               ++reader;
  +        else if (optchar == 'f')
  +            testfile = optarg;
  +    }
  +    if (status != APR_SUCCESS && status != APR_EOF) {
  +        char msgbuf[80];
  +
  +        fprintf(stderr, "error: %s\n",
  +                apr_strerror(status, msgbuf, sizeof msgbuf));
  +        exit(1);
       }
   
       if (reader)
  
  
  

Mime
View raw message