summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2011-08-15 12:45:40 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2011-08-15 12:45:40 +0200
commit4a9fd9b097c0c1bbd37b436bbd4bb0a6a6bf78a9 (patch)
treeeff751a92d6d2bb903675868c2064e34f618a1ef /tools.c
parent9ebdb619954771a0641a3d6b873c1b2a19047c8c (diff)
downloadvdr-4a9fd9b097c0c1bbd37b436bbd4bb0a6a6bf78a9.tar.gz
vdr-4a9fd9b097c0c1bbd37b436bbd4bb0a6a6bf78a9.tar.bz2
Implemented command line options --filesize and --split
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools.c b/tools.c
index e0b11633..ccd2783d 100644
--- a/tools.c
+++ b/tools.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.c 2.15 2011/07/31 13:19:28 kls Exp $
+ * $Id: tools.c 2.16 2011/08/15 12:23:20 kls Exp $
*/
#include "tools.h"
@@ -270,6 +270,21 @@ bool isnumber(const char *s)
return true;
}
+int64_t StrToNum(const char *s)
+{
+ char *t = NULL;
+ int64_t n = strtoll(s, &t, 10);
+ if (t) {
+ switch (*t) {
+ case 'T': n *= 1024;
+ case 'G': n *= 1024;
+ case 'M': n *= 1024;
+ case 'K': n *= 1024;
+ }
+ }
+ return n;
+}
+
cString AddDirectory(const char *DirName, const char *FileName)
{
return cString::sprintf("%s/%s", DirName && *DirName ? DirName : ".", FileName);