tin  2.6.1
About: TIN is a threaded NNTP and spool based UseNet newsreader.
  Fossies Dox: tin-2.6.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

prompt.c
Go to the documentation of this file.
1/*
2 * Project : tin - a Usenet reader
3 * Module : prompt.c
4 * Author : I. Lea
5 * Created : 1991-04-01
6 * Updated : 2021-10-29
7 * Notes :
8 *
9 * Copyright (c) 1991-2022 Iain Lea <iain@bricbrac.de>
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 *
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 *
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * 3. Neither the name of the copyright holder nor the names of its
24 * contributors may be used to endorse or promote products derived from
25 * this software without specific prior written permission.
26 *
27 * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40
41#ifndef TIN_H
42# include "tin.h"
43#endif /* !TIN_H */
44#ifndef TCURSES_H
45# include "tcurses.h"
46#endif /* !TCURSES_H */
47
48
49static char *prompt_slk_message; /* prompt message for prompt_slk_redraw */
50static char *prompt_yn_message;
51static char *prompt_yn_choice;
52
53/*
54 * Local prototypes
55 */
56static int prompt_list(int row, int col, int var, constext *help_text, constext *prompt_text, constext *list[], int size);
57
58
59/*
60 * prompt_num
61 * get a number from the user
62 * Return -1 if missing or bad number typed
63 */
64int
66 int ch,
67 const char *prompt)
68{
69 char *p;
70 char tmp[LEN];
71 int num;
72
74 snprintf(tmp, sizeof(tmp), "%c", ch);
75 if ((p = tin_getline(prompt, 1, tmp, 0, FALSE, HIST_OTHER)) != NULL) {
76 STRCPY(tmp, p);
77 num = atoi(tmp);
78 } else
79 num = -1;
80
82 return num;
83}
84
85
86/*
87 * prompt_string
88 * get a string from the user
89 * Return TRUE if a valid string was typed, FALSE otherwise
90 * TODO: no bounds checking on buf size, tin_getline() defaults to 1024
91 */
94 const char *prompt,
95 char *buf,
96 int which_hist)
97{
98 return prompt_default_string(prompt, buf, 0, (char *) NULL, which_hist);
99}
100
101
102/*
103 * prompt_default_string
104 * get a string from the user, display default value
105 * Return TRUE if a valid string was typed, FALSE otherwise
106 */
107t_bool
109 const char *prompt,
110 char *buf,
111 int buf_len,
112 char *default_prompt,
113 int which_hist)
114{
115 char *p;
116
118 if ((p = tin_getline(prompt, 0, default_prompt, buf_len, FALSE, which_hist)) == NULL) {
119 buf[0] = '\0';
121 return FALSE;
122 }
123 strcpy(buf, p);
125 return TRUE;
126}
127
128
129/*
130 * prompt_menu_string
131 * get a string from the user
132 * Return TRUE if a valid string was typed, FALSE otherwise
133 */
134t_bool
136 int line,
137 const char *prompt,
138 char *var)
139{
140 char *p;
141
142 /*
143 * clear buffer - this is needed, otherwise a lost
144 * connection right before a resync_active() call
145 * would lead to a 'n' answer to the reconnect prompt
146 */
147 /* fflush(stdin); */
148 MoveCursor(line, 0);
149 if ((p = tin_getline(prompt, 0, var, 0, FALSE, HIST_OTHER)) == NULL)
150 return FALSE;
151
152 strcpy(var, p);
153 return TRUE;
154}
155
156
157/*
158 * prompt_yn
159 * prompt user for 'y'es or 'n'o decision. "prompt" will be displayed in the
160 * last line giving the default answer "default_answer".
161 * The function returns 1 if the user decided "yes", -1 if the user wanted
162 * to escape, or 0 for any other decision.
163 */
164int
166 const char *prompt,
167 t_bool default_answer)
168{
169 char *keyprompt;
170 char keyno[MAXKEYLEN], keyyes[MAXKEYLEN];
171 int keyyes_len, keyno_len, maxlen, prompt_len;
173#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
174 wint_t yes, no, prompt_ch, ch;
175#else
176 char yes, no, prompt_ch;
177 int ch;
178#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
179
180/* fflush(stdin); */ /* Prevent finger trouble from making important decisions */
181
182#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
183 yes = (wint_t) func_to_key(PROMPT_YES, prompt_keys);
184 no = (wint_t) func_to_key(PROMPT_NO, prompt_keys);
185
186 printascii(keyyes, (default_answer ? towupper(yes) : yes));
187 printascii(keyno, (!default_answer ? towupper(no) : no));
188#else
191
192 printascii(keyyes, (default_answer ? my_toupper(yes) : yes));
193 printascii(keyno, (!default_answer ? my_toupper(no) : no));
194#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
195
196 keyyes_len = strwidth(keyyes);
197 keyno_len = strwidth(keyno);
198 maxlen = MAX(keyyes_len, keyno_len);
199 prompt_len = keyyes_len + keyno_len + maxlen + 6;
201 prompt_yn_choice = my_malloc(prompt_len + 1);
202
204
205 do {
206 prompt_ch = (default_answer ? yes : no);
207 keyprompt = (default_answer ? keyyes : keyno);
208
209 snprintf(prompt_yn_choice, (size_t) prompt_len, " (%s/%s) %-*s", keyyes, keyno, maxlen, keyprompt);
211
212#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
213 if (((ch = ReadWch()) == '\n') || (ch == '\r'))
214#else
215 if (((ch = (char) ReadCh()) == '\n') || (ch == '\r'))
216#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
217 ch = prompt_ch;
218
219 switch (ch) {
220 case ESC: /* (ESC) common arrow keys */
221#ifdef HAVE_KEY_PREFIX
222 case KEY_PREFIX:
223#endif /* HAVE_KEY_PREFIX */
224 switch (get_arrow_key((int) ch)) {
225 case KEYMAP_UP:
226 case KEYMAP_DOWN:
227 default_answer = bool_not(default_answer);
228 ch = '\0'; /* set to a not bindable key to not leave the loop yet */
229 break;
230
231 case KEYMAP_LEFT:
232 ch = ESC;
233 break;
234
235 case KEYMAP_RIGHT:
236 ch = prompt_ch;
237 break;
238
239 default:
240 break;
241 }
242 break;
243
244 default:
245 break;
246 }
247 func = key_to_func((wchar_t) ch, prompt_keys);
248 } while (func == NOT_ASSIGNED);
249
253
254 if (!cmd_line) {
256 my_flush();
257 }
258 return (func == PROMPT_YES) ? 1 : (func == GLOBAL_ABORT) ? -1 : 0;
259}
260
261
262/*
263 * (Re)draws and resize the prompt message for prompt_yn()
264 */
265void
267 void)
268{
269 char *buf;
270 int choice_len = strwidth(prompt_yn_choice);
271 int message_len = strwidth(prompt_yn_message);
272
273 if (!cmd_line) {
274 MoveCursor(cLINES, 0);
275 CleartoEOLN();
276 }
277 if (message_len + choice_len > cCOLS - 1) {
278 buf = strunc(prompt_yn_message, cCOLS - choice_len - 1);
279 message_len = strwidth(buf);
281 free(buf);
282 } else
284
285 if (!cmd_line)
286 cursoron();
287 my_flush();
288 if (!cmd_line)
289 MoveCursor(cLINES, (message_len + choice_len) - 1);
290}
291
292
293/*
294 * help_text is displayed near the bottom of the screen.
295 * var is an index into a list containing size elements.
296 * The text from list is shown at row, col + len(prompt_text)
297 * Choice is incremented using the space bar, wrapping to 0
298 * ESC is used to abort any changes, RET saves changes.
299 * The new value is returned.
300 */
301static int
303 int row,
304 int col,
305 int var,
306 constext *help_text,
307 constext *prompt_text,
308 constext *list[],
309 int size)
310{
311 int ch, var_orig;
312 int i, offset, width = 0;
313 int change;
314 int adjust = (strcasecmp(_(list[0]), _(txt_default)) == 0);
315#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
316 char *buf;
317#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
318
319 var += adjust;
320 var_orig = var;
321
322 /*
323 * Find the length of longest printable text
324 */
325 for (i = 0; i < size; i++)
326 width = MAX(width, strwidth(_(list[i])));
327
328 show_menu_help(help_text);
329 cursoron();
330
331 offset = strwidth(_(prompt_text));
332
333 /*
334 * Make sure to not exceed cCOLS
335 */
336 if (offset + width >= cCOLS)
337 width = cCOLS - offset - 1;
338
339 do {
340 MoveCursor(row, col + offset);
341 ch = (char) ReadCh();
342
343 /*
344 * change:
345 * 1 = move to the next list element
346 * 0 = do nothing
347 * -1 = move to the previous list element
348 *
349 * if an arrow key was pressed change ch to another value
350 * otherwise we will exit the while loop
351 */
352 switch (ch) {
353 case ' ':
354 change = 1;
355 break;
356
357 case ESC: /* (ESC) common arrow keys */
358#ifdef HAVE_KEY_PREFIX
359 case KEY_PREFIX:
360#endif /* HAVE_KEY_PREFIX */
361 switch (get_arrow_key(ch)) {
362 case KEYMAP_UP:
363 change = -1;
364 ch = ' ';
365 break;
366
367 case KEYMAP_DOWN:
368 change = 1;
369 ch = ' ';
370 break;
371
372 default:
373 change = 0;
374 break;
375 }
376 break;
377
378 default:
379 change = 0;
380 break;
381 }
382
383 if (change) {
384 /*
385 * increment or decrement list, loop around at the limits
386 */
387 var += change;
388 if (var < 0)
389 var = size - 1;
390 else
391 var %= (size ? size : 1);
392
393#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
394 if ((buf = spart(_(list[var]), width, TRUE)) != NULL) {
395 my_printf("%s", buf);
396 free(buf);
397 } else
398#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
399 my_printf("%-*s", width, _(list[var]));
400 my_flush();
401 }
402 } while (ch != '\r' && ch != '\n' && ch != ESC);
403
404 if (ch == ESC) {
405 var = var_orig;
406#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
407 if ((buf = spart(_(list[var]), width, TRUE)) != NULL) {
408 my_printf("%s", buf);
409 free(buf);
410 } else
411#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
412 my_printf("%-*s", width, _(list[var]));
413 my_flush();
414 }
415
416 cursoroff();
417 return (var - adjust);
418}
419
420
421/*
422 * Special case of prompt_option_list() Toggle between ON and OFF
423 * The function returns TRUE, if the value was changed, FALSE otherwise.
424 */
425t_bool
427 enum option_enum option)
428{
429 char prompt[LEN];
430 t_bool *variable = OPT_ON_OFF_list[option_table[option].var_index];
431 t_bool old_value = *variable;
432
433 fmt_option_prompt(prompt, sizeof(prompt), TRUE, option);
434 *variable = prompt_list(option_row(option), 0, (int) *variable, option_table[option].txt->help, prompt, txt_onoff, 2) ? TRUE : FALSE;
435 return bool_not(bool_equal(*variable, old_value));
436}
437
438
439/*
440 * The function returns TRUE, if the value was changed, FALSE otherwise.
441 */
442t_bool
444 enum option_enum option)
445{
446 char prompt[LEN];
447 int *variable = option_table[option].variable;
448 int old_value = *variable;
449 int opt_count = 0;
450
451 while (option_table[option].opt_list[opt_count] != NULL)
452 ++opt_count;
453 fmt_option_prompt(prompt, sizeof(prompt), TRUE, option);
454 *variable = prompt_list(option_row(option), 0, *variable, option_table[option].txt->help, prompt, option_table[option].opt_list, opt_count);
455 return *variable != old_value;
456}
457
458
459/*
460 * Displays option text and actual option value for string based options in
461 * one line, help text for that option near the bottom of the screen. Allows
462 * change of the old value by normal editing; history function of tin_getline()
463 * will be used properly so that editing won't leave the actual line.
464 *
465 * The function returns TRUE, if the value was changed, FALSE otherwise.
466 */
467t_bool
469 enum option_enum option) /* return value is always ignored */
470{
471 char *variable = OPT_STRING_list[option_table[option].var_index];
472 char prompt[LEN];
473 char old_value[LEN];
474
475 STRCPY(old_value, variable);
476 show_menu_help(option_table[option].txt->help);
477 fmt_option_prompt(prompt, sizeof(prompt) - 1, TRUE, option);
478 if (prompt_menu_string(option_row(option), prompt, variable))
479 return strcmp(old_value, variable) ? TRUE : FALSE;
480 else
481 return FALSE;
482}
483
484
485/*
486 * Displays option text and current option value for number based options in
487 * one line, help text for that option near the bottom of the screen. Allows
488 * change of the old value by normal editing; history function of tin_getline()
489 * will be used properly so that editing won't leave the current line.
490 *
491 * The function returns TRUE if the value was changed, FALSE otherwise.
492 */
493t_bool
495 enum option_enum option) /* return value is always ignored */
496{
497 char prompt[LEN];
498 char number[LEN];
499 char *p;
500 int num;
501
502 show_menu_help(option_table[option].txt->help);
503 MoveCursor(option_row(option), 0);
504 fmt_option_prompt(prompt, sizeof(prompt) - 1, TRUE, option);
505 snprintf(&number[0], sizeof(number), "%d", *(option_table[option].variable));
506
507 if ((p = tin_getline(prompt, 2, number, 0, FALSE, HIST_OTHER)) == NULL)
508 return FALSE;
509
510 STRCPY(number, p);
511 num = atoi(number);
512 *(option_table[option].variable) = num;
514 return TRUE;
515}
516
517
518/*
519 * Displays option text and actual option value for character based options
520 * in one line, help text for that option near the bottom of the screen.
521 * Allows change of the old value by normal editing.
522 *
523 * The function returns TRUE if the value was changed, FALSE otherwise.
524 */
525t_bool
527 enum option_enum option) /* return value is always ignored */
528{
529 char prompt[LEN];
530#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
531 wchar_t input[2];
532 wchar_t *variable = OPT_CHAR_list[option_table[option].var_index];
533 int max_chars = (int) sizeof(wchar_t) + 1;
534 wchar_t *wp;
535 char *p;
536 char *curr_val;
537#else
538 char input[2];
539 char *variable = OPT_CHAR_list[option_table[option].var_index];
540 char *p;
541 char *curr_val = &input[0];
542 int max_chars = 1;
543#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
544
545 input[0] = *variable;
546 input[1] = '\0';
547
548#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
549 if ((curr_val = wchar_t2char(input))) {
550#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
551
552 do {
553 show_menu_help(option_table[option].txt->help);
554 MoveCursor(option_row(option), 0);
555 fmt_option_prompt(prompt, sizeof(prompt) - 1, TRUE, option);
556
557 if ((p = tin_getline(prompt, 0, curr_val, max_chars, FALSE, HIST_OTHER)) == NULL) {
559 return FALSE;
560 }
561 if (!*p)
563 } while (!*p);
564
565#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
566 if ((wp = char2wchar_t(p))) {
567 *variable = wp[0];
568 free(wp);
569 }
570 free(curr_val);
571 }
572#else
573 *variable = p[0];
574#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
575
577 return TRUE;
578}
579
580
581/*
582 * Get a string. Make it the new default.
583 * If none given, use the default.
584 * Return the string or NULL if we can't get anything useful
585 */
586char *
588 const char *prompt,
589 char *def,
590 const char *failtext,
591 int history)
592{
593 char pattern[LEN];
594
596
597 if (!prompt_string(prompt, pattern, history)) {
599 return NULL;
600 }
601
602 if (pattern[0] != '\0') /* got a string - make it the default */
603 my_strncpy(def, pattern, LEN);
604 else {
605 if (def[0] == '\0') { /* no default - give up */
606 error_message(2, "%s", failtext);
607 return NULL;
608 }
609 }
610
611 return def; /* use the default */
612}
613
614
615/*
616 * Get a message ID for the 'L' command. Add <> if needed
617 * If the msgid exists and is reachable, return its index
618 * in arts[], else ART_UNAVAILABLE
619 */
620int
622 void)
623{
624 char buf[LEN];
625
627 char *ptr = str_trim(buf + 1);
628 struct t_msgid *msgid;
629
630 /*
631 * If the user failed to supply Message-ID in <>, add them
632 */
633 if (buf[1] != '<') {
634 buf[0] = '<';
635 strcat(buf, ">");
636 ptr = buf;
637 }
638
639 if ((msgid = find_msgid(ptr)) == NULL) {
641 return ART_UNAVAILABLE;
642 }
643
644 /*
645 * Is it expired or otherwise not on the spool ?
646 */
647 if (msgid->article == ART_UNAVAILABLE) {
649 return ART_UNAVAILABLE;
650 }
651
652 /*
653 * If the article is no longer part of a thread, then there is
654 * no way to display it
655 */
656 if (which_thread(msgid->article) == -1) {
658 return ART_UNAVAILABLE;
659 }
660
661 return msgid->article;
662 }
663
664 return ART_UNAVAILABLE;
665}
666
667
668/*
669 * Format a message such that it'll fit within the screen width
670 * Useful for fitting long Subjects and newsgroup names into prompts
671 * result will contain a pointer to the malloced memory containing the
672 * sized message
673 */
674char *
676 char **result,
677 const char *format,
678 const char *subject)
679{
680 char *buf;
681 int max_len;
682
683 max_len = cCOLS - strwidth(format) + 2 - 1; /* The formatting info (%s) wastes 2 chars, but our prompt needs 1 char */
684
685 buf = strunc(subject, max_len);
686
687 *result = fmt_string(format, buf);
688 free(buf);
689
690 return *result;
691}
692
693
694/*
695 * Implement the Single-Letter-Key mini menus at the bottom of the screen
696 * eg, Press a)ppend, o)verwrite, q)uit :
697 */
700 t_function default_func,
701 const struct keylist keys,
702 const char *fmt,
703 ...)
704{
705 va_list ap;
706 char buf[LEN];
708#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
709 wchar_t ch;
710#else
711 char ch;
712#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
713
714 va_start(ap, fmt);
715 vsnprintf(buf, sizeof(buf), fmt, ap);
716 va_end(ap);
717
718 prompt_slk_message = my_malloc(strlen(buf) + 2);
719#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
720 {
721 char *tmp;
722 wchar_t wtmp[2] = { '\0', '\0' };
723
724 wtmp[0] = func_to_key(default_func, keys);
725 tmp = wchar_t2char(wtmp);
726 snprintf(prompt_slk_message, strlen(buf) + 2, "%s%s", buf, tmp);
727 FreeIfNeeded(tmp);
728 }
729#else
730 snprintf(prompt_slk_message, strlen(buf) + 2, "%s%c", buf, func_to_key(default_func, keys));
731#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
732
734
735 do {
736 prompt_slk_redraw(); /* draw the prompt */
737
738#if defined(MULTIBYTE_ABLE) && !defined(NO_LOCALE)
739 if ((ch = (wchar_t) ReadWch()) == '\r' || ch == '\n')
740#else
741 if ((ch = ReadCh()) == '\r' || ch == '\n')
742#endif /* MULTIBYTE_ABLE && !NO_LOCALE */
743 func = default_func;
744 else
745 func = key_to_func(ch, keys);
746
747#if 1
748 /*
749 * ignore special-keys which are represented as a multibyte ESC-seq
750 * to avoid interpreting them as 'ESC' only
751 */
752 if (ch == ESC) {
753 switch (get_arrow_key(ch)) {
754 case KEYMAP_UP:
755 case KEYMAP_DOWN:
756 case KEYMAP_LEFT:
757 case KEYMAP_RIGHT:
758 case KEYMAP_PAGE_DOWN:
759 case KEYMAP_PAGE_UP:
760 case KEYMAP_HOME:
761 case KEYMAP_END:
762 ch = '\0';
764 break;
765
766 default:
767 break;
768 }
769 }
770#endif /* 1 */
771 } while (func == NOT_ASSIGNED);
772
775
777 return func;
778}
779
780
781/* (Re)draws the prompt message for prompt_slk_response() */
782void
784 void)
785{
786 int column;
787
789
790 /* get the cursor _just_ right */
791 column = strwidth(prompt_slk_message) - 1;
792 MoveCursor(cLINES, column);
793}
794
795
796/*
797 * Wait until a key is pressed. We specify the <RETURN> key otherwise
798 * pedants will point out that:
799 * i) There is no 'any' key on a keyboard
800 * ii) CTRL, SHIFT etc don't work
801 */
802void
804 void)
805{
806 int ch;
807 int save_signal_context = signal_context;
808
809 cmd_line = TRUE;
813
814 switch ((ch = ReadCh())) {
815 case ESC:
816#ifdef HAVE_KEY_PREFIX
817 case KEY_PREFIX:
818#endif /* HAVE_KEY_PREFIX */
819 (void) get_arrow_key(ch);
820 /* FALLTHROUGH */
821
822 default:
823 break;
824 }
825
827 signal_context = save_signal_context;
828
829#ifdef USE_CURSES
830 my_fputc('\n', stdout);
831#endif /* USE_CURSES */
832 cmd_line = FALSE;
833#ifdef USE_CURSES
834 my_retouch();
835#endif /* USE_CURSES */
836}
#define bool_equal(a, b)
Definition: bool.h:82
unsigned t_bool
Definition: bool.h:77
#define bool_not(b)
Definition: bool.h:81
#define TRUE
Definition: bool.h:74
#define FALSE
Definition: bool.h:70
@ HIST_OTHER
Definition: extern.h:1558
@ HIST_MESSAGE_ID
Definition: extern.h:1564
constext txt_info_enter_valid_character[]
Definition: lang.c:552
int input_context
Definition: signal.c:106
struct t_option option_table[]
t_bool * OPT_ON_OFF_list[]
constext * txt_onoff[]
Definition: lang.c:1270
t_bool cmd_line
Definition: init.c:129
constext txt_art_unavailable[]
Definition: lang.c:69
constext txt_no_last_message[]
Definition: lang.c:686
int signal_context
Definition: signal.c:105
int cCOLS
Definition: curses.c:53
int cLINES
Definition: curses.c:52
constext txt_return_key[]
Definition: lang.c:799
char * OPT_CHAR_list[]
constext txt_enter_message_id[]
Definition: lang.c:175
constext txt_default[]
Definition: lang.c:161
char * OPT_STRING_list[]
#define MAXKEYLEN
Definition: keymap.h:136
t_function key_to_func(const char key, const struct keylist keys)
Definition: keymap.c:98
struct keylist prompt_keys
Definition: keymap.c:86
#define ESC
Definition: keymap.h:140
char * printascii(char *buf, int ch)
Definition: keymap.c:273
@ PROMPT_YES
Definition: keymap.h:332
@ PROMPT_NO
Definition: keymap.h:331
@ NOT_ASSIGNED
Definition: keymap.h:149
@ GLOBAL_ABORT
Definition: keymap.h:186
char func_to_key(t_function func, const struct keylist keys)
Definition: keymap.c:125
enum defined_functions t_function
Definition: keymap.h:375
static char buf[16]
Definition: langinfo.c:50
void prompt_continue(void)
Definition: prompt.c:803
t_function prompt_slk_response(t_function default_func, const struct keylist keys, const char *fmt,...)
Definition: prompt.c:699
char * prompt_string_default(const char *prompt, char *def, const char *failtext, int history)
Definition: prompt.c:587
t_bool prompt_option_num(enum option_enum option)
Definition: prompt.c:494
t_bool prompt_string(const char *prompt, char *buf, int which_hist)
Definition: prompt.c:93
static char * prompt_yn_message
Definition: prompt.c:50
int prompt_msgid(void)
Definition: prompt.c:621
t_bool prompt_option_char(enum option_enum option)
Definition: prompt.c:526
static char * prompt_slk_message
Definition: prompt.c:49
t_bool prompt_menu_string(int line, const char *prompt, char *var)
Definition: prompt.c:135
void prompt_slk_redraw(void)
Definition: prompt.c:783
t_bool prompt_default_string(const char *prompt, char *buf, int buf_len, char *default_prompt, int which_hist)
Definition: prompt.c:108
t_bool prompt_option_list(enum option_enum option)
Definition: prompt.c:443
t_bool prompt_option_on_off(enum option_enum option)
Definition: prompt.c:426
static int prompt_list(int row, int col, int var, constext *help_text, constext *prompt_text, constext *list[], int size)
Definition: prompt.c:302
char * sized_message(char **result, const char *format, const char *subject)
Definition: prompt.c:675
int prompt_num(int ch, const char *prompt)
Definition: prompt.c:65
void prompt_yn_redraw(void)
Definition: prompt.c:266
int prompt_yn(const char *prompt, t_bool default_answer)
Definition: prompt.c:165
t_bool prompt_option_string(enum option_enum option)
Definition: prompt.c:468
static char * prompt_yn_choice
Definition: prompt.c:51
struct t_msgid * find_msgid(const char *msgid)
Definition: refs.c:351
int ReadCh(void)
Definition: curses.c:1110
char * str_trim(char *string)
Definition: string.c:539
int atoi(const char *s)
char * tin_getline(const char *prompt, int number_only, const char *str, int max_chars, t_bool passwd, int which_hist)
Definition: getline.c:85
void error_message(unsigned int sdelay, const char *fmt,...)
Definition: screen.c:224
void cursoroff(void)
Definition: curses.c:721
void info_message(const char *fmt,...)
Definition: screen.c:102
char * my_strdup(const char *str)
Definition: string.c:139
void MoveCursor(int row, int col)
Definition: curses.c:441
void clear_message(void)
Definition: screen.c:283
char * fmt_option_prompt(char *dst, size_t len, t_bool editing, enum option_enum option)
Definition: options_menu.c:402
int which_thread(int n)
Definition: thread.c:1073
int strwidth(const char *str)
Definition: string.c:1050
void cursoron(void)
Definition: curses.c:712
void show_menu_help(const char *help_message)
Definition: options_menu.c:833
int my_toupper(int)
Definition: string.c:276
void wait_message(unsigned int sdelay, const char *fmt,...)
Definition: screen.c:133
void my_strncpy(char *p, const char *q, size_t n)
Definition: string.c:196
int option_row(enum option_enum option)
Definition: options_menu.c:149
int strcasecmp(const char *p, const char *q)
Definition: string.c:475
char * strunc(const char *message, int len)
Definition: string.c:1076
void CleartoEOLN(void)
Definition: curses.c:458
char * fmt_string(const char *fmt,...)
Definition: string.c:1386
int get_arrow_key(int prech)
Definition: curses.c:961
static int offset
Definition: read.c:62
void(* func)(SIG_ARGS)
Definition: signal.c:176
Definition: tin.h:1509
int article
Definition: tin.h:1514
int var_index
Definition: tin.h:2034
constext ** opt_list
Definition: tin.h:2036
int * variable
Definition: tin.h:2035
#define my_flush()
Definition: tcurses.h:177
#define my_retouch()
Definition: tcurses.h:179
#define my_printf
Definition: tcurses.h:175
#define my_fputc(ch, stream)
Definition: tcurses.h:158
#define vsnprintf
Definition: tin.h:2467
@ cPromptYN
Definition: tin.h:108
@ cNone
Definition: tin.h:108
@ cPromptCONT
Definition: tin.h:108
@ cPromptSLK
Definition: tin.h:108
#define LEN
Definition: tin.h:860
#define KEYMAP_END
Definition: tin.h:1084
#define KEYMAP_RIGHT
Definition: tin.h:1080
@ cMain
Definition: tin.h:107
#define STRCPY(dst, src)
Definition: tin.h:820
#define KEYMAP_UP
Definition: tin.h:1077
#define KEYMAP_LEFT
Definition: tin.h:1079
#define my_malloc(size)
Definition: tin.h:2245
#define KEYMAP_PAGE_DOWN
Definition: tin.h:1082
#define KEYMAP_PAGE_UP
Definition: tin.h:1081
#define FreeIfNeeded(p)
Definition: tin.h:2252
#define _(Text)
Definition: tin.h:94
#define snprintf
Definition: tin.h:2464
#define FreeAndNull(p)
Definition: tin.h:2253
const char constext
Definition: tin.h:2018
#define KEYMAP_DOWN
Definition: tin.h:1078
#define ART_UNAVAILABLE
Definition: tin.h:1348
#define KEYMAP_HOME
Definition: tin.h:1083
#define MAX(a, b)
Definition: tin.h:808