JPRED-2 Add sources of all binaries (except alscript) to Git
[jpred.git] / sources / multicoil / scsystem.c
1 /*  Bonnie Berger, David Wilson and Theodore Tonchev 1992  */
2 /*       C Code File       */
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <time.h>
7 #include "scsystem.h"
8
9 /* Error Messages */
10 char* err_msg[] = {
11   "Tracing",
12   "Usage Error",
13   "Unrecognized switch:",
14   "Error while opening file",
15   "Error while writing in",
16   "Error while reading from",
17   "Bad Magic Number of",
18   "Not Enough Memory"
19   };
20
21 void error(int errcode, char* msg)
22 {
23   switch (errcode) {
24   case NO_ERR:
25     fprintf(stderr,"%s\n", err_msg[NO_ERR]);
26     break;
27   case USAGE_ERR:
28     usage();
29     exit(1);
30   default:
31     fprintf(stderr,"ERROR: %s %s\n", err_msg[errcode], msg);
32     exit(2);
33   }
34 }
35
36 void timestamp(FILE* flog)
37 {
38   time_t tp;
39
40   time(&tp);
41   fprintf(flog, "%s\n", ctime(&tp));
42 }
43
44 /*       End of Code       */