OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../lua-posix/t2-ext-glob.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. --- posix/lposix.c 2005-09-08 21:50:42.445019600 +0200
  17. +++ posix-t2/lposix.c 2005-09-08 21:49:14.994723494 +0200
  18. @@ -22,6 +22,7 @@
  19. #include <time.h>
  20. #include <unistd.h>
  21. #include <utime.h>
  22. +#include <glob.h>
  23. #define MYNAME "posix"
  24. #define MYVERSION MYNAME " library for " LUA_VERSION " / Nov 2003"
  25. @@ -177,6 +178,25 @@
  26. }
  27. +static int Pglob(lua_State *L) /** glob(pattern) */
  28. +{
  29. + const char *pattern = luaL_optstring(L, 1, ".");
  30. + glob_t globres;
  31. +
  32. + if (glob(pattern, GLOB_MARK, NULL, &globres))
  33. + return pusherror(L, pattern);
  34. + else
  35. + {
  36. + int i;
  37. + lua_newtable(L);
  38. + for (i=1; i<=globres.gl_pathc; i++)
  39. + storeindex(L, i, globres.gl_pathv[i-1]);
  40. + globfree(&globres);
  41. + return 1;
  42. + }
  43. +}
  44. +
  45. +
  46. static int aux_files(lua_State *L)
  47. {
  48. DIR *d = lua_touserdata(L, lua_upvalueindex(1));
  49. @@ -773,6 +793,7 @@
  50. {"getlogin", Pgetlogin},
  51. {"getpasswd", Pgetpasswd},
  52. {"getprocessid", Pgetprocessid},
  53. + {"glob", Pglob},
  54. {"kill", Pkill},
  55. {"link", Plink},
  56. {"mkdir", Pmkdir},