diff -r 000000000000 -r f9a7fa531563 update/update.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/update/update.c Thu Feb 11 19:47:47 2010 +0000 @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 J. Ali Harlow + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include "config.h" +#include "plover/plover.h" +#include "whelk/whelk.h" + +LUALIB_API int luaopen_posix(lua_State *L); + +void update(const char *argv0) +{ + char *path,*s,*prefix; + struct comps *comps; + path=plover_get_program_directory(argv0); + s=plover_strconcat(path,"/repodata/comps.xml",NULL); + comps=plover_comps_new_from_file(s); + if (!comps) + { + perror(s); + exit(1); + } + free(s); + prefix=plover_default_prefix_for_vendor(comps->vendor); + plover_comps_free(comps); + plover_update(path,prefix,NULL); + free(prefix); + free(path); +} + +int main(int argc,char **argv) +{ + razor_set_lua_loader("posix",luaopen_posix); + razor_set_lua_loader("whelk",luaopen_whelk); + update(argv[0]); +}