=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rdist/expand.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/rdist/expand.c 1996/06/26 05:38:12 1.4 --- src/usr.bin/rdist/expand.c 1998/06/26 21:21:10 1.5 *************** *** 1,4 **** ! /* $OpenBSD: expand.c,v 1.4 1996/06/26 05:38:12 deraadt Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. --- 1,4 ---- ! /* $OpenBSD: expand.c,v 1.5 1998/06/26 21:21:10 millert Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. *************** *** 34,41 **** */ #ifndef lint static char RCSid[] = ! "$OpenBSD: expand.c,v 1.4 1996/06/26 05:38:12 deraadt Exp $"; static char sccsid[] = "@(#)expand.c 5.2 (Berkeley) 3/28/86"; --- 34,46 ---- */ #ifndef lint + #if 0 static char RCSid[] = ! "$From: expand.c,v 6.18 1998/03/24 00:37:10 michaelc Exp $"; ! #else ! static char RCSid[] = ! "$OpenBSD: expand.c,v 1.5 1998/06/26 21:21:10 millert Exp $"; ! #endif static char sccsid[] = "@(#)expand.c 5.2 (Berkeley) 3/28/86"; *************** *** 85,102 **** return; } ! eargv[++eargc] = (char *) NULL; eargv[eargc - 1] = cp = xmalloc(len); do { if (*s1 == QUOTECHAR) s1++; ! } while (*cp++ = *s1++); cp--; do { if (*s2 == QUOTECHAR) s2++; ! } while (*cp++ = *s2++); } static void addpath(c) --- 90,107 ---- return; } ! eargv[++eargc] = NULL; eargv[eargc - 1] = cp = xmalloc(len); do { if (*s1 == QUOTECHAR) s1++; ! } while ((*cp++ = *s1++)); cp--; do { if (*s2 == QUOTECHAR) s2++; ! } while ((*cp++ = *s2++)); } static void addpath(c) *************** *** 143,149 **** tilde = ""; eargc = 0; eargv = sortbase = argvbuf; ! *eargv = (char *) NULL; /* * Walk the name list and expand names into eargv[]; --- 148,154 ---- tilde = ""; eargc = 0; eargv = sortbase = argvbuf; ! *eargv = NULL; /* * Walk the name list and expand names into eargv[]; *************** *** 155,161 **** */ list = prev = NULL; for (n = 0; n < eargc; n++) { ! nl = makenl((char *)NULL); nl->n_name = eargv[n]; if (prev == NULL) list = prev = nl; --- 160,166 ---- */ list = prev = NULL; for (n = 0; n < eargc; n++) { ! nl = makenl(NULL); nl->n_name = eargv[n]; if (prev == NULL) list = prev = nl; *************** *** 182,188 **** if (ch == *cp) return(cp); ! return((u_char *)NULL); } void expstr(s) --- 187,193 ---- if (ch == *cp) return(cp); ! return(NULL); } void expstr(s) *************** *** 251,257 **** savec = *tail; *tail = CNULL; } ! tp = lookup((char *)cp, LOOKUP, (struct namelist *)NULL); if (savec != CNULL) *tail = savec; if (tp != NULL) { --- 256,262 ---- savec = *tail; *tail = CNULL; } ! tp = lookup((char *)cp, LOOKUP, NULL); if (savec != CNULL) *tail = savec; if (tp != NULL) { *************** *** 296,302 **** cp1 = (u_char *)pw->pw_dir; s = cp; } ! for (cp = (u_char *)path; *cp++ = *cp1++; ) ; tpathp = pathp = (char *)cp - 1; } else { --- 301,307 ---- cp1 = (u_char *)pw->pw_dir; s = cp; } ! for (cp = (u_char *)path; (*cp++ = *cp1++); ) ; tpathp = pathp = (char *)cp - 1; } else { *************** *** 320,326 **** sort(); } ! static argcmp(a1, a2) char **a1, **a2; { --- 325,331 ---- sort(); } ! static int argcmp(a1, a2) char **a1, **a2; { *************** *** 361,367 **** cp++, pathp++; *pathp = CNULL; if (*oldcp == '{') { ! (void) execbrc(cp, (u_char *)NULL); return; } matchdir((char *)cp); --- 366,372 ---- cp++, pathp++; *pathp = CNULL; if (*oldcp == '{') { ! (void) execbrc(cp, NULL); return; } matchdir((char *)cp); *************** *** 410,415 **** --- 415,421 ---- yyerror(path); } + int execbrc(p, s) /* quote in p */ u_char *p, *s; { *************** *** 500,505 **** --- 506,512 ---- return (0); } + int match(s, p) /* quote in p */ char *s, *p; { *************** *** 517,522 **** --- 524,530 ---- return (c); } + int amatch(s, p) /* quote in p */ register char *s; register u_char *p; *************** *** 538,544 **** case '[': ok = 0; lc = 077777; ! while (cc = *p++) { if (cc == ']') { if (ok) break; --- 546,552 ---- case '[': ok = 0; lc = 077777; ! while ((cc = *p++)) { if (cc == ']') { if (ok) break; *************** *** 600,607 **** else Cat((u_char *)tilde, (u_char *)tpathp); ! } else expsh(p); pathp = spathp; *pathp = CNULL; return (0); --- 608,616 ---- else Cat((u_char *)tilde, (u_char *)tpathp); ! } else { expsh(p); + } pathp = spathp; *pathp = CNULL; return (0);