Beispiel #1
0
std::string InCronTabEntry::ToString() const
{
  std::ostringstream ss;
  
  std::string m;
  
  InotifyEvent::DumpTypes(m_uMask, m);
  if (m.empty()) {
    m = m_fNoLoop ? "IN_NO_LOOP" : "0";
  }
  else {
    if (m_fNoLoop)
      m.append(",IN_NO_LOOP");
  }
  
  ss << GetSafePath(m_path) << " " << m << " " << m_cmd;
  return ss.str();
}
Beispiel #2
0
std::string IncronTabEntry::ToString() const
{
  std::ostringstream ss;
  
  std::string m;
  
  InotifyEvent::DumpTypes(m_uMask, m);
  // don't write IN_NO_LOOP anymore
//  if (m.empty())
//    m = m_fNoLoop ? IN_NO_LOOP_OLD : m;
//  else
//    if (m_fNoLoop) m.append(std::string(","+IN_NO_LOOP_OLD);

  // add CT_NORECURSION artificially
  if (m.empty())
    m = m_fNoRecursion ? CT_NORECURSION : m;
  else
    if (m_fNoRecursion) m.append(std::string(",")+CT_NORECURSION);
  
  // add CT_LOOPABLE artificially
  if (m.empty())
    m = !m_fNoLoop ? CT_LOOPABLE : m;
  else
    if (!m_fNoLoop) m.append(std::string(",")+CT_LOOPABLE);
  
  // add CT_DOTDIRS artificially
  if (m.empty())
    m = m_fDotDirs ? CT_DOTDIRS : m;
  else
    if (m_fDotDirs) m.append(std::string(",")+CT_DOTDIRS);
  
  // fill a default value for broken lines
  if (m.empty())
    m = "IN_ALL_EVENTS";
  
  ss << GetSafePath(m_path) << "\t" << m << "\t" << m_cmd;
  return ss.str();
}