Exemplo n.º 1
0
/* ****************************************************************************
*
* optionNameDuplicated -
*/
static bool optionNameDuplicated(char* name, int start)
{
  int ix;
  int opts    = paOptionsNoOf(paiList);
  int matches = 0;

  if (name == NULL)
  {
    return false;
  }

  if (name[0] == 0)
  {
    return false;
  }

  for (ix = start; ix < opts; ix++)
  {
    PaiArgument* aP;

    if ((aP = paIxLookup(paiList, ix)) == NULL)
    {
      break;
    }

    if (aP->option == NULL)
    {
      continue;
    }

    if (aP->removed == true)
    {
      continue;
    }

    if (aP->option[0] == 0)
    {
      continue;
    }

    if (strcmp(aP->option, " ") == 0)
    {
      continue;
    }

    if (strcmp(name, aP->option) == 0)
    {
      ++matches;
    }
  }

  if (matches <= 1)
  {
    return false;
  }

  return true;
}
Exemplo n.º 2
0
/* ****************************************************************************
*
* envNameDuplicated -
*/
static bool envNameDuplicated(char* name, int start)
{
  int   ix;
  int   opts    = paOptionsNoOf(paiList);
  int   matches = 0;

  if (name == NULL)
  {
    return false;
  }

  if (name[0] == 0)
  {
    return false;
  }

  for (ix = start; ix < opts; ix++)
  {
    PaiArgument*  aP;
    char          envVarName[128];

    if ((aP = paIxLookup(paiList, ix)) == NULL)
    {
      break;
    }

    if (aP->removed == true)
    {
      continue;
    }

    if (aP->envName == NULL)
    {
      continue;
    }

    paEnvName(aP, envVarName, sizeof(envVarName));

    if (strcmp(name, envVarName) == 0)
    {
      ++matches;
    }
  }

  if (matches <= 1)
  {
    return false;
  }

  return true;
}
Exemplo n.º 3
0
/* ****************************************************************************
*
* paIxLookup - 
*/
PaiArgument* paIxLookup(PaiArgument* paList, int ix)
{
  int builtins = paBuiltinNoOf();

  if (ix < builtins)
  {
    return &paBuiltin[ix];
  }
  else if (ix < paOptionsNoOf(paList))
  {
    return &paList[ix - builtins];
  }

  return NULL;
}