logo

cmd-glob

glob(1) wrapper around glob(3), inspired by https://github.com/isaacs/node-glob
commit: 05d56e99f0ada6175893c0a8762c545a3bd2b0f5
parent deca5340bc368b58fe0029b2c1b13bf11ef837d8
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 16 Sep 2023 05:46:36 +0200

glob: Print usage when there's no arguments

Diffstat:

Mglob.c5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/glob.c b/glob.c @@ -29,6 +29,11 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if(argc == 0) { + fprintf(stderr, "Usage: glob [-m] pattern ...\n"); + return 1; + } + for(int i = 0; i < argc; i++) { char *pat = argv[i];