X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/d55654f4e6221f7b5e74acb92e9b544eedfbb8b9..67805159a972397342c342ee735c8acd640e1399:/backup/dump_db.qc diff --git a/backup/dump_db.qc b/backup/dump_db.qc index ab581ca6..b468ca16 100644 --- a/backup/dump_db.qc +++ b/backup/dump_db.qc @@ -3,19 +3,13 @@ * $Author$ * $Header$ * - * Copyright (C) 1987 by the Massachusetts Institute of Technology + * (c) Copyright 1988 by the Massachusetts Institute of Technology. + * For copying and distribution information, please see the file + * . * * This program dumps the SMS database to a series of output files * which can be later read back into SMS in the event of a crash. * - * $Log$ - * Revision 1.2 1987-07-13 03:52:53 wesommer - * Modified to pass lint, do better backups. - * -Revision 1.1 87/07/11 19:51:05 wesommer -Initial revision - - * */ #ifndef lint @@ -25,6 +19,8 @@ static char *rcsid_dump_db_c = "$Header$"; #include #include #include +#include +#include "dump_db.h" /* putc without the line buffer hair */ @@ -51,15 +47,18 @@ main(argc, argv) bzero(act, 128); - act[':']=1; + act[SEP_CHAR]=1; act['\\']=1; act[127]=2; for (i=0; i<' '; i++) act[i]=2; ## ingres sms - +## set lockmode session where level = table +## begin transaction + do_backups(prefix); - + +## end transaction ## exit exit(0); } @@ -82,7 +81,8 @@ dump_str(f, str) register FILE *f; register char *str; { - register char *ibp = str; + char *strtrim(); + register char *ibp = strtrim(str); register int c; /* PCC doesn't put chars in registers.. */ for (; c = *ibp; ibp++) { c = toascii(c); /* punt 8th bit */ @@ -103,7 +103,6 @@ dump_str(f, str) if (putc1(t,f) < 0) wpunt(); t = (c&7) + '0'; if (putc1(t,f) < 0) wpunt(); - fprintf(stderr, "control character \\%03o\n", c); break; default: @@ -145,13 +144,31 @@ FILE *open_file(prefix, suffix) return(f); } + /* - * Local Variables: - * mode: c - * c-indent-level: 4 - * c-continued-statement-offset: 4 - * c-brace-offset: -4 - * c-argdecl-indent: 4 - * c-label-offset: -4 - * End: + * Trim whitespace off both ends of a string. */ +char *strtrim(save) + register char *save; +{ + register char *t, *s; + + s = save; + while (isspace(*s)) s++; + /* skip to end of string */ + if (*s == '\0') { + *save = '\0'; + return(save); + } + + for (t = s; *t; t++) continue; + while (t > s) { + --t; + if (!isspace(*t)) { + t++; + break; + } + } + *t = '\0'; + return s; +}