diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2000-07-28 13:44:31 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2000-07-28 13:44:31 +0200 |
commit | 92096e097a5cb6b90fb982d90b16012682d67ccf (patch) | |
tree | 132e337d98f7dbfec9d81c234d32171abd9d3fdc /tools.c | |
parent | 7ac97639da8b6428e2a17464bddea0280f032321 (diff) | |
download | vdr-92096e097a5cb6b90fb982d90b16012682d67ccf.tar.gz vdr-92096e097a5cb6b90fb982d90b16012682d67ccf.tar.bz2 |
Added command line option '-v'
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.10 2000/07/23 13:16:54 kls Exp $ + * $Id: tools.c 1.11 2000/07/28 13:22:10 kls Exp $ */ #define _GNU_SOURCE @@ -145,6 +145,24 @@ bool isnumber(const char *s) return true; } +bool DirectoryOk(const char *DirName) +{ + struct stat ds; + if (stat(DirName, &ds) == 0) { + if (S_ISDIR(ds.st_mode)) { + if (access(DirName, R_OK | W_OK | X_OK) == 0) + return true; + else + esyslog(LOG_ERR, "ERROR: can't access %s", DirName); + } + else + esyslog(LOG_ERR, "ERROR: %s is not a directory", DirName); + } + else + LOG_ERROR_STR(DirName); + return false; +} + bool MakeDirs(const char *FileName, bool IsDirectory) { bool result = true; |