Home

Dokumentation

Impressum

Dokumentation VDR
 

Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

tools.c File Reference

#include "tools.h"
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/vfs.h>
#include <time.h>
#include <unistd.h>
#include "i18n.h"

Include dependency graph for tools.c:

Include dependency graph

Go to the source code of this file.

Defines

#define LOCKFILENAME   ".lock-vdr"
#define LOCKFILESTALETIME   600

Functions

ssize_t safe_read (int filedes, void *buffer, size_t size)
ssize_t safe_write (int filedes, const void *buffer, size_t size)
void writechar (int filedes, char c)
char * readline (FILE *f)
char * strcpyrealloc (char *dest, const char *src)
char * strn0cpy (char *dest, const char *src, size_t n)
char * strreplace (char *s, char c1, char c2)
char * strreplace (char *s, const char *s1, const char *s2)
 re-allocates 's' and deletes the original string if necessary!

char * skipspace (const char *s)
char * stripspace (char *s)
char * compactspace (char *s)
const char * strescape (const char *s, const char *chars)
 
Warning:
returns a statically allocated string!


bool startswith (const char *s, const char *p)
bool endswith (const char *s, const char *p)
bool isempty (const char *s)
int numdigits (int n)
int time_ms (void)
void delay_ms (int ms)
bool isnumber (const char *s)
const char * itoa (int n)
 
Warning:
returns a statically allocated string!


const char * AddDirectory (const char *DirName, const char *FileName)
 
Warning:
returns a statically allocated string!


int FreeDiskSpaceMB (const char *Directory, int *UsedMB)
bool DirectoryOk (const char *DirName, bool LogErrors)
bool MakeDirs (const char *FileName, bool IsDirectory)
bool RemoveFileOrDir (const char *FileName, bool FollowSymlinks)
bool RemoveEmptyDirectories (const char *DirName, bool RemoveThis)
char * ReadLink (const char *FileName)
bool SpinUpDisk (const char *FileName)
const char * WeekDayName (int WeekDay)
 
Warning:
returns a statically allocated string!


const char * DayDateTime (time_t t)
 
Warning:
returns a statically allocated string!



Variables

int SysLogLevel = 3


Define Documentation

#define LOCKFILENAME   ".lock-vdr"
 

Definition at line 698 of file tools.c.

#define LOCKFILESTALETIME   600
 

Definition at line 699 of file tools.c.

Referenced by cLockFile::Lock().


Function Documentation

const char* AddDirectory const char *    DirName,
const char *    FileName
 

Warning:
returns a statically allocated string!

Definition at line 255 of file tools.c.

Referenced by cSIProcessor::GetEpgDataFileName(), cMarks::Load(), main(), and cSIProcessor::SetEpgDataFileName().

char* compactspace char *    s
 

Definition at line 145 of file tools.c.

References skipspace(), and stripspace().

Referenced by cEventInfo::FixEpgBugs(), and cSetupLine::Parse().

const char* DayDateTime time_t    t
 

Warning:
returns a statically allocated string!

Definition at line 490 of file tools.c.

References WeekDayName().

Referenced by cDisplayChannel::DisplayChannel(), and cOsdMenu::SetTitle().

void delay_ms int    ms
 

Definition at line 229 of file tools.c.

References time_ms().

Referenced by cRcuRemote::DetectCode().

bool DirectoryOk const char *    DirName,
bool    LogErrors
 

Definition at line 280 of file tools.c.

References esyslog, and LOG_ERROR_STR.

Referenced by cLockFile::cLockFile(), main(), cVideoDirectory::Next(), cSIProcessor::SetEpgDataFileName(), and SpinUpDisk().

bool endswith const char *    s,
const char *    p
 

Definition at line 194 of file tools.c.

Referenced by cRecording::Remove().

int FreeDiskSpaceMB const char *    Directory,
int *    UsedMB
 

Definition at line 263 of file tools.c.

References LOG_ERROR_STR.

Referenced by cVideoDirectory::FreeMB(), OpenVideoFile(), and cRecorder::RunningLowOnDiskSpace().

bool isempty const char *    s
 

Definition at line 205 of file tools.c.

References skipspace().

Referenced by cMenuEvent::cMenuEvent(), cRecording::cRecording(), cTimer::cTimer(), cOsdMenu::Display(), cDisplayChannel::DisplayInfo(), cEventInfo::Dump(), cConfig< cDiseqc >::Load(), cCommand::Parse(), cTimer::SetFile(), and cMenuTimers::Summary().

bool isnumber const char *    s
 

Definition at line 236 of file tools.c.

Referenced by cSVDRP::CmdCHAN(), cSVDRP::CmdDELR(), cSVDRP::CmdDELT(), cSVDRP::CmdGRAB(), cSVDRP::CmdLSTC(), cSVDRP::CmdLSTR(), cSVDRP::CmdLSTT(), cSVDRP::CmdVOLU(), and main().

const char* itoa int    n
 

Warning:
returns a statically allocated string!

Definition at line 248 of file tools.c.

Referenced by cTimer::ToText().

bool MakeDirs const char *    FileName,
bool    IsDirectory
 

Definition at line 298 of file tools.c.

References dsyslog, and LOG_ERROR_STR.

