+2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
+
+ * libmisc/ttytype.c: Avoid implicit conversion of pointers /
+ integers to booleans.
+ * libmisc/ttytype.c: Avoid assignments in comparisons.
+ * libmisc/ttytype.c: Add brackets and parenthesis.
+ * libmisc/ttytype.c: The return values of fclose is not checked on
+ purpose.
+
2008-05-26 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/mail.c: Avoid implicit conversion of pointers to
return;
if ((typefile = getdef_str ("TTYTYPE_FILE")) == NULL)
return;
- if (access (typefile, F_OK))
+ if (access (typefile, F_OK) != 0)
return;
- if (!(fp = fopen (typefile, "r"))) {
+ fp = fopen (typefile, "r");
+ if (NULL == fp) {
perror (typefile);
return;
}
- while (fgets (buf, sizeof buf, fp)) {
- if (buf[0] == '#')
+ while (fgets (buf, sizeof buf, fp) == buf) {
+ if (buf[0] == '#') {
continue;
+ }
- if ((cp = strchr (buf, '\n')))
+ cp = strchr (buf, '\n');
+ if (NULL != cp) {
*cp = '\0';
+ }
- if (sscanf (buf, "%s %s", type, port) == 2 &&
- strcmp (line, port) == 0)
+ if ((sscanf (buf, "%s %s", type, port) == 2) &&
+ (strcmp (line, port) == 0)) {
break;
+ }
}
- if (!feof (fp) && !ferror (fp))
+ if ((feof (fp) == 0) && (ferror (fp) == 0)) {
addenv ("TERM", type);
+ }
- fclose (fp);
+ (void) fclose (fp);
}
+