First step is post something which is half-way decently indented if you want people to look at it.
Code:
main()
{
ret=open_sqlite("/mnt/jffs2/atm.db");// the name of the database
ppp_open();//function to open ppp port to send the data.
}
//the defination of these two functions
int open_sqlite(char *db_name)
{
if(sqlite3_open(db_name, &db_conn) == SQLITE_OK)
{
printf("database opened \n");
return 1;
}
else
return 0;
}
int ppp_open()
{
int fd9,i,j;
printf("PPP starting\n");
printf("PPP something\n");
ret=system("rm -f /var/run/ppp.link");
printf("\nreturn of system ppp.link::: %d",ret);
ret=system("/etc/ppp/dialout&");// the command to run the dailup function from the device.
printf("\nreturn of system dialout::: %d",ret);
sleep(10);
printf("\nppp_open\n");
sleep(5);
i=0;
while (i<20)
{
fd9=open("/var/run/ppp.link",O_RDONLY);
printf("inside ppp_open :::::fd9 = %d\n",fd9);
if (fd9 > 0)
{
printf("\nNext to close\n");
close(fd9);
break;
}
printf("i = %d\n",i);
sleep(1);
i++;
}
if(i>=20)
{
ppp_close();
printf("\nppp closed\n");
return -1;
}
printf("\nPPP Connected \n");
sleep(2);
return 0;
}
Next tell us EXACTLY what you see on screen. A terminal log would be ideal.
Consider using the script utility to make a log.
Code:
SCRIPT(1) BSD General Commands Manual SCRIPT(1)
NAME
script - make typescript of terminal session
SYNOPSIS
script [-a] [-c COMMAND] [-f] [-q] [-t] [file]
DESCRIPTION
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as
proof of an assignment, as the typescript file can be printed out later with lpr(1).