pike.git / lib / modules / Getopt.pmod

version» Context lines:

pike.git/lib/modules/Getopt.pmod:257:   //! @note   //! @[find_all_options()] modifies @[argv].   //!   //! Index @tt{0@} (zero) of @[argv] is not scanned for options, since it   //! is reserved for the program name.   //!   //! @seealso   //! @[Getopt.get_args()], @[Getopt.find_option()]   //!   array(array) find_all_options(array(string) argv, -  array(array(array(string)|string)) options, +  array(array(array(string)|string|int)) options,    void|int(-1..1) posix_me_harder, void|int throw_errors)   {    // --- Initialize variables    -  mapping(string:array(string|array(string))) quick=([]); +  mapping(string:array(string|int|array(string))) quick=([]);    -  foreach(options; int i; array(array(string)|string) opt) { +  foreach(options; int i; array(array(string)|string|int) opt) {    if(sizeof(opt)!=SIZE) {    options[i] = opt + allocate(SIZE-sizeof(opt));    opt = options[i];    }    array(string)|string aliases = [array(string)|string]opt[ALIASES];    if(!arrayp(aliases)) aliases = ({[string]aliases});       foreach([array(string)]aliases, string optname)    if(optname[0..1]=="--")    quick[optname]=opt;
pike.git/lib/modules/Getopt.pmod:288:    }       posix_me_harder = posix_me_harder!=-1 &&    (posix_me_harder || !!getenv("POSIX_ME_HARDER"));       // --- Do the actual parsing of arguments.       array(array) ret=({});    foreach(argv; int e; string opt) {    -  if(!e) continue; -  if(!opt || sizeof(opt)<2 || opt[0]!='-') { +  if(!e || !opt) continue; +  if(sizeof(opt)<2 || opt[0]!='-') {    if(posix_me_harder) break;    continue;    }       if(opt[1]=='-') {       if(opt=="--") break;       string arg;    sscanf(opt, "%s=%s", opt, arg);
pike.git/lib/modules/Getopt.pmod:352:    }       argv[e] = opts*"";    if(argv[e]=="-") argv[e]=0;    }    }       // --- Fill out empty slots with environment values       multiset(string) done = [multiset(string)]mkmultiset(column(ret, 0)); -  foreach(options, array(string|array(string)) option) { +  foreach(options, array(string|int|array(string)) option) {    string name=[string]option[NAME];    if(done[name]) continue;       if(option[ENV]) { -  array(string)|string foo=option[ENV]; +  array(string)|string foo=[array(string)|string]option[ENV];    if(!foo) continue;    if(stringp(foo)) foo = ({ [string]foo });       foreach([array(string)]foo, foo)    if(foo=[string]getenv([string]foo)) {    ret += ({ ({name, foo}) });    done[name] = 1;    break;    }    }
pike.git/lib/modules/Getopt.pmod:399:   //! @[Getopt.find_option()], @[Getopt.find_all_options()]   //!   array(string) get_args(array(string) argv, void|int(-1..1) posix_me_harder,    void|int throw_errors)   {    posix_me_harder = posix_me_harder!=-1 &&    (posix_me_harder || !!getenv("POSIX_ME_HARDER"));       foreach(argv; int i; string opt) {    -  if(!i) continue; -  if(!stringp(opt) || sizeof(opt)<2 || opt[0]!='-') { +  if(!i || !stringp(opt)) continue; +  if(sizeof(opt)<2 || opt[0]!='-') {    if(posix_me_harder) break;    continue;    }       if(opt[1]=='-') {       if(opt=="--") {    argv[i]=0;    break;    }