static void outwinname(Biobuf *b, Hist *h, char *ds, char *p) { if(isdelim(p[0])) { // full rooted name zfile(b, ds, 3); // leading "c:/" outzfile(b, p+1); } else { // relative name if(h->offset == 0 && pathname && pathname[1] == ':') { if(tolowerrune(ds[0]) == tolowerrune(pathname[0])) { // using current drive zfile(b, pathname, 3); // leading "c:/" outzfile(b, pathname+3); } else { // using drive other then current, // we don't have any simple way to // determine current working directory // there, therefore will output name as is zfile(b, ds, 2); // leading "c:" } } outzfile(b, p); } }
static void Sp_toLowerCase(js_State *J) { const char *src = js_tostring(J, 0); char *dst = js_malloc(J, UTFmax * strlen(src) + 1); const char *s = src; char *d = dst; Rune rune; while (*s) { s += chartorune(&rune, s); rune = tolowerrune(rune); d += runetochar(d, &rune); } *d = 0; if (js_try(J)) { js_free(J, dst); js_throw(J); } js_pushstring(J, dst); js_endtry(J); js_free(J, dst); }