apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: apr/include/arch/netware apr_private.h
Date Mon, 14 Jul 2003 19:02:11 GMT
bnicholes    2003/07/14 12:02:11

  Modified:    file_io/netware filestat.c
               include/arch/netware apr_private.h
  Log:
  Implemented apr_file_mtime_set() for NetWare
  
  Revision  Changes    Path
  1.31      +41 -2     apr/file_io/netware/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/netware/filestat.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- filestat.c	8 Jul 2003 16:03:37 -0000	1.30
  +++ filestat.c	14 Jul 2003 19:02:11 -0000	1.31
  @@ -62,6 +62,10 @@
   #include "apr_hash.h"
   #include "apr_thread_rwlock.h"
   
  +#ifdef HAVE_UTIME_H
  +#include <utime.h>
  +#endif
  +
   /*#define APR_HAS_PSA*/
   
   static apr_filetype_e filetype_from_mode(mode_t mode)
  @@ -388,10 +392,45 @@
   }
   
   
  -/* ### Somebody please write this! */
   APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
                                                 apr_time_t mtime,
                                                 apr_pool_t *pool)
   {
  -  return APR_ENOTIMPL;
  +    apr_status_t status;
  +    apr_finfo_t finfo;
  +
  +    status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool);
  +    if (!APR_STATUS_IS_SUCCESS(status)) {
  +        return status;
  +    }
  +
  +#ifdef HAVE_UTIMES
  +    {
  +      struct timeval tvp[2];
  +    
  +      tvp[0].tv_sec = apr_time_sec(finfo.atime);
  +      tvp[0].tv_usec = apr_time_usec(finfo.atime);
  +      tvp[1].tv_sec = apr_time_sec(mtime);
  +      tvp[1].tv_usec = apr_time_usec(mtime);
  +      
  +      if (utimes(fname, tvp) == -1) {
  +        return errno;
  +      }
  +    }
  +#elif defined(HAVE_UTIME)
  +    {
  +      struct utimbuf buf;
  +      
  +      buf.actime = (time_t) (finfo.atime / APR_USEC_PER_SEC);
  +      buf.modtime = (time_t) (mtime / APR_USEC_PER_SEC);
  +      
  +      if (utime(fname, &buf) == -1) {
  +        return errno;
  +      }
  +    }
  +#else
  +    return APR_ENOTIMPL;
  +#endif
  +
  +    return APR_SUCCESS;
   }
  
  
  
  1.20      +2 -0      apr/include/arch/netware/apr_private.h
  
  Index: apr_private.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/netware/apr_private.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- apr_private.h	16 Feb 2003 21:59:08 -0000	1.19
  +++ apr_private.h	14 Jul 2003 19:02:11 -0000	1.20
  @@ -87,6 +87,7 @@
   #define HAVE_SYS_MMAN_H 1
   #define HAVE_FCNTL_H    1
   #define HAVE_ICONV_H    1
  +#define HAVE_UTIME_H    1
   
   #define HAVE_STRICMP    1
   #define HAVE_STRNICMP   1
  @@ -94,6 +95,7 @@
   #define HAVE_STRSTR     1
   #define HAVE_MEMCHR     1
   #define HAVE_CALLOC     1
  +#define HAVE_UTIME      1
   
   /*#define DSO_USE_DLFCN */
   
  
  
  

Mime
View raw message