[Pkg-shadow-commits] r2043 - in upstream/trunk: . libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun May 25 23:57:42 UTC 2008


Author: nekral-guest
Date: 2008-05-25 23:57:41 +0000 (Sun, 25 May 2008)
New Revision: 2043

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/loginprompt.c
Log:
	* libmisc/loginprompt.c: Avoid implicit conversion of pointers / chars to booleans.
	* libmisc/loginprompt.c: Add brackets.
	* libmisc/loginprompt.c: Avoid assignments in comparisons.
	* libmisc/loginprompt.c: The return values of fclose and fflush are not checked on purpose.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-05-25 23:50:03 UTC (rev 2042)
+++ upstream/trunk/ChangeLog	2008-05-25 23:57:41 UTC (rev 2043)
@@ -1,5 +1,14 @@
 2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/loginprompt.c: Avoid implicit conversion of pointers /
+	chars to booleans.
+	* libmisc/loginprompt.c: Add brackets.
+	* libmisc/loginprompt.c: Avoid assignments in comparisons.
+	* libmisc/loginprompt.c: The return values of fclose and fflush
+	are not checked on purpose.
+
+2008-05-26  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* libmisc/setupenv.c: Avoid implicit conversion of chars to
 	booleans.
 

Modified: upstream/trunk/libmisc/loginprompt.c
===================================================================
--- upstream/trunk/libmisc/loginprompt.c	2008-05-25 23:50:03 UTC (rev 2042)
+++ upstream/trunk/libmisc/loginprompt.c	2008-05-25 23:57:41 UTC (rev 2043)
@@ -88,15 +88,19 @@
 
 	if (prompt) {
 		cp = getdef_str ("ISSUE_FILE");
-		if (cp && (fp = fopen (cp, "r"))) {
-			while ((i = getc (fp)) != EOF)
-				putc (i, stdout);
+		if (NULL != cp) {
+			fp = fopen (cp, "r");
+			if (NULL != fp) {
+				while ((i = getc (fp)) != EOF) {
+					putc (i, stdout);
+				}
 
-			fclose (fp);
+				(void) fclose (fp);
+			}
 		}
 		gethostname (buf, sizeof buf);
 		printf (prompt, buf);
-		fflush (stdout);
+		(void) fflush (stdout);
 	}
 
 	/* 
@@ -105,12 +109,14 @@
 	 */
 
 	memzero (buf, sizeof buf);
-	if (fgets (buf, sizeof buf, stdin) != buf)
+	if (fgets (buf, sizeof buf, stdin) != buf) {
 		exit (1);
+	}
 
 	cp = strchr (buf, '\n');
-	if (!cp)
+	if (NULL == cp) {
 		exit (1);
+	}
 	*cp = '\0';		/* remove \n [ must be there ] */
 
 	/*
@@ -122,11 +128,13 @@
 	for (cp = buf; *cp == ' ' || *cp == '\t'; cp++);
 
 	for (i = 0; i < namesize - 1 && isgraph (*cp); name[i++] = *cp++);
-	while (isgraph (*cp))
+	while (isgraph (*cp)) {
 		cp++;
+	}
 
-	if (*cp)
+	if ('\0' != *cp) {
 		cp++;
+	}
 
 	name[i] = '\0';
 
@@ -136,15 +144,16 @@
 	 * to do this, and I just take the easy way out.
 	 */
 
-	if (*cp != '\0') {	/* process new variables */
+	if ('\0' != *cp) {	/* process new variables */
 		char *nvar;
 		int count = 1;
 
 		for (envc = 0; envc < MAX_ENV; envc++) {
-			nvar = strtok (envc ? (char *) 0 : cp, " \t,");
-			if (!nvar)
+			nvar = strtok ((0 != envc) ? (char *) 0 : cp, " \t,");
+			if (NULL == nvar) {
 				break;
-			if (strchr (nvar, '=')) {
+			}
+			if (strchr (nvar, '=') != NULL) {
 				envp[envc] = nvar;
 			} else {
 				envp[envc] = xmalloc (strlen (nvar) + 32);
@@ -163,3 +172,4 @@
 	signal (SIGTSTP, sigtstp);
 #endif
 }
+




More information about the Pkg-shadow-commits mailing list