gwenhywfar  5.4.1
cgui.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Tue Oct 02 2002
3  copyright : (C) 2002-2017 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * *
8  * This library is free software; you can redistribute it and/or *
9  * modify it under the terms of the GNU Lesser General Public *
10  * License as published by the Free Software Foundation; either *
11  * version 2.1 of the License, or (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16  * Lesser General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Lesser General Public *
19  * License along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  * *
23  ***************************************************************************/
24 
25 
26 #ifdef HAVE_CONFIG_H
27 # include <config.h>
28 #endif
29 
30 #define DISABLE_DEBUGLOG
31 
32 
33 #include "cgui_p.h"
34 #include "i18n_l.h"
35 
36 #include <gwenhywfar/gui_be.h>
37 #include <gwenhywfar/inherit.h>
38 #include <gwenhywfar/debug.h>
39 #include <gwenhywfar/misc.h>
40 #include <gwenhywfar/db.h>
41 #include <gwenhywfar/gwentime.h>
42 #include <gwenhywfar/mdigest.h>
43 #include <gwenhywfar/text.h>
44 
45 
46 #include <stdlib.h>
47 #include <string.h>
48 #include <ctype.h>
49 #ifdef HAVE_TERMIOS_H
50 # include <termios.h>
51 #endif
52 #include <unistd.h>
53 #include <fcntl.h>
54 #include <stdio.h>
55 #include <errno.h>
56 
57 #ifdef HAVE_SIGNAL_H
58 # include <signal.h>
59 #endif
60 #ifdef HAVE_ICONV_H
61 # include <iconv.h>
62 #endif
63 #ifndef ICONV_CONST
64 # define ICONV_CONST
65 #endif
66 
67 
68 
69 GWEN_INHERIT(GWEN_GUI, GWEN_GUI_CGUI)
70 
71 
72 
73 
75 {
76  GWEN_GUI *gui;
77  GWEN_GUI_CGUI *cgui;
78 
79  gui=GWEN_Gui_new();
80  GWEN_NEW_OBJECT(GWEN_GUI_CGUI, cgui);
81  cgui->progressList=GWEN_Gui_CProgress_List_new();
82  GWEN_INHERIT_SETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui, cgui,
84 
94 
95  return gui;
96 }
97 
98 
99 
101 {
102  GWEN_GUI_CGUI *cgui;
103 
104  cgui=(GWEN_GUI_CGUI *)p;
105  GWEN_Gui_CProgress_List_free(cgui->progressList);
106  GWEN_FREE_OBJECT(cgui);
107 }
108 
109 
110 
112 {
113  int chr;
114 #ifdef HAVE_TERMIOS_H
115  struct termios OldAttr, NewAttr;
116  int AttrChanged = 0;
117 #endif
118 #if HAVE_DECL_SIGPROCMASK
119  sigset_t snew, sold;
120 #endif
121 
122  // disable canonical mode to receive a single character
123 #if HAVE_DECL_SIGPROCMASK
124  sigemptyset(&snew);
125  sigaddset(&snew, SIGINT);
126  sigaddset(&snew, SIGSTOP);
127  sigprocmask(SIG_BLOCK, &snew, &sold);
128 #endif
129 #ifdef HAVE_TERMIOS_H
130  if (0 == tcgetattr(fileno(stdin), &OldAttr)) {
131  NewAttr = OldAttr;
132  NewAttr.c_lflag &= ~ICANON;
133  NewAttr.c_lflag &= ~ECHO;
134  tcsetattr(fileno(stdin), TCSAFLUSH, &NewAttr);
135  AttrChanged = !0;
136  }
137 #endif
138 
139  for (;;) {
140  chr=getchar();
141  if (waitFor) {
142  if (chr==-1 ||
143  chr==GWEN_GUI_CGUI_CHAR_ABORT ||
144  chr==GWEN_GUI_CGUI_CHAR_ENTER ||
145  chr==waitFor)
146  break;
147  }
148  else
149  break;
150  }
151 
152 #ifdef HAVE_TERMIOS_H
153  /* re-enable canonical mode (if previously disabled) */
154  if (AttrChanged)
155  tcsetattr(fileno(stdin), TCSADRAIN, &OldAttr);
156 #endif
157 
158 #if HAVE_DECL_SIGPROCMASK
159  sigprocmask(SIG_BLOCK, &sold, 0);
160 #endif
161 
162  return chr;
163 }
164 
165 
166 
168  uint32_t flags,
169  char *buffer,
170  int minLen,
171  int maxLen,
172  uint32_t guiid)
173 {
174 #ifdef HAVE_TERMIOS_H
175  struct termios OldInAttr, NewInAttr;
176  struct termios OldOutAttr, NewOutAttr;
177  int AttrInChanged = 0;
178  int AttrOutChanged = 0;
179 #endif
180  int chr;
181  unsigned int pos;
182  char *pOutbuf;
183  int rv;
184 #if HAVE_DECL_SIGPROCMASK
185  sigset_t snew, sold;
186 #endif
187 #ifdef HAVE_ICONV
188 #define INBUFSIZE 6
189  char inbuf[INBUFSIZE];
190  iconv_t ic;
191  size_t inLeft;
192  size_t outLeft;
193  size_t done;
194  ICONV_CONST char *pInbuf;
195  char *nextchr;
196 
197  nextchr=(char *)GWEN_Gui_GetCharSet(gui);
198  if (!nextchr)
199  nextchr="UTF-8";
200  ic=iconv_open("UTF-8", nextchr);
201  if (ic==(iconv_t)-1) {
202  DBG_ERROR(GWEN_LOGDOMAIN, "Cannot convert from \"%s\" to \"UTF-8\", %s",
203  nextchr, strerror(errno));
204  return GWEN_ERROR_GENERIC;
205  }
206 
207  pInbuf=inbuf;
208  outLeft=maxLen;
209 #endif
210 
211  /* if possible, disable echo from stdin to stdout during password
212  * entry */
213 #if HAVE_DECL_SIGPROCMASK
214  sigemptyset(&snew);
215  sigaddset(&snew, SIGINT);
216  sigaddset(&snew, SIGSTOP);
217  sigprocmask(SIG_BLOCK, &snew, &sold);
218 #endif
219 
220 #ifdef HAVE_TERMIOS_H
221  if (0 == tcgetattr(fileno(stdin), &OldInAttr)) {
222  NewInAttr = OldInAttr;
223  NewInAttr.c_lflag &= ~ECHO;
224  NewInAttr.c_lflag &= ~ICANON;
225  tcsetattr(fileno(stdin), TCSAFLUSH, &NewInAttr);
226  AttrInChanged = !0;
227  }
228  if (0 == tcgetattr(fileno(stdout), &OldOutAttr)) {
229  NewOutAttr = OldOutAttr;
230  NewOutAttr.c_lflag &= ~ICANON;
231  tcsetattr(fileno(stdout), TCSAFLUSH, &NewOutAttr);
232  AttrOutChanged = !0;
233  }
234 #endif
235 
236  pos=0;
237  pOutbuf=buffer;
238  for (;;) {
239 #ifdef HAVE_ICONV
240  nextchr=inbuf;
241  pInbuf=inbuf;
242  inLeft=0;
243  outLeft=maxLen-pos;
244  do {
245  chr=getchar();
246  if (chr==EOF)
247  break;
248  *nextchr++=chr;
249  inLeft++;
250  done=iconv(ic, &pInbuf, &inLeft, &pOutbuf, &outLeft);
251  }
252  while (done==(size_t)-1 && errno==EINVAL &&
253  nextchr-inbuf<INBUFSIZE);
254 
255  if (chr==EOF) {
256  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
258  break;
259  }
260  else if (done==(size_t)-1) {
261  if (errno==E2BIG || errno==EILSEQ) {
262  GWEN_Gui_StdPrintf(gui, stdout, "\007");
263  continue;
264  }
265  DBG_ERROR(GWEN_LOGDOMAIN, "Unrecoverable error in conversion: %s",
266  strerror(errno));
268  break;
269  }
270 #else /* HAVE_ICONV */
271  chr=getchar();
272  if (chr!=EOF)
273  *pOutbuf++=chr;
274  else {
275  DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected EOF while reading from stdin");
277  break;
278  }
279 #endif /* HAVE_ICONV */
280 
281  if (chr==GWEN_GUI_CGUI_CHAR_DELETE) {
282  if (pos) {
283  /* Look for the start of the previous UTF-8 character */
284  do
285  pos--;
286  while ((buffer[pos]&0xC0)==0x80 && pos);
287  GWEN_Gui_StdPrintf(gui, stdout, "%c %c", 8, 8);
288  }
289  pOutbuf=buffer+pos;
290  }
291  else if (chr==GWEN_GUI_CGUI_CHAR_ENTER) {
292  if (minLen && pos<minLen) {
293  if (pos==0 && (flags & GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT)) {
297  I18N("Empty Input"),
298  I18N("Your input was empty.\n"
299  "Do you want to use the default?"),
300  I18N("Yes"),
301  I18N("No"),
302  I18N("Abort"), guiid);
303  if (rv==1) {
305  break;
306  }
307  else {
309  break;
310  }
311  }
312  else {
313  /* too few characters */
314  GWEN_Gui_StdPrintf(gui, stdout, "\007");
315  pOutbuf=buffer+pos;
316  }
317  }
318  else {
319  GWEN_Gui_StdPrintf(gui, stdout, "\n");
320  buffer[pos]=0;
321  rv=0;
322  break;
323  }
324  }
325  else if (chr==GWEN_GUI_CGUI_CHAR_ABORT) {
326  DBG_INFO(GWEN_LOGDOMAIN, "User aborted");
328  break;
329  }
330  else if (pOutbuf-buffer<maxLen) {
331  if ((flags & GWEN_GUI_INPUT_FLAGS_NUMERIC) &&
332  !isdigit(chr)) {
333  /* bad character */
334  GWEN_Gui_StdPrintf(gui, stdout, "\007");
335  pOutbuf=buffer+pos;
336  }
337  else {
338  if (flags & GWEN_GUI_INPUT_FLAGS_SHOW) {
339  *pOutbuf=0;
340  GWEN_Gui_StdPrintf(gui, stdout, "%s", buffer+pos);
341  }
342  else
343 #ifndef HAVE_ICONV
344  /* Do not print stars for continuation bytes */
345  if ((chr&0xC0)!=0x80)
346 #endif
347  GWEN_Gui_StdPrintf(gui, stdout, "*");
348  pos=pOutbuf-buffer;
349  }
350  }
351  else {
352  /* buffer full */
353  GWEN_Gui_StdPrintf(gui, stdout, "\007");
354  pOutbuf=buffer+pos;
355  }
356  } /* for */
357 
358 #ifdef HAVE_TERMIOS_H
359  /* re-enable echo (if previously disabled) */
360  if (AttrOutChanged)
361  tcsetattr(fileno(stdout), TCSADRAIN, &OldOutAttr);
362  if (AttrInChanged)
363  tcsetattr(fileno(stdin), TCSADRAIN, &OldInAttr);
364 #endif
365 
366 #if HAVE_DECL_SIGPROCMASK
367  sigprocmask(SIG_BLOCK, &sold, 0);
368 #endif
369 #ifdef HAVE_ICONV
370  iconv_close(ic);
371 #endif
372  return rv;
373 }
374 
375 
376 
378  uint32_t flags,
379  const char *title,
380  const char *text,
381  const char *b1,
382  const char *b2,
383  const char *b3,
384  GWEN_UNUSED uint32_t guiid)
385 {
386  GWEN_BUFFER *tbuf;
387  int c;
388 
389  assert(gui);
390 
391  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
392  GWEN_Gui_GetRawText(gui, text, tbuf);
393 
396  GWEN_Gui_StdPrintf(gui, stdout,
397  "Got the following dangerous message:\n%s\n",
398  GWEN_Buffer_GetStart(tbuf));
399  GWEN_Buffer_free(tbuf);
400  return 0;
401  }
402  else {
404  "Auto-answering the following message with %d:\n%s",
406  GWEN_Buffer_GetStart(tbuf));
407  GWEN_Buffer_free(tbuf);
408  return GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(flags);
409  }
410  }
411 
412  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
413  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
414  GWEN_Buffer_free(tbuf);
415  tbuf=0;
416 
417  if (b1) {
418  GWEN_Gui_StdPrintf(gui, stdout, "(1) %s", b1);
419  if (b2) {
420  GWEN_Gui_StdPrintf(gui, stdout, " (2) %s", b2);
421  if (b3) {
422  GWEN_Gui_StdPrintf(gui, stdout, " (3) %s", b3);
423  }
424  }
425  GWEN_Gui_StdPrintf(gui, stdout, "\n");
426  }
427  GWEN_Gui_StdPrintf(gui, stdout, "Please enter your choice: ");
428  for (;;) {
430  if (c==EOF) {
431  GWEN_Gui_StdPrintf(gui, stdout, "Aborted.\n");
433  }
434  if (!b1 && c==13)
435  return 0;
436  if (c=='1' && b1) {
437  GWEN_Gui_StdPrintf(gui, stdout, "1\n");
438  return 1;
439  }
440  else if (c=='2' && b2) {
441  GWEN_Gui_StdPrintf(gui, stdout, "2\n");
442  return 2;
443  }
444  else if (c=='3' && b3) {
445  GWEN_Gui_StdPrintf(gui, stdout, "3\n");
446  return 3;
447  }
448  else {
449  GWEN_Gui_StdPrintf(gui, stdout, "%c", 7);
450  }
451  } /* for */
452 
453 }
454 
455 
456 
458  uint32_t flags,
459  const char *title,
460  const char *text,
461  char *buffer,
462  int minLen,
463  int maxLen,
464  uint32_t guiid)
465 {
466  int rv;
467  GWEN_BUFFER *tbuf;
468 
469  assert(gui);
470 
472  (flags & GWEN_GUI_INPUT_FLAGS_TAN)) {
473  DBG_ERROR(GWEN_LOGDOMAIN, "No TAN input in non-interactive mode");
475  }
476 
477 
478  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
479  GWEN_Gui_GetRawText(gui, text, tbuf);
480 
481  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
482  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
483  GWEN_Buffer_free(tbuf);
484  tbuf=0;
485 
486  if (flags & GWEN_GUI_INPUT_FLAGS_CONFIRM) {
487  char *lbuffer=0;
488 
489  lbuffer=(char *)malloc(maxLen);
490  if (!lbuffer) {
491  DBG_ERROR(GWEN_LOGDOMAIN, "Not enough memory for %d bytes", maxLen);
492  return GWEN_ERROR_INVALID;
493  }
494  for (;;) {
495  GWEN_Gui_StdPrintf(gui, stdout, "Input: ");
496  rv=GWEN_Gui_CGui__input(gui, flags, lbuffer, minLen, maxLen, guiid);
497  if (rv) {
498  free(lbuffer);
499  return rv;
500  }
501 
502  GWEN_Gui_StdPrintf(gui, stdout, "Again: ");
503  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
504  if (rv) {
505  free(lbuffer);
506  return rv;
507  }
508  if (strcmp(lbuffer, buffer)!=0) {
509  GWEN_Gui_StdPrintf(gui, stdout,
510  "ERROR: Entries do not match, please try (again or abort)\n");
511  }
512  else {
513  rv=0;
514  break;
515  }
516 
517  } /* for */
518  free(lbuffer);
519  }
520  else {
521  GWEN_Gui_StdPrintf(gui, stdout, "Input: ");
522  rv=GWEN_Gui_CGui__input(gui, flags, buffer, minLen, maxLen, guiid);
523  }
524 
525  if ((rv==0) && (GWEN_Gui_GetFlags(gui) & GWEN_GUI_FLAGS_PERMPASSWORDS)) {
526  /* if the user allows it (by setting flag GWEN_GUI_FLAGS_PERMPASSWORDS)
527  * return 1, meaning the input may be stored in a permanent password store */
528  return 1;
529  }
530 
531  return rv;
532 }
533 
534 
535 
537  GWEN_UNUSED uint32_t flags,
538  const char *title,
539  const char *text,
540  GWEN_UNUSED uint32_t guiid)
541 {
542  GWEN_GUI_CGUI *cgui;
543  GWEN_BUFFER *tbuf;
544 
545  assert(gui);
546  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
547  assert(cgui);
548 
549  tbuf=GWEN_Buffer_new(0, 256, 0, 1);
550  GWEN_Gui_GetRawText(gui, text, tbuf);
551 
552  GWEN_Gui_StdPrintf(gui, stdout, "===== %s =====\n", title);
553  GWEN_Gui_StdPrintf(gui, stdout, "%s\n", GWEN_Buffer_GetStart(tbuf));
554  GWEN_Buffer_free(tbuf);
555  tbuf=0;
556 
557  return ++(cgui->nextBoxId);
558 }
559 
560 
561 
563 {
564  GWEN_GUI_CGUI *cgui;
565 
566  assert(gui);
567  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
568  assert(cgui);
569 
570  /* nothing to do right now */
571 }
572 
573 
574 
576  uint32_t progressFlags,
577  const char *title,
578  const char *text,
579  uint64_t total,
580  GWEN_UNUSED uint32_t guiid)
581 {
582  GWEN_GUI_CGUI *cgui;
583  GWEN_GUI_CPROGRESS *cp;
584 
585  assert(gui);
586  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
587  assert(cgui);
588 
589  cp=GWEN_Gui_CProgress_new(gui,
590  ++(cgui->nextProgressId),
591  progressFlags,
592  title,
593  text,
594  total);
595  GWEN_Gui_CProgress_List_Insert(cp, cgui->progressList);
596  return GWEN_Gui_CProgress_GetId(cp);
597 }
598 
599 
600 
602 {
603  GWEN_GUI_CGUI *cgui;
604  GWEN_GUI_CPROGRESS *cp;
605 
606  assert(gui);
607  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
608  assert(cgui);
609 
610  cp=GWEN_Gui_CProgress_List_First(cgui->progressList);
611  if (id==0)
612  return cp;
613  while (cp) {
614  if (GWEN_Gui_CProgress_GetId(cp)==id)
615  break;
616  cp=GWEN_Gui_CProgress_List_Next(cp);
617  } /* while */
618 
619  return cp;
620 }
621 
622 
623 
625  uint32_t id,
626  uint64_t progress)
627 {
628  GWEN_GUI_CGUI *cgui;
629  GWEN_GUI_CPROGRESS *cp;
630 
631  assert(gui);
632  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
633  assert(cgui);
634 
635  cp=GWEN_Gui_CGui__findProgress(gui, id);
636  if (!cp) {
637  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
638  return 0;
639  }
640  else {
641  return GWEN_Gui_CProgress_Advance(cp, progress);
642  }
643 }
644 
645 
646 
647 int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
648 {
649  GWEN_GUI_CGUI *cgui;
650  GWEN_GUI_CPROGRESS *cp;
651 
652  assert(gui);
653  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
654  assert(cgui);
655 
656  cp=GWEN_Gui_CGui__findProgress(gui, id);
657  if (!cp) {
658  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
659  }
660  else
661  GWEN_Gui_CProgress_SetTotal(cp, total);
662  return 0;
663 }
664 
665 
666 
668  uint32_t id,
669  GWEN_LOGGER_LEVEL level,
670  const char *text)
671 {
672  GWEN_GUI_CGUI *cgui;
673  GWEN_GUI_CPROGRESS *cp;
674 
675  assert(gui);
676  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
677  assert(cgui);
678 
679  cp=GWEN_Gui_CGui__findProgress(gui, id);
680  if (!cp) {
681  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
682  return 0;
683  }
684  else {
685  return GWEN_Gui_CProgress_Log(cp, level, text);
686  }
687 }
688 
689 
690 
691 int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
692 {
693  GWEN_GUI_CGUI *cgui;
694  GWEN_GUI_CPROGRESS *cp;
695 
696  assert(gui);
697  cgui=GWEN_INHERIT_GETDATA(GWEN_GUI, GWEN_GUI_CGUI, gui);
698  assert(cgui);
699 
700  cp=GWEN_Gui_CGui__findProgress(gui, id);
701  if (!cp) {
702  DBG_DEBUG(GWEN_LOGDOMAIN, "Progress object %u not found", id);
703  return 0;
704  }
705  else {
706  int rv;
707 
708  rv=GWEN_Gui_CProgress_End(cp);
709  GWEN_Gui_CProgress_List_Del(cp);
711  return rv;
712  }
713 }
714 
715 
716 
GWEN_GUI_CPROGRESS * GWEN_Gui_CGui__findProgress(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:601
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition: buffer.c:235
#define I18N(m)
Definition: error.c:42
GWEN_GUI_PROGRESS_END_FN GWEN_Gui_SetProgressEndFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_END_FN f)
Definition: gui.c:489
uint32_t GWEN_Gui_CProgress_GetId(const GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:96
#define GWEN_ERROR_INVALID
Definition: error.h:67
#define GWEN_GUI_MSG_FLAGS_SEVERITY_IS_DANGEROUS(fl)
Definition: gui.h:338
GWEN_GUI_PROGRESS_LOG_FN GWEN_Gui_SetProgressLogFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_LOG_FN f)
Definition: gui.c:477
#define GWEN_GUI_INPUT_FLAGS_CONFIRM
Definition: gui.h:211
GWEN_GUI_HIDEBOX_FN GWEN_Gui_SetHideBoxFn(GWEN_GUI *gui, GWEN_GUI_HIDEBOX_FN f)
Definition: gui.c:428
#define GWEN_GUI_FLAGS_NONINTERACTIVE
Definition: gui.h:986
int GWEN_Gui_CGui_ProgressSetTotal(GWEN_GUI *gui, uint32_t id, uint64_t total)
Definition: cgui.c:647
GWEN_LOGGER_LEVEL
Definition: logger.h:64
#define GWEN_GUI_INPUT_FLAGS_ALLOW_DEFAULT
Definition: gui.h:220
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define GWEN_GUI_FLAGS_PERMPASSWORDS
Definition: gui.h:992
#define GWEN_GUI_INPUT_FLAGS_NUMERIC
Definition: gui.h:215
#define GWEN_LOGDOMAIN
Definition: logger.h:35
int GWEN_Gui_MessageBox(uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, uint32_t guiid)
Definition: gui.c:875
char GWEN_Gui_CGui__readCharFromStdin(int waitFor)
Definition: cgui.c:111
void GWENHYWFAR_CB GWEN_Gui_CGui_FreeData(GWEN_UNUSED void *bp, void *p)
Definition: cgui.c:100
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition: buffer.c:42
#define GWEN_GUI_MSG_FLAGS_TYPE_INFO
Definition: gui.h:281
int GWEN_Gui_CProgress_End(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:272
int GWEN_Gui_CGui_ProgressEnd(GWEN_GUI *gui, uint32_t id)
Definition: cgui.c:691
GWEN_GUI_PROGRESS_SETTOTAL_FN GWEN_Gui_SetProgressSetTotalFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_SETTOTAL_FN f)
Definition: gui.c:465
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
#define GWEN_GUI_MSG_FLAGS_CONFIRM_BUTTON(fl)
Definition: gui.h:305
#define GWEN_GUI_MSG_FLAGS_SEVERITY_DANGEROUS
Definition: gui.h:337
GWEN_GUI_CPROGRESS * GWEN_Gui_CProgress_new(GWEN_GUI *gui, uint32_t id, uint32_t progressFlags, const char *title, const char *text, uint64_t total)
Definition: cprogress.c:28
uint32_t GWEN_Gui_CGui_ProgressStart(GWEN_GUI *gui, uint32_t progressFlags, const char *title, const char *text, uint64_t total, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:575
#define GWENHYWFAR_CB
Definition: gwenhywfarapi.h:89
#define DBG_DEBUG(dbg_logger, format, args...)
Definition: debug.h:209
int GWEN_Gui_CGui_ProgressAdvance(GWEN_GUI *gui, uint32_t id, uint64_t progress)
Definition: cgui.c:624
GWEN_GUI_MESSAGEBOX_FN GWEN_Gui_SetMessageBoxFn(GWEN_GUI *gui, GWEN_GUI_MESSAGEBOX_FN f)
Definition: gui.c:389
#define GWEN_GUI_INPUT_FLAGS_TAN
Definition: gui.h:222
int GWEN_Gui_CGui_InputBox(GWEN_GUI *gui, uint32_t flags, const char *title, const char *text, char *buffer, int minLen, int maxLen, uint32_t guiid)
Definition: cgui.c:457
GWEN_GUI_PROGRESS_START_FN GWEN_Gui_SetProgressStartFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_START_FN f)
Definition: gui.c:441
#define GWEN_ERROR_GENERIC
Definition: error.h:62
int GWEN_Gui_CProgress_Log(GWEN_GUI_CPROGRESS *cp, GWEN_LOGGER_LEVEL level, const char *text)
Definition: cprogress.c:239
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition: buffer.c:89
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
#define GWEN_ERROR_DEFAULT_VALUE
Definition: error.h:117
int GWEN_Gui_CGui__input(GWEN_UNUSED GWEN_GUI *gui, uint32_t flags, char *buffer, int minLen, int maxLen, uint32_t guiid)
Definition: cgui.c:167
void GWEN_Gui_CGui_HideBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t id)
Definition: cgui.c:562
GWEN_GUI_SHOWBOX_FN GWEN_Gui_SetShowBoxFn(GWEN_GUI *gui, GWEN_GUI_SHOWBOX_FN f)
Definition: gui.c:415
int GWEN_Gui_CGui_ProgressLog(GWEN_GUI *gui, uint32_t id, GWEN_LOGGER_LEVEL level, const char *text)
Definition: cgui.c:667
#define DBG_ERROR(dbg_logger, format, args...)
Definition: debug.h:97
#define GWEN_GUI_INPUT_FLAGS_SHOW
Definition: gui.h:213
int GWEN_Gui_CProgress_Advance(GWEN_GUI_CPROGRESS *cp, uint64_t progress)
Definition: cprogress.c:164
GWEN_GUI * GWEN_Gui_new(void)
Definition: gui.c:78
void GWEN_Gui_GetRawText(GWEN_UNUSED const GWEN_GUI *gui, const char *text, GWEN_BUFFER *tbuf)
Definition: gui.c:353
#define GWEN_GUI_MSG_FLAGS_CONFIRM_B1
Definition: gui.h:299
#define ICONV_CONST
Definition: cgui.c:64
GWEN_GUI_INPUTBOX_FN GWEN_Gui_SetInputBoxFn(GWEN_GUI *gui, GWEN_GUI_INPUTBOX_FN f)
Definition: gui.c:402
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:178
uint32_t GWEN_Gui_CGui_ShowBox(GWEN_GUI *gui, GWEN_UNUSED uint32_t flags, const char *title, const char *text, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:536
struct GWEN_GUI GWEN_GUI
Definition: gui.h:176
void GWEN_Gui_CProgress_SetTotal(GWEN_GUI_CPROGRESS *cp, uint64_t i)
Definition: cprogress.c:128
struct GWEN_GUI_CPROGRESS GWEN_GUI_CPROGRESS
Definition: cprogress_l.h:14
#define GWEN_INHERIT(bt, t)
Definition: inherit.h:264
void GWEN_Gui_CProgress_free(GWEN_GUI_CPROGRESS *cp)
Definition: cprogress.c:75
#define GWEN_ERROR_USER_ABORTED
Definition: error.h:65
int GWEN_Gui_StdPrintf(const GWEN_GUI *gui, FILE *stream, const char *fmt,...)
Definition: gui.c:259
#define GWEN_INHERIT_SETDATA(bt, t, element, data, fn)
Definition: inherit.h:292
GWEN_GUI * GWEN_Gui_CGui_new(void)
Definition: cgui.c:74
int GWEN_Gui_CGui_MessageBox(GWEN_GUI *gui, uint32_t flags, const char *title, const char *text, const char *b1, const char *b2, const char *b3, GWEN_UNUSED uint32_t guiid)
Definition: cgui.c:377
uint32_t GWEN_Gui_GetFlags(const GWEN_GUI *gui)
Definition: gui.c:700
GWEN_GUI_PROGRESS_ADVANCE_FN GWEN_Gui_SetProgressAdvanceFn(GWEN_GUI *gui, GWEN_GUI_PROGRESS_ADVANCE_FN f)
Definition: gui.c:453
#define GWEN_UNUSED
const char * GWEN_Gui_GetCharSet(const GWEN_GUI *gui)
Definition: gui.c:752
#define GWEN_INHERIT_GETDATA(bt, t, element)
Definition: inherit.h:271