diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2018-02-23 11:47:11 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2018-02-23 11:47:11 -0800 |
commit | 32abf6aa80d92576db59b5380b30dabe4152bdf0 (patch) | |
tree | 21fb6c98b0d3c3dd57664a1e3772dc886bf458d5 /src | |
parent | dde6c5e93e26f6706cd04745928ae9ad5dddfc9f (diff) |
util: drop stdio ask_$type() helpers
With drmsetup.c gone these are no longer used and I don't see
their use returning. Get rid of them.
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 37 | ||||
-rw-r--r-- | src/util.h | 2 |
2 files changed, 0 insertions, 39 deletions
@@ -21,40 +21,3 @@ unsigned get_ncpus(void) return n == 0 ? 1 : n; } - - -static void query(const char *prompt, const char *def, char *buf, int len) -{ - buf[0] = '\0'; - - printf("%s [%s]: ", prompt, def); - fflush(stdout); - - fgets(buf, len, stdin); - if (buf[0] == '\0' || buf[0] == '\n') { - snprintf(buf, len, "%s", def); - } else if(strchr(buf, '\n')) { - *strchr(buf, '\n') = '\0'; - } -} - - -void ask_string(char *buf, int len, const char *prompt, const char *def) -{ - query(prompt, def, buf, len); -} - - -void ask_num(int *res, int max, const char *prompt, int def) -{ - char buf[21], buf2[256]; - int num; - - snprintf(buf, sizeof(buf), "%i", def); - do { - query(prompt, buf, buf2, sizeof(buf2)); - num = atoi(buf2); /* TODO: errors (strtol)*/ - } while (num > max); - - *res = num; -} @@ -28,7 +28,5 @@ ((_a) > (_b) ? (_a) : (_b)) unsigned get_ncpus(void); -void ask_string(char *buf, int len, const char *prompt, const char *def); -void ask_num(int *res, int max, const char *prompt, int def); #endif /* _UTIL_H */ |