Greg Stein <gstein@lyra.org> writes:
> hehe... *cough apr_stat* .... *cough finfo.filetype*
>
> ahem. sorry. something in my throat.
Doh!
Of course that's the right way to do it. Thank you, will change.
> On Wed, Oct 18, 2000 at 12:09:11AM -0000, kfogel@tigris.org wrote:
> > User: kfogel
> > Date: 00/10/17 17:09:11
> >
> > Modified: subversion/libsvn_subr Makefile.am
> > Added: subversion/libsvn_subr io.c
> > Log:
> > * io.c (svn_io_check_path): new file, new func. All callers changed.
> >
> > * libsvn_wc (svn_wc__file_exists_p): removed, in favor of
> > svn_io_check_path.
> >
> > Also, we're not going to have a generic recursion function, because
> > recursing is easy and genericizing it actually results in more code
> > than not. Thank goodness for the phone call with Jim! So:
> >
> > (svn_wc__entries_recurse, svn_wc__recurse_enter_dir_t,
> > svn_wc__recurse_leave_dir_t, svn_wc__recurse_handle_file_t): removed.
> > (compose_paths): replaces remove_redundancies. But not removed, as
> > will still be useful.
> >
> > Revision Changes Path
> > 1.10 +1 -1 subversion/subversion/libsvn_subr/Makefile.am
> >
> > Index: Makefile.am
> > ===================================================================
> > RCS file: /cvs/subversion/subversion/libsvn_subr/Makefile.am,v
> > retrieving revision 1.9
> > retrieving revision 1.10
> > diff -u -r1.9 -r1.10
> > --- Makefile.am 2000/10/12 17:11:53 1.9
> > +++ Makefile.am 2000/10/18 00:09:10 1.10
> > @@ -9,7 +9,7 @@
> >
> > ## Sources needed to build each library (names canonicalized)
> > libsvn_subr_la_SOURCES = svn_string.c svn_error.c path.c \
> > - hashdump.c xml.c base64.c
> > + hashdump.c xml.c base64.c io.c
> >
> > ## Build flags ---------
> >
> >
> >
> >
> > 1.1 subversion/subversion/libsvn_subr/io.c
> >
> > Index: io.c
> > ===================================================================
> > /*
> > * io.c: shared file reading, writing, and probing code.
> > *
> > * ================================================================
> > * Copyright (c) 2000 CollabNet. All rights reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions are
> > * met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in the
> > * documentation and/or other materials provided with the distribution.
> > *
> > * 3. The end-user documentation included with the redistribution, if
> > * any, must include the following acknowlegement: "This product includes
> > * software developed by CollabNet (http://www.Collab.Net)."
> > * Alternately, this acknowlegement may appear in the software itself, if
> > * and wherever such third-party acknowlegements normally appear.
> > *
> > * 4. The hosted project names must not be used to endorse or promote
> > * products derived from this software without prior written
> > * permission. For written permission, please contact info@collab.net.
> > *
> > * 5. Products derived from this software may not use the "Tigris" name
> > * nor may "Tigris" appear in their names without prior written
> > * permission of CollabNet.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> > * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
> > * IN NO EVENT SHALL COLLABNET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
> > * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> > * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
> > * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> > * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
> > * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
> > * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
> > * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> > *
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals and marine fronds on behalf of CollabNet.
> > */
> >
> >
> >
> > #include <apr_pools.h>
> > #include <apr_file_io.h>
> > #include "svn_types.h"
> > #include "svn_path.h"
> > #include "svn_string.h"
> > #include "svn_error.h"
> > #include "svn_io.h"
> >
> > svn_error_t *
> > svn_io_check_path (svn_string_t *path,
> > enum svn_node_kind *kind,
> > apr_pool_t *pool)
> > {
> > apr_dir_t *d = NULL;
> > apr_file_t *f = NULL;
> > apr_status_t apr_err;
> >
> > /* Try it as a dir first. */
> > apr_err = apr_opendir (&d, path->data, pool);
> > if (! apr_err)
> > {
> > *kind = svn_dir_kind;
> > apr_err = apr_closedir (d);
> > if (apr_err)
> > return svn_error_createf (apr_err, 0, NULL, pool,
> > "svn_io_check_path: "
> > "problem closing dir %s",
> > path->data);
> > else
> > return SVN_NO_ERROR;
> > }
> > else if (apr_err && (apr_err == APR_ENOENT))
> > {
> > *kind = svn_invalid_kind;
> > return SVN_NO_ERROR;
> > }
> > else if (apr_err && (apr_err != APR_ENOTDIR))
> > {
> > return svn_error_createf (apr_err, 0, NULL, pool,
> > "svn_io_check_path: "
> > "opendir %s failed, but not with ENOTDIR",
> > path->data);
> > }
> >
> > /* todo: handle symlink case, others, someday? */
> >
> > /* Else try it as a file. */
> >
> > apr_err = apr_open (&f, path->data, APR_READ, APR_OS_DEFAULT, pool);
> > if (! apr_err)
> > {
> > *kind = svn_file_kind;
> > apr_err = apr_close (f);
> > if (apr_err)
> > return svn_error_createf (apr_err, 0, NULL, pool,
> > "svn_io_check_path: "
> > "problem closing file %s",
> > path->data);
> > return SVN_NO_ERROR;
> > }
> > else if (apr_err && (apr_err == APR_ENOENT))
> > {
> > *kind = svn_invalid_kind;
> > return SVN_NO_ERROR;
> > }
> > else
> > return svn_error_createf (apr_err, 0, NULL, pool,
> > "svn_io_check_path: "
> > "problem opening file %s",
> > path->data);
> > }
> >
> >
> >
> >
> > /*
> > * local variables:
> > * eval: (load-file "../svn-dev.el")
> > * end:
> > */
> >
> >
> >
>
> --
> Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:11 2006