int main (int argc, char *argv[]) { pinentry_init (PGMNAME); #ifdef FALLBACK_CURSES if (pinentry_have_display (argc, argv)) gtk_init (&argc, &argv); else pinentry_cmd_handler = curses_cmd_handler; #else gtk_init (&argc, &argv); #endif /* Consumes all arguments. */ if (pinentry_parse_opts (argc, argv)) { printf(PGMNAME " " VERSION "\n"); exit(EXIT_SUCCESS); } if (pinentry_loop ()) return 1; return 0; }
int main (int argc, char *argv[]) { static GMemVTable secure_mem = { secentry_malloc, secentry_realloc, secentry_free, NULL, NULL, NULL }; g_mem_set_vtable (&secure_mem); pinentry_init (PGMNAME); #ifdef FALLBACK_CURSES if (pinentry_have_display (argc, argv)) gtk_init (&argc, &argv); else pinentry_cmd_handler = curses_cmd_handler; #else gtk_init (&argc, &argv); #endif /* Consumes all arguments. */ if (pinentry_parse_opts (argc, argv)) { printf(PGMNAME " " VERSION "\n"); exit(EXIT_SUCCESS); } if (pinentry_loop ()) return 1; return 0; }
int main (int argc, char *argv[]) { pinentry_init ("pinentry-qt4"); std::auto_ptr<QApplication> app; #ifdef FALLBACK_CURSES if (!pinentry_have_display (argc, argv)) pinentry_cmd_handler = curses_cmd_handler; else #endif { /* Qt does only understand -display but not --display; thus we are fixing that here. The code is pretty simply and may get confused if an argument is called "--display". */ char **new_argv, *p; size_t n; int i, done; for (n=0,i=0; i < argc; i++) n += strlen (argv[i])+1; n++; new_argv = (char**)calloc (argc+1, sizeof *new_argv); if (new_argv) *new_argv = (char*)malloc (n); if (!new_argv || !*new_argv) { fprintf (stderr, "pinentry-qt4: can't fixup argument list: %s\n", strerror (errno)); exit (EXIT_FAILURE); } for (done=0,p=*new_argv,i=0; i < argc; i++) if (!done && !strcmp (argv[i], "--display")) { new_argv[i] = strcpy (p, argv[i]+1); p += strlen (argv[i]+1) + 1; done = 1; } else { new_argv[i] = strcpy (p, argv[i]); p += strlen (argv[i]) + 1; } /* We use a modal dialog window, so we don't need the application window anymore. */ i = argc; app.reset (new QApplication (i, new_argv)); const QIcon icon( QLatin1String( ":/document-encrypt.png" ) ); app->setWindowIcon( icon ); } /* Consumes all arguments. */ if (pinentry_parse_opts (argc, argv)) { printf ("pinentry-qt4 (pinentry) " /* VERSION */ "\n"); return EXIT_SUCCESS; } else { return pinentry_loop () ? EXIT_FAILURE : EXIT_SUCCESS ; } }
int main (int argc, char *argv[]) { pinentry_init ("pinentry-qt"); #ifdef FALLBACK_CURSES if (!pinentry_have_display (argc, argv)) pinentry_cmd_handler = curses_cmd_handler; else #endif { /* Qt does only understand -display but not --display; thus we are fixing that here. The code is pretty simply and may get confused if an argument is called "--display". */ char **new_argv, *p; size_t n; int i, done; for (n=0,i=0; i < argc; i++) n += strlen (argv[i])+1; n++; new_argv = (char**)calloc (argc+1, sizeof *new_argv); if (new_argv) *new_argv = (char*)malloc (n); if (!new_argv || !*new_argv) { fprintf (stderr, "pinentry-qt: can't fixup argument list: %s\n", strerror (errno)); exit (EXIT_FAILURE); } for (done=0,p=*new_argv,i=0; i < argc; i++) if (!done && !strcmp (argv[i], "--display")) { new_argv[i] = (char*)"-display"; done = 1; } else { new_argv[i] = strcpy (p, argv[i]); p += strlen (argv[i]) + 1; } /* We use a modal dialog window, so we don't need the application window anymore. */ i = argc; new QApplication (i, new_argv); } /* Consumes all arguments. */ if (pinentry_parse_opts (argc, argv)) { printf ("pinentry-qt (pinentry) " VERSION "\n"); exit (EXIT_SUCCESS); } if (pinentry_loop ()) return 1; return 0; }