Changeset 1214 for trunk/src/kash/expand.c
- Timestamp:
- Oct 7, 2007, 10:39:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/expand.c
r1207 r1214 33 33 */ 34 34 35 #ifdef HAVE_SYS_CDEFS_H 36 #include <sys/cdefs.h> 37 #endif 35 #if 0 38 36 #ifndef lint 39 #if 040 37 static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; 41 38 #else 42 39 __RCSID("$NetBSD: expand.c,v 1.71 2005/06/01 15:41:19 lukem Exp $"); 40 #endif /* not lint */ 43 41 #endif 44 #endif /* not lint */45 42 46 43 #include <sys/types.h> 47 44 #include <sys/time.h> 48 #include <sys/stat.h>49 45 #include <errno.h> 50 #include <dirent.h>51 #include <unistd.h>52 #include <pwd.h>53 46 #include <stdlib.h> 54 47 #include <stdio.h> 55 #ifdef __sun__56 #include <iso/limits_iso.h>57 #endif58 48 59 49 /* … … 267 257 { 268 258 char c, *startp = p; 269 struct passwd *pw;270 259 const char *home; 271 260 int quotes = flag & (EXP_FULL | EXP_CASE); … … 292 281 goto lose; 293 282 } else { 294 if (( pw = getpwnam(startp+1)) == NULL)283 if ((home = sh_gethomedir(psh, startp+1)) == NULL) 295 284 goto lose; 296 home = pw->pw_dir;297 285 } 298 286 if (*home == '\0') … … 1140 1128 int metaflag; 1141 1129 struct stat statb; 1142 DIR*dirp;1143 s tructdirent *dp;1130 shdir *dirp; 1131 shdirent *dp; 1144 1132 int atend; 1145 1133 int matchdot; … … 1215 1203 enddir[-1] = '\0'; 1216 1204 } 1217 if ((dirp = opendir(cp)) == NULL)1205 if ((dirp = shfile_opendir(&psh->fdtab, cp)) == NULL) 1218 1206 return; 1219 1207 if (enddir != psh->expdir) … … 1233 1221 if (*p == '.') 1234 1222 matchdot++; 1235 while (! int_pending() && (dp = readdir(dirp)) != NULL) {1236 if (dp-> d_name[0] == '.' && ! matchdot)1223 while (! int_pending() && (dp = shfile_readdir(dirp)) != NULL) { 1224 if (dp->name[0] == '.' && ! matchdot) 1237 1225 continue; 1238 if (patmatch(psh, start, dp-> d_name, 0)) {1226 if (patmatch(psh, start, dp->name, 0)) { 1239 1227 if (atend) { 1240 scopy(dp-> d_name, enddir);1228 scopy(dp->name, enddir); 1241 1229 addfname(psh, psh->expdir); 1242 1230 } else { 1243 for (p = enddir, cp = dp-> d_name;1231 for (p = enddir, cp = dp->name; 1244 1232 (*p++ = *cp++) != '\0';) 1245 1233 continue; … … 1249 1237 } 1250 1238 } 1251 closedir(dirp);1239 shfile_closedir(dirp); 1252 1240 if (! atend) 1253 1241 endname[-1] = '/';
Note:
See TracChangeset
for help on using the changeset viewer.