Implemented command line options --filesize and --split

This commit is contained in:
Klaus Schmidinger
2011-08-15 12:45:40 +02:00
parent 9ebdb61995
commit 4a9fd9b097
6 changed files with 61 additions and 4 deletions

17
tools.c
View File

@@ -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);