Referenced by cPlugin::ConfigDirectory(), cRecorder::cRecorder(), OpenVideoFile(), and cCutter::Start().

int numdigits int    n
 

Definition at line 210 of file tools.c.

char* readline FILE *    f
 

Definition at line 60 of file tools.c.

References MAXPARSEBUFFER.

Referenced by cRecordings::Load(), cEventInfo::Read(), and cSchedule::Read().

char* ReadLink const char *    FileName
 

Definition at line 424 of file tools.c.

References esyslog, and LOG_ERROR_STR.

Referenced by cSafeFile::cSafeFile().

bool RemoveEmptyDirectories const char *    DirName,
bool    RemoveThis
 

Definition at line 382 of file tools.c.

References dsyslog, and LOG_ERROR_STR.

Referenced by RemoveEmptyVideoDirectories().

bool RemoveFileOrDir const char *    FileName,
bool    FollowSymlinks
 

Definition at line 326 of file tools.c.

References dsyslog, esyslog, LOG_ERROR_STR, and MALLOC.

Referenced by RemoveVideoFile().

ssize_t safe_read int    filedes,
void *    buffer,
size_t    size
 

Definition at line 23 of file tools.c.

References dsyslog.

Referenced by cSIProcessor::Action(), cLircRemote::Action(), cIndexFile::CatchUp(), cIndexFile::cIndexFile(), cRecording::cRecording(), cSVDRP::Process(), cResumeFile::Read(), ReadFrame(), and cRcuRemote::ReceiveByte().

ssize_t safe_write int    filedes,
const void *    buffer,
size_t    size
 

Definition at line 35 of file tools.c.

References dsyslog.

Referenced by cCuttingThread::Action(), cRecorder::Action(), cResumeFile::Save(), cSVDRP::Send(), cDvbDevice::StillPicture(), cIndexFile::Write(), and writechar().

char* skipspace const char *    s
 

Definition at line 126 of file tools.c.

Referenced by cSVDRP::CmdMODC(), cSVDRP::CmdMODT(), cDiseqc::Codes(), compactspace(), cSVDRP::Execute(), cOsdMenu::HotKey(), isempty(), cChannel::Parse(), cCommand::Parse(), cKey::Parse(), cMark::Parse(), cTimer::Parse(), cEventInfo::Read(), and cSchedule::Read().

bool SpinUpDisk const char *    FileName
 

Definition at line 444 of file tools.c.

References DirectoryOk(), dsyslog, esyslog, and LOG_ERROR_STR.

Referenced by cRecorder::cRecorder().

bool startswith const char *    s,
const char *    p
 

Definition at line 185 of file tools.c.

Referenced by cEventInfo::FixEpgBugs().

char* strcpyrealloc char *    dest,
const char *    src
 

Definition at line 72 of file tools.c.

References esyslog, and max().

Referenced by cEventInfo::SetExtendedDescription(), cEventInfo::SetSubtitle(), and cEventInfo::SetTitle().

const char* strescape const char *    s,
const char *    chars
 

Warning:
returns a statically allocated string!

Definition at line 162 of file tools.c.

Referenced by cRecordingUserCommand::InvokeCommand(), and main().

char* stripspace char *    s
 

Definition at line 133 of file tools.c.

Referenced by compactspace(), cConfig< cDiseqc >::Load(), cCommand::Parse(), cMenuEditStrItem::ProcessKey(), and cRecording::Title().

char* strn0cpy char *    dest,
const char *    src,
size_t    n
 

Definition at line 89 of file tools.c.

Referenced by cTimer::cTimer(), cChannel::Parse(), cCommand::Parse(), cSetup::Parse(), cTimer::Parse(), cTimer::SetFile(), cReplayControl::ShowMode(), cInterface::Title(), and cRecording::Title().

char* strreplace char *    s,
const char *    s1,
const char *    s2
 

re-allocates 's' and deletes the original string if necessary!

Definition at line 109 of file tools.c.

Referenced by cSVDRP::CmdLSTR(), cRecording::cRecording(), cEventInfo::FixEpgBugs(), cChannel::Parse(), cTimer::Parse(), cChannel::ToText(), and cTimer::ToText().

char* strreplace char *    s,
char    c1,
char    c2
 

Definition at line 97 of file tools.c.

int time_ms void   
 

Definition at line 217 of file tools.c.

Referenced by cKbdRemote::Action(), cRcuRemote::Action(), cLircRemote::Action(), cDisplayChannel::cDisplayChannel(), cDisplayVolume::cDisplayVolume(), delay_ms(), cDisplayChannel::DisplayInfo(), cDisplayVolume::ProcessKey(), cDisplayChannel::ProcessKey(), and cDisplayChannel::Refresh().

const char* WeekDayName int    WeekDay
 

Warning:
returns a statically allocated string!

Definition at line 476 of file tools.c.

References tr.

Referenced by DayDateTime(), and cMenuEditDateItem::Set().

void writechar int    filedes,
char    c
 

Definition at line 55 of file tools.c.

References safe_write().

Referenced by cIndexFile::cIndexFile().


Variable Documentation

int SysLogLevel = 3
 

Definition at line 21 of file tools.c.


Generated on Wed Feb 5 23:30:55 2003 for VDR by doxygen1.3-rc2