static int lua_kpathsea_new(lua_State * L) { kpathsea kpse = NULL; kpathsea *kp = NULL; const char *av = luaL_checkstring(L, 1); const char *liar = luaL_optstring(L, 2, av); kpse = kpathsea_new(); kpathsea_set_program_name(kpse, av, liar); kp = (kpathsea *) lua_newuserdata(L, sizeof(kpathsea *)); *kp = kpse; luaL_getmetatable(L, KPATHSEA_METATABLE); lua_setmetatable(L, -2); return 1; }
int main(int argc, char **argv) { const char **p; kpathsea kpse = kpathsea_new(); kpathsea_set_program_name (kpse, argv[0], NULL); printf("\n%s: name -> xdirname(name) + xbasename(name)\n\n", kpse->invocation_short_name); for (p = tab; *p; p++) { char *q = xdirname(*p); printf("%s -> %s + %s\n", *p, q, xbasename(*p)); free (q); } #if defined (WIN32) kanji_test(); #endif return 0; }
#ifdef USE_KPSE static kpathsea kpse = NULL; #define USED_FOR_KPSE #else #define USED_FOR_KPSE __attribute__((unused)) #endif void gregorio_support_init(const char *const program USED_FOR_KPSE, const char *const argv0 USED_FOR_KPSE) { gregorio_set_error_out(stderr); gregorio_set_verbosity_mode(VERBOSITY_ERROR); gregorio_struct_init(); #ifdef USE_KPSE kpse = kpathsea_new(); kpathsea_set_program_name(kpse, argv0, program); #endif } void gregorio_print_version(const char *copyright) { #ifdef USE_KPSE printf("Gregorio %s (%s).\n%s\n", GREGORIO_VERSION, kpathsea_version_string, copyright); #else printf("Gregorio %s.\n%s\n", GREGORIO_VERSION, copyright); #endif printf("License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ This is free software: you are free to change and redistribute it.\n\