replace strlens by breaks, fix comparison warnings.
[citadel.git] / citadel / utils / setup.c
index bb7f542dec09c2fe53248fba5d6f65df9b64386d..85288088cceaffa123718374f02cd3399945f334 100644 (file)
@@ -335,7 +335,7 @@ void important_message(const char *title, const char *msgtext)
                printf("       %s \n\n%s\n\n", title, msgtext);
                printf("%s", _("Press return to continue..."));
                if (fgets(buf, sizeof buf, stdin))
-                       ;
+               {;}
                break;
 
        case UI_DIALOG:
@@ -949,9 +949,10 @@ void fixnss(void) {
 
        while (fgets(buf, sizeof buf, fp_read) != NULL) {
                strcpy(buf_nc, buf);
-               for (i=0; i<strlen(buf_nc); ++i) {
+               for (i=0; buf_nc[i]; ++i) {
                        if (buf_nc[i] == '#') {
                                buf_nc[i] = 0;
+                               break;
                        }
                }
                for (i=0; i<strlen(buf_nc); ++i) {
@@ -969,7 +970,8 @@ void fixnss(void) {
                                }
                        }
                }
-               if (write(fd_write, buf, strlen(buf)) != strlen(buf)) {
+               long buflen = strlen(buf);
+               if (write(fd_write, buf, buflen) != buflen) {
                        fclose(fp_read);
                        close(fd_write);
                        unlink(new_filename);