httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/lib apr_cpystrn.c
Date Wed, 13 Oct 1999 18:07:24 GMT
rbb         99/10/13 11:07:23

  Modified:    src/lib/apr/include apr_lib.h
               src/lib/apr/lib apr_cpystrn.c
  Log:
  Move filename_of_pathname down to APR.  I have put an ap_ at the beginning
  to protect namespace.  This is "distilled" from http_main.c
  Submitted by:	Ben Hyde
  
  Revision  Changes    Path
  1.13      +1 -0      apache-2.0/src/lib/apr/include/apr_lib.h
  
  Index: apr_lib.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lib.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- apr_lib.h	1999/10/11 14:20:38	1.12
  +++ apr_lib.h	1999/10/13 18:07:22	1.13
  @@ -166,6 +166,7 @@
   API_EXPORT(char *) ap_cpystrn(char *d, const char *s, size_t l);
   API_EXPORT(int) ap_tokenize_to_argv(ap_context_t *token_context,
                                       char *arg_str, char ***argv_out);
  +API_EXPORT(const char *) ap_filename_of_pathname(const char *pathname);
   /*API_EXPORT(ap_mutex_t *) ap_create_mutex(void *m);*/
   API_EXPORT(int) ap_slack(int l, int h);
   API_EXPORT_NONSTD(int) ap_execle(const char *c, const char *a, ...);
  
  
  
  1.7       +21 -0     apache-2.0/src/lib/apr/lib/apr_cpystrn.c
  
  Index: apr_cpystrn.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_cpystrn.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_cpystrn.c	1999/10/12 14:13:40	1.6
  +++ apr_cpystrn.c	1999/10/13 18:07:23	1.7
  @@ -196,3 +196,24 @@
   
       return(rc);
   }
  +
  +/* Filename_of_pathname returns the final element of the pathname.
  + * Using the current platform's filename syntax.
  + *   "/foo/bar/gum" -> "gum"
  + *   "/foo/bar/gum/" -> ""
  + *   "gum" -> "gum"
  + *   "wi\\n32\\stuff" -> "stuff
  + */
  +
  +const char *ap_filename_of_pathname(const char *pathname)
  +{
  +#ifdef WIN32
  +    const char path_separator = '\\';
  +#else
  +    const char path_separator = '/';
  +#endif
  +    const char *s = strrchr(pathname, path_separator);
  +
  +    return s ? ++s : pathname;
  +}
  +
  
  
  

Mime
View raw message