X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/31593dd6106cfef78fc88cbe9c831a51f00a4aa6..4c3d16be50ebe52e51383e396a641448c4ba00c0:/util.c diff --git a/util.c b/util.c index 7d15a8a6..ed8d34e2 100644 --- a/util.c +++ b/util.c @@ -504,3 +504,42 @@ 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