Hi there,
I have been trying unsuccessfully for a while now reading lftp's output with
my application but all I get is nothing. I am running lftp 2.6.11.
I have a script, called doFtp.sh, that launches lftp. The command to launch
lftp is:
lftp -f /home/asier/gprs/getMedia.sh
And getMedia.sh has this (variable) content:
open -u user,password ip-address
cd log
put mylog
exit
I tried achieving by running:
]$ /home/asier/gprs/doFtp.sh | ./piping
]$ lftp -f /home/asier/gprs/getMedia.sh | ./piping
where ./piping is a simple application which only reads the inputs from stdin
and pirnts them out on the screen.
Do I need to update lftp version or am I missing something in here? Thanks for
your help,
Asier
PS: This is the code for piping.c, I tested it with other applications and it
works fine for me:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <termios.h>
#include <string.h>
int c;
FILE *fp;
void main (void){
printf("piping application started\n");
fp = fopen ("erantzuna.txt","w");
do{
c=getchar();
fputc(c, fp);
printf("%c",c);
}while(c!='�');
fclose(fp);
printf("\npiping application finished\n");
}