コード例 #1
0
ファイル: JoinCameraFactory.cpp プロジェクト: HackLinux/HAL
  std::shared_ptr<CameraDriverInterface> GetDevice(const Uri& uri)
  {
    std::vector<Uri> suburis = splitUri(uri.url);
    std::vector<std::shared_ptr<CameraDriverInterface>> cameras;
    cameras.reserve(suburis.size());

    for( const Uri& uri : suburis ) {
      try {
        std::cout << "Creating stream from uri: " << uri.ToString()
                  << std::endl;
        cameras.emplace_back
            (DeviceRegistry<hal::CameraDriverInterface>::I().Create(uri));
      } catch ( std::exception& e ) {
        throw DeviceException(std::string("Error creating driver from uri \"") +
                              uri.ToString() + "\": " + e.what());
      }
    }

    if( cameras.empty() ) {
      throw DeviceException("No input cameras given to join");
    }

    JoinCameraDriver* pDriver = new JoinCameraDriver(cameras);
    return std::shared_ptr<CameraDriverInterface>( pDriver );
  }
コード例 #2
0
ファイル: Network.cpp プロジェクト: AjayTShephertz/phonegap
void
Network::Run(const String& command) {
	if (!command.IsEmpty()) {
		String args;
		String delim(L"/");
		command.SubString(String(L"gap://").GetLength(), args);
		StringTokenizer strTok(args, delim);
		if(strTok.GetTokenCount() < 3) {
			AppLogDebug("Not enough params");
			return;
		}
		String method;
		String hostAddr;
		strTok.GetNextToken(method);
		strTok.GetNextToken(callbackId);
		strTok.GetNextToken(hostAddr);

		// URL decoding
		Uri uri;
		uri.SetUri(hostAddr);
		AppLogDebug("Method %S, callbackId %S, hostAddr %S URI %S", method.GetPointer(), callbackId.GetPointer(), hostAddr.GetPointer(), uri.ToString().GetPointer());
		if(method == L"org.apache.cordova.Network.isReachable") {
			IsReachable(uri.ToString());
		}
		AppLogDebug("Network command %S completed", command.GetPointer());
		} else {
			AppLogDebug("Can't run empty command");
		}
}
コード例 #3
0
ファイル: DebugConsole.cpp プロジェクト: 4z3/phonegap
void
DebugConsole::CleanUp(String& str) {
	Uri uri;
	uri.SetUri(str);
	str.Clear();
	str.Append(uri.ToString());
}
コード例 #4
0
// Reference:	URL Access Restrictions in Silverlight 2
//		http://msdn.microsoft.com/en-us/library/cc189008(VS.95).aspx
bool
HttpRequest::CheckRedirectionPolicy (const char *url)
{
    if (!url)
        return false;

    // the original URI
    Uri *source = this->original_uri;
    if (Uri::IsNullOrEmpty (source))
        return false;

    // if the (original) source is relative then the (final) 'url' will be the absolute version of the uri
    // or if the source scheme is "file" then no server is present for redirecting the url somewhere else
    if (!source->IsAbsolute () || source->IsScheme ("file"))
        return true;

    char *strsrc = source->ToString ();
    // if the original URI and the end URI are identical then there was no redirection involved
    bool retval = (g_ascii_strcasecmp (strsrc, url) == 0);
    g_free (strsrc);
    if (retval)
        return true;

    // the destination URI
    Uri *dest = new Uri ();
    if (dest->Parse (url)) {
        // there was a redirection, but is it allowed ?
        switch (access_policy) {
        case DownloaderPolicy:
            // Redirection allowed for 'same domain' and 'same scheme'
            // note: if 'dest' is relative then it's the same scheme and site
            if (!dest->IsAbsolute () || (Uri::SameDomain (source, dest) && Uri::SameScheme (source, dest)))
                retval = true;
            break;
        case MediaPolicy:
            // Redirection allowed for: 'same scheme' and 'same or different sites'
            // note: if 'dest' is relative then it's the same scheme and site
            if (!dest->IsAbsolute () || Uri::SameScheme (source, dest))
                retval = true;
            break;
        case XamlPolicy:
        case FontPolicy:
        case MsiPolicy:
        case StreamingPolicy:
            // Redirection NOT allowed
            break;
        default:
            // no policy (e.g. downloading codec EULA and binary) is allowed
            retval = true;
            break;
        }
    }

    delete dest;

    return retval;
}
コード例 #5
0
ファイル: NodeCarDriver.cpp プロジェクト: areslp/HAL
bool NodeCarDriver::RegisterInHost(const Uri &uri) {
  hal::RegisterControllerReqMsg req;
  hal::RegisterControllerRepMsg rep;
  req.set_topic(node_topic_);
  req.set_uri(uri.ToString());
  int nTries = 0;
  while (nTries < 10000 &&
         node_.call_rpc(sim_name_, "RegisterControllerDevice",
                        req, rep) == false) {
    LOG(debug_level_) << "RPC call to register car controller failed";
    std::this_thread::sleep_for(std::chrono::milliseconds(100));
    nTries++;
  }
  if(rep.success()) {
    LOG(debug_level_) << "Car controller Registered";
    return true;
  }
  else {
    LOG(ERROR) << "Car controller wasn't registered";
    return false;
  }
}
コード例 #6
0
NodeDescription PlacementAndLoadBalancingUnitTest::CreateNodeDescriptionWithDomainsAndCapacity(
    int nodeId,
    std::wstring fdPath,
    std::wstring ud,
    std::wstring capacityStr,
    Reliability::NodeDeactivationIntent::Enum deactivationIntent,
    Reliability::NodeDeactivationStatus::Enum deactivationStatus
    )
{
    NodeDescription::DomainId fdId = fdPath.empty() ?
        NodeDescription::DomainId() : Uri(*Reliability::LoadBalancingComponent::Constants::FaultDomainIdScheme, L"", fdPath).Segments;

    map<wstring, uint> capacities = CreateCapacities(capacityStr);

    //add fdPath and ud as implicit properties
    map<wstring, wstring> nodePropertiesWithImplicitProperties;

    if (!fdPath.empty())
    {
        Uri fdUri = Uri(*Reliability::LoadBalancingComponent::Constants::FaultDomainIdScheme, L"", fdPath);
        nodePropertiesWithImplicitProperties.insert(make_pair(*Reliability::LoadBalancingComponent::Constants::ImplicitFaultDomainId, fdUri.ToString()));
    }

    return NodeDescription(CreateNodeInstance(nodeId, 0), true, deactivationIntent, deactivationStatus,
        move(nodePropertiesWithImplicitProperties), move(fdId), move(ud), map<wstring, uint>(), move(capacities));
}
コード例 #7
0
NodeDescription PlacementAndLoadBalancingUnitTest::CreateNodeDescription(
    int nodeId,
    wstring fdPath,
    wstring ud,
    map<wstring, wstring> && nodeProperties,
    std::wstring capacityStr,
    bool isUp)
{
    NodeDescription::DomainId fdId = fdPath.empty() ? 
        NodeDescription::DomainId() : Uri(*Reliability::LoadBalancingComponent::Constants::FaultDomainIdScheme, L"", fdPath).Segments;

    //add fdPath and ud as implicit properties
    map<wstring, wstring> nodePropertiesWithImplicitProperties(nodeProperties);

    if (!fdPath.empty())
    {
        Uri fdUri = Uri(*Reliability::LoadBalancingComponent::Constants::FaultDomainIdScheme, L"", fdPath);
        nodePropertiesWithImplicitProperties.insert(make_pair(*Reliability::LoadBalancingComponent::Constants::ImplicitFaultDomainId, fdUri.ToString()));
    }

    if (!ud.empty())
    {
        nodePropertiesWithImplicitProperties.insert(make_pair(*Reliability::LoadBalancingComponent::Constants::ImplicitUpgradeDomainId, ud));
    }

    return NodeDescription(
        CreateNodeInstance(nodeId, 0),
        isUp,
        Reliability::NodeDeactivationIntent::Enum::None,
        Reliability::NodeDeactivationStatus::Enum::None,
        move(nodePropertiesWithImplicitProperties),
        move(fdId),
        move(ud),
        map<wstring, uint>(),
        CreateCapacities(capacityStr));
}
コード例 #8
0
ファイル: CmdMerge.cpp プロジェクト: georgebrock/task
int CmdMerge::execute (std::string& output)
{
  context.footnote ("The 'merge' command is deprecated, and will be removed in a subsequent release.");

  // invoke gc and commit before merging in order to update data files
  context.tdb2.gc ();
  context.tdb2.commit ();

  std::vector <std::string> words = context.a3.extract_words ();
  std::string file;
  if (words.size ())
    file = words[0];

  std::string pushfile = "";
  std::string tmpfile = "";

  std::string sAutopush = lowerCase (context.config.get        ("merge.autopush"));
  bool        bAutopush =            context.config.getBoolean ("merge.autopush");

  Uri uri (file, "merge");
  uri.parse();

  if (uri._data.length ())
  {
    Directory location (context.config.get ("data.location"));

    // be sure that uri points to a file
    uri.append ("undo.data");

    Transport* transport;
    if ((transport = Transport::getTransport (uri)) != NULL )
    {
      tmpfile = location._data + "/undo_remote.data";
      transport->recv (tmpfile);
      delete transport;

      file = tmpfile;
    }
    else
      file = uri._path;

    // XXX the following function could indicate whether a modification was
    // performed without an exception (by returning a boolean, within a status
    // object or with a specific function)
    try
    {
        context.tdb2.merge (file);
    }
    catch (const std::string& e) {
        if (e == STRING_TDB2_UP_TO_DATE)
        {
            output += e + "\n";
            return 0;
        }
        else
            throw e;
    }

    output += std::string (STRING_CMD_MERGE_COMPLETE) + "\n";

    if (tmpfile != "")
      remove (tmpfile.c_str ());

    if (((sAutopush == "ask") && (confirm (format (STRING_CMD_MERGE_CONFIRM, uri.ToString ()))))
       || (bAutopush))
    {
      // Derive autopush uri from merge.default.uri? otherwise: change prompt above

      // Change the "merge" command to "push".
      std::vector <Arg>::iterator i;
      for (i = context.a3.begin (); i != context.a3.end (); ++i)
      {
        if (i->_category == Arg::cat_command)
        {
          i->_raw = "push";
          break;
        }
      }

      // Append the URI argument.
      context.a3.push_back (Arg (uri._data, Arg::cat_literal));

      std::string out;
      assert (context.commands["push"]);
      context.commands["push"]->execute (out);
    }
  }
  else
    throw std::string (STRING_CMD_MERGE_NO_URI);

  return 0;
}
コード例 #9
0
ファイル: CmdPull.cpp プロジェクト: georgebrock/task
int CmdPull::execute (std::string& output)
{
  context.footnote ("The 'pull' command is deprecated, and will be removed in a subsequent release.");

  std::vector <std::string> words = context.a3.extract_words ();
  std::string file;
  if (words.size ())
    file = words[0];

  Uri uri (file, "pull");
  uri.parse ();

  if (uri._data.length ())
  {
		Directory location (context.config.get ("data.location"));

    if (! uri.append ("{pending,undo,completed}.data"))
      throw format (STRING_CMD_PULL_NOT_DIR, uri._path);

		Transport* transport;
		if ((transport = Transport::getTransport (uri)) != NULL)
		{
			transport->recv (location._data + "/");
			delete transport;
		}
		else
		{
      // Verify that files are not being copied from rc.data.location to the
      // same place.
      if (Directory (uri._path) == Directory (context.config.get ("data.location")))
        throw std::string (STRING_CMD_PULL_SAME);

      // copy files locally

      // remove {pending,undo,completed}.data
      uri._path = uri.parent();

      Path path1 (uri._path + "undo.data");
      Path path2 (uri._path + "pending.data");
      Path path3 (uri._path + "completed.data");

      if (path1.exists() && path2.exists() && path3.exists())
      {
//        if (confirm ("xxxxxxxxxxxxx"))
//        {
          std::ofstream ofile1 ((location._data + "/undo.data").c_str(), std::ios_base::binary);
          std::ifstream ifile1 (path1._data.c_str()                    , std::ios_base::binary);
          ofile1 << ifile1.rdbuf();

          std::ofstream ofile2 ((location._data + "/pending.data").c_str(), std::ios_base::binary);
          std::ifstream ifile2 (path2._data.c_str()                    , std::ios_base::binary);
          ofile2 << ifile2.rdbuf();

          std::ofstream ofile3 ((location._data + "/completed.data").c_str(), std::ios_base::binary);
          std::ifstream ifile3 (path3._data.c_str()                    , std::ios_base::binary);
          ofile3 << ifile3.rdbuf();
//        }
      }
      else
      {
        throw format (STRING_CMD_PULL_MISSING, uri._path);
      }
		}

    output += format (STRING_CMD_PULL_TRANSFERRED, uri.ToString ()) + "\n";
  }
  else
    throw std::string (STRING_CMD_PULL_NO_URI);

  return 0;
}
コード例 #10
0
ファイル: uri.cpp プロジェクト: 499940913/moon
Uri *
Uri::CombineWithSourceLocation (Deployment *deployment, const Uri *base_uri, const Uri *relative_uri, bool allow_escape)
{
	Uri *absolute_dummy;
	Uri *absolute_base;
	Uri *absolute_uri;
	Uri *result;

	LOG_DOWNLOADER ("Uri::CombineWithSourceLocation (%s, %s, %s, %s)\n", deployment->GetSourceLocation (NULL)->ToString (), base_uri ? base_uri->ToString () : NULL, relative_uri->ToString (), allow_escape ? "true" : "false");

	if (allow_escape) {
		absolute_base = Uri::Create (deployment->GetSourceLocation (NULL), base_uri);
		absolute_uri = Uri::Create (absolute_base, relative_uri);

		LOG_DOWNLOADER ("Uri::CombineWithSourceLocation (): absolute base: '%s' absolute uri: '%s'\n", absolute_base->ToString (), absolute_uri->ToString ());

		delete absolute_base;

		result = absolute_uri;
	} else {
		/*
		 * We must combine base_uri and relative_uri, having in mind that base_uri can't get out of the
		 * source location using ".."
		 * So we create a dummy absolute uri (with an empty path), and combine it with the base_uri => absolute_base.
		 * This will remove any ".."'s we don't want.
		 * Then we combine absolute_base with the relative_uri => absolute_uri.
		 * Finally we take the source location and combine it with the path of absolute_uri => result.
		 */
		absolute_dummy = Uri::Create ("http://www.mono-project.com/");
		if (base_uri != NULL && base_uri->GetOriginalString () != NULL) {
			absolute_base = Uri::Create (absolute_dummy, base_uri);
		} else {
			absolute_base = Uri::Clone (absolute_dummy);
		}
		delete absolute_dummy;

		if (absolute_base == NULL)
			return NULL;

		LOG_DOWNLOADER ("Uri::CombineWithSourceLocation (): absolute base uri with dummy root: '%s'\n", absolute_base->ToString ());

		/* Combine the absolute base uri with the uri of the resource */
		absolute_uri = Uri::Create (absolute_base, relative_uri);
		delete absolute_base;

		if (absolute_uri == NULL)
			return NULL;

		LOG_DOWNLOADER ("Uri::CombineWithSourceLocation (): absolute base with dummy root and uri: '%s'\n", absolute_uri->ToString ());

		const char *path = absolute_uri->GetPath ();
		if (path != NULL && path [0] == '/') {
			/* Skip over any '/' so that the absolute uri's path is not resolved against the root of the source location */
			path++;
		}
		result = Uri::Create (deployment->GetSourceLocation (NULL), path);
		delete absolute_uri;

		LOG_DOWNLOADER ("Uri::CombineWithSourceLocation () final uri: '%s' (path: '%s')\n", result->ToString (), path);
	}

	return result;
}
コード例 #11
0
ファイル: CmdShow.cpp プロジェクト: SEJeff/task
int CmdShow::execute (std::string& output)
{
  int rc = 0;
  std::stringstream out;

  // Obtain the arguments from the description.  That way, things like '--'
  // have already been handled.
  std::vector <std::string> words = context.a3.extract_words ();
  if (words.size () > 2)
    throw std::string (STRING_CMD_SHOW_ARGS);

  int width = context.getWidth ();

  // Complain about configuration variables that are not recognized.
  // These are the regular configuration variables.
  // Note that there is a leading and trailing space, to make it easier to
  // search for whole words.
  std::string recognized =
    " abbreviation.minimum"
    " active.indicator"
    " avoidlastcolumn"
    " bulk"
    " burndown.bias"
    " calendar.details"
    " calendar.details.report"
    " calendar.holidays"
    " calendar.legend"
    " calendar.offset"
    " calendar.offset.value"
    " color"
    " color.active"
    " color.alternate"
    " color.blocked"
    " color.burndown.done"
    " color.burndown.pending"
    " color.burndown.started"
    " color.calendar.due"
    " color.calendar.due.today"
    " color.calendar.holiday"
    " color.calendar.overdue"
    " color.calendar.today"
    " color.calendar.weekend"
    " color.calendar.weeknumber"
    " color.completed"
    " color.debug"
    " color.deleted"
    " color.due"
    " color.due.today"
    " color.footnote"
    " color.header"
    " color.history.add"
    " color.history.delete"
    " color.history.done"
    " color.label"
    " color.overdue"
    " color.pri.H"
    " color.pri.L"
    " color.pri.M"
    " color.pri.none"
    " color.recurring"
    " color.summary.background"
    " color.summary.bar"
    " color.sync.added"
    " color.sync.changed"
    " color.sync.rejected"
    " color.tagged"
    " color.undo.after"
    " color.undo.before"
    " column.padding"
    " complete.all.projects"
    " complete.all.tags"
    " confirmation"
    " data.location"
    " dateformat"
    " dateformat.annotation"
    " dateformat.holiday"
    " dateformat.report"
    " debug"
    " default.command"
    " default.due"
    " default.priority"
    " default.project"
    " defaultheight"
    " defaultwidth"
    " dependency.confirmation"
    " dependency.indicator"
    " dependency.reminder"
    " detection"
    " displayweeknumber"
    " dom"
    " due"
    " echo.command"                      // Deprecated 2.0
    " edit.verbose"                      // Deprecated 2.0
    " editor"
    " exit.on.missing.db"
    " expressions"
    " extensions"
    " fontunderline"
    " gc"
    " hyphenate"
    " indent.annotation"
    " indent.report"
    " journal.info"
    " journal.time"
    " journal.time.start.annotation"
    " journal.time.stop.annotation"
    " json.array"
    " list.all.projects"
    " list.all.tags"
    " locale"
    " locking"
    " merge.autopush"
    " merge.default.uri"
    " monthsperline"
    " nag"
    " patterns"
    " pull.default.uri"
    " push.default.uri"
    " recurrence.indicator"
    " recurrence.limit"
    " regex"
    " row.padding"
    " rule.precedence.color"
    " search.case.sensitive"
    " shadow.command"
    " shadow.file"
    " shadow.notify"
    " shell.prompt"
    " tag.indicator"
    " taskd.server"
    " taskd.credentials"
    " undo.style"
    " urgency.active.coefficient"
    " urgency.annotations.coefficient"
    " urgency.blocked.coefficient"
    " urgency.blocking.coefficient"
    " urgency.due.coefficient"
    " urgency.next.coefficient"
    " urgency.priority.coefficient"
    " urgency.project.coefficient"
    " urgency.tags.coefficient"
    " urgency.waiting.coefficient"
    " urgency.age.coefficient"
    " urgency.age.max"
    " verbose"
    " weekstart"
    " xterm.title"
    " ";

  // This configuration variable is supported, but not documented.  It exists
  // so that unit tests can force color to be on even when the output from task
  // is redirected to a file, or stdout is not a tty.
  recognized += "_forcecolor ";

  std::vector <std::string> all;
  context.config.all (all);

  std::vector <std::string> unrecognized;
  std::vector <std::string>::iterator i;
  for (i = all.begin (); i != all.end (); ++i)
  {
    // Disallow partial matches by tacking a leading and trailing space on each
    // variable name.
    std::string pattern = " " + *i + " ";
    if (recognized.find (pattern) == std::string::npos)
    {
      // These are special configuration variables, because their name is
      // dynamic.
      if (i->substr (0, 14) != "color.keyword."        &&
          i->substr (0, 14) != "color.project."        &&
          i->substr (0, 10) != "color.tag."            &&
          i->substr (0,  8) != "holiday."              &&
          i->substr (0,  7) != "report."               &&
          i->substr (0,  6) != "alias."                &&
          i->substr (0,  5) != "hook."                 &&
          i->substr (0,  5) != "push."                 &&
          i->substr (0,  5) != "pull."                 &&
          i->substr (0,  6) != "merge."                &&
          i->substr (0,  4) != "uda."                  &&
          i->substr (0, 21) != "urgency.user.project." &&
          i->substr (0, 17) != "urgency.user.tag.")
      {
        unrecognized.push_back (*i);
      }
    }
  }

  // Find all the values that match the defaults, for highlighting.
  std::vector <std::string> default_values;
  Config default_config;
  default_config.setDefaults ();

  for (i = all.begin (); i != all.end (); ++i)
    if (context.config.get (*i) != default_config.get (*i))
      default_values.push_back (*i);

  // Create output view.
  ViewText view;
  view.width (width);
  view.add (Column::factory ("string", STRING_CMD_SHOW_CONF_VAR));
  view.add (Column::factory ("string", STRING_CMD_SHOW_CONF_VALUE));

  Color error ("bold white on red");
  Color warning ("black on yellow");

  std::string section;

  // Look for the first plausible argument which could be a pattern 
  if (words.size ())
    section = words[0];

  if (section == "all")
    section = "";

  for (i = all.begin (); i != all.end (); ++i)
  {
    std::string::size_type loc = i->find (section, 0);
    if (loc != std::string::npos)
    {
      // Look for unrecognized.
      Color color;
      if (std::find (unrecognized.begin (), unrecognized.end (), *i) != unrecognized.end ())
        color = error;
      else if (std::find (default_values.begin (), default_values.end (), *i) != default_values.end ())
        color = warning;

      std::string value = context.config.get (*i);
      // hide sensible information
      if ( (i->substr (0, 5) == "push."   ||
            i->substr (0, 5) == "pull."   ||
            i->substr (0, 6) == "merge.") && (i->find (".uri") != std::string::npos) ) {

        Uri uri (value);
        uri.parse ();
        value = uri.ToString ();
      }

      int row = view.addRow ();
      view.set (row, 0, *i, color);
      view.set (row, 1, value, color);
    }
  }

  out << "\n"
      << view.render ()
      << (view.rows () == 0 ? STRING_CMD_SHOW_NONE : "")
      << (view.rows () == 0 ? "\n\n" : "\n");

  if (default_values.size ())
  {
    out << STRING_CMD_SHOW_DIFFER;

    if (context.color ())
      out << "  "
          << format (STRING_CMD_SHOW_DIFFER_COLOR, warning.colorize ("color"))
          << "\n\n";
  }

  // Display the unrecognized variables.
  if (unrecognized.size ())
  {
    out << STRING_CMD_SHOW_UNREC << "\n";

    for (i = unrecognized.begin (); i != unrecognized.end (); ++i)
      out << "  " << *i << "\n";

    if (context.color ())
      out << "\n  " << format (STRING_CMD_SHOW_DIFFER_COLOR, error.colorize ("color"));

    out << "\n\n";
  }

  out << legacyCheckForDeprecatedVariables ();
  out << legacyCheckForDeprecatedColor ();
  out << legacyCheckForDeprecatedColumns ();

  // TODO Check for referenced but missing theme files.
  // TODO Check for referenced but missing string files.
  // TODO Check for referenced but missing tips files.

  // Check for referenced but missing hook scripts.
#ifdef HAVE_LIBLUA
  std::vector <std::string> missing_scripts;
  for (i = all.begin (); i != all.end (); ++i)
  {
    if (i->substr (0, 5) == "hook.")
    {
      std::string value = context.config.get (*i);
      Nibbler n (value);

      // <path>:<function> [, ...]
      while (!n.depleted ())
      {
        std::string file;
        std::string function;
        if (n.getUntil (':', file) &&
            n.skip (':')           &&
            n.getUntil (',', function))
        {
          Path script (file);
          if (!script.exists () || !script.readable ())
            missing_scripts.push_back (file);

          (void) n.skip (',');
        }
      }
    }
  }

  if (missing_scripts.size ())
  {
    out << STRING_CMD_SHOW_HOOKS << "\n";

    for (i = missing_scripts.begin (); i != missing_scripts.end (); ++i)
      out << "  " << *i << "\n";

    out << "\n";
  }
#endif

  // Check for bad values in rc.annotations.
  // TODO Deprecated.
  std::string annotations = context.config.get ("annotations");
  if (annotations != "full"   &&
      annotations != "sparse" &&
      annotations != "none")
    out << format (STRING_CMD_SHOW_CONFIG_ERROR, "annotations", annotations)
        << "\n";

  // Check for bad values in rc.calendar.details.
  std::string calendardetails = context.config.get ("calendar.details");
  if (calendardetails != "full"   &&
      calendardetails != "sparse" &&
      calendardetails != "none")
    out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.details", calendardetails)
        << "\n";

  // Check for bad values in rc.calendar.holidays.
  std::string calendarholidays = context.config.get ("calendar.holidays");
  if (calendarholidays != "full"   &&
      calendarholidays != "sparse" &&
      calendarholidays != "none")
    out << format (STRING_CMD_SHOW_CONFIG_ERROR, "calendar.holidays", calendarholidays)
        << "\n";

  // Check for bad values in rc.default.priority.
  std::string defaultPriority = context.config.get ("default.priority");
  if (defaultPriority != "H" &&
      defaultPriority != "M" &&
      defaultPriority != "L" &&
      defaultPriority != "")
    out << format (STRING_CMD_SHOW_CONFIG_ERROR, "default.priority", defaultPriority)
        << "\n";

  // Verify installation.  This is mentioned in the documentation as the way
  // to ensure everything is properly installed.

  if (all.size () == 0)
  {
    out << STRING_CMD_SHOW_EMPTY << "\n";
    rc = 1;
  }
  else
  {
    Directory location (context.config.get ("data.location"));

    if (location._data == "")
      out << STRING_CMD_SHOW_NO_LOCATION << "\n";

    if (! location.exists ())
      out << STRING_CMD_SHOW_LOC_EXIST << "\n";
  }

  output = out.str ();
  return rc;
}