# [PATCH] Fix compilation of git.c

3 messages from 2005-11-16 to 2005-11-16. Participants: Johannes Schindelin, Junio C Hamano, Andreas Ericsson.
Thread: https://gitlist.dev/t/2545

## Johannes Schindelin, 2005-11-16 01:44

Subject: [PATCH] Fix compilation of git.c
Message-ID: <Pine.LNX.4.63.0511160243360.14176@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0511160243360.14176%40wbgn013.biozentrum.uni-wuerzburg.de

```

Some systems do not define GLOB_ABORTED and GLOB_NOMATCH.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

---

 git.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

applies-to: c20dc1194fcfa73a7bf6e9d315c878d4f8c2828a
57cce66195a824221c0e9517ff4999daf2fbe2d2
diff --git a/git.c b/git.c
index 583923d..30b3c04 100644
--- a/git.c
+++ b/git.c
@@ -77,13 +77,17 @@ static void list_commands(const char *ex
 	case GLOB_NOSPACE:
 		puts("Out of memory when running glob()");
 		exit(2);
+#ifdef GLOB_ABORTED
 	case GLOB_ABORTED:
 		printf("'%s': Read error: %s\n", exec_path, strerror(errno));
 		exit(2);
+#endif
+#ifdef GLOB_NOMATCH
 	case GLOB_NOMATCH:
 		printf("No git commands available in '%s'.\n", exec_path);
 		printf("Do you need to specify --exec-path or set GIT_EXEC_PATH?\n");
 		exit(1);
+#endif
 	}
 
 	for (i = 0; i < gl.gl_pathc; i++) {
---
0.99.9.GIT

```

## Junio C Hamano, 2005-11-16 03:01

Subject: Re: [PATCH] Fix compilation of git.c
Message-ID: <7v4q6de1oc.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v4q6de1oc.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0511160243360.14176@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Some systems do not define GLOB_ABORTED and GLOB_NOMATCH.

That's true, but the glob does not distinguish executables and
others anyway, do wouldn't it be more portable and easier to do
readdir, stat and list in the loop?

```

## Andreas Ericsson, 2005-11-16 06:54

Subject: Re: [PATCH] Fix compilation of git.c
Message-ID: <437AD7A6.6050906@op5.se>
URL: https://gitlist.dev/e/437AD7A6.6050906%40op5.se
In-Reply-To: <7v4q6de1oc.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> 
>>Some systems do not define GLOB_ABORTED and GLOB_NOMATCH.
> 
> 
> That's true, but the glob does not distinguish executables and
> others anyway, do wouldn't it be more portable and easier to do
> readdir, stat and list in the loop?
> 

Got one implementation of that too, but it doesn't sort the command list 
and I thought it was nice to have them that way while too lazy to 
implement myself.

OTOH, that switch/case thing was for debugging (forgot prefix=/usr when 
compiling...). I'm perfectly fine with

if (glob(....)) {
	error_out("friendly message");
}

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

```
