diff options
author | Mystery Man <unknown@mandriva.org> | 2002-08-05 15:51:48 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2002-08-05 15:51:48 +0000 |
commit | 60a32f602c51495953e8f5db7ff42704a939caca (patch) | |
tree | e5927f165ceb0e00e0067ed53ac00bcfb6ef4a80 /mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c | |
parent | f40f7286b31daab17a4db329040e543f830d3175 (diff) | |
download | drakx-60a32f602c51495953e8f5db7ff42704a939caca.tar drakx-60a32f602c51495953e8f5db7ff42704a939caca.tar.gz drakx-60a32f602c51495953e8f5db7ff42704a939caca.tar.bz2 drakx-60a32f602c51495953e8f5db7ff42704a939caca.tar.xz drakx-60a32f602c51495953e8f5db7ff42704a939caca.zip |
This commit was manufactured by cvs2svn to create tag 'V1_1_9_5mdk'.V1_1_9_5mdk
Diffstat (limited to 'mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c')
-rw-r--r-- | mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c b/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c deleted file mode 100644 index 48ca04202..000000000 --- a/mdk-stage1/ppp/contrib/pppgetpass/pppgetpass.gtk.c +++ /dev/null @@ -1,92 +0,0 @@ -#include <glib.h> -#include <gdk/gdk.h> -#include <gtk/gtkwindow.h> -#include <gtk/gtkmain.h> -#include <gtk/gtkbutton.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> -#include <gtk/gtksignal.h> - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <syslog.h> - -int outfd; -int err; - -static void okpressed(void *widget, void *clientdata) -{ - GtkWidget *answer=clientdata; - gchar *pass; - int passlen; - ssize_t wrote; - (void)widget; - - pass=gtk_entry_get_text(GTK_ENTRY(answer)); - - passlen=strlen(pass); - if(!passlen) - return; - - if((wrote=write(outfd, pass, passlen))!=passlen) { - if(wrote<0) - syslog(LOG_ERR, "write error on outpipe: %m"); - else - syslog(LOG_ERR, "short write on outpipe"); - err=1; - } - gtk_main_quit(); -} - -int main(int argc, char **argv) -{ - GtkWidget *mainwindow, *vbox, *question, *answer, *ok; - char buf[1024]; - gtk_init(&argc, &argv); - - openlog(argv[0], LOG_PID, LOG_DAEMON); - if(argc!=4) { - syslog(LOG_WARNING, "Usage error"); - return 1; - } - outfd=atoi(argv[3]); - mainwindow=gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(GTK_WINDOW(mainwindow), "pppgetpass"); - gtk_signal_connect(GTK_OBJECT(mainwindow), "destroy", - GTK_SIGNAL_FUNC(gtk_main_quit), 0); - - vbox=gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(mainwindow), vbox); - gtk_widget_show(vbox); - - if(argv[1][0] && argv[2][0]) - snprintf(buf, sizeof buf, "Password for PPP client %s on server %s: ", argv[1], argv[2]); - else if(argv[1][0] && !argv[2][0]) - snprintf(buf, sizeof buf, "Password for PPP client %s: ", argv[1]); - else if(!argv[1][0] && argv[2][0]) - snprintf(buf, sizeof buf, "Password for PPP on server %s: ", argv[2]); - else - snprintf(buf, sizeof buf, "Enter PPP password: "); - question=gtk_label_new(buf); - gtk_box_pack_start(GTK_BOX(vbox), question, FALSE, TRUE, 0); - gtk_widget_show(question); - - answer=gtk_entry_new(); - gtk_entry_set_visibility(GTK_ENTRY(answer), 0); - gtk_box_pack_start(GTK_BOX(vbox), answer, FALSE, TRUE, 0); - gtk_widget_show(answer); - - ok=gtk_button_new_with_label("OK"); - gtk_box_pack_start(GTK_BOX(vbox), ok, FALSE, TRUE, 0); - gtk_signal_connect(GTK_OBJECT(ok), "clicked", - GTK_SIGNAL_FUNC(okpressed), answer); - gtk_widget_show(ok); - - gtk_widget_show(mainwindow); - gtk_main(); - - return err; -} |