1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
grobian@gentoo.org
auto-flush on stdio is really a glibc feature AFAICT, so in order for
musl to get prompts (and make the tool more bearable) just flush right
after writing half a line
--- mac-fdisk-0.1.orig/io.c 2022-06-01 19:37:08.000000000 +0200
+++ mac-fdisk-0.1.orig/io.c 2022-06-01 20:32:12.000000000 +0200
@@ -151,7 +151,8 @@
int c;
flush_to_newline(0);
- printf(prompt);
+ printf("%s", prompt);
+ fflush(NULL);
for (;;) {
c = getch();
@@ -169,7 +170,8 @@
return 0;
} else {
flush_to_newline(0);
- printf(prompt);
+ printf("%s", prompt);
+ fflush(NULL);
}
}
return -1;
@@ -182,7 +184,8 @@
int c;
if (promptBeforeGet) {
- printf(prompt);
+ printf("%s", prompt);
+ fflush(NULL);
}
for (;;) {
c = getch();
@@ -192,7 +195,8 @@
} else if (c == ' ' || c == '\t') {
// skip blanks and tabs
} else if (c == '\n') {
- printf(prompt);
+ printf("%s", prompt);
+ fflush(NULL);
} else {
*command = c;
return 1;
@@ -217,7 +220,8 @@
// skip blanks and tabs
} else if (c == '\n') {
if (default_value < 0) {
- printf(prompt);
+ printf("%s", prompt);
+ fflush(NULL);
} else {
ungetch(c);
*number = default_value;
@@ -295,7 +307,8 @@
// skip blanks and tabs
} else if (c == '\n') {
if (reprompt) {
- printf(prompt);
+ printf("%s", prompt);
+ fflush(NULL);
} else {
ungetch(c);
*string = NULL;
|