pull-prototypes-to-head-20020821
[openafs.git] / src / config / config.c
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <sys/types.h>
11 #include <sys/types.h>
12 #include <sys/file.h>
13 #include <sys/time.h>
14 #include <stdio.h>
15 #include <errno.h>
16
17 #include "AFS_component_version_number.c"
18
19 /* prototypes */
20 int mc_copy(FILE *, FILE *, char **);
21
22 int main(int argc, char **argv) {
23     register FILE *infile;
24     register FILE *outfile;
25     char *alist[3];
26     register int code;
27
28     if (argc != 4) {
29         printf("config: usage is 'config <from file> <to file> <system name>'\n");
30         exit(1);
31     }
32     infile = fopen(argv[1], "r");
33     if (!infile) {
34         printf("config: input file %s not found.\n", argv[1]);
35         exit(1);
36     }
37     outfile = fopen(argv[2], "w+");
38     if (!outfile) {
39         printf("config: output file %s not found.\n", argv[2]);
40         exit(1);
41     }
42     alist[0] = argv[3];
43     alist[1] = "all";
44     alist[2] = NULL;
45     code = mc_copy(infile, outfile, alist);
46     if (code) {
47         printf("config: failed to correctly write makefile '%s', code %d\n",
48                 argv[2], code);
49         exit(1);
50     }
51     else {
52         printf("Wrote new makefile '%s'.\n", argv[2]);
53         exit(0);
54     }
55 }