commit 52d3b5c

default  ·  2023-07-26 04:40:23 +0000 UTC
parent ede2a38
Call fflush() after admin prompts without newlines.
1 files changed,  +7, -7
+7, -7
 1@@ -87,7 +87,7 @@ int snac_init(const char *basedir)
 2     FILE *f;
 3 
 4     if (basedir == NULL) {
 5-        printf("Base directory: ");
 6+        printf("Base directory: "); fflush(stdout);
 7         srv_basedir = xs_strip_i(xs_readline(stdin));
 8     }
 9     else
10@@ -109,14 +109,14 @@ int snac_init(const char *basedir)
11     xs *layout = xs_number_new(disk_layout);
12     srv_config = xs_dict_set(srv_config, "layout", layout);
13 
14-    printf("Network address [%s]: ", xs_dict_get(srv_config, "address"));
15+    printf("Network address [%s]: ", xs_dict_get(srv_config, "address")); fflush(stdout);
16     {
17         xs *i = xs_strip_i(xs_readline(stdin));
18         if (*i)
19             srv_config = xs_dict_set(srv_config, "address", i);
20     }
21 
22-    printf("Network port [%d]: ", (int)xs_number_get(xs_dict_get(srv_config, "port")));
23+    printf("Network port [%d]: ", (int)xs_number_get(xs_dict_get(srv_config, "port"))); fflush(stdout);
24     {
25         xs *i = xs_strip_i(xs_readline(stdin));
26         if (*i) {
27@@ -125,7 +125,7 @@ int snac_init(const char *basedir)
28         }
29     }
30 
31-    printf("Host name: ");
32+    printf("Host name: "); fflush(stdout);
33     {
34         xs *i = xs_strip_i(xs_readline(stdin));
35         if (*i == '\0')
36@@ -134,7 +134,7 @@ int snac_init(const char *basedir)
37         srv_config = xs_dict_set(srv_config, "host", i);
38     }
39 
40-    printf("URL prefix: ");
41+    printf("URL prefix: "); fflush(stdout);
42     {
43         xs *i = xs_strip_i(xs_readline(stdin));
44 
45@@ -146,7 +146,7 @@ int snac_init(const char *basedir)
46         }
47     }
48 
49-    printf("Admin email address (optional): ");
50+    printf("Admin email address (optional): "); fflush(stdout);
51     {
52         xs *i = xs_strip_i(xs_readline(stdin));
53 
54@@ -227,7 +227,7 @@ int adduser(const char *uid)
55     FILE *f;
56 
57     if (uid == NULL) {
58-        printf("Username: ");
59+        printf("Username: "); fflush(stdout);
60         uid = xs_strip_i(xs_readline(stdin));
61     }
62