File: get_image.c

package info (click to toggle)
dqs 3.1.8-9
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 8,908 kB
  • ctags: 9,887
  • sloc: ansic: 87,447; sh: 2,952; makefile: 442; yacc: 247; lex: 94; perl: 83; csh: 51; fortran: 24; awk: 16
file content (211 lines) | stat: -rwxr-xr-x 6,006 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
static char get_image_rcsid[]="$Id: get_image.c,v 1.1.1.1 1997/04/10 15:10:36 green Exp $";

/* get_image.c - Tom Green '94
 *
 * Copyright 1994
 *
 * SUPER COMPUTER COMPUTATIONS RESEARCH INSTITUTE
 *            FLORIDA STATE UNIVERSITY
 *
 *
 * SCRI representatives make no claims about the
 * suitability of this software for any purpose.
 * It is provided "as is" without express or
 * implied warranty.
 *
 * $Log: get_image.c,v $
 * Revision 1.1.1.1  1997/04/10 15:10:36  green
 * DQS 3.1.3.4.1 Distribution
 *
 * Revision 3.0  1994/03/07 04:16:15  green
 * 3.0 freeze
 *
 * Revision 1.1  1994/02/28  14:39:42  green
 * "killd" and "killq" are development tools which have been included
 * JIC they may be of use.
 *
 * "get_image.c" is also a development tool - the diference being it
 * isn't complete yet and just "sort-of" works...
 *
 * Revision 1.1  92/03/23  14:48:39  green
 * Initial revision
 * 
 *
 */

#include <stdio.h>
#include "../SRC/prognames.h"

int i,j;
FILE *in,*in2,*out;

main()

{

	char str0[80],str1[80],str2[40];
        char in_file[80];
        
	mkdir("IMAGES",0755);
	mkdir("IMAGES/QUEUES",0755);
        unlink("rebuild_image");
        unlink("IMAGES/IMAGE");

	printf("retrieving DQS trusted hosts");
	fflush(stdout);
	system("qconf3 -sh > IMAGES/HOSTS");
        line();
        system("echo DQS trusted hosts >> IMAGES/IMAGE");
        system("qconf3 -sh >> IMAGES/IMAGE");
	printf(" -- DONE\n");

	printf("retrieving DQS managers     ");
	fflush(stdout);
	system("qconf3 -sm > IMAGES/MANAGERS");
        line();
        system("echo DQS managers >> IMAGES/IMAGE");
        system("qconf3 -sm >> IMAGES/IMAGE");
	printf(" -- DONE\n");

	printf("retrieving DQS operators    ");
	fflush(stdout);
	system("qconf3 -so > IMAGES/OPERATORS");
        line();
        system("echo DQS operators >> IMAGES/IMAGE");
        system("qconf3 -so >> IMAGES/IMAGE");
	printf(" -- DONE\n");

	printf("retrieving DQS queue list   ");
	fflush(stdout);
	system("qconf3 -sql > IMAGES/QUEUE_LIST");
        line();
        system("echo DQS queues >> IMAGES/IMAGE");
        system("qconf3 -sql >> IMAGES/IMAGE");
	printf(" -- DONE\n");

        sprintf(in_file,"%s","IMAGES/QUEUE_LIST");
        in=fopen(in_file,"r");
        if (!in) {
                printf("couldn't open %s\n",in_file);
                exit(-1);
	      }
        bzero(str0,sizeof(str0));
        while ((i=fscanf(in,"%s\n",str0))==1) {
                if (!strncmp(str0,"permission",5))
                        break;
                printf("retrieving DQS queue configuration %s",str0);
                sprintf(str1,"qconf3 -sq %s > IMAGES/QUEUES/%s\n",str0,str0);
                system(str1);
                line();
                sprintf(str1,"qconf3 -sq %s >> IMAGES/IMAGE\n",str0);
                system(str1);
                bzero(str0,sizeof(str0));
                sleep(1);
                printf(" -- DONE\n");
	      }
        fclose(in);

        printf("creating rebuild_image      ");

	out=fopen("rebuild_image","a");
	if (!out) {
		printf("couldn't open rebuild_image\n");
		exit(-1);
	}
        fprintf(out,"#!/bin/csh\n");

/***********************************************************/

        fprintf(out,"#******************************************\n");
        fprintf(out,"# add DQS trusted hosts\n");
        sprintf(in_file,"%s","IMAGES/HOSTS");
	in=fopen(in_file,"r");
	if (!in) {
		printf("couldn't open %s\n",in_file);
		exit(-1);
	}
	bzero(str0,sizeof(str0));
	while ((i=fscanf(in,"%s\n",str0))==1) {
		if (!strncmp(str0,"permission",5)) 
                        break;
		fprintf(out,"qconf3 -ah %s\n",str0);
		bzero(str0,sizeof(str0));
	}
	fclose(in);

/***********************************************************/

        fprintf(out,"#******************************************\n");
        fprintf(out,"# add DQS queues\n");
        sprintf(in_file,"%s","IMAGES/QUEUE_LIST");
        in=fopen(in_file,"r");
        if (!in) {
                printf("couldn't open %s\n",in_file);
                exit(-1);
        }
        bzero(str0,sizeof(str0));
        while ((i=fscanf(in,"%s\n",str0))==1) {
                if (!strncmp(str0,"permission",5)) 
                        break;
                fprintf(out,"qconf3 -AQ IMAGES/QUEUES/%s\n",str0);
                bzero(str0,sizeof(str0));
        }
        fclose(in);

/***********************************************************/

        fprintf(out,"#******************************************\n");
        fprintf(out,"# add DQS managers\n");
        sprintf(in_file,"%s","IMAGES/MANAGERS");
        in=fopen(in_file,"r");
        if (!in) {
                printf("couldn't open %s\n",in_file);
                exit(-1);
	      }
        bzero(str0,sizeof(str0));
        while ((i=fscanf(in,"%s\n",str0))==1) {
                if (!strncmp(str0,"permission",5)) 
                        break;
                fprintf(out,"qconf3 -am %s\n",str0);
                bzero(str0,sizeof(str0));
	      }
        fclose(in);

/***********************************************************/

        fprintf(out,"#******************************************\n");
        fprintf(out,"# add DQS operators\n");

        sprintf(in_file,"%s","IMAGES/OPERATORS");
        in=fopen(in_file,"r");
        if (!in) {
                printf("couldn't open %s\n",in_file);
                exit(-1);
              }
        bzero(str0,sizeof(str0));
        while ((i=fscanf(in,"%s\n",str0))==1) {
                if (!strncmp(str0,"permission",5)) 
                        break;
                fprintf(out,"qconf3 -ao %s\n",str0);
                bzero(str0,sizeof(str0));
              }
        fclose(in);

       

        chmod("rebuild_image",0755);
        printf(" -- DONE\n");
        printf("ascii image contained in IMAGES/IMAGE\n");
        exit(0);

}

/********************************************************************/

line()

{

   system("echo ----------------------------------------------- >> IMAGES/IMAGE");

}