X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/31593dd6106cfef78fc88cbe9c831a51f00a4aa6..0cea42440ffc9edab56710ab0baaff9454a86fea:/util.c?ds=sidebyside diff --git a/util.c b/util.c index 7d15a8a6..ffbdc932 100644 --- a/util.c +++ b/util.c @@ -504,3 +504,30 @@ int lock_range(int fd, int offset, int len) return fcntl(fd,F_SETLK,&lock) == 0; } + + +void glob_expand(char **argv, int *argc, int maxargs) +{ +#ifndef HAVE_GLOB + (*argc)++; + return; +#else + glob_t globbuf; + int i; + + memset(&globbuf, 0, sizeof(globbuf)); + glob(argv[*argc], 0, NULL, &globbuf); + if (globbuf.gl_pathc == 0) { + (*argc)++; + globfree(&globbuf); + return; + } + for (i=0; i<(maxargs - (*argc)) && i