public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Support "@file"
@ 2005-09-26 23:13 Mark Mitchell
  2005-09-27  2:33 ` Ben Elliston
  2005-09-30 15:47 ` Nick Clifton
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Mitchell @ 2005-09-26 23:13 UTC (permalink / raw)
  To: binutils


Here's a (boring) patch that makes binutils programs support "@file"
arguments by using the new expandargv function in libiberty.  Is this
OK to apply?

Where should documentation for the "@file" argument go?  Should I add
it to the list of options for every program in the binutils manual?
Or, add a section up front with common options, of which this will be
the only one?  Or...?

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-08-30  Mark Mitchell  <mark@codesourcery.com>

	* ld/ldmain.c (main): Use expandargv.
	* binutils/addr2line.c (main): Likewise.
	* binutils/ar.c (main): Likewise.
	* binutils/coffdump.c (main): Likewise.
	* binutils/cxxfilt.c (main): Likewise.
	* binutils/dlltool.c (main): Likewise.
	* binutils/dllwrap.c (main): Likewise.
	* binutils/nlmconv.c (main): Likewise.
	* binutils/nm.c (main): Likewise.
	* binutils/objcopy.c (main): Likewise.
	* binutils/objdump.c (main): Likewise.
	* binutils/readelf.c (main): Likewise.
	* binutils/size.c (main): Likeiwse.
	* binutils/srcconv.c (main): Likewise.
	* binutils/strings.c (main): Likewise.
	* binutils/sysdump.c (main): Likewise.
	* binutils/sysinfo.c (main): Likewise.
	* binutils/windres.c (main): Likewise.
	
Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.24
diff -c -5 -p -r1.24 addr2line.c
*** binutils/addr2line.c	23 May 2005 17:45:42 -0000	1.24
--- binutils/addr2line.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 294,303 ****
--- 294,305 ----
    textdomain (PACKAGE);
  
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    file_name = NULL;
    target = NULL;
Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.42
diff -c -5 -p -r1.42 ar.c
*** binutils/ar.c	14 Jun 2005 13:26:42 -0000	1.42
--- binutils/ar.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 358,367 ****
--- 358,369 ----
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    if (is_ranlib < 0)
      {
        char *temp;
  
        temp = strrchr (program_name, '/');
Index: binutils/coffdump.c
===================================================================
RCS file: /cvs/src/src/binutils/coffdump.c,v
retrieving revision 1.13
diff -c -5 -p -r1.13 coffdump.c
*** binutils/coffdump.c	8 May 2005 14:17:38 -0000	1.13
--- binutils/coffdump.c	26 Sep 2005 21:09:12 -0000
*************** main (int ac, char **av)
*** 492,501 ****
--- 492,503 ----
    textdomain (PACKAGE);
  
    program_name = av[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    while ((opt = getopt_long (ac, av, "HhVv", long_options,
  			     (int *) NULL))
  	 != EOF)
      {
        switch (opt)
Index: binutils/cxxfilt.c
===================================================================
RCS file: /cvs/src/src/binutils/cxxfilt.c,v
retrieving revision 1.6
diff -c -5 -p -r1.6 cxxfilt.c
*** binutils/cxxfilt.c	8 May 2005 14:17:38 -0000	1.6
--- binutils/cxxfilt.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 168,177 ****
--- 168,179 ----
    enum demangling_styles style = auto_demangling;
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    strip_underscore = TARGET_PREPENDS_UNDERSCORE;
  
    while ((c = getopt_long (argc, argv, "_nps:", long_options, (int *) 0)) != EOF)
      {
        switch (c)
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.64
diff -c -5 -p -r1.64 dlltool.c
*** binutils/dlltool.c	1 Aug 2005 16:54:07 -0000	1.64
--- binutils/dlltool.c	26 Sep 2005 21:09:12 -0000
*************** main (int ac, char **av)
*** 3122,3131 ****
--- 3122,3133 ----
    setlocale (LC_CTYPE, "");
  #endif
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
+   expandargv (&argc, &argv);
+ 
    while ((c = getopt_long (ac, av,
  #ifdef DLLTOOL_MCORE_ELF
  			   "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHhM:L:F:",
  #else
  			   "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHh",
Index: binutils/dllwrap.c
===================================================================
RCS file: /cvs/src/src/binutils/dllwrap.c,v
retrieving revision 1.18
diff -c -5 -p -r1.18 dllwrap.c
*** binutils/dllwrap.c	8 Jul 2005 05:32:46 -0000	1.18
--- binutils/dllwrap.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 625,634 ****
--- 625,636 ----
    setlocale (LC_CTYPE, "");
  #endif
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
+   expandargv (&argc, &argv);
+ 
    saved_argv = (char **) xmalloc (argc * sizeof (char*));
    dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
    driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
    for (i = 0; i < argc; ++i)
      {
Index: binutils/nlmconv.c
===================================================================
RCS file: /cvs/src/src/binutils/nlmconv.c,v
retrieving revision 1.25
diff -c -5 -p -r1.25 nlmconv.c
*** binutils/nlmconv.c	8 May 2005 14:17:38 -0000	1.25
--- binutils/nlmconv.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 208,217 ****
--- 208,219 ----
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((opt = getopt_long (argc, argv, "dHhI:l:O:T:Vv", long_options,
  			     (int *) NULL))
Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.46
diff -c -5 -p -r1.46 nm.c
*** binutils/nm.c	6 Jun 2005 14:28:31 -0000	1.46
--- binutils/nm.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 1489,1498 ****
--- 1489,1500 ----
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:",
  			   long_options, (int *) 0)) != EOF)
Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.85
diff -c -5 -p -r1.85 objcopy.c
*** binutils/objcopy.c	4 Jul 2005 01:53:42 -0000	1.85
--- binutils/objcopy.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char *argv[])
*** 3179,3188 ****
--- 3179,3190 ----
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    strip_symbols = STRIP_UNDEF;
    discard_locals = LOCALS_UNDEF;
  
    bfd_init ();
    set_default_bfd_target ();
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.111
diff -c -5 -p -r1.111 objdump.c
*** binutils/objdump.c	17 Aug 2005 14:28:01 -0000	1.111
--- binutils/objdump.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 2814,2823 ****
--- 2814,2825 ----
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSI:j:wE:zgeG",
  			   long_options, (int *) 0))
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.316
diff -c -5 -p -r1.316 readelf.c
*** binutils/readelf.c	20 Sep 2005 17:55:13 -0000	1.316
--- binutils/readelf.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 12651,12660 ****
--- 12651,12662 ----
    setlocale (LC_CTYPE, "");
  #endif
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
+   expandargv (&argc, &argv);
+ 
    parse_args (argc, argv);
  
    if (num_dump_sects > 0)
      {
        /* Make a copy of the dump_sects array.  */
Index: binutils/size.c
===================================================================
RCS file: /cvs/src/src/binutils/size.c,v
retrieving revision 1.23
diff -c -5 -p -r1.23 size.c
*** binutils/size.c	8 May 2005 14:17:39 -0000	1.23
--- binutils/size.c	26 Sep 2005 21:09:12 -0000
*************** main (int argc, char **argv)
*** 131,140 ****
--- 131,142 ----
    textdomain (PACKAGE);
  
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((c = getopt_long (argc, argv, "ABHhVvdfotx", long_options,
  			   (int *) 0)) != EOF)
Index: binutils/srconv.c
===================================================================
RCS file: /cvs/src/src/binutils/srconv.c,v
retrieving revision 1.16
diff -c -5 -p -r1.16 srconv.c
*** binutils/srconv.c	8 May 2005 14:17:39 -0000	1.16
--- binutils/srconv.c	26 Sep 2005 21:09:12 -0000
*************** main (int ac, char **av)
*** 1759,1768 ****
--- 1759,1770 ----
    textdomain (PACKAGE);
  
    program_name = av[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    while ((opt = getopt_long (ac, av, "dHhVvqn", long_options,
  			     (int *) NULL))
  	 != EOF)
      {
        switch (opt)
Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.29
diff -c -5 -p -r1.29 strings.c
*** binutils/strings.c	5 Jul 2005 11:43:55 -0000	1.29
--- binutils/strings.c	26 Sep 2005 21:09:13 -0000
*************** main (int argc, char **argv)
*** 183,192 ****
--- 183,195 ----
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
+ 
+   expandargv (&argc, &argv);
+ 
    string_min = -1;
    print_addresses = FALSE;
    print_filenames = FALSE;
    datasection_only = TRUE;
    target = NULL;
Index: binutils/sysdump.c
===================================================================
RCS file: /cvs/src/src/binutils/sysdump.c,v
retrieving revision 1.15
diff -c -5 -p -r1.15 sysdump.c
*** binutils/sysdump.c	8 May 2005 14:17:39 -0000	1.15
--- binutils/sysdump.c	26 Sep 2005 21:09:13 -0000
*************** main (int ac, char **av)
*** 671,680 ****
--- 671,682 ----
    textdomain (PACKAGE);
  
    program_name = av[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF)
      {
        switch (opt)
  	{
  	case 'H':
Index: binutils/sysinfo.y
===================================================================
RCS file: /cvs/src/src/binutils/sysinfo.y,v
retrieving revision 1.8
diff -c -5 -p -r1.8 sysinfo.y
*** binutils/sysinfo.y	8 May 2005 14:17:39 -0000	1.8
--- binutils/sysinfo.y	26 Sep 2005 21:09:13 -0000
*************** enum_list:
*** 410,419 ****
--- 410,421 ----
  int yydebug;
  
  int 
  main (int ac, char **av)
  {
+   expandargv (&ac, &av);
+ 
    yydebug=0;
    if (ac > 1)
      writecode = av[1][1];
  if (writecode == 'd')
    {
Index: binutils/windres.c
===================================================================
RCS file: /cvs/src/src/binutils/windres.c,v
retrieving revision 1.24
diff -c -5 -p -r1.24 windres.c
*** binutils/windres.c	8 May 2005 14:17:39 -0000	1.24
--- binutils/windres.c	26 Sep 2005 21:09:13 -0000
*************** main (int argc, char **argv)
*** 765,774 ****
--- 765,776 ----
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    res_init ();
  
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.101
diff -c -5 -p -r1.101 ldmain.c
*** ld/ldmain.c	29 Jul 2005 13:32:45 -0000	1.101
--- ld/ldmain.c	26 Sep 2005 21:09:16 -0000
*************** main (int argc, char **argv)
*** 196,205 ****
--- 196,207 ----
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
  
    bfd_set_error_program_name (program_name);
  
    xatexit (remove_output);

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-09-26 23:13 PATCH: Support "@file" Mark Mitchell
@ 2005-09-27  2:33 ` Ben Elliston
  2005-09-27  6:51   ` DJ Delorie
  2005-09-30 15:47 ` Nick Clifton
  1 sibling, 1 reply; 14+ messages in thread
From: Ben Elliston @ 2005-09-27  2:33 UTC (permalink / raw)
  To: binutils

Hi Mark

> Here's a (boring) patch that makes binutils programs support "@file"
> arguments by using the new expandargv function in libiberty.  Is this
> OK to apply?

I see you've added the expandargv function to libiberty.  The libiberty testsuite is
probably the right place to test that function--will you be writing tests for it?

Cheers, Ben

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-09-27  2:33 ` Ben Elliston
@ 2005-09-27  6:51   ` DJ Delorie
  0 siblings, 0 replies; 14+ messages in thread
From: DJ Delorie @ 2005-09-27  6:51 UTC (permalink / raw)
  To: bje; +Cc: binutils


> The libiberty testsuite

Have you looked at "the libiberty testsuite"?  It only really tests
the demangler and pexecute at the moment, and isn't set up to test
anything else.  Feel free to make it more flexible :-) (note that
there's a Makefile target for building a libiberty-for-test library,
which doesn't exclude anything it can reasonably include)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-09-26 23:13 PATCH: Support "@file" Mark Mitchell
  2005-09-27  2:33 ` Ben Elliston
@ 2005-09-30 15:47 ` Nick Clifton
  2005-09-30 18:04   ` Mark Mitchell
  2005-09-30 22:52   ` Mark Mitchell
  1 sibling, 2 replies; 14+ messages in thread
From: Nick Clifton @ 2005-09-30 15:47 UTC (permalink / raw)
  To: mark; +Cc: binutils

Hi Mark,

> Here's a (boring) patch that makes binutils programs support "@file"
> arguments by using the new expandargv function in libiberty.  Is this
> OK to apply?

Yes, please do.

> Where should documentation for the "@file" argument go?

In the linker doc file (ld/ld.texinfo), the binutils doc file 
(binutils/doc/binutils.texi) *and* the --help output of these programs. 
  (Submitting a separate patch to do this is acceptable).

Question: is there any reason why you did not update GAS to use this 
feature as well ?  What about gprof too ?

> Should I add
> it to the list of options for every program in the binutils manual?
> Or, add a section up front with common options, of which this will be
> the only one?  Or...?

Your choice.  If you create a "common options" section you could also 
put --version and --help in there, and maybe --verbose.  (Not sure if 
all commands accept it).

Cheers
   Nick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-09-30 15:47 ` Nick Clifton
@ 2005-09-30 18:04   ` Mark Mitchell
  2005-09-30 22:52   ` Mark Mitchell
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Mitchell @ 2005-09-30 18:04 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Nick Clifton wrote:

>> Where should documentation for the "@file" argument go?

As you suggested, I'll work up a separate patch for that, ASAP.  Thanks
for the hints.

> Question: is there any reason why you did not update GAS to use this
> feature as well ?  What about gprof too ?

I just missed them out.

Here's the version I checked in, which does include GAS and gprof.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

[-- Attachment #2: usefileargs.patch --]
[-- Type: text/plain, Size: 13681 bytes --]

2005-08-30  Mark Mitchell  <mark@codesourcery.com>

	* addr2line.c (main): Likewise.
	* ar.c (main): Likewise.
	* coffdump.c (main): Likewise.
	* cxxfilt.c (main): Likewise.
	* dlltool.c (main): Likewise.
	* dllwrap.c (main): Likewise.
	* nlmconv.c (main): Likewise.
	* nm.c (main): Likewise.
	* objcopy.c (main): Likewise.
	* objdump.c (main): Likewise.
	* readelf.c (main): Likewise.
	* size.c (main): Likeiwse.
	* srcconv.c (main): Likewise.
	* strings.c (main): Likewise.
	* sysdump.c (main): Likewise.
	* sysinfo.c (main): Likewise.
	* windres.c (main): Likewise.
	
2005-09-30  Mark Mitchell  <mark@codesourcery.com>

	* ldmain.c (main): Use expandargv.

2005-09-30  Mark Mitchell  <mark@codesourcery.com>

	* gprof.c (main): Use expandargv.

2005-09-30  Mark Mitchell  <mark@codesourcery.com>

	* as.c (main): Use expandargv.

Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.24
diff -c -5 -p -r1.24 addr2line.c
*** binutils/addr2line.c	23 May 2005 17:45:42 -0000	1.24
--- binutils/addr2line.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 294,303 ****
--- 294,305 ----
    textdomain (PACKAGE);
  
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    file_name = NULL;
    target = NULL;
Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.42
diff -c -5 -p -r1.42 ar.c
*** binutils/ar.c	14 Jun 2005 13:26:42 -0000	1.42
--- binutils/ar.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 358,367 ****
--- 358,369 ----
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    if (is_ranlib < 0)
      {
        char *temp;
  
        temp = strrchr (program_name, '/');
Index: binutils/coffdump.c
===================================================================
RCS file: /cvs/src/src/binutils/coffdump.c,v
retrieving revision 1.13
diff -c -5 -p -r1.13 coffdump.c
*** binutils/coffdump.c	8 May 2005 14:17:38 -0000	1.13
--- binutils/coffdump.c	30 Sep 2005 16:32:33 -0000
*************** main (int ac, char **av)
*** 492,501 ****
--- 492,503 ----
    textdomain (PACKAGE);
  
    program_name = av[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    while ((opt = getopt_long (ac, av, "HhVv", long_options,
  			     (int *) NULL))
  	 != EOF)
      {
        switch (opt)
Index: binutils/cxxfilt.c
===================================================================
RCS file: /cvs/src/src/binutils/cxxfilt.c,v
retrieving revision 1.6
diff -c -5 -p -r1.6 cxxfilt.c
*** binutils/cxxfilt.c	8 May 2005 14:17:38 -0000	1.6
--- binutils/cxxfilt.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 168,177 ****
--- 168,179 ----
    enum demangling_styles style = auto_demangling;
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    strip_underscore = TARGET_PREPENDS_UNDERSCORE;
  
    while ((c = getopt_long (argc, argv, "_nps:", long_options, (int *) 0)) != EOF)
      {
        switch (c)
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.64
diff -c -5 -p -r1.64 dlltool.c
*** binutils/dlltool.c	1 Aug 2005 16:54:07 -0000	1.64
--- binutils/dlltool.c	30 Sep 2005 16:32:33 -0000
*************** main (int ac, char **av)
*** 3122,3131 ****
--- 3122,3133 ----
    setlocale (LC_CTYPE, "");
  #endif
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
+   expandargv (&argc, &argv);
+ 
    while ((c = getopt_long (ac, av,
  #ifdef DLLTOOL_MCORE_ELF
  			   "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHhM:L:F:",
  #else
  			   "m:e:l:aD:d:z:b:xp:cCuUkAS:f:nvVHh",
Index: binutils/dllwrap.c
===================================================================
RCS file: /cvs/src/src/binutils/dllwrap.c,v
retrieving revision 1.18
diff -c -5 -p -r1.18 dllwrap.c
*** binutils/dllwrap.c	8 Jul 2005 05:32:46 -0000	1.18
--- binutils/dllwrap.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 625,634 ****
--- 625,636 ----
    setlocale (LC_CTYPE, "");
  #endif
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
+   expandargv (&argc, &argv);
+ 
    saved_argv = (char **) xmalloc (argc * sizeof (char*));
    dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
    driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
    for (i = 0; i < argc; ++i)
      {
Index: binutils/nlmconv.c
===================================================================
RCS file: /cvs/src/src/binutils/nlmconv.c,v
retrieving revision 1.25
diff -c -5 -p -r1.25 nlmconv.c
*** binutils/nlmconv.c	8 May 2005 14:17:38 -0000	1.25
--- binutils/nlmconv.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 208,217 ****
--- 208,219 ----
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((opt = getopt_long (argc, argv, "dHhI:l:O:T:Vv", long_options,
  			     (int *) NULL))
Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.46
diff -c -5 -p -r1.46 nm.c
*** binutils/nm.c	6 Jun 2005 14:28:31 -0000	1.46
--- binutils/nm.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 1489,1498 ****
--- 1489,1500 ----
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((c = getopt_long (argc, argv, "aABCDef:gHhlnopPrSst:uvVvX:",
  			   long_options, (int *) 0)) != EOF)
Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.85
diff -c -5 -p -r1.85 objcopy.c
*** binutils/objcopy.c	4 Jul 2005 01:53:42 -0000	1.85
--- binutils/objcopy.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char *argv[])
*** 3179,3188 ****
--- 3179,3190 ----
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    strip_symbols = STRIP_UNDEF;
    discard_locals = LOCALS_UNDEF;
  
    bfd_init ();
    set_default_bfd_target ();
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.113
diff -c -5 -p -r1.113 objdump.c
*** binutils/objdump.c	30 Sep 2005 14:57:52 -0000	1.113
--- binutils/objdump.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 2981,2990 ****
--- 2981,2992 ----
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((c = getopt_long (argc, argv, "pib:m:M:VvCdDlfaHhrRtTxsSI:j:wE:zgeGW",
  			   long_options, (int *) 0))
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.320
diff -c -5 -p -r1.320 readelf.c
*** binutils/readelf.c	30 Sep 2005 15:19:53 -0000	1.320
--- binutils/readelf.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 8827,8836 ****
--- 8827,8838 ----
    setlocale (LC_CTYPE, "");
  #endif
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
+   expandargv (&argc, &argv);
+ 
    parse_args (argc, argv);
  
    if (num_dump_sects > 0)
      {
        /* Make a copy of the dump_sects array.  */
Index: binutils/size.c
===================================================================
RCS file: /cvs/src/src/binutils/size.c,v
retrieving revision 1.23
diff -c -5 -p -r1.23 size.c
*** binutils/size.c	8 May 2005 14:17:39 -0000	1.23
--- binutils/size.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 131,140 ****
--- 131,142 ----
    textdomain (PACKAGE);
  
    program_name = *argv;
    xmalloc_set_program_name (program_name);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    while ((c = getopt_long (argc, argv, "ABHhVvdfotx", long_options,
  			   (int *) 0)) != EOF)
Index: binutils/srconv.c
===================================================================
RCS file: /cvs/src/src/binutils/srconv.c,v
retrieving revision 1.16
diff -c -5 -p -r1.16 srconv.c
*** binutils/srconv.c	8 May 2005 14:17:39 -0000	1.16
--- binutils/srconv.c	30 Sep 2005 16:32:33 -0000
*************** main (int ac, char **av)
*** 1759,1768 ****
--- 1759,1770 ----
    textdomain (PACKAGE);
  
    program_name = av[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    while ((opt = getopt_long (ac, av, "dHhVvqn", long_options,
  			     (int *) NULL))
  	 != EOF)
      {
        switch (opt)
Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.29
diff -c -5 -p -r1.29 strings.c
*** binutils/strings.c	5 Jul 2005 11:43:55 -0000	1.29
--- binutils/strings.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 183,192 ****
--- 183,195 ----
    bindtextdomain (PACKAGE, LOCALEDIR);
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
+ 
+   expandargv (&argc, &argv);
+ 
    string_min = -1;
    print_addresses = FALSE;
    print_filenames = FALSE;
    datasection_only = TRUE;
    target = NULL;
Index: binutils/sysdump.c
===================================================================
RCS file: /cvs/src/src/binutils/sysdump.c,v
retrieving revision 1.15
diff -c -5 -p -r1.15 sysdump.c
*** binutils/sysdump.c	8 May 2005 14:17:39 -0000	1.15
--- binutils/sysdump.c	30 Sep 2005 16:32:33 -0000
*************** main (int ac, char **av)
*** 671,680 ****
--- 671,682 ----
    textdomain (PACKAGE);
  
    program_name = av[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    while ((opt = getopt_long (ac, av, "HhVv", long_options, (int *) NULL)) != EOF)
      {
        switch (opt)
  	{
  	case 'H':
Index: binutils/sysinfo.y
===================================================================
RCS file: /cvs/src/src/binutils/sysinfo.y,v
retrieving revision 1.8
diff -c -5 -p -r1.8 sysinfo.y
*** binutils/sysinfo.y	8 May 2005 14:17:39 -0000	1.8
--- binutils/sysinfo.y	30 Sep 2005 16:32:33 -0000
*************** enum_list:
*** 410,419 ****
--- 410,421 ----
  int yydebug;
  
  int 
  main (int ac, char **av)
  {
+   expandargv (&ac, &av);
+ 
    yydebug=0;
    if (ac > 1)
      writecode = av[1][1];
  if (writecode == 'd')
    {
Index: binutils/windres.c
===================================================================
RCS file: /cvs/src/src/binutils/windres.c,v
retrieving revision 1.24
diff -c -5 -p -r1.24 windres.c
*** binutils/windres.c	8 May 2005 14:17:39 -0000	1.24
--- binutils/windres.c	30 Sep 2005 16:32:33 -0000
*************** main (int argc, char **argv)
*** 765,774 ****
--- 765,776 ----
    textdomain (PACKAGE);
  
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
+   expandargv (&ac, &av);
+ 
    bfd_init ();
    set_default_bfd_target ();
  
    res_init ();
  
Index: gas/as.c
===================================================================
RCS file: /cvs/src/src/gas/as.c,v
retrieving revision 1.64
diff -c -5 -p -r1.64 as.c
*** gas/as.c	11 Aug 2005 01:25:20 -0000	1.64
--- gas/as.c	30 Sep 2005 16:32:36 -0000
*************** main (int argc, char ** argv)
*** 1048,1057 ****
--- 1048,1059 ----
  #endif
  
    myname = argv[0];
    xmalloc_set_program_name (myname);
  
+   expandargv (&argc, &argv);
+ 
    START_PROGRESS (myname, 0);
  
  #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME
  #define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out"
  #endif
Index: gprof/gprof.c
===================================================================
RCS file: /cvs/src/src/gprof/gprof.c,v
retrieving revision 1.23
diff -c -5 -p -r1.23 gprof.c
*** gprof/gprof.c	30 Sep 2005 11:42:05 -0000	1.23
--- gprof/gprof.c	30 Sep 2005 16:32:37 -0000
*************** main (int argc, char **argv)
*** 195,204 ****
--- 195,206 ----
  #endif
  
    whoami = argv[0];
    xmalloc_set_program_name (whoami);
  
+   expandargv (&argc, &argv);
+ 
    while ((ch = getopt_long (argc, argv,
  	"aA::bBcCd::De:E:f:F:hiI:J::k:lLm:n::N::O:p::P::q::Q::st:Tvw:xyzZ::",
  			    long_options, 0))
  	 != EOF)
      {
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.101
diff -c -5 -p -r1.101 ldmain.c
*** ld/ldmain.c	29 Jul 2005 13:32:45 -0000	1.101
--- ld/ldmain.c	30 Sep 2005 16:32:37 -0000
*************** main (int argc, char **argv)
*** 196,205 ****
--- 196,207 ----
    program_name = argv[0];
    xmalloc_set_program_name (program_name);
  
    START_PROGRESS (program_name, 0);
  
+   expandargv (&argc, &argv);
+ 
    bfd_init ();
  
    bfd_set_error_program_name (program_name);
  
    xatexit (remove_output);

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-09-30 15:47 ` Nick Clifton
  2005-09-30 18:04   ` Mark Mitchell
@ 2005-09-30 22:52   ` Mark Mitchell
  2005-10-03  9:12     ` Nick Clifton
  1 sibling, 1 reply; 14+ messages in thread
From: Mark Mitchell @ 2005-09-30 22:52 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

Nick Clifton wrote:

>> Where should documentation for the "@file" argument go?
> 
> 
> In the linker doc file (ld/ld.texinfo), the binutils doc file
> (binutils/doc/binutils.texi) *and* the --help output of these programs.
>  (Submitting a separate patch to do this is acceptable).

Here's the binutils patch.  Tested by building GNU/Linux and MinGW tools
and running the various programs with --help to look at the output.

The common options section does document "-V" or "-H" because these are
used inconsistently; some programs use "-V" while others use "-v", and
similarly for "-h" and "-H".

Once this is approved (possibly after iterating with you), I'll do the
equivalent as/ld/gprof changes.

OK to apply?

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

[-- Attachment #2: binutils.patch --]
[-- Type: text/plain, Size: 18636 bytes --]

2005-09-30  Mark Mitchell  <mark@codesourcery.com>

	* addr2line.c (usage): Document @file.
	* ar.c (usage): Likewise.
	* coffdump (usage): Likewise.
	* cxxfilt.c (usage): Likewise.
	* dlltool.c (usage): Likewise.
	* dllwrap.c (usage): Likewise.
	* nlmconv.c (usage): Likewise.
	* nm.c (usage): Likewise.
	* objcopy.c (usage): Likewise.
	* objdump.c (usage): Likewise.
	* readelf.c (usage): Likewise.
	* size.c (usage): Likeise.
	* srconv.c (usage): Likewise.
	* strings.c (usage): Likewise.
	* windres.c (usage): Likewise.
	* doc/binutils.texi: Add section on common options. 

Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.25
diff -c -5 -p -r1.25 addr2line.c
*** binutils/addr2line.c	30 Sep 2005 16:37:31 -0000	1.25
--- binutils/addr2line.c	30 Sep 2005 20:49:24 -0000
*************** usage (FILE *stream, int status)
*** 75,84 ****
--- 75,85 ----
  {
    fprintf (stream, _("Usage: %s [option(s)] [addr(s)]\n"), program_name);
    fprintf (stream, _(" Convert addresses into line number/file name pairs.\n"));
    fprintf (stream, _(" If no addresses are specified on the command line, they will be read from stdin\n"));
    fprintf (stream, _(" The options are:\n\
+   @<file>                Read options from <file>\n\
    -b --target=<bfdname>  Set the binary file format\n\
    -e --exe=<executable>  Set the input file name (default is a.out)\n\
    -i --inlines		 Unwind inlined functions\n\
    -s --basenames         Strip directory names\n\
    -f --functions         Show function names\n\
Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.43
diff -c -5 -p -r1.43 ar.c
*** binutils/ar.c	30 Sep 2005 16:37:31 -0000	1.43
--- binutils/ar.c	30 Sep 2005 20:49:25 -0000
*************** usage (int help)
*** 240,258 ****
        fprintf (s, _("  [c]          - do not warn if the library had to be created\n"));
        fprintf (s, _("  [s]          - create an archive index (cf. ranlib)\n"));
        fprintf (s, _("  [S]          - do not build a symbol table\n"));
        fprintf (s, _("  [v]          - be verbose\n"));
        fprintf (s, _("  [V]          - display the version number\n"));
! 
        ar_emul_usage (s);
      }
    else
      {
        /* xgettext:c-format */
        fprintf (s, _("Usage: %s [options] archive\n"), program_name);
        fprintf (s, _(" Generate an index to speed access to archives\n"));
        fprintf (s, _(" The options are:\n\
    -h --help                    Print this help message\n\
    -V --version                 Print version information\n"));
      }
  
    list_supported_targets (program_name, stderr);
--- 240,260 ----
        fprintf (s, _("  [c]          - do not warn if the library had to be created\n"));
        fprintf (s, _("  [s]          - create an archive index (cf. ranlib)\n"));
        fprintf (s, _("  [S]          - do not build a symbol table\n"));
        fprintf (s, _("  [v]          - be verbose\n"));
        fprintf (s, _("  [V]          - display the version number\n"));
!       fprintf (s, _("  @<file>      - read options from <file>\n"));
!  
        ar_emul_usage (s);
      }
    else
      {
        /* xgettext:c-format */
        fprintf (s, _("Usage: %s [options] archive\n"), program_name);
        fprintf (s, _(" Generate an index to speed access to archives\n"));
        fprintf (s, _(" The options are:\n\
+   @<file>                      Read options from <file>\n\
    -h --help                    Print this help message\n\
    -V --version                 Print version information\n"));
      }
  
    list_supported_targets (program_name, stderr);
Index: binutils/coffdump.c
===================================================================
RCS file: /cvs/src/src/binutils/coffdump.c,v
retrieving revision 1.14
diff -c -5 -p -r1.14 coffdump.c
*** binutils/coffdump.c	30 Sep 2005 16:37:31 -0000	1.14
--- binutils/coffdump.c	30 Sep 2005 20:49:25 -0000
*************** static void
*** 455,464 ****
--- 455,465 ----
  show_usage (FILE *file, int status)
  {
    fprintf (file, _("Usage: %s [option(s)] in-file\n"), program_name);
    fprintf (file, _(" Print a human readable interpretation of a SYSROFF object file\n"));
    fprintf (file, _(" The options are:\n\
+   @<file>                Read options from <file>\n\
    -h --help              Display this information\n\
    -v --version           Display the program's version\n\
  \n"));
  
    if (status == 0)
Index: binutils/cxxfilt.c
===================================================================
RCS file: /cvs/src/src/binutils/cxxfilt.c,v
retrieving revision 1.7
diff -c -5 -p -r1.7 cxxfilt.c
*** binutils/cxxfilt.c	30 Sep 2005 16:37:31 -0000	1.7
--- binutils/cxxfilt.c	30 Sep 2005 20:49:25 -0000
*************** Usage: %s [-_] [-n] [--strip-underscores
*** 86,96 ****
         [--format ");
    print_demangler_list (stream);
    fprintf (stream, "]\n");
  
    fprintf (stream, "\
!        [--help] [--version] [arg...]\n");
    exit (status);
  }
  
  static char mbuffer[32767];
  
--- 86,96 ----
         [--format ");
    print_demangler_list (stream);
    fprintf (stream, "]\n");
  
    fprintf (stream, "\
!        [@file] [--help] [--version] [arg...]\n");
    exit (status);
  }
  
  static char mbuffer[32767];
  
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.66
diff -c -5 -p -r1.66 dlltool.c
*** binutils/dlltool.c	30 Sep 2005 20:04:21 -0000	1.66
--- binutils/dlltool.c	30 Sep 2005 20:49:25 -0000
*************** usage (FILE *file, int status)
*** 3056,3065 ****
--- 3056,3066 ----
    fprintf (file, _("   -n --no-delete            Keep temp files (repeat for extra preservation).\n"));
    fprintf (file, _("   -t --temp-prefix <prefix> Use <prefix> to construct temp file names.\n"));
    fprintf (file, _("   -v --verbose              Be verbose.\n"));
    fprintf (file, _("   -V --version              Display the program version.\n"));
    fprintf (file, _("   -h --help                 Display this information.\n"));
+   fprintf (file, _("   @<file>                   Read options from <file>.\n"));
  #ifdef DLLTOOL_MCORE_ELF
    fprintf (file, _("   -M --mcore-elf <outname>  Process mcore-elf object files into <outname>.\n"));
    fprintf (file, _("   -L --linker <name>        Use <name> as the linker.\n"));
    fprintf (file, _("   -F --linker-flags <flags> Pass <flags> to the linker.\n"));
  #endif
Index: binutils/dllwrap.c
===================================================================
RCS file: /cvs/src/src/binutils/dllwrap.c,v
retrieving revision 1.19
diff -c -5 -p -r1.19 dllwrap.c
*** binutils/dllwrap.c	30 Sep 2005 16:37:31 -0000	1.19
--- binutils/dllwrap.c	30 Sep 2005 20:49:25 -0000
*************** strhash (const char *str)
*** 471,480 ****
--- 471,481 ----
  static void
  usage (FILE *file, int status)
  {
    fprintf (file, _("Usage %s <option(s)> <object-file(s)>\n"), prog_name);
    fprintf (file, _("  Generic options:\n"));
+   fprintf (file, _("   @<file>                Read options from <file>\n"));    
    fprintf (file, _("   --quiet, -q            Work quietly\n"));
    fprintf (file, _("   --verbose, -v          Verbose\n"));
    fprintf (file, _("   --version              Print dllwrap version\n"));
    fprintf (file, _("   --implib <outname>     Synonym for --output-lib\n"));
    fprintf (file, _("  Options for %s:\n"), prog_name);
Index: binutils/nlmconv.c
===================================================================
RCS file: /cvs/src/src/binutils/nlmconv.c,v
retrieving revision 1.26
diff -c -5 -p -r1.26 nlmconv.c
*** binutils/nlmconv.c	30 Sep 2005 16:37:31 -0000	1.26
--- binutils/nlmconv.c	30 Sep 2005 20:49:25 -0000
*************** show_usage (FILE *file, int status)
*** 1103,1112 ****
--- 1103,1113 ----
    -I --input-target=<bfdname>   Set the input binary file format\n\
    -O --output-target=<bfdname>  Set the output binary file format\n\
    -T --header-file=<file>       Read <file> for NLM header information\n\
    -l --linker=<linker>          Use <linker> for any linking\n\
    -d --debug                    Display on stderr the linker command line\n\
+   @<file>                       Read options from <file>.\n\
    -h --help                     Display this information\n\
    -v --version                  Display the program's version\n\
  "));
    if (status == 0)
      fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.47
diff -c -5 -p -r1.47 nm.c
*** binutils/nm.c	30 Sep 2005 16:37:31 -0000	1.47
--- binutils/nm.c	30 Sep 2005 20:49:25 -0000
*************** usage (FILE *stream, int status)
*** 252,261 ****
--- 252,262 ----
        --synthetic        Display synthetic symbols as well\n\
    -t, --radix=RADIX      Use RADIX for printing symbol values\n\
        --target=BFDNAME   Specify the target object format as BFDNAME\n\
    -u, --undefined-only   Display only undefined symbols\n\
    -X 32_64               (ignored)\n\
+   @FILE                  Read options from FILE\n\
    -h, --help             Display this information\n\
    -V, --version          Display this program's version number\n\
  \n"));
    list_supported_targets (program_name, stream);
    if (status == 0)
Index: binutils/objcopy.c
===================================================================
RCS file: /cvs/src/src/binutils/objcopy.c,v
retrieving revision 1.86
diff -c -5 -p -r1.86 objcopy.c
*** binutils/objcopy.c	30 Sep 2005 16:37:31 -0000	1.86
--- binutils/objcopy.c	30 Sep 2005 20:49:25 -0000
*************** copy_usage (FILE *stream, int exit_statu
*** 474,483 ****
--- 474,484 ----
       --prefix-sections <prefix>    Add <prefix> to start of every section name\n\
       --prefix-alloc-sections <prefix>\n\
                                     Add <prefix> to start of every allocatable\n\
                                       section name\n\
    -v --verbose                     List all object files modified\n\
+   @<file>                          Read options from <file>\n\
    -V --version                     Display this program's version number\n\
    -h --help                        Display this output\n\
       --info                        List object formats & architectures supported\n\
  "));
    list_supported_targets (program_name, stream);
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.114
diff -c -5 -p -r1.114 objdump.c
*** binutils/objdump.c	30 Sep 2005 16:37:31 -0000	1.114
--- binutils/objdump.c	30 Sep 2005 20:49:25 -0000
*************** usage (FILE *stream, int status)
*** 194,203 ****
--- 194,204 ----
    -W, --dwarf              Display DWARF info in the file\n\
    -t, --syms               Display the contents of the symbol table(s)\n\
    -T, --dynamic-syms       Display the contents of the dynamic symbol table\n\
    -r, --reloc              Display the relocation entries in the file\n\
    -R, --dynamic-reloc      Display the dynamic relocation entries in the file\n\
+   @<file>                  Read options from <file>\n\
    -v, --version            Display this program's version number\n\
    -i, --info               List object formats and architectures supported\n\
    -H, --help               Display this information\n\
  "));
    if (status != 2)
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.321
diff -c -5 -p -r1.321 readelf.c
*** binutils/readelf.c	30 Sep 2005 16:37:31 -0000	1.321
--- binutils/readelf.c	30 Sep 2005 20:49:25 -0000
*************** usage (void)
*** 2614,2623 ****
--- 2614,2624 ----
                           Disassemble the contents of section <number>\n"));
  #endif
    fprintf (stdout, _("\
    -I --histogram         Display histogram of bucket list lengths\n\
    -W --wide              Allow output width to exceed 80 characters\n\
+   @<file>                Read options from <file>\n\
    -H --help              Display this information\n\
    -v --version           Display the version number of readelf\n"));
    fprintf (stdout, _("Report bugs to %s\n"), REPORT_BUGS_TO);
  
    exit (0);
Index: binutils/size.c
===================================================================
RCS file: /cvs/src/src/binutils/size.c,v
retrieving revision 1.24
diff -c -5 -p -r1.24 size.c
*** binutils/size.c	30 Sep 2005 16:37:31 -0000	1.24
--- binutils/size.c	30 Sep 2005 20:49:25 -0000
*************** usage (FILE *stream, int status)
*** 85,94 ****
--- 85,95 ----
    fprintf (stream, _(" The options are:\n\
    -A|-B     --format={sysv|berkeley}  Select output style (default is %s)\n\
    -o|-d|-x  --radix={8|10|16}         Display numbers in octal, decimal or hex\n\
    -t        --totals                  Display the total sizes (Berkeley only)\n\
              --target=<bfdname>        Set the binary file format\n\
+             @<file>                   Read options from <file>\n\
    -h        --help                    Display this information\n\
    -v        --version                 Display the program's version\n\
  \n"),
  #if BSD_DEFAULT
    "berkeley"
Index: binutils/srconv.c
===================================================================
RCS file: /cvs/src/src/binutils/srconv.c,v
retrieving revision 1.17
diff -c -5 -p -r1.17 srconv.c
*** binutils/srconv.c	30 Sep 2005 16:37:31 -0000	1.17
--- binutils/srconv.c	30 Sep 2005 20:49:25 -0000
*************** show_usage (FILE *file, int status)
*** 1722,1731 ****
--- 1722,1732 ----
    fprintf (file, _("Convert a COFF object file into a SYSROFF object file\n"));
    fprintf (file, _(" The options are:\n\
    -q --quick       (Obsolete - ignored)\n\
    -n --noprescan   Do not perform a scan to convert commons into defs\n\
    -d --debug       Display information about what is being done\n\
+   @<file>          Read options from <file>\n\
    -h --help        Display this information\n\
    -v --version     Print the program's version number\n"));
  
    if (status == 0)
      fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
Index: binutils/strings.c
===================================================================
RCS file: /cvs/src/src/binutils/strings.c,v
retrieving revision 1.30
diff -c -5 -p -r1.30 strings.c
*** binutils/strings.c	30 Sep 2005 16:37:31 -0000	1.30
--- binutils/strings.c	30 Sep 2005 20:49:25 -0000
*************** usage (FILE *stream, int status)
*** 715,724 ****
--- 715,725 ----
    -t --radix={o,d,x}        Print the location of the string in base 8, 10 or 16\n\
    -o                        An alias for --radix=o\n\
    -T --target=<BFDNAME>     Specify the binary file format\n\
    -e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
                              s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
+   @<file>                   Read options from <file>\n\
    -h --help                 Display this information\n\
    -v --version              Print the program's version number\n"));
    list_supported_targets (program_name, stream);
    if (status == 0)
      fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
Index: binutils/windres.c
===================================================================
RCS file: /cvs/src/src/binutils/windres.c,v
retrieving revision 1.26
diff -c -5 -p -r1.26 windres.c
*** binutils/windres.c	30 Sep 2005 20:04:21 -0000	1.26
--- binutils/windres.c	30 Sep 2005 20:49:25 -0000
*************** usage (FILE *stream, int status)
*** 657,666 ****
--- 657,667 ----
    fprintf (stream, _("\
       --yydebug                 Turn on parser debugging\n"));
  #endif
    fprintf (stream, _("\
    -r                           Ignored for compatibility with rc\n\
+   @<file>                      Read options from <file>\n\
    -h --help                    Print this help message\n\
    -V --version                 Print version information\n"));
    fprintf (stream, _("\
  FORMAT is one of rc, res, or coff, and is deduced from the file name\n\
  extension if not specified.  A single file name is an input file.\n\
Index: binutils/doc/binutils.texi
===================================================================
RCS file: /cvs/src/src/binutils/doc/binutils.texi,v
retrieving revision 1.77
diff -c -5 -p -r1.77 binutils.texi
*** binutils/doc/binutils.texi	15 Aug 2005 15:37:13 -0000	1.77
--- binutils/doc/binutils.texi	30 Sep 2005 20:49:25 -0000
*************** section entitled "GNU Free Documentation
*** 164,173 ****
--- 164,174 ----
  * cxxfilt: c++filt.             MS-DOS name for c++filt
  * addr2line::			Convert addresses to file and line
  * nlmconv::                     Converts object code into an NLM
  * windres::			Manipulate Windows resources
  * dlltool::			Create files needed to build and use DLLs
+ * Common Options::              Command-line options for all utilities
  * Selecting The Target System:: How these utilities determine the target.
  * Reporting Bugs::              Reporting Bugs
  * GNU Free Documentation License::  GNU Free Documentation License
  * Index::                       Index
  @end menu
*************** Display the command line options underst
*** 3424,3433 ****
--- 3425,3456 ----
  @c man begin SEEALSO readelf
  objdump(1), and the Info entries for @file{binutils}.
  @c man end
  @end ignore
  
+ @node Common Options
+ @chapter Common Options
+ 
+ The following command-line options are supported by all of the
+ programs described in this manual.
+ 
+ @table @env
+ @item @@@var{file}
+ Read command-line options from @var{file}.  Options are separated by
+ whitespace.  A whitespace character may be included in an option by
+ surrounding the entire option in either single or double quotes.  Any
+ character (including a backslash) may be included by prefixing the
+ character to be included character with a backslash.
+ 
+ @item --help
+ Display the command-line options supported by the program.
+ 
+ @item --version
+ Display the version number of the program.
+ 
+ @end table
+ 
  @node Selecting The Target System
  @chapter Selecting the Target System
  
  You can specify two aspects of the target system to the @sc{gnu}
  binary file utilities, each in several ways:

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-09-30 22:52   ` Mark Mitchell
@ 2005-10-03  9:12     ` Nick Clifton
  2005-10-03 19:40       ` Mark Mitchell
  0 siblings, 1 reply; 14+ messages in thread
From: Nick Clifton @ 2005-10-03  9:12 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: binutils

Hi Mark,

> The common options section does document "-V" or "-H" because these are
> used inconsistently; some programs use "-V" while others use "-v", and
> similarly for "-h" and "-H".

Yes, that is a shame.  Ideally we ought to give the tools a consistent 
command line interface but it is probably too late to do that here.

 > OK to apply?

Yes, but I think that the section describing the @<file> syntax ought to 
be extended to mention that:

   * The command-line options read from the file are treated as if they 
had been included on the original command line at the point where the 
@<file> was used.

   * The @<file> syntax cannot be used inside the file being parsed.


Also it occurs to me that maybe we ought to have a long-option 
equivalent of @<file>, eg something like:

   --extra-switches-from-file=<file>

This would mean changing libiberty to allow an entry point into the body 
of the expandargv() function or else getting the various different 
projects that use libiberty's expandargv() function to agree on a name 
of the long option.  What do you think ?

Cheers
   Nick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-03  9:12     ` Nick Clifton
@ 2005-10-03 19:40       ` Mark Mitchell
  2005-10-04  6:52         ` Nick Clifton
  2005-10-07 11:08         ` Richard Sandiford
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Mitchell @ 2005-10-03 19:40 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Nick Clifton wrote:

>> OK to apply?
> 
> Yes, but I think that the section describing the @<file> syntax ought to
> be extended to mention that:
> 
>   * The command-line options read from the file are treated as if they
> had been included on the original command line at the point where the
> @<file> was used.
> 
>   * The @<file> syntax cannot be used inside the file being parsed.

The second point is actually not true; DJ asked that I make it support
recursion.  I committed my changes, using the following for the
documentation:

--

@item @@@var{file}
Read command-line options from @var{file}.  The options read are
inserted in place of the original @@@var{file} option.  If @var{file}
does not exist, or cannot be read, then the option will be treated
literally, and not removed.

Options in @var{file} are separated by whitespace.  A whitespace
character may be included in an option by surrounding the entire
option in either single or double quotes.  Any character (including a
backslash) may be included by prefixing the character to be included
character with a backslash.  The @var{file} may itself contain
additional @@@var{file} options; any such options will be processed
recursively.

--

which I think satifies your requests.

> Also it occurs to me that maybe we ought to have a long-option
> equivalent of @<file>, eg something like:
> 
>   --extra-switches-from-file=<file>
> 
> This would mean changing libiberty to allow an entry point into the body
> of the expandargv() function or else getting the various different
> projects that use libiberty's expandargv() function to agree on a name
> of the long option.  What do you think ?

If we do it, I think we should do that in the existing expandargv.  That
will ensure it's consistent across all programs which use expandargv,
which seems like a good thing.

I shall now work on as/ld docs for @file.

Thanks,

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-03 19:40       ` Mark Mitchell
@ 2005-10-04  6:52         ` Nick Clifton
  2005-10-04  7:03           ` Mark Mitchell
  2005-10-04 19:02           ` DJ Delorie
  2005-10-07 11:08         ` Richard Sandiford
  1 sibling, 2 replies; 14+ messages in thread
From: Nick Clifton @ 2005-10-04  6:52 UTC (permalink / raw)
  To: Mark Mitchell, DJ Delorie; +Cc: binutils

Hi Mark,

>>  * The @<file> syntax cannot be used inside the file being parsed.
> 
> The second point is actually not true; DJ asked that I make it support
> recursion. 

Oops - I looked at the code in libiberty but I must have missed that. 
Sorry.


> @item @@@var{file}
> Read command-line options from @var{file}.  The options read are
> inserted in place of the original @@@var{file} option.  If @var{file}
> does not exist, or cannot be read, then the option will be treated
> literally, and not removed.
> 
> Options in @var{file} are separated by whitespace.  A whitespace
> character may be included in an option by surrounding the entire
> option in either single or double quotes.  Any character (including a
> backslash) may be included by prefixing the character to be included
> character with a backslash.  The @var{file} may itself contain
> additional @@@var{file} options; any such options will be processed
> recursively.

This is excellent - thanks very much.


>>  --extra-switches-from-file=<file>

> If we do it, I think we should do that in the existing expandargv.  That
> will ensure it's consistent across all programs which use expandargv,
> which seems like a good thing.

Agreed - DJ - do you think that this is a good idea ?  I can submit a 
patch for exandargv if you like.

Cheers
   Nick

PS.  Mark - is @file support going to be added to GCC as well ?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-04  6:52         ` Nick Clifton
@ 2005-10-04  7:03           ` Mark Mitchell
  2005-10-04 19:02           ` DJ Delorie
  1 sibling, 0 replies; 14+ messages in thread
From: Mark Mitchell @ 2005-10-04  7:03 UTC (permalink / raw)
  To: Nick Clifton; +Cc: DJ Delorie, binutils

Nick Clifton wrote:

> PS.  Mark - is @file support going to be added to GCC as well ?

Yes, definitely -- but perhaps not until GCC 4.2.  (GCC is in bug-fix
only mode now...)  It will be a very simple patch to gcc.c.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-04  6:52         ` Nick Clifton
  2005-10-04  7:03           ` Mark Mitchell
@ 2005-10-04 19:02           ` DJ Delorie
  2005-10-06 11:45             ` Nick Clifton
  1 sibling, 1 reply; 14+ messages in thread
From: DJ Delorie @ 2005-10-04 19:02 UTC (permalink / raw)
  To: nickc; +Cc: mark, binutils


> >>  --extra-switches-from-file=<file>
> 
> > If we do it, I think we should do that in the existing expandargv.  That
> > will ensure it's consistent across all programs which use expandargv,
> > which seems like a good thing.
> 
> Agreed - DJ - do you think that this is a good idea ?  I can submit a 
> patch for exandargv if you like.

I don't see the need, and neither DJGPP nor MSVC support it (they both
support @file).

Plus, @file is for more than just switches - it's for arbitrary
command line arguments, including for example, file names found with
"find".

If you want to play with expandargv, I'd rather the effort go into
supporting find's -print0 option, by detecting NULs in the file and
switching to NUL-delimited arguments instead of whitespace (and
skipping the quoting logic too).  This feature would give us a
security layer for managing files that the usual shell quoting
doesn't.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-04 19:02           ` DJ Delorie
@ 2005-10-06 11:45             ` Nick Clifton
  0 siblings, 0 replies; 14+ messages in thread
From: Nick Clifton @ 2005-10-06 11:45 UTC (permalink / raw)
  To: DJ Delorie; +Cc: mark, binutils

Hi DJ,

>>>> --extra-switches-from-file=<file>

> I don't see the need, and neither DJGPP nor MSVC support it (they both
> support @file).

OK.

> If you want to play with expandargv, I'd rather the effort go into
> supporting find's -print0 option, by detecting NULs in the file and
> switching to NUL-delimited arguments instead of whitespace (and
> skipping the quoting logic too).  This feature would give us a
> security layer for managing files that the usual shell quoting
> doesn't.

Another one for my Copious Free Time(tm) then. :-)

Cheers
   Nick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-03 19:40       ` Mark Mitchell
  2005-10-04  6:52         ` Nick Clifton
@ 2005-10-07 11:08         ` Richard Sandiford
  2005-10-07 14:23           ` Mark Mitchell
  1 sibling, 1 reply; 14+ messages in thread
From: Richard Sandiford @ 2005-10-07 11:08 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Nick Clifton, binutils

Mark Mitchell <mark@codesourcery.com> writes:
> option in either single or double quotes.  Any character (including a
> backslash) may be included by prefixing the character to be included
> character with a backslash.
  ^^^^^^^^^
stray "character"?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Support "@file"
  2005-10-07 11:08         ` Richard Sandiford
@ 2005-10-07 14:23           ` Mark Mitchell
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Mitchell @ 2005-10-07 14:23 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: Nick Clifton, binutils

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

Richard Sandiford wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
> 
>>option in either single or double quotes.  Any character (including a
>>backslash) may be included by prefixing the character to be included
>>character with a backslash.
> 
>   ^^^^^^^^^
> stray "character"?

Thanks!

I took the libiberty of checking in the attached patch, which removes
the last occurrence "character", which had clearly escaped (from my
machine)...

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

[-- Attachment #2: at.patch --]
[-- Type: text/plain, Size: 1285 bytes --]

2005-10-07  Mark Mitchell  <mark@codesourcery.com>

	* at-file.texi: Fix typo.

Index: at-file.texi
===================================================================
RCS file: /cvs/src/src/libiberty/at-file.texi,v
retrieving revision 1.1
diff -c -5 -p -r1.1 at-file.texi
*** at-file.texi	4 Oct 2005 05:34:17 -0000	1.1
--- at-file.texi	7 Oct 2005 14:20:16 -0000
*************** literally, and not removed.  
*** 9,16 ****
  
  Options in @var{file} are separated by whitespace.  A whitespace
  character may be included in an option by surrounding the entire
  option in either single or double quotes.  Any character (including a
  backslash) may be included by prefixing the character to be included
! character with a backslash.  The @var{file} may itself contain
! additional @@@var{file} options; any such options will be processed
! recursively.
--- 9,15 ----
  
  Options in @var{file} are separated by whitespace.  A whitespace
  character may be included in an option by surrounding the entire
  option in either single or double quotes.  Any character (including a
  backslash) may be included by prefixing the character to be included
! with a backslash.  The @var{file} may itself contain additional
! @@@var{file} options; any such options will be processed recursively.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-10-07 14:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-26 23:13 PATCH: Support "@file" Mark Mitchell
2005-09-27  2:33 ` Ben Elliston
2005-09-27  6:51   ` DJ Delorie
2005-09-30 15:47 ` Nick Clifton
2005-09-30 18:04   ` Mark Mitchell
2005-09-30 22:52   ` Mark Mitchell
2005-10-03  9:12     ` Nick Clifton
2005-10-03 19:40       ` Mark Mitchell
2005-10-04  6:52         ` Nick Clifton
2005-10-04  7:03           ` Mark Mitchell
2005-10-04 19:02           ` DJ Delorie
2005-10-06 11:45             ` Nick Clifton
2005-10-07 11:08         ` Richard Sandiford
2005-10-07 14:23           ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).