errors regarding the code



#include<gtk/gtk.h>
#include<stdio.h>
#include<stdlib.h>
gchar *chardadd1=NULL,*chardadd2=NULL;

void dadd(GtkWidget *widget, gpointer label)
{
char str[512];
int x;
sprintf(str,"sh st1.sh %s ",chardadd1);
x=system(str);
}
int main(int argc,char *argv[]) 
{
int i;char buf[128];


GtkWidget *window;
GtkWidget *tabledadd;
GtkWidget *labeldadd1;
GtkWidget *entrydadd1;
GtkWidget *buttondadd;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_title(GTK_WINDOW(window), "GtkEntry");

gtk_container_set_border_width(GTK_CONTAINER(window), 50);
entrydadd1 = gtk_entry_new();
tabledadd = gtk_table_new(3, 2, FALSE);
gtk_container_add(GTK_CONTAINER(window), tabledadd);
labeldadd1 = gtk_label_new("group name");
buttondadd=gtk_button_new_with_label("click me");
gtk_table_attach(GTK_TABLE(tabledadd), labeldadd1, 0, 1, 0, 1, 
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 5, 5);
gtk_table_attach(GTK_TABLE(tabledadd), entrydadd1, 1, 2, 0, 1, 
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 5, 5);

gtk_table_attach(GTK_TABLE(tabledadd), buttondadd, 0, 2, 2, 3, 
GTK_FILL | GTK_SHRINK, GTK_FILL | GTK_SHRINK, 5, 5);

chardadd1=gtk_entry_get_text(GTK_ENTRY(entrydadd1));
gtk_widget_show(window);
gtk_widget_show(tabledadd);
gtk_widget_show(labeldadd1);
gtk_widget_show(entrydadd1);
gtk_widget_show(buttondadd);

//dadd will be called in the below statement
g_signal_connect(buttondadd, "clicked",G_CALLBACK(dadd), entrydadd1);

g_signal_connect(window, "destroy",G_CALLBACK(gtk_main_quit), NULL);
gtk_main();
return 0;
}


Shell script is:

IN=$1
c=`echo $IN | tr -dc ';' | wc -c`
b=(`awk -F';' '$1=$1' <<<$IN`)
i=0
while [ $i -le $c ];
do
d=(`echo ${b[i]} | tr '-' ' '`)
a=${d[0]}
b=${d[1]}

while [ $a -le $b ];
do
echo $a
a=`expr $a + 1`
done
i=`expr $i + 1`
done




The input that has to be given in text entry should be in the format 
"1-10;20-30;40-50;60-70"

and this will be passed to shell script and it gets splitted there and the numbers from 1-10,20-30,40-50,60-70 (as per the given input) will be displayed.
The shell script alone is working fine, but if I give more inputs through the text entry then it's not getting passed form Gtk program to shell program 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]