pike.git / lib / modules / Arg.pmod

version» Context lines:

pike.git/lib/modules/Arg.pmod:1:   //   // Argument parser   // By Martin Nilsson - // $Id: Arg.pmod,v 1.1 2008/05/01 20:50:25 nilsson Exp $ + // $Id: Arg.pmod,v 1.2 2008/05/01 21:07:35 nilsson Exp $   //      #pike __REAL_VERSION__      //! Base class for parsing an argument. Inherit this class to create   //! custom made argument types.   class Arg   {    constant is_arg = 1;    static Arg next;
pike.git/lib/modules/Arg.pmod:463:    if( has_prefix(arg, "--") )    {    sscanf( arg, "--%s=%s", name, value ) || sscanf( arg, "--%s", name );    if(!name) return 0; // arg == "--"    values[name] = value||1;    argv[0]=0;    return 1;    }       sscanf( arg, "-%s=%s", name, value ) || sscanf( arg, "-%s", name ); -  if( !name ) return 0; +  if( !name || !sizeof(name) ) return 0;    foreach( name/1; int pos; string c )    if( pos == sizeof(name)-1 )    values[c] = value||1;    else    values[c] = 1;    argv[0]=0;    return 1;    }   }