changeset 164:1e60714b0bd5

-#include <stdio.h>
author mmj
date Fri, 04 Jun 2004 00:39:01 +1000
parents 39c46b88720d
children acaaecfd3236
files src/ctrlvalue.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ctrlvalue.c	Fri Jun 04 00:30:09 2004 +1000
+++ b/src/ctrlvalue.c	Fri Jun 04 00:39:01 2004 +1000
@@ -9,7 +9,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdlib.h>
-#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 #include "strgen.h"
 #include "ctrlvalue.h"
@@ -20,14 +21,17 @@
 {
 	char *value = NULL;
 	char *filename = concatstr(3, listdir, "/control/", ctrlstr);
-	FILE *ctrlfile;
+	int ctrlfd;
 
-	ctrlfile = fopen(filename, "r");
+	ctrlfd = open(filename, O_RDONLY);
+	free(filename);
 
-	if(ctrlfile) {
-		value = myfgetline(ctrlfile);
+	if(ctrlfd < 0)
+		return NULL;
+		
+	value = mygetline(ctrlfd);
+	close(ctrlfd);
 		chomp(value);
-	}
 
 	return value;
 }