Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 243

Warning: Undefined variable $n in /usr/local/www/websvn.planix.org/include/diff_util.php on line 247

Warning: Undefined variable $m in /usr/local/www/websvn.planix.org/include/diff_util.php on line 251
WebSVN – tendra.SVN – Diff – /trunk/src/tools/tcc/execute.c – Rev 2 and 7

Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 37... Line 67...
37
#include "flags.h"
67
#include "flags.h"
38
#include "main.h"
68
#include "main.h"
39
#include "utility.h"
69
#include "utility.h"
40
 
70
 
41
 
71
 
164
 
270
 
165
 
271
 
166
/*
272
/*
167
    LAST COMMAND
273
 * PRINT COMMAND INTO BUFFER
168
 
274
 *
169
    The name of the last command executed, and its return value (zero
275
 * This routine prints the current command into a buffer and returns a pointer
170
    indicating success) are stored.
-
 
171
*/
-
 
172
 
-
 
173
char *last_command = null ;
-
 
174
int last_return = 0 ;
276
 * to the result.
175
 
-
 
176
 
-
 
177
/*
-
 
178
    THE CURRENT PROCESS
-
 
179
 
-
 
180
    When a process is active, its pid is stored as running_pid.  The
-
 
181
    value -1 is used to indicate that no process is active.
-
 
182
*/
277
 */
183
 
278
 
184
#if FS_FORK
279
static void
-
 
280
print_cmd(char *b)
-
 
281
{
-
 
282
	char **s;
185
static long running_pid = -1 ;
283
	for (s = command; *s != null; s++) {
-
 
284
		*b = ' ';
-
 
285
		IGNORE strcpy(b + 1, *s);
-
 
286
		b += strlen(b);
-
 
287
	}
186
#endif
288
	return;
-
 
289
}
187
 
290
 
188
 
291
 
189
/*
292
/*
190
    KILL ANY STRAY PROCESSES
293
 * EXECUTE THE CURRENT COMMAND
-
 
294
 *
-
 
295
 * This routine executes the command given by the command array. It returns
-
 
296
 * either output, the list of all output files, if successful, or null,
-
 
297
 * otherwise. The routine is POSIX compliant. It uses fork and execv from
-
 
298
 * unistd.h to fork a process and various routines from sys/wait.h to analyse
-
 
299
 * the result. The interface with sys/wait.h has been abstracted to also allow
-
 
300
 * the BSD implementation.
-
 
301
 */
191
 
302
 
192
    Occasionally a runaway process may occur.  This routine is indended
-
 
193
    to deal with these by sending the signal SIGTERM to the process.
-
 
194
    This routine is POSIX compliant.
-
 
195
*/
-
 
196
 
-
 
197
void kill_stray
303
filename *
198
    PROTO_Z ()
304
execute(filename *input, filename *output)
199
{
305
{
-
 
306
	char *cmd;
-
 
307
	int err = 0;
-
 
308
	boolean filled_buff = 0;
-
 
309
	char buff[buffer_size];
-
 
310
 
-
 
311
	cmd_string((char *)null);
-
 
312
	cmd = command[0];
-
 
313
	if (cmd == null) {
-
 
314
		error(INTERNAL, "Empty command");
-
 
315
		return (null);
-
 
316
	}
-
 
317
	last_command = cmd;
-
 
318
	last_return = 0;
-
 
319
	junk = output;
-
 
320
 
-
 
321
	if (taciturn) {
-
 
322
		/* Print input files if in taciturn mode */
-
 
323
		filename *p;
-
 
324
		for (p = input; p != null; p = p->next) {
-
 
325
			if (p->storage == INPUT_FILE) {
-
 
326
				comment(1, "%s:\n", p->name);
-
 
327
			}
-
 
328
		}
-
 
329
	}
-
 
330
 
-
 
331
	if (verbose) {
-
 
332
		/* Print command if in verbose mode */
-
 
333
		print_cmd(buff);
-
 
334
		filled_buff = 1;
-
 
335
		comment(1, "%s\n", buff + 1);
-
 
336
	}
-
 
337
 
-
 
338
	if (cmd && strneq(cmd, "builtin/", 8)) {
-
 
339
		/* Check built in commands */
-
 
340
		cmd += 8;
-
 
341
		switch (*cmd) {
-
 
342
		case 'b':
-
 
343
			if (streq(cmd, "build_archive")) {
-
 
344
				err = build_archive(command[1], command + 2);
-
 
345
				goto execute_error;
-
 
346
			}
-
 
347
			break;
-
 
348
		case 'c':
-
 
349
			if (streq(cmd, "cat")) {
-
 
350
				err = cat_file(command[1]);
-
 
351
				goto execute_error;
-
 
352
			}
-
 
353
			break;
-
 
354
		case 'm':
-
 
355
			if (streq(cmd, "mkdir")) {
-
 
356
				err = make_dir(command[1]);
-
 
357
				goto execute_error;
-
 
358
			}
-
 
359
			if (streq(cmd, "move")) {
-
 
360
				err = move_file(command[1], command[2]);
-
 
361
				goto execute_error;
-
 
362
			}
-
 
363
			break;
-
 
364
		case 'r':
-
 
365
			if (streq(cmd, "remove")) {
-
 
366
				err = remove_file(command[1]);
-
 
367
				goto execute_error;
-
 
368
			}
-
 
369
			break;
-
 
370
		case 's':
-
 
371
			if (streq(cmd, "split_archive")) {
-
 
372
				err = split_archive(command[1], &output);
-
 
373
				goto execute_error;
-
 
374
			}
-
 
375
			break;
-
 
376
		case 't':
-
 
377
			if (streq(cmd, "touch")) {
-
 
378
				err = touch_file(command[1], command[2]);
-
 
379
				goto execute_error;
-
 
380
			}
-
 
381
			break;
-
 
382
		case 'u':
-
 
383
			if (streq(cmd, "undef")) {
-
 
384
				int sev;
-
 
385
				if (dry_run) {
-
 
386
					sev = WARNING;
-
 
387
				} else {
-
 
388
					sev = INTERNAL;
-
 
389
					err = 1;
-
 
390
				}
-
 
391
				cmd = command[1];
-
 
392
				error(sev, "The tool '%s' is not available", cmd);
-
 
393
				goto execute_error;
-
 
394
			}
-
 
395
			break;
-
 
396
		}
-
 
397
		error(SERIOUS, "Built-in '%s' command not implemented", cmd);
-
 
398
		err = 1;
-
 
399
 
-
 
400
	} else if (!dry_run) {
-
 
401
		/* Call system commands */
200
#if FS_FORK
402
#if FS_FORK
-
 
403
		pid_t pid = fork();
-
 
404
		if (pid == (pid_t) -1) {
-
 
405
			error(SERIOUS, "Can't fork process");
-
 
406
			err = 1;
-
 
407
		} else {
-
 
408
			if (pid) {
-
 
409
				wait_type status;
201
    if ( running_pid == -1 ) return ;
410
				running_pid = (long)pid;
202
    IGNORE kill ( ( pid_t ) running_pid, SIGTERM ) ;
411
				while (process_wait ( &status ) != pid ) {
-
 
412
					;	/* empty */
-
 
413
				}
203
    running_pid = -1 ;
414
				running_pid = -1;
-
 
415
				if (process_exited(status)) {
-
 
416
					err = process_exit_value(status);
-
 
417
					/* This only returns if there was no
-
 
418
					 * remembered signal. */
-
 
419
					process_delayed_signal();
-
 
420
				} else {
-
 
421
					if (process_signaled(status)) {
-
 
422
						/* delay_signal_handling is a
-
 
423
						 * global that tells us
-
 
424
						 * that it is ok to let the
-
 
425
						 * next call to execute report
-
 
426
						 * that the command received a
-
 
427
						 * signal. This supports the
-
 
428
						 * way that the producer is
-
 
429
						 * called. */
-
 
430
						int sig = process_signal_value(status);
-
 
431
						if (delay_signal_handling &&
-
 
432
						    last_signal == 0) {
-
 
433
							last_signaled_cmd =
-
 
434
							    string_copy(cmd);
-
 
435
							last_signal = sig;
-
 
436
						} else {
-
 
437
							handler(sig);
-
 
438
						}
204
#endif
439
					}
205
    return ;
440
					err = 1;
-
 
441
				}
-
 
442
				goto execute_error;
-
 
443
			}
206
}
444
 
-
 
445
			/* print tool chain commands sent to execv */
-
 
446
			if (tool_chain) {
-
 
447
				char **curr = command;
-
 
448
				IGNORE printf ("\n%s \\\n", *curr++);
207
 
449
 
-
 
450
				while (*curr) {
-
 
451
					IGNORE printf ("\t%s", *curr++);
208
 
452
 
-
 
453
					if (*curr) {
-
 
454
						IGNORE printf (" \\");
-
 
455
					}
209
/*
456
 
210
    LIST OF FILES TO BE REMOVED BY REMOVE_JUNK
457
					IGNORE printf ("\n");
-
 
458
				}
-
 
459
			}
211
 
460
 
212
    This gives the list of the files which are to be removed if an
461
			/* print environment values sent to execv */
-
 
462
			if (tool_chain_environ) {
213
    error occurs.
463
				char **curr = environment;
214
*/
-
 
-
 
464
				IGNORE printf ("\n\tEnvironment dump");
215
 
465
 
-
 
466
				if (!tool_chain) {
216
static filename *junk = null ;
467
					IGNORE printf (" for cmd %s", cmd);
-
 
468
				}
217
 
469
 
-
 
470
				IGNORE printf ("\n");
218
 
471
 
219
/*
-
 
220
    REMOVE ANY INCOMPLETE OUTPUT FILES
-
 
221
 
-
 
222
    Any files which are being created when an error occurs should be
-
 
223
    removed.
-
 
224
*/
-
 
225
 
-
 
226
void remove_junk
-
 
227
    PROTO_Z ()
-
 
228
{
-
 
229
    if ( !dry_run && !flag_keep_err ) {
-
 
230
	filename *p ;
-
 
231
	for ( p = junk ; p != null ; p = p->next ) {
-
 
232
	    if ( p->storage == OUTPUT_FILE ) IGNORE remove ( p->name ) ;
-
 
233
	}
-
 
234
    }
-
 
235
    junk = null ;
-
 
236
    return ;
-
 
237
}
-
 
238
 
-
 
239
 
-
 
240
/*
-
 
241
    PRINT COMMAND INTO BUFFER
-
 
242
 
-
 
243
    This routine prints the current command into a buffer and returns
-
 
244
    a pointer to the result.
-
 
245
*/
-
 
246
 
-
 
247
static void print_cmd
-
 
248
    PROTO_N ( ( b ) )
-
 
249
    PROTO_T ( char *b )
-
 
250
{
-
 
251
    char **s ;
-
 
252
    for ( s = command ; *s != null ; s++ ) {
-
 
253
	*b = ' ' ;
-
 
254
	IGNORE strcpy ( b + 1, *s ) ;
-
 
255
	b += strlen ( b ) ;
-
 
256
    }
-
 
257
    return ;
-
 
258
}
-
 
259
 
-
 
260
 
-
 
261
/*
-
 
262
    EXECUTE THE CURRENT COMMAND
-
 
263
 
-
 
264
    This routine executes the command given by the command array.  It
-
 
265
    returns either output, the list of all output files, if successful,
-
 
266
    or null, otherwise.  The routine is POSIX compliant.  It uses fork
-
 
267
    and execv from unistd.h to fork a process and various routines from
-
 
268
    sys/wait.h to analyse the result.  The interface with sys/wait.h
-
 
269
    has been abstracted to also allow the BSD implementation.
-
 
270
*/
-
 
271
 
-
 
272
filename *execute
-
 
273
    PROTO_N ( ( input, output ) )
-
 
274
    PROTO_T ( filename *input X filename *output )
-
 
275
{
-
 
276
    char *cmd ;
-
 
277
    int err = 0 ;
-
 
278
    boolean filled_buff = 0 ;
-
 
279
    char buff [ buffer_size ] ;   
-
 
280
  
-
 
281
    cmd_string ( ( char * ) null ) ;
-
 
282
    cmd = command [0] ;
-
 
283
    if ( cmd == null ) {
-
 
284
	error ( INTERNAL, "Empty command" ) ;
-
 
285
	return ( null ) ;
-
 
286
    }
-
 
287
    last_command = cmd ;
-
 
288
    last_return = 0 ;
-
 
289
    junk = output ;
-
 
290
 
-
 
291
    if ( taciturn ) {
-
 
292
	/* Print input files if in taciturn mode */
-
 
293
	filename *p ;
-
 
294
	for ( p = input ; p != null ; p = p->next ) {
-
 
295
	    if ( p->storage == INPUT_FILE ) {
-
 
296
		comment ( 1, "%s:\n", p->name ) ;
-
 
297
	    }
-
 
298
	}
-
 
299
    }
-
 
300
 
-
 
301
    if ( verbose ) {
-
 
302
	/* Print command if in verbose mode */
-
 
303
	print_cmd ( buff ) ;
-
 
304
	filled_buff = 1 ;
-
 
305
	comment ( 1, "%s\n", buff + 1 ) ;
-
 
306
    }
-
 
307
 
-
 
308
    if ( cmd && strneq ( cmd, "builtin/", 8 ) ) {
-
 
309
	/* Check built in commands */
-
 
310
	cmd += 8 ;
-
 
311
	switch ( *cmd ) {
472
				while (*curr) {
312
	    case 'b' : {
-
 
313
		if ( streq ( cmd, "build_archive" ) ) {
-
 
314
		    err = build_archive ( command [1], command + 2 ) ;
-
 
315
		    goto execute_error ;
-
 
316
		}
-
 
317
		break ;
-
 
318
	    }
-
 
319
	    case 'c' : {
-
 
320
		if ( streq ( cmd, "cat" ) ) {
-
 
321
		    err = cat_file ( command [1] ) ;
473
					IGNORE printf ("\t%s\n", *curr);
322
		    goto execute_error ;
-
 
323
		}
-
 
324
		break ;
474
					curr++;
325
	    }
-
 
326
	    case 'm' : {
-
 
327
		if ( streq ( cmd, "mkdir" ) ) {
-
 
328
		    err = make_dir ( command [1] ) ;
-
 
329
		    goto execute_error ;
-
 
330
		}
-
 
331
		if ( streq ( cmd, "move" ) ) {
-
 
332
		    err = move_file ( command [1], command [2] ) ;
-
 
333
		    goto execute_error ;
-
 
334
		}
475
				}
335
		break ;
-
 
336
	    }
-
 
337
	    case 'r' : {
-
 
338
		if ( streq ( cmd, "remove" ) ) {
-
 
339
		    err = remove_file ( command [1] ) ;
-
 
340
		    goto execute_error ;
-
 
341
		}
476
			}
342
		break ;
-
 
343
	    }
-
 
344
	    case 's' : {
-
 
345
		if ( streq ( cmd, "split_archive" ) ) {
-
 
346
		    err = split_archive ( command [1], &output ) ;
-
 
347
		    goto execute_error ;
-
 
348
		}
-
 
349
		break ;
-
 
350
	    }
-
 
351
	    case 't' : {
-
 
352
		if ( streq ( cmd, "touch" ) ) {
-
 
353
		    err = touch_file ( command [1], command [2] ) ;
-
 
354
		    goto execute_error ;
-
 
355
		}
-
 
356
		break ;
-
 
357
	    }
-
 
358
	    case 'u' : {
-
 
359
		if ( streq ( cmd, "undef" ) ) {
-
 
360
		    int sev ;
-
 
361
		    if ( dry_run ) {
-
 
362
			sev = WARNING ;
-
 
363
		    } else {
-
 
364
			sev = INTERNAL ;
-
 
365
			err = 1 ;
-
 
366
		    }
-
 
367
		    cmd = command [1] ;
-
 
368
		    error ( sev, "The tool '%s' is not available", cmd ) ;
-
 
369
		    goto execute_error ;
-
 
370
		}
-
 
371
		break ;
-
 
372
	    }
-
 
373
	}
-
 
374
	error ( SERIOUS, "Built-in '%s' command not implemented", cmd ) ;
-
 
375
	err = 1 ;
-
 
376
 
477
 
377
    } else if ( !dry_run ) {
-
 
378
	/* Call system commands */
478
			IGNORE execve(cmd, command, environment);
379
#if FS_FORK
-
 
380
	{
-
 
381
	    pid_t pid = fork () ;
479
			running_pid = -1;
382
	    if ( pid == ( pid_t ) -1 ) {
-
 
383
		error ( SERIOUS, "Can't fork process" ) ;
480
			error(SERIOUS, "Can't execute '%s'", cmd);
384
		err = 1 ;
481
			exit(2);
-
 
482
		}
385
	    } else {
483
#else
-
 
484
		wait_type status;
386
		if ( pid ) {
485
		if (!filled_buff) {
387
		    wait_type status ;
486
			print_cmd(buff);
388
		    running_pid = ( long ) pid ;
487
			filled_buff = 1;
-
 
488
		}
389
		    while ( process_wait ( &status ) != pid ) /* empty */ ;
489
		err = system(buff + 1);
390
		    running_pid = -1 ;
490
		process_return(status, err);
391
		    if ( process_exited ( status ) ) {
491
		if (process_exited(status)) {
392
			err = process_exit_value ( status ) ;
492
			err = process_exit_value(status);
393
			/* This only returns if there was no remembered
-
 
394
			   signal. */
-
 
395
			process_delayed_signal () ;
493
			process_delayed_signal();
396
		    } else {
494
		} else {
397
			if ( process_signaled ( status ) ) {
495
			if (process_signaled(status)) {
398
			    /* delay_signal_handling is a global that tells us
496
				/* delay_signal_handling is a global that tells
399
			       that it is ok to let the next call to execute
497
				 * us that it is ok to let the next call to
400
			       report that the command received a signal.
498
				 * execute report that the command received a
401
			       This supports the way that the producer is called. */
499
				 * signal. This supports the way that the
-
 
500
				 * producer is called. */
402
			    int sig = process_signal_value ( status ) ;
501
				int sig = process_signal_value(status);
403
			    if ( delay_signal_handling && last_signal == 0 ) {
502
				if (delay_signal_handling &&
-
 
503
				    last_signal == 0) {
404
				last_signaled_cmd = string_copy ( cmd ) ;
504
					last_signaled_cmd = string_copy(cmd);
405
				last_signal = sig ;
505
					last_signal = sig;
406
			    } else {
506
				} else {
407
				handler ( sig ) ;
507
					handler(sig);
408
			    }					
508
				}
409
			}
509
			}
410
			err = 1 ;
510
			err = 1;
411
		    }
-
 
412
		    goto execute_error ;
-
 
413
		}
511
		}
414
		IGNORE execve ( cmd, command, environment ) ;
-
 
415
		running_pid = -1 ;
-
 
416
		error ( SERIOUS, "Can't execute '%s'", cmd ) ;
-
 
417
		exit ( 2 ) ;
-
 
418
	    }
-
 
419
	}
-
 
420
#else
-
 
421
	{
-
 
422
	    wait_type status ;
-
 
423
	    if ( !filled_buff ) {
-
 
424
		print_cmd ( buff ) ;
-
 
425
		filled_buff = 1 ;
-
 
426
	    }
-
 
427
	    err = system ( buff + 1 ) ;
-
 
428
	    process_return ( status, err ) ;
-
 
429
	    if ( process_exited ( status ) ) {
-
 
430
		err = process_exit_value ( status ) ;
-
 
431
		process_delayed_signal () ;
-
 
432
	    } else {
-
 
433
		if ( process_signaled ( status ) ) {
-
 
434
		    /* delay_signal_handling is a global that tells us
-
 
435
		       that it is ok to let the next call to execute
-
 
436
		       report that the command received a signal.
-
 
437
		       This supports the way that the producer is called. */
-
 
438
		    int sig = process_signal_value ( status ) ;
-
 
439
		    if ( delay_signal_handling && last_signal == 0 ) {
-
 
440
			last_signaled_cmd = string_copy ( cmd ) ;
-
 
441
			last_signal = sig ;
-
 
442
		    } else {
-
 
443
			handler ( sig ) ;
-
 
444
		    }
-
 
445
		}
-
 
446
		err = 1 ;
-
 
447
	    }
-
 
448
	}
-
 
449
#endif
512
#endif
450
    }
513
	}
451
 
514
 
452
    /* Deal with errors */
515
	/* Deal with errors */
453
    execute_error : {      
516
execute_error:
454
        disable_delayed_signal () ;
517
	disable_delayed_signal();
455
	last_return = err ;
518
	last_return = err;
456
	if ( tidy_up ) {
519
	if (tidy_up) {
457
	    /* Remove unneeded files */
520
		/* Remove unneeded files */
458
	    filename *p ;
521
		filename *p;
459
	    for ( p = input ; p != null ; p = p->next ) {
522
		for (p = input; p != null; p = p->next) {
460
		if ( p->storage == TEMP_FILE && p->type != BINARY_OBJ ) {
523
			if (p->storage == TEMP_FILE && p->type != BINARY_OBJ) {
461
		    IGNORE remove ( p->name ) ;
524
				IGNORE remove(p->name);
-
 
525
			}
462
		}
526
		}
463
	    }
-
 
464
	}
527
	}
465
	if ( err ) {
528
	if (err) {
466
	    exec_error = 1 ;
529
		exec_error = 1;
467
	    exit_status = EXIT_FAILURE ;
530
		exit_status = EXIT_FAILURE;
468
	    if ( show_errors ) {
531
		if (show_errors) {
469
		/* Show when the error occurred */
532
			/* Show when the error occurred */
470
		if ( !filled_buff ) print_cmd ( buff ) ;
533
			if (!filled_buff) {
-
 
534
				print_cmd(buff);
-
 
535
			}
471
		error ( INFO, "Error in '%s'", buff + 1 ) ;
536
			error(INFO, "Error in '%s'", buff + 1);
472
	    }
537
		}
473
	    remove_junk () ;
538
		remove_junk();
474
	    return ( null ) ;
539
		return (null);
475
	}
540
	}
476
	junk = null ;
541
	junk = null;
477
	return ( output ) ;
542
	return (output);
478
    }
-
 
479
}
543
}