[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdebase/kdm/backend
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2005-01-23 22:36:05
Message-ID: 20050123223605.87EFE1BAC1 () office ! kde ! org
[Download RAW message or body]

CVS commit by ossi: 

use new utility function


  M +3 -9      policy.c   1.29


--- kdebase/kdm/backend/policy.c  #1.28:1.29
@@ -152,9 +152,6 @@ Willing_msg( char *mbuf )
                 return;
 
-        while (!feof( f )) {
+        while (fGets( buf, sizeof(buf), f ) != -1) {
                 float m;
-                fgets( buf, sizeof(buf), f );
-                buf[sizeof(buf) - 1] = 0;
-
                 if (sscanf( buf, "cpu MHz : %f", &m )) {
                         numcpu++;
@@ -204,11 +201,8 @@ Willing( ARRAY8Ptr addr, CARD16 connecti
                 if (*willing) {
                         FILE *fd;
-                        int ok = 0;
+                        int len, ok = 0;
                         if ((fd = popen( willing, "r" ))) {
                                 for (;;) {
-                                        if (fgets( statusBuf, sizeof(statusBuf), fd )) {
-                                                int len = strlen( statusBuf );
-                                                if (len && statusBuf[len - 1] == '\n')
-                                                        statusBuf[--len] = 0; /* chop newline */
+                                        if ((len = fGets( statusBuf, sizeof(statusBuf), fd )) != -1) {
                                                 if (len) {
                                                         ok = 1;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic