Amanda-Users

Re: include/export again

2003-05-24 11:35:56
Subject: Re: include/export again
From: Mathias Körber <mathias AT koerber DOT org>
Date: Sat, 24 May 2003 23:34:23 +0800


--On Saturday, May 24, 2003 04:06:14 PM +0800 Mathias Körber <mathias AT koerber DOT org> wrote:

May need to add some code to check whether a multi-/ name
exists exactly as given and let that through too.
Anythoughts on whether that will break anything?

I found a function glob(3) which seems to do exactly what needs
to be done: find fines which match a given glob.

from the manpage:

GLOB(3)             Linux Programmer's Manual             GLOB(3)

NAME
       glob, globfree - find pathnames matching a pattern, free memory
from glob()

SYNOPSIS
       #include <glob.h>

       int glob(const char *pattern, int flags,
                int errfunc(const char *epath, int eerrno),
                glob_t *pglob);
       void globfree(glob_t *pglob);

DESCRIPTION
       The  glob()  function  searches for all the pathnames matching
pattern according to the rules used by the shell (see glob(7)).  No tilde
       expansion or parameter substitution is done; if you want these,
use wordexp(3).

       The globfree() function frees the dynamically allocated storage
from an earlier call to glob().

       The results of a glob() call are stored in the structure pointed
to by pglob, which is a  glob_t  which  is  declared  in  <glob.h>  and
includes the following elements defined by POSIX.2 (more may be present
as an extension):

          typedef struct
          {
                  size_t gl_pathc;    /* Count of paths matched so far  */
                  char **gl_pathv;    /* List of matched pathnames.  */
                  size_t gl_offs;     /* Slots to reserve in `gl_pathv'.
*/           } glob_t;

       Results are stored in dynamically allocated storage.

       The parameter flags is made up of bitwise OR of zero or more the
following symbolic constants, which modify the of behaviour of glob():


Is this available under other unices (and is it equivalent there?)

Ill try and come up with a patch based on this if I find the time...

any comments/hints/suggestions etc welcome.

mk


<Prev in Thread] Current Thread [Next in Thread>