126 *
127 * Print a message and die
128 *
129 * Parameters:
130 * format printf type format string
131 * args Arguments to match the format
132 *
133 * Global variables used:
134 * fatal_in_progress Indicates if this is a recursive call
135 * parallel_process_cnt Do we need to wait for anything?
136 * report_pwd Should we report the current path?
137 */
138 /*VARARGS*/
139 void
140 fatal(const char *message, ...)
141 {
142 va_list args;
143
144 va_start(args, message);
145 (void) fflush(stdout);
146 #ifdef DISTRIBUTED
147 (void) fprintf(stderr, catgets(catd, 1, 262, "dmake: Fatal error: "));
148 #else
149 (void) fprintf(stderr, catgets(catd, 1, 263, "make: Fatal error: "));
150 #endif
151 (void) vfprintf(stderr, message, args);
152 (void) fprintf(stderr, "\n");
153 va_end(args);
154 if (report_pwd) {
155 (void) fprintf(stderr,
156 catgets(catd, 1, 156, "Current working directory %s\n"),
157 get_current_path());
158 }
159 (void) fflush(stderr);
160 if (fatal_in_progress) {
161 exit_status = 1;
162 exit(1);
163 }
164 fatal_in_progress = true;
165 #ifdef TEAMWARE_MAKE_CMN
166 /* Let all parallel children finish */
167 if ((dmake_mode_type == parallel_mode) &&
168 (parallel_process_cnt > 0)) {
169 (void) fprintf(stderr,
170 catgets(catd, 1, 157, "Waiting for %d %s to finish\n"),
171 parallel_process_cnt,
172 parallel_process_cnt == 1 ?
173 catgets(catd, 1, 158, "job") : catgets(catd, 1, 159, "jobs"));
174 (void) fflush(stderr);
175 }
176
177 while (parallel_process_cnt > 0) {
178 #ifdef DISTRIBUTED
179 if (dmake_mode_type == distributed_mode) {
180 (void) await_dist(false);
181 } else {
182 await_parallel(true);
183 }
184 #else
185 await_parallel(true);
186 #endif
187 finish_children(false);
188 }
189 #endif
190
191 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
192 job_adjust_fini();
193 #endif
194
195 exit_status = 1;
196 exit(1);
197 }
198
199 /*
200 * warning(format, args...)
201 *
202 * Print a message and continue.
203 *
204 * Parameters:
205 * format printf type format string
206 * args Arguments to match the format
207 *
208 * Global variables used:
209 * report_pwd Should we report the current path?
210 */
211 /*VARARGS*/
212 void
213 warning(char * message, ...)
214 {
215 va_list args;
216
217 va_start(args, message);
218 (void) fflush(stdout);
219 #ifdef DISTRIBUTED
220 (void) fprintf(stderr, catgets(catd, 1, 264, "dmake: Warning: "));
221 #else
222 (void) fprintf(stderr, catgets(catd, 1, 265, "make: Warning: "));
223 #endif
224 (void) vfprintf(stderr, message, args);
225 (void) fprintf(stderr, "\n");
226 va_end(args);
227 if (report_pwd) {
228 (void) fprintf(stderr,
229 catgets(catd, 1, 161, "Current working directory %s\n"),
230 get_current_path());
231 }
232 (void) fflush(stderr);
233 }
234
235 /*
236 * time_to_string(time)
237 *
238 * Take a numeric time value and produce
239 * a proper string representation.
240 *
241 * Return value:
242 * The string representation of the time
243 *
267 /*
268 * get_current_path()
269 *
270 * Stuff current_path with the current path if it isnt there already.
271 *
272 * Parameters:
273 *
274 * Global variables used:
275 */
276 char *
277 get_current_path(void)
278 {
279 char pwd[(MAXPATHLEN * MB_LEN_MAX)];
280 static char *current_path;
281
282 if (current_path == NULL) {
283 getcwd(pwd, sizeof(pwd));
284 if (pwd[0] == (int) nul_char) {
285 pwd[0] = (int) slash_char;
286 pwd[1] = (int) nul_char;
287 #ifdef DISTRIBUTED
288 current_path = strdup(pwd);
289 } else if (IS_EQUALN(pwd, NOCATGETS("/tmp_mnt"), 8)) {
290 current_path = strdup(pwd + 8);
291 } else {
292 current_path = strdup(pwd);
293 }
294 #else
295 }
296 current_path = strdup(pwd);
297 #endif
298 }
299 return current_path;
300 }
301
302 /*****************************************
303 *
304 * Make internal state dumping
305 *
306 * This is a set of routines for dumping the internal make state
307 * Used for the -p option
308 */
309
310 /*
311 * dump_make_state()
312 *
313 * Dump make's internal state to stdout
314 *
315 * Parameters:
316 *
317 * Global variables used:
|
126 *
127 * Print a message and die
128 *
129 * Parameters:
130 * format printf type format string
131 * args Arguments to match the format
132 *
133 * Global variables used:
134 * fatal_in_progress Indicates if this is a recursive call
135 * parallel_process_cnt Do we need to wait for anything?
136 * report_pwd Should we report the current path?
137 */
138 /*VARARGS*/
139 void
140 fatal(const char *message, ...)
141 {
142 va_list args;
143
144 va_start(args, message);
145 (void) fflush(stdout);
146 (void) fprintf(stderr, catgets(catd, 1, 263, "make: Fatal error: "));
147 (void) vfprintf(stderr, message, args);
148 (void) fprintf(stderr, "\n");
149 va_end(args);
150 if (report_pwd) {
151 (void) fprintf(stderr,
152 catgets(catd, 1, 156, "Current working directory %s\n"),
153 get_current_path());
154 }
155 (void) fflush(stderr);
156 if (fatal_in_progress) {
157 exit_status = 1;
158 exit(1);
159 }
160 fatal_in_progress = true;
161 #ifdef TEAMWARE_MAKE_CMN
162 /* Let all parallel children finish */
163 if ((dmake_mode_type == parallel_mode) &&
164 (parallel_process_cnt > 0)) {
165 (void) fprintf(stderr,
166 catgets(catd, 1, 157, "Waiting for %d %s to finish\n"),
167 parallel_process_cnt,
168 parallel_process_cnt == 1 ?
169 catgets(catd, 1, 158, "job") : catgets(catd, 1, 159, "jobs"));
170 (void) fflush(stderr);
171 }
172
173 while (parallel_process_cnt > 0) {
174 await_parallel(true);
175 finish_children(false);
176 }
177 #endif
178
179 #if defined (TEAMWARE_MAKE_CMN) && defined (MAXJOBS_ADJUST_RFE4694000)
180 job_adjust_fini();
181 #endif
182
183 exit_status = 1;
184 exit(1);
185 }
186
187 /*
188 * warning(format, args...)
189 *
190 * Print a message and continue.
191 *
192 * Parameters:
193 * format printf type format string
194 * args Arguments to match the format
195 *
196 * Global variables used:
197 * report_pwd Should we report the current path?
198 */
199 /*VARARGS*/
200 void
201 warning(char * message, ...)
202 {
203 va_list args;
204
205 va_start(args, message);
206 (void) fflush(stdout);
207 (void) fprintf(stderr, catgets(catd, 1, 265, "make: Warning: "));
208 (void) vfprintf(stderr, message, args);
209 (void) fprintf(stderr, "\n");
210 va_end(args);
211 if (report_pwd) {
212 (void) fprintf(stderr,
213 catgets(catd, 1, 161, "Current working directory %s\n"),
214 get_current_path());
215 }
216 (void) fflush(stderr);
217 }
218
219 /*
220 * time_to_string(time)
221 *
222 * Take a numeric time value and produce
223 * a proper string representation.
224 *
225 * Return value:
226 * The string representation of the time
227 *
251 /*
252 * get_current_path()
253 *
254 * Stuff current_path with the current path if it isnt there already.
255 *
256 * Parameters:
257 *
258 * Global variables used:
259 */
260 char *
261 get_current_path(void)
262 {
263 char pwd[(MAXPATHLEN * MB_LEN_MAX)];
264 static char *current_path;
265
266 if (current_path == NULL) {
267 getcwd(pwd, sizeof(pwd));
268 if (pwd[0] == (int) nul_char) {
269 pwd[0] = (int) slash_char;
270 pwd[1] = (int) nul_char;
271 }
272 current_path = strdup(pwd);
273 }
274 return current_path;
275 }
276
277 /*****************************************
278 *
279 * Make internal state dumping
280 *
281 * This is a set of routines for dumping the internal make state
282 * Used for the -p option
283 */
284
285 /*
286 * dump_make_state()
287 *
288 * Dump make's internal state to stdout
289 *
290 * Parameters:
291 *
292 * Global variables used:
|