RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Ralf S. Engelschall
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm lua                          Date:   20-Jan-2008 12:29:50
  Branch: HEAD                             Handle: 2008012011294900

  Modified files:
    lua/local               lposix.c
    rpm                     CHANGES

  Log:
    Provide RPM Lua function posix.glob(<pattern>).

  Summary:
    Revision    Changes     Path
    1.8         +25 -1      lua/local/lposix.c
    1.2084      +1  -0      rpm/CHANGES
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: lua/local/lposix.c
  ============================================================================
  $ cvs diff -u -r1.7 -r1.8 lposix.c
  --- lua/local/lposix.c        19 Jan 2008 12:27:26 -0000      1.7
  +++ lua/local/lposix.c        20 Jan 2008 11:29:49 -0000      1.8
  @@ -5,7 +5,7 @@
   * 05 Nov 2003 22:09:10
   */
   
  -#include "system.h" /* setenv/unsetenv/etc */
  +#include "system.h" /* setenv/unsetenv/glob/etc */
   
   #include <dirent.h>
   #include <errno.h>
  @@ -837,6 +837,29 @@
        return doselection(L, 1, SgetID, FgetID, NULL);
   }
   
  +static int Pglob(lua_State *L)  /** glob(pattern) */
  +{
  +    const char *pattern;
  +    glob_t g;
  +    int i;
  +    int rc;
  +
  +    pattern = luaL_optstring(L, 1, ".");
  +    rc = glob(pattern, 0, NULL, &g);
  +    if (rc == 0) {
  +        lua_newtable(L);
  +        for (i = 1; i <= g.gl_pathc; i++)
  +            storeindex(L, i, g.gl_pathv[i - 1]);
  +        globfree(&g);
  +        return 1;
  +    }
  +    else if (rc == GLOB_NOMATCH) {
  +        lua_newtable(L);
  +        return 1;
  +    }
  +    else
  +        return pusherror(L, pattern);
  +}
   
   static int Pttyname(lua_State *L)            /** ttyname(fd) */
        /[EMAIL PROTECTED] L @*/
  @@ -1148,6 +1171,7 @@
        {"getlogin",            Pgetlogin},
        {"getpasswd",           Pgetpasswd},
        {"getprocessid",        Pgetprocessid},
  +     {"glob",                Pglob},
        {"kill",                Pkill},
        {"link",                Plink},
        {"mkdir",               Pmkdir},
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2083 -r1.2084 CHANGES
  --- rpm/CHANGES       20 Jan 2008 11:05:34 -0000      1.2083
  +++ rpm/CHANGES       20 Jan 2008 11:29:49 -0000      1.2084
  @@ -1,4 +1,5 @@
   5.0.0 -> 5.1a1:
  +    - rse: provide RPM Lua function posix.glob(<pattern>)
       - rse: make older C compiler happy by not declaring a variable in the 
middle of a block in rpmconstant/constant.c
       - rse: let RPM Lua init procedure load all init scripts configured with 
new Autoconf option --with-path-rpmlua 
       - rse: fix Autoconf procedure by running python(1) based checks only 
under --with-python
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to