commit 7799db8d23636a4d4b4b2a359aed49e637916112
parent 762492cc57647fa41c44131beb39f7f050935d36
Author: Claudio Alessi <smoppy@gmail.com>
Date: Wed, 13 Apr 2016 20:15:07 +0200
Rename ui_start() to ui_init() (and move it).
stfl_run() now have a timeout of -3.
Diffstat:
M | myadm.c | | | 23 | ++++++++++++----------- |
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/myadm.c b/myadm.c
@@ -108,6 +108,7 @@ void sigint_handler(int unused);
int stripesc(char *src, char *dst, int len);
void ui_end(void);
struct stfl_form *ui_getform(wchar_t *code);
+void ui_init(void);
void ui_modify(const char *name, const char *mode, const char *fmtstr, ...);
void ui_listview(Item *items, Field *fields);
void ui_putitem(Item *item, int *lens);
@@ -115,7 +116,6 @@ void ui_refresh(void);
void ui_set(const char *key, const char *fmtstr, ...);
void ui_showfields(Field *fds, int *lens);
void ui_showitems(Item *items, int *lens);
-void ui_start(void);
void usage(void);
void viewdb(const Arg *arg);
void viewdb_show(void);
@@ -554,7 +554,7 @@ setup(void) {
sigemptyset(&sa.sa_mask);
sa.sa_handler = sigint_handler;
sigaction(SIGINT, &sa, NULL);
- ui_start();
+ ui_init();
viewdblist(NULL);
}
@@ -590,6 +590,16 @@ ui_getform(wchar_t *code) {
}
void
+ui_init(void) {
+ struct stfl_form *f = ui_getform(L"label");
+
+ stfl_run(f, -3); /* init ncurses */
+ stfl_free(f);
+ nl();
+ ipool = stfl_ipool_create(nl_langinfo(CODESET));
+}
+
+void
ui_modify(const char *name, const char *mode, const char *fmtstr, ...) {
va_list ap;
char txt[256];
@@ -655,15 +665,6 @@ ui_set(const char *key, const char *fmtstr, ...) {
}
void
-ui_start(void) {
- struct stfl_form *f = ui_getform(L"label");
- stfl_run(f, -1);
- stfl_free(f);
- nl();
- ipool = stfl_ipool_create(nl_langinfo(CODESET));
-}
-
-void
usage(void) {
die("Usage: %s [-vhup <arg>]\n", argv0);
}