3 * Utility routines used by the MOIRA extraction programs.
5 * (c) Copyright 1988 by the Massachusetts Institute of Technology.
6 * For copying and distribution information, please see the file
11 #include <mit-copyright.h>
15 #include <moira_site.h>
17 extern void sqlglm(char buf[], int *, int *);
22 char oldfile[64], filename[64];
24 sprintf(oldfile, "%s.old", targetfile);
25 sprintf(filename, "%s~", targetfile);
26 if (rename(targetfile, oldfile) == 0) {
27 if (rename(filename, targetfile) < 0) {
28 rename(oldfile, targetfile);
29 perror("Unable to install new file (rename failed)\n");
30 fprintf(stderr, "Filename = %s\n", targetfile);
34 if (rename(filename, targetfile) < 0) {
35 perror("Unable to rename old file\n");
36 fprintf(stderr, "Filename = %s\n", targetfile);
70 int bufsize=256, len=0;
72 com_err(whoami, MR_DBMS_ERR, " code %d\n", code);
73 sqlglm(buf, &bufsize, &len);
75 com_err(whoami, 0, "SQL error text = %s", buf);
76 critical_alert("DCM", "%s build encountered DATABASE ERROR %d\n%s",