6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
8 * This program dumps the SMS database to a series of output files
9 * which can be later read back into SMS in the event of a crash.
12 * Revision 1.1 1987-07-11 19:51:05 wesommer
19 static char *rcsid_dump_db_c = "$Header$";
34 fprintf(stderr, "Usage: smsbackup prefix\n");
47 FILE *open_file(prefix, suffix)
48 char *prefix, *suffix;
57 fd = open(name, O_CREAT|O_WRONLY|O_EXCL, 0644);
63 fprintf(stderr, "fdopen of ");
66 fprintf(stderr, "Working on %s\n", name);
75 sprintf(buf, "%d", n);
85 * Should check that we're not printing non-printing characters or
86 * ':' characters here (??? recovery if we do??)
93 register int len = strlen(str);
95 if (fwrite(str, 1, len, f) != len) punt("short write");
110 if (fflush(stream) == EOF)
111 punt("Unable to fflush");
112 if (fsync(fileno(stream)) != 0)
113 punt("Unable to fsync");
121 * c-continued-statement-offset: 4
123 * c-argdecl-indent: 4