1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/update/update.c Thu Nov 10 11:00:49 2011 +0000
1.3 @@ -0,0 +1,52 @@
1.4 +/*
1.5 + * Copyright (C) 2009 J. Ali Harlow <ali@juiblex.co.uk>
1.6 + *
1.7 + * This program is free software; you can redistribute it and/or modify
1.8 + * it under the terms of the GNU General Public License as published by
1.9 + * the Free Software Foundation; either version 2 of the License, or
1.10 + * (at your option) any later version.
1.11 + *
1.12 + * This program is distributed in the hope that it will be useful,
1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 + * GNU General Public License for more details.
1.16 + *
1.17 + * You should have received a copy of the GNU General Public License along
1.18 + * with this program; if not, write to the Free Software Foundation, Inc.,
1.19 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1.20 + */
1.21 +
1.22 +#include <stdlib.h>
1.23 +#include <lua.h>
1.24 +#include "config.h"
1.25 +#include "plover/plover.h"
1.26 +#include "whelk/whelk.h"
1.27 +
1.28 +LUALIB_API int luaopen_posix(lua_State *L);
1.29 +
1.30 +void update(const char *argv0)
1.31 +{
1.32 + char *path,*s,*prefix;
1.33 + struct comps *comps;
1.34 + path=plover_get_program_directory(argv0);
1.35 + s=plover_strconcat(path,"/repodata/comps.xml",NULL);
1.36 + comps=plover_comps_new_from_file(s);
1.37 + if (!comps)
1.38 + {
1.39 + perror(s);
1.40 + exit(1);
1.41 + }
1.42 + free(s);
1.43 + prefix=plover_default_prefix_for_vendor(comps->vendor);
1.44 + plover_comps_free(comps);
1.45 + plover_update(path,prefix,NULL);
1.46 + free(prefix);
1.47 + free(path);
1.48 +}
1.49 +
1.50 +int main(int argc,char **argv)
1.51 +{
1.52 + razor_set_lua_loader("posix",luaopen_posix);
1.53 + razor_set_lua_loader("whelk",luaopen_whelk);
1.54 + update(argv[0]);
1.55 +}