-/*
- * $Source$
- * $Author$
- * $Header$
+/* $Id$
*
- * (c) Copyright 1988 by the Massachusetts Institute of Technology.
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
+ * This program restores the Moira database from an mrbackup.
*
+ * Copyright (C) 1988-1998 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
*/
-#ifndef lint
-static char *rcsid_rest_db_qc = "$Header$";
-#endif lint
+#include <mit-copyright.h>
+#include <moira.h>
+#include "dump_db.h"
-#include <sys/file.h>
-#include <stdio.h>
-#include <fcntl.h>
#include <ctype.h>
-#include <mit-copyright.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
EXEC SQL INCLUDE sqlca;
-#include "dump_db.h"
+RCSID("$Header$");
+
+int yes_or_no(char *prompt);
int main(int argc, char **argv)
{
EXEC SQL CONNECT :db IDENTIFIED BY :db;
if (sqlca.sqlcode != 0)
{
- com_err(argv[0], 0, "Ingres database open failed");
+ com_err(argv[0], 0, "Database open failed");
exit(1);
}
printf(" done\n");
int tt = open("/dev/tty", O_RDWR, 0);
FILE *o, *i;
- register char *cp;
+ char *cp;
if (tt < 0)
return 0;
return ret;
}
-int parse_int(register FILE *f)
+int parse_int(FILE *f)
{
- register int c;
- register int val = 0;
- register int sign = 1;
+ int c;
+ int val = 0;
+ int sign = 1;
while ((c = getc(f)) != EOF && c != SEP_CHAR && c != '\n')
{
if (c == '-')
return val * sign;
}
-void parse_str(register FILE *f, register char *buf, register int maxlen)
+void parse_str(FILE *f, char *buf, int maxlen)
{
- register int c, len = 0;
+ int c, len = 0;
while ((c = getc(f)) != EOF && c != SEP_CHAR && c != '\n' && len < maxlen)
{
if (isdigit(c))
{
/* Expect three-digit octal number.. */
- register int c1, c2;
+ int c1, c2;
c1 = getc(f);
c2 = getc(f);
if (!isdigit(c1) || !isdigit(c2))
if (getc(f) != SEP_CHAR)
punt("Expected Separator");
}
+
void parse_nl(FILE *f)
{
if (getc(f) != '\n')
punt("Expected newline");
}
-
FILE *open_file(char *prefix, char *suffix)
{
char name[BUFSIZ];