Add include files to get prototype declarations, and fix bugs found.
[unix-history] / usr / src / lib / libc / gen / glob.c
index 80b7651..1e94505 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)glob.c     5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)glob.c     5.4 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 /*
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -32,11 +32,16 @@ static char sccsid[] = "@(#)glob.c  5.3 (Berkeley) %G%";
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
 #include <stdio.h>
-
-char *malloc(), *realloc();
+#include <stdlib.h>
 
 typedef int bool_t;
 
 
 typedef int bool_t;
 
+static glob1();
+static glob2();
+static glob3();
+static globextend();
+static bool_t match();
+
 #define        DOLLAR          '$'
 #define        DOT             '.'
 #define        EOS             '\0'
 #define        DOLLAR          '$'
 #define        DOT             '.'
 #define        EOS             '\0'
@@ -77,12 +82,14 @@ compare(p, q)
  * to find no matches.
  */
 glob(pattern, flags, errfunc, pglob)
  * to find no matches.
  */
 glob(pattern, flags, errfunc, pglob)
-       char *pattern;
-       int flags, (*errfunc)();
+       const char *pattern;
+       int flags;
+       int (*errfunc) __P((char *, int));
        glob_t *pglob;
 {
        int err, oldpathc;
        glob_t *pglob;
 {
        int err, oldpathc;
-       char *bufnext, *bufend, *compilebuf, *compilepat, *patnext;
+       char *bufnext, *bufend, *compilebuf;
+       const char *compilepat, *patnext;
        char c, patbuf[MAXPATHLEN+1];
 
        patnext = pattern;
        char c, patbuf[MAXPATHLEN+1];
 
        patnext = pattern;