Ignore:
Timestamp:
Dec 1, 2007, 9:11:25 PM (18 years ago)
Author:
bird
Message:

better check for the kmk shell. don't freak out and use the shell on double-quote (probably a bug).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kbuild.c

    r1128 r1298  
    134134            szTmp[rc] = '\0';
    135135    }
    136    
     136
    137137#elif defined(WINDOWS32)
    138138    if (GetModuleFileName(GetModuleHandle(NULL), szTmp, GET_PATH_MAX))
     
    167167                    break;
    168168                }
    169             }   
     169            }
    170170
    171171            /* next */
     
    176176        free(pszCopy);
    177177    }
    178 #endif       
     178#endif
    179179
    180180    if (rc < 0)
     
    204204 * Determin the PATH_KBUILD value.
    205205 *
    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).
    207207 */
    208208const char *get_path_kbuild(void)
     
    236236 * Determin the PATH_KBUILD_BIN value.
    237237 *
    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).
    239239 */
    240240const char *get_path_kbuild_bin(void)
     
    276276}
    277277
     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 */
     284const 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}
    278302
    279303#ifdef KMK_HELPERS
Note: See TracChangeset for help on using the changeset viewer.