Files
mars-nwe/src/dbmtool.c
Mario Fetka f8317503df
All checks were successful
Source release / source-package (push) Successful in 40s
docs: normalize source license headers to gpl2 only
2026-06-03 00:46:27 +02:00

56 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* dbmtool.c 10-Nov-99 data base tool program for mars_nwe */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* Copyright (C) 2026 Mario Fetka
*
* 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; version 2 only.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "net.h"
#include "nwdbm.h"
/* dummy to make nwdbm happy */
int b_acc(uint32 obj_id, int security, int forwrite)
{
return(0);
}
static int usage(char *s)
{
char *p=strrchr(s, '/');
fprintf(stderr, "usage:\t%s e | i | r [path]\n", p ? p+1 : s);
fprintf(stderr, "\te = export\n");
fprintf(stderr, "\ti = import\n");
fprintf(stderr, "\tr = repair\n");
fprintf(stderr, "\tE = Export To DIR\n");
return(1);
}
int main(int argc, char *argv[])
{
init_tools(0, 0);
nw_debug=5;
if (argc < 2) return(usage(argv[0]));
if (*argv[1] == 'e') return(do_export_dbm(argv[2]));
else if (*argv[1] == 'i') return(do_import_dbm(argv[2]));
else if (*argv[1] == 'r') {
if (!do_export_dbm(argv[2]))
return(do_import_dbm(argv[2]));
else return(1);
}
if (*argv[1] == 'E') return(do_export_dbm_to_dir());
else usage(argv[0]);
return(0);
}