mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-12-27 07:11:05 +01:00
Implemented command line options --filesize and --split
This commit is contained in:
17
tools.c
17
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);
|
||||
|
||||
Reference in New Issue
Block a user