comparison libiberty/argv.c @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents 77e2b8dfacca
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 /* Create and destroy argument vectors (argv's) 1 /* Create and destroy argument vectors (argv's)
2 Copyright (C) 1992, 2001 Free Software Foundation, Inc. 2 Copyright (C) 1992, 2001, 2010 Free Software Foundation, Inc.
3 Written by Fred Fish @ Cygnus Support 3 Written by Fred Fish @ Cygnus Support
4 4
5 This file is part of the libiberty library. 5 This file is part of the libiberty library.
6 Libiberty is free software; you can redistribute it and/or 6 Libiberty is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
384 { 384 {
385 /* The argument we are currently processing. */ 385 /* The argument we are currently processing. */
386 int i = 0; 386 int i = 0;
387 /* Non-zero if ***argvp has been dynamically allocated. */ 387 /* Non-zero if ***argvp has been dynamically allocated. */
388 int argv_dynamic = 0; 388 int argv_dynamic = 0;
389 /* Limit the number of response files that we parse in order
390 to prevent infinite recursion. */
391 unsigned int iteration_limit = 2000;
389 /* Loop over the arguments, handling response files. We always skip 392 /* Loop over the arguments, handling response files. We always skip
390 ARGVP[0], as that is the name of the program being run. */ 393 ARGVP[0], as that is the name of the program being run. */
391 while (++i < *argcp) 394 while (++i < *argcp)
392 { 395 {
393 /* The name of the response file. */ 396 /* The name of the response file. */
410 size_t file_argc; 413 size_t file_argc;
411 /* We are only interested in options of the form "@file". */ 414 /* We are only interested in options of the form "@file". */
412 filename = (*argvp)[i]; 415 filename = (*argvp)[i];
413 if (filename[0] != '@') 416 if (filename[0] != '@')
414 continue; 417 continue;
418 /* If we have iterated too many times then stop. */
419 if (-- iteration_limit == 0)
420 {
421 fprintf (stderr, "%s: error: too many @-files encountered\n", (*argvp)[0]);
422 xexit (1);
423 }
415 /* Read the contents of the file. */ 424 /* Read the contents of the file. */
416 f = fopen (++filename, "r"); 425 f = fopen (++filename, "r");
417 if (!f) 426 if (!f)
418 continue; 427 continue;
419 if (fseek (f, 0L, SEEK_END) == -1) 428 if (fseek (f, 0L, SEEK_END) == -1)