whereis.c (e97f67f53276c84755c7239e71fa7110be6f216e) | whereis.c (8e4c33e9e7c9915c4b3b36001216ac8f48bdf7f9) |
---|---|
1/* 2 * Copyright � 2002, J�rg Wunsch 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 245 unchanged lines hidden (view full) --- 254 DIR *dir; 255 struct stat sb; 256 struct dirent *dirp; 257 258 /* default to -bms if none has been specified */ 259 if (!opt_b && !opt_m && !opt_s) 260 opt_b = opt_m = opt_s = 1; 261 | 1/* 2 * Copyright � 2002, J�rg Wunsch 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 245 unchanged lines hidden (view full) --- 254 DIR *dir; 255 struct stat sb; 256 struct dirent *dirp; 257 258 /* default to -bms if none has been specified */ 259 if (!opt_b && !opt_m && !opt_s) 260 opt_b = opt_m = opt_s = 1; 261 |
262 /* -b defaults to default path + /usr/libexec + user's path */ | 262 /* -b defaults to default path + /usr/libexec + 263 * /usr/games + user's path */ |
263 if (!bindirs) { 264 if (sysctlbyname("user.cs_path", (void *)NULL, &s, 265 (void *)NULL, 0) == -1) 266 err(EX_OSERR, "sysctlbyname(\"user.cs_path\")"); 267 if ((b = malloc(s + 1)) == NULL) 268 abort(); 269 if (sysctlbyname("user.cs_path", b, &s, (void *)NULL, 0) == -1) 270 err(EX_OSERR, "sysctlbyname(\"user.cs_path\")"); 271 nele = 0; 272 decolonify(b, &bindirs, &nele); | 264 if (!bindirs) { 265 if (sysctlbyname("user.cs_path", (void *)NULL, &s, 266 (void *)NULL, 0) == -1) 267 err(EX_OSERR, "sysctlbyname(\"user.cs_path\")"); 268 if ((b = malloc(s + 1)) == NULL) 269 abort(); 270 if (sysctlbyname("user.cs_path", b, &s, (void *)NULL, 0) == -1) 271 err(EX_OSERR, "sysctlbyname(\"user.cs_path\")"); 272 nele = 0; 273 decolonify(b, &bindirs, &nele); |
273 bindirs = realloc(bindirs, (nele + 2) * sizeof(char *)); | 274 bindirs = realloc(bindirs, (nele + 3) * sizeof(char *)); |
274 if (bindirs == NULL) 275 abort(); 276 bindirs[nele++] = "/usr/libexec"; | 275 if (bindirs == NULL) 276 abort(); 277 bindirs[nele++] = "/usr/libexec"; |
278 bindirs[nele++] = "/usr/games"; |
|
277 bindirs[nele] = NULL; 278 if ((cp = getenv("PATH")) != NULL) { 279 /* don't destroy the original environment... */ 280 if ((b = malloc(strlen(cp) + 1)) == NULL) 281 abort(); 282 strcpy(b, cp); 283 decolonify(b, &bindirs, &nele); 284 } --- 309 unchanged lines hidden --- | 279 bindirs[nele] = NULL; 280 if ((cp = getenv("PATH")) != NULL) { 281 /* don't destroy the original environment... */ 282 if ((b = malloc(strlen(cp) + 1)) == NULL) 283 abort(); 284 strcpy(b, cp); 285 decolonify(b, &bindirs, &nele); 286 } --- 309 unchanged lines hidden --- |