Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _N_GNU_nonoption_argv_flags_

2011-09-27, 19:13(-07), Bart Schaefer:
> On Sep 27,  7:42pm, Stephane Chazelas wrote:
> }
> }        _N_GNU_nonoption_argv_flags_
> } 	      (Here N is grep's numeric process ID.)  If the ith
> } 	      character of this environment variable's value is
> } 	      1, do not consider the ith operand of grep to be
> } 	      an option, even if it appears  to  be  one.
> } 
> } It's news to me. Is there any plan for zsh to implement that?
> I would have to guess there are no plans, because I've never heard
> it mentioned (either the variable itself, or of implementing it).

I've just seen this in GNU bash source (GPL code):

#if 0   /* UNUSED -- it caused too many problems */
put_gnu_argv_flags_into_env (pid, flags_string)
     intmax_t pid;
     char *flags_string;
  char *dummy, *pbuf;
  int l, fl;

  pbuf = itos (pid);
  l = strlen (pbuf);

  fl = strlen (flags_string);

  dummy = (char *)xmalloc (l + fl + 30);
  dummy[0] = '_';
  strcpy (dummy + 1, pbuf);
  strcpy (dummy + 1 + l, "_GNU_nonoption_argv_flags_");
  dummy[l + 27] = '=';
  strcpy (dummy + l + 28, flags_string);

  free (pbuf);

  export_env = add_or_supercede_exported_var (dummy, 0);

If Chet reads us, what were the "too many problems" caused.
Where does that come from. I expect it to be an extension of GNU
getopt, but that is not mentionned in the documentation, a grep
on libc.so doesn't return anything and actually it doesn't seem
to even work here:

sh -c 'export _$$_GNU_nonoption_argv_flags_=1111; exec grep -t a'
grep: invalid option -- 't'


Messages sorted by: Reverse Date, Date, Thread, Author