summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-01-27 13:11:23 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2002-01-27 13:11:23 +0100
commit28e54bc648502820202ea44f6a990c9502f901f7 (patch)
tree436b3e56eb28e8c13002e97c511c11234c55f0b4 /tools.c
parent53c5499a0b93cd1cb47394381c4262f01b6c0c00 (diff)
downloadvdr-28e54bc648502820202ea44f6a990c9502f901f7.tar.gz
vdr-28e54bc648502820202ea44f6a990c9502f901f7.tar.bz2
The 'Main' menu now displays the used disk space in the title
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools.c b/tools.c
index b18c0ef5..dc579e55 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 1.52 2002/01/26 12:04:32 kls Exp $
+ * $Id: tools.c 1.53 2002/01/27 12:36:23 kls Exp $
*/
#include "tools.h"
@@ -223,10 +223,12 @@ const char *AddDirectory(const char *DirName, const char *FileName)
#define DFCMD "df -m -P '%s'"
-uint FreeDiskSpaceMB(const char *Directory)
+int FreeDiskSpaceMB(const char *Directory, int *UsedMB)
{
//TODO Find a simpler way to determine the amount of free disk space!
- uint Free = 0;
+ if (UsedMB)
+ *UsedMB = 0;
+ int Free = 0;
char *cmd = NULL;
asprintf(&cmd, DFCMD, Directory);
FILE *p = popen(cmd, "r");
@@ -234,8 +236,10 @@ uint FreeDiskSpaceMB(const char *Directory)
char *s;
while ((s = readline(p)) != NULL) {
if (strchr(s, '/')) {
- uint available;
- sscanf(s, "%*s %*d %*d %u", &available);
+ int used, available;
+ sscanf(s, "%*s %*d %d %d", &used, &available);
+ if (UsedMB)
+ *UsedMB = used;
Free = available;
break;
}