7. Create

create creates a weewiki database in the currently directory. By default, this is called "a.db".

<<argparse_entries>>=
{"create", 6, p_create, NULL},
<<static_funcdefs>>=
static int p_create(int argc, char *argv[]);
<<functions>>=
static int p_create(int argc, char *argv[])
{
    weewiki_d ww;
    int rc;
    const char *dbname;

    if (argc > 1) {
        dbname = argv[1];
    } else {
        dbname = weewiki_dbname_get();
    }

    weewiki_init(&ww);

    rc = weewiki_create(&ww, dbname);

    weewiki_close(&ww);
    weewiki_clean(&ww);
    return rc;
}



prev | home | next