SOURCES: postshell.c - avoid using fprintf(). saved 5k with diet

glen glen at pld-linux.org
Fri Jun 17 18:25:15 CEST 2005


Author: glen                         Date: Fri Jun 17 16:25:15 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- avoid using fprintf(). saved 5k with diet

---- Files affected:
SOURCES:
   postshell.c (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: SOURCES/postshell.c
diff -u SOURCES/postshell.c:1.3 SOURCES/postshell.c:1.4
--- SOURCES/postshell.c:1.3	Fri Jun 17 18:12:57 2005
+++ SOURCES/postshell.c	Fri Jun 17 18:25:10 2005
@@ -194,12 +194,15 @@
 	}
 }
 
+#define error(msg) write(2, msg, strlen(msg))
 int main(int argc, char **argv)
 {
 	FILE *f;
 
 	if (argc < 2) {
-		fprintf(stderr, "USAGE: %s filename\n", argv[0]);
+		error("USAGE: ");
+		error(argv[0]);
+		error(" filename\n");
 		exit(1);
 	}
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/postshell.c?r1=1.3&r2=1.4&f=u




More information about the pld-cvs-commit mailing list