Changeset 1298 in kBuild
- Timestamp:
- Dec 1, 2007 8:11:25 PM (17 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/job.c
r1290 r1298 29 29 #ifdef CONFIG_WITH_KMK_BUILTIN 30 30 # include "kmkbuiltin.h" 31 #endif 32 #ifdef KMK 33 # include "kbuild.h" 31 34 #endif 32 35 … … 2522 2525 static char *sh_cmds[] = { 0 }; 2523 2526 #else /* must be UNIX-ish */ 2524 static char sh_chars [] = "#;\"*?[]&|<>(){}$`^~!";2525 static char *sh_cmds [] = { ".", ":", "break", "case", "cd", "continue",2527 static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^~!"; /* kmk: +_sh */ 2528 static char *sh_cmds_sh[] = { ".", ":", "break", "case", "cd", "continue", /* kmk: +_sh */ 2526 2529 "eval", "exec", "exit", "export", "for", "if", 2527 2530 "login", "logout", "read", "readonly", "set", … … 2534 2537 static char *sh_chars_sh = sh_chars; 2535 2538 # endif /* HAVE_DOS_PATHS */ 2539 # ifdef KMK 2540 char* sh_chars = sh_chars_sh; 2541 char** sh_cmds = sh_cmds_sh; 2542 # endif 2543 #endif 2544 #ifdef KMK 2545 static char sh_chars_kash[] = "#;*?[]&|<>(){}$`^~!"; /* note: no \" */ 2546 static char *sh_cmds_kash[] = { 2547 ".", ":", "break", "case", "cd", "continue", 2548 "echo", "eval", "exec", "exit", "export", "for", "if", 2549 "login", "logout", "read", "readonly", "set", 2550 "shift", "switch", "test", "times", "trap", 2551 "umask", "wait", "while", 0 2552 }; 2553 int is_kmk_shell = 0; 2536 2554 #endif 2537 2555 int i; … … 2564 2582 2565 2583 /* See if it is safe to parse commands internally. */ 2584 #ifdef KMK /* kmk_ash and kmk_kash are both fine, kmk_ash is the default btw. */ 2585 if (shell == 0) 2586 { 2587 is_kmk_shell = 1; 2588 shell = (char *)get_default_kbuild_shell (); 2589 } 2590 else if (!strcmp (shell, get_default_kbuild_shell())) 2591 is_kmk_shell = 1; 2592 else 2593 { 2594 const char *psz = strstr (shell, "/kmk_ash"); 2595 if (psz) 2596 psz += sizeof ("/kmk_ash") - 1; 2597 else 2598 { 2599 psz = strstr (shell, "/kmk_kash"); 2600 if (psz) 2601 psz += sizeof ("/kmk_kash") - 1; 2602 } 2603 # if defined (__OS2__) || defined (_WIN32) || defined (WINDOWS32) 2604 is_kmk_shell = psz && (*psz == '\0' || !stricmp (psz, ".exe")); 2605 # else 2606 is_kmk_shell = psz && *psz == '\0'; 2607 # endif 2608 } 2609 if (is_kmk_shell) 2610 { 2611 sh_chars = sh_chars_kash; 2612 sh_cmds = sh_cmds_kash; 2613 } 2614 #else /* !KMK */ 2566 2615 if (shell == 0) 2567 2616 shell = default_shell; 2617 #endif /* !KMK */ 2568 2618 #ifdef WINDOWS32 2569 2619 else if (strcmp (shell, default_shell)) … … 2613 2663 #else /* !__MSDOS__ */ 2614 2664 else if (strcmp (shell, default_shell)) 2615 # ifndef KMK2616 2665 goto slow; 2617 # else /* KMK */2618 {2619 /* Allow ash from kBuild. */2620 const char *psz = strstr(shell, "/kmk_ash");2621 if ( !psz2622 || (!psz[sizeof("/kmk_ash")] && psz[sizeof("/kmk_ash")] == '.')) /* FIXME: this test looks bogus... */2623 goto slow;2624 }2625 # endif /* KMK */2626 2666 #endif /* !__MSDOS__ && !__EMX__ */ 2627 2667 #endif /* not WINDOWS32 */ -
trunk/src/kmk/kbuild.c
r1128 r1298 134 134 szTmp[rc] = '\0'; 135 135 } 136 136 137 137 #elif defined(WINDOWS32) 138 138 if (GetModuleFileName(GetModuleHandle(NULL), szTmp, GET_PATH_MAX)) … … 167 167 break; 168 168 } 169 } 169 } 170 170 171 171 /* next */ … … 176 176 free(pszCopy); 177 177 } 178 #endif 178 #endif 179 179 180 180 if (rc < 0) … … 204 204 * Determin the PATH_KBUILD value. 205 205 * 206 * @returns Pointer to static buffer to be treated as read only!206 * @returns Pointer to static a buffer containing the value (consider it read-only). 207 207 */ 208 208 const char *get_path_kbuild(void) … … 236 236 * Determin the PATH_KBUILD_BIN value. 237 237 * 238 * @returns Pointer to static buffer to be treated as read only!238 * @returns Pointer to static a buffer containing the value (consider it read-only). 239 239 */ 240 240 const char *get_path_kbuild_bin(void) … … 276 276 } 277 277 278 279 /** 280 * Determin the location of default kBuild shell. 281 * 282 * @returns Pointer to static a buffer containing the location (consider it read-only). 283 */ 284 const char *get_default_kbuild_shell(void) 285 { 286 static char *s_pszDefaultShell = NULL; 287 if (!s_pszDefaultShell) 288 { 289 #if defined(__OS2__) || defined(_WIN32) || defined(WINDOWS32) 290 static const char s_szShellName[] = "/kmk_ash.exe"; 291 #else 292 static const char s_szShellName[] = "/kmk_ash"; 293 #endif 294 const char *pszBin = get_path_kbuild_bin(); 295 size_t cchBin = strlen(pszBin); 296 s_pszDefaultShell = xmalloc(cchBin + sizeof(s_szShellName)); 297 memcpy(s_pszDefaultShell, pszBin, cchBin); 298 memcpy(&s_pszDefaultShell[cchBin], s_szShellName, sizeof(s_szShellName)); 299 } 300 return s_pszDefaultShell; 301 } 278 302 279 303 #ifdef KMK_HELPERS -
trunk/src/kmk/kbuild.h
r933 r1298 37 37 const char *get_path_kbuild(void); 38 38 const char *get_path_kbuild_bin(void); 39 const char *get_default_kbuild_shell(void); 39 40 40 41 #endif
Note:
See TracChangeset
for help on using the changeset viewer.