Thanks! I will come back to you when I have done the job (I think I
will have a slot on thursday).

Best,

T. Laronde

On Sun, Sep 22, 2024 at 06:07:21PM +0700, Robert Elz wrote:
> 
>   | is set, the option can not be set; if posix is set after, the option
>   | is reset to off) with a name of "xpathsearch" or "xfilename", would
>   | seem acceptable? I will find some time next week to try to add it.
> 
> To do that you're going to want to apply the following patch to
> mkoptions.sh first.
> 
> I'm also including a patch for option.list to demonstrate how to set it up.
> 
> In that I used VARNAME and OPTIONNAME as dummy placeholders (and also set up
> the option set to make the new option and "posix" be mutually exclusive).
> 
> For that OPTIONNAME is whatever the (long) option name is to be called, and
> can be anything that doesn't conflict with the exising long option names
> (it must be at least 2 chars long or it would be an option flag instead,
> and have different requirements).
> 
> VARNAME is what the option is called inside the shell source code, you use
> it just like a boolean
>       if (VARNAME /* && ... */)
> It can be anything that would be a normal C variable name (not usually all
> upper case) but ends up being defined as a macro (#define VARNAME ...)
> so needs to be different from all other names anywhere in the shell source
> code (grep to check), and you must not attempt to declare it anywhere.
> Just insure that "options.h" is #included (only likely to be relevant if
> you add new source file(s) - I'd guess that one is included everywhere
> already).
> 
> If the requirements for both of those are met, VARNAME and OPTIONNAME can
> be made equal, which can make reading the sources a bit easier.
> 
> It is not important where that line is put in option.list - anywhere works,
> but it is better to pick the right group (which would be the one I used in
> the example patch) and then very roughly lexically sorted in that group
> (which I didn't do, the names I used are obviously fake) - only roughly
> sorted as other historical/emotional issues also come into play here
> (and the order really makes no difference to how it all ends up or is
> used, it is 100% for human benefit).
> 
> Don't attempt to do anything which would alter VARNAME - all that will
> already be handled.  Just use it and modify the path searching code using it.
> (You can apply both patches as they are and verify that all of the stuff
> related to managing the new option works properly without any new code,
> it just won't accomplish anything without adding appropriate code to
> make it happen.)
> 
> You'll also see I have assumed that the new option won't exist in a SMALL
> shell (the kind of thing that goes on boot media, etc) - if that remains
> all the code that uses (references in any way) the option needs to remain
> inside
>       #ifndef SMALL
>       #endif
> blocks.
> Be wary of bloating SMALL shells, it can break boot media space limits.
> 
> kre
> 
> Index: mkoptions.sh
> ===================================================================
> RCS file: /cvsroot/src/bin/sh/mkoptions.sh,v
> retrieving revision 1.8
> diff -u -r1.8 mkoptions.sh
> --- mkoptions.sh      16 Apr 2024 23:30:19 -0000      1.8
> +++ mkoptions.sh      22 Sep 2024 09:26:41 -0000
> @@ -95,6 +95,7 @@
>  
>       case "${chr}" in
>       -)      chr= set= dflt="$4";;
> +     +)      chr= ;;
>       ''|?)   ;;
>       *)      printf >&2 'flag "%s": Not a character\n' "${chr}"; continue;;
>       esac
> Index: option.list
> ===================================================================
> RCS file: /cvsroot/src/bin/sh/option.list,v
> retrieving revision 1.10
> diff -u -r1.10 option.list
> --- option.list       18 Sep 2022 06:03:19 -0000      1.10
> +++ option.list       22 Sep 2024 09:26:41 -0000
> @@ -62,12 +62,13 @@
>  cdprint      cdprint                         # always print result of a cd
>  usefork      fork            F               # use fork(2) instead of 
> vfork(2)
>  pflag        nopriv          p               # preserve privs if set[ug]id
> -posix        posix                           # be closer to POSIX compat
> +posix        posix           + p             # be closer to POSIX compat
>  qflag        quietprofile    q               # disable -v/-x in startup files
>  fnline1      local_lineno    L on            # number lines in funcs 
> starting at 1
>  promptcmds promptcmds                        # allow $( ) in PS1 (et al).
>  pipefail pipefail                    # pipe exit status
>  Xflag        xlock           X #ifndef SMALL # sticky stderr for -x (implies 
> -x)
> +VARNAME      OPTIONNAME      + p #ifndef SMALL # allow subdir PATH searches
>  
>  // editline/history related options ("vi" is standard, 'V' and others are 
> not)
>  // only one of vi/emacs can be set, hence the "set" definition, value
> 
> 

-- 
        Thierry Laronde <tlaronde +AT+ kergis +dot+ com>
                     http://www.kergis.com/
                    http://kertex.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C

Reply via email to