You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2002/07/08 02:53:16 UTC

cvs commit: modperl-2.0/src/modules/perl modperl_sys.c modperl_sys.h

dougm       2002/07/07 17:53:16

  Modified:    src/modules/perl modperl_sys.c modperl_sys.h
  Log:
  add modperl_sys_is_dir function
  
  Revision  Changes    Path
  1.4       +17 -0     modperl-2.0/src/modules/perl/modperl_sys.c
  
  Index: modperl_sys.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_sys.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modperl_sys.c	21 Jun 2002 01:32:56 -0000	1.3
  +++ modperl_sys.c	8 Jul 2002 00:53:15 -0000	1.4
  @@ -1,4 +1,21 @@
  +#include "modperl_largefiles.h"
   #include "mod_perl.h"
  +
  +/*
  + * Stat_t needs flags in modperl_largefiles.h
  + */
  +int modperl_sys_is_dir(pTHX_ SV *sv)
  +{
  +    Stat_t statbuf;
  +    STRLEN n_a;
  +    char *name = SvPV(sv, n_a);
  +
  +    if (PerlLIO_stat(name, &statbuf) < 0) {
  +        return 0;
  +    }
  +
  +    return S_ISDIR(statbuf.st_mode);
  +}
   
   /*
    * Perl does not provide this abstraction.
  
  
  
  1.2       +3 -0      modperl-2.0/src/modules/perl/modperl_sys.h
  
  Index: modperl_sys.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_sys.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- modperl_sys.h	21 Jun 2002 00:05:17 -0000	1.1
  +++ modperl_sys.h	8 Jul 2002 00:53:15 -0000	1.2
  @@ -6,6 +6,9 @@
    * hopefully won't be much here since Perl/APR/Apache
    * take care of most portablity issues.
    */
  +
  +int modperl_sys_is_dir(pTHX_ SV *sv);
  +
   int modperl_sys_dlclose(void *handle);
   
   #endif /* MODPERL_SYS_H */