On Fri, Sep 11, 2009 at 5:35 AM, Marc - A. Dahlhaus [ Administration |
Westermann GmbH ] <[email protected]> wrote:
> This patch adds the ability to use Include filenames
> containing wildcards.
>
> Added a headercheck for glob.h to configure.ac.
> Added a globfree call to clean up the struct properly.
> Removed tilde expanding.
> Fixed a no debug print on GLOB_NOMATCH condition bug.
>
> Signed-off-by: Marc-A. Dahlhaus <[email protected]>
> ---
Xavier, comments here? I kind of dropped this one on the floor, but a
quick review and I think it is good.

>
> --- pacman-3.3.0.orig/configure.ac
> +++ pacman-3.3.0/configure.ac
> @@ -150,7 +150,7 @@ fi
>  AM_CONDITIONAL(INTERNAL_DOWNLOAD, test "x$internaldownload" = "xyes")
>
>  # Checks for header files.
> -AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h string.h
> strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h
> sys/time.h syslog.h wchar.h])
> +AC_CHECK_HEADERS([fcntl.h glob.h libintl.h limits.h locale.h string.h
> strings.h sys/ioctl.h sys/param.h sys/statvfs.h sys/syslimits.h
> sys/time.h syslog.h wchar.h])
>
>  # Checks for typedefs, structures, and compiler characteristics.
>  AC_C_INLINE
> --- pacman-3.3.0.orig/src/pacman/pacman.c
> +++ pacman-3.3.0/src/pacman/pacman.c
> @@ -38,6 +38,7 @@
>  #include <locale.h> /* setlocale */
>  #include <time.h> /* time_t */
>  #include <errno.h>
> +#include <glob.h>
>  #if defined(PACMAN_DEBUG) && defined(HAVE_MCHECK_H)
>  #include <mcheck.h> /* debug tracing (mtrace) */
>  #endif
> @@ -814,8 +815,24 @@ static int _parseconfig(const char *file
>                        } else {
>                                /* directives with settings */
>                                if(strcmp(key, "Include") == 0) {
> -                                       pm_printf(PM_LOG_DEBUG, "config: 
> including %s\n", ptr);
> -                                       _parseconfig(ptr, section, db);
> +                                       int globret;
> +                                       glob_t globbuf;
> +                                       globret = glob(ptr, GLOB_NOCHECK, 
> NULL, &globbuf);
> +                                       switch(globret) {
> +                                               case GLOB_NOSPACE:
> +                                                       
> pm_printf(PM_LOG_DEBUG, "config: include globing out of space
> \n");
> +                                               break;
> +                                               case GLOB_ABORTED:
> +                                                       
> pm_printf(PM_LOG_DEBUG, "config: include globing read error for
> %s\n", ptr);
> +                                               break;
> +                                               default:
> +                                                       for(int gindex = 0; 
> gindex < globbuf.gl_pathc; gindex++) {
> +                                                               
> pm_printf(PM_LOG_DEBUG, "config: including %s\n",
> globbuf.gl_pathv[gindex]);
> +                                                               
> _parseconfig(globbuf.gl_pathv[gindex], section, db);
> +                                                       }
> +                                               break;
> +                                       }
> +                                       globfree(&globbuf);
>                                        /* Ignore include failures... assume 
> non-critical */
>                                } else if(strcmp(section, "options") == 0) {
>                                        if(strcmp(key, "NoUpgrade") == 0) {
>
>
>
>

  • [pacman-dev] [RFC]... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
    • [pacman-dev] ... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
      • Re: [pacm... Xavier
        • Re: [... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
          • R... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
            • ... Xavier
              • ... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
              • ... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
              • ... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
              • ... Dan McGee
              • ... Dan McGee
              • ... Xavier
              • ... Dan McGee
              • ... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]
              • ... Marc - A. Dahlhaus [ Administration | Westermann GmbH ]

Reply via email to