You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2002/02/02 07:12:35 UTC

cvs commit: apr/file_io/os2 copy.c Makefile.in filestat.c

bjh         02/02/01 22:12:35

  Modified:    file_io/os2 Makefile.in filestat.c
  Added:       file_io/os2 copy.c
  Log:
  OS/2: Implement apr_file_attrs_set() & other minor build fixes for the
  addition of apr_file_copy() & friends.
  
  Revision  Changes    Path
  1.23      +2 -1      apr/file_io/os2/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/Makefile.in,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Makefile.in	30 Sep 2001 08:13:51 -0000	1.22
  +++ Makefile.in	2 Feb 2002 06:12:34 -0000	1.23
  @@ -13,7 +13,8 @@
   	fullrw.lo \
   	filepath.lo \
   	filesys.lo \
  -	mktemp.lo
  +	mktemp.lo \
  +	copy.lo
   
   # bring in rules.mk for standard functionality
   @INCLUDE_RULES@
  
  
  
  1.26      +26 -0     apr/file_io/os2/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/filestat.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- filestat.c	28 Dec 2001 22:28:16 -0000	1.25
  +++ filestat.c	2 Feb 2002 06:12:34 -0000	1.26
  @@ -197,3 +197,29 @@
   {
       return apr_stat(finfo, fname, wanted, cont);
   }
  +
  +
  +
  +APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
  +                                             apr_fileattrs_t attributes,
  +                                             apr_pool_t *cont)
  +{
  +    FILESTATUS3 fs3;
  +    ULONG rc = DosQueryPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3));
  +
  +    if (rc == 0) {
  +        ULONG old_attr = fs3.attrFile;
  +
  +        if (attributes & APR_FILE_ATTR_READONLY) {
  +            fs3.attrFile |= FILE_READONLY;
  +        } else {
  +            fs3.attrFile &= ~FILE_READONLY;
  +        }
  +
  +        if (fs3.attrFile != old_attr) {
  +            rc = DosSetPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3), 0);
  +        }
  +    }
  +
  +    return APR_FROM_OS_ERROR(rc);
  +}
  
  
  
  1.1                  apr/file_io/os2/copy.c
  
  Index: copy.c
  ===================================================================
  #include "../unix/copy.c"