8. Push/Pull
8.1. Push
<<argparse_entries>>=
{"push", 4, p_push, NULL},
<<static_funcdefs>>=
static int p_push(int argc, char *argv[]);
<<functions>>=
static int p_push(int argc, char *argv[])
{
weewiki_d ww;
int rc;
if (argc < 3) {
fprintf(stderr,
"Usage: %s file key\n",
argv[0]);
return 1;
}
weewiki_init(&ww);
weewiki_open(&ww, weewiki_dbname_get());
rc = weewiki_push(&ww, argv[1], argv[2]);
weewiki_close(&ww);
weewiki_clean(&ww);
return rc;
}
8.2. Pull
<<argparse_entries>>=
{"pull", 4, p_pull, NULL},
<<static_funcdefs>>=
static int p_pull(int argc, char *argv[]);
<<functions>>=
static int p_pull(int argc, char *argv[])
{
weewiki_d ww;
int rc;
if (argc < 3) {
fprintf(stderr,
"Usage: %s file key\n",
argv[0]);
return 1;
}
weewiki_init(&ww);
weewiki_open(&ww, weewiki_dbname_get());
rc = weewiki_pull(&ww, argv[1], argv[2]);
weewiki_close(&ww);
weewiki_clean(&ww);
return rc;
}
prev | home | next