]> andersk Git - moira.git/blobdiff - backup/dump_db.qc
install startdcm correctly
[moira.git] / backup / dump_db.qc
index ab581ca69fe6f56f8f98c641caa553cebe81c605..18c5340ccf723d7ec7c067e8db660e13dba1427d 100644 (file)
@@ -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
+ *     <mit-copyright.h>.
  *
  *     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,7 @@ static char *rcsid_dump_db_c = "$Header$";
 #include <stdio.h>
 #include <sys/file.h>
 #include <ctype.h>
+#include <mit-copyright.h>
 
 /* putc without the line buffer hair */
 
@@ -82,7 +77,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 */
@@ -145,6 +141,37 @@ FILE *open_file(prefix, suffix)
     return(f);
 }
 
+
+/*
+ * 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;
+}
+
+
+
 /*
  * Local Variables:
  * mode: c
This page took 0.03303 seconds and 4 git commands to generate.