Back to index

lshw  02.16
Defines | Functions
options.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define REMOVED   "[REMOVED]"

Functions

bool parse_options (int &argc, char *argv[])
void alias (const char *a, const char *cname)
bool enabled (const char *option)
bool disabled (const char *option)
void enable (const char *option)
void disable (const char *option)
bool visible (const char *c)

Define Documentation

#define REMOVED   "[REMOVED]"

Definition at line 4 of file options.h.


Function Documentation

void alias ( const char *  a,
const char *  cname 
)

Definition at line 27 of file options.cc.

{
  aliases[lowercase(aname)] = lowercase(cname);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void disable ( const char *  option)

Definition at line 138 of file options.cc.

{
  disabled_tests.insert(lowercase(option));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool disabled ( const char *  option)

Definition at line 123 of file options.cc.

{
  return disabled_tests.find(lowercase(option)) != disabled_tests.end();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void enable ( const char *  option)

Definition at line 129 of file options.cc.

{
  if (!disabled(option))
    return;

  disabled_tests.erase(lowercase(option));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool enabled ( const char *  option)

Definition at line 117 of file options.cc.

{
  return !(disabled(lowercase(option).c_str()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool parse_options ( int &  argc,
char *  argv[] 
)

Definition at line 53 of file options.cc.

{
  int i = 1;
  string option = "";

  while (i < argc)
  {
    option = string(argv[i]);

    if (option == "-disable")
    {
      if (i + 1 >= argc)
        return false;                             // -disable requires an argument

      disable(argv[i + 1]);

      remove_option_argument(i, argc, argv);
    }
    else if (option == "-enable")
    {
      if (i + 1 >= argc)
        return false;                             // -enable requires an argument

      enable(argv[i + 1]);

      remove_option_argument(i, argc, argv);
    }
#ifdef SQLITE
    else if (option == "-dump")
    {
      if (i + 1 >= argc)
        return false;                             // -dump requires an argument

      setenv("OUTFILE", argv[i + 1], 1);
      enable("output:db");

      remove_option_argument(i, argc, argv);
    }
#endif
    else if ( (option == "-class") || (option == "-C") || (option == "-c"))
    {
      vector < string > classes;

      enable("output:list");

      if (i + 1 >= argc)
        return false;                             // -class requires an argument

      splitlines(argv[i + 1], classes, ',');

      for (unsigned int j = 0; j < classes.size(); j++)
        visible_classes.insert(getcname(classes[j].c_str()));

      remove_option_argument(i, argc, argv);
    }
    else
      i++;
  }

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool visible ( const char *  c)

Definition at line 144 of file options.cc.

{
  if (visible_classes.size() == 0)
    return true;
  return visible_classes.find(getcname(c)) != visible_classes.end();
}

Here is the call graph for this function:

Here is the caller graph for this function: