qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char), pglob);
qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
glob0(pattern, pglob)	const Char *pattern;	glob_t *pglob;{	const Char *qpatnext;	int c, err, oldpathc;	Char *bufnext, patbuf[MAXPATHLEN+1];	size_t limit = 0;	qpatnext = globtilde(pattern, patbuf, sizeof(patbuf) / sizeof(Char),	    pglob);	oldpathc = pglob->gl_pathc;	bufnext = patbuf;	/* We don't need to check for buffer overflow any more. */	while ((c = *qpatnext++) != EOS) {		switch (c) {		case LBRACKET:			c = *qpatnext;			if (c == NOT)				++qpatnext;			if (*qpatnext == EOS ||			    g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {				*bufnext++ = LBRACKET;				if (c == NOT)					--qpatnext;				break;			}			*bufnext++ = M_SET;			if (c == NOT)				*bufnext++ = M_NOT;			c = *qpatnext++;			do {				*bufnext++ = CHAR(c);				if (*qpatnext == RANGE &&				    (c = qpatnext[1]) != RBRACKET) {					*bufnext++ = M_RNG;					*bufnext++ = CHAR(c);					qpatnext += 2;				}			} while ((c = *qpatnext++) != RBRACKET);			pglob->gl_flags |= GLOB_MAGCHAR;			*bufnext++ = M_END;			break;		case QUESTION:			pglob->gl_flags |= GLOB_MAGCHAR;			*bufnext++ = M_ONE;			break;		case STAR:			pglob->gl_flags |= GLOB_MAGCHAR;			/* collapse adjacent stars to one,			 * to avoid exponential behavior			 */			if (bufnext == patbuf || bufnext[-1] != M_ALL)				*bufnext++ = M_ALL;			break;		default:			*bufnext++ = CHAR(c);			break;		}	}	*bufnext = EOS;#ifdef DEBUG	qprintf("glob0:", patbuf);#endif	if ((err = glob1(patbuf, pglob, &limit)) != 0)		return(err);	/*	 * If there was no match we are going to append the pattern	 * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified	 * and the pattern did not contain any magic characters	 * GLOB_NOMAGIC is there just for compatibility with csh.	 */	if (pglob->gl_pathc == oldpathc) {		if ((pglob->gl_flags & GLOB_NOCHECK) ||		    ((pglob->gl_flags & GLOB_NOMAGIC) &&		    !(pglob->gl_flags & GLOB_MAGCHAR)))			return(globextend(pattern, pglob, &limit));		else			return(GLOB_NOMATCH);	}	if (!(pglob->gl_flags & GLOB_NOSORT))		qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,		    pglob->gl_pathc - oldpathc, sizeof(char *), compare);	return(0);}