Receive ZModem

Hello.

I'm trying to get rz (receive zmodem) working with my program... I have the following relevant code so far:


        int zmodem_result=1;
        pid_t childpid;

                if ((childpid = fork()))
                { 
                        execlp("rz","rz",NULL); 
                        perror("exec() of rz failed"); 
                        exit(-1);
                }
                else if (childpid>0)
                        wait(&zmodem_result);
                else perror("fork failed");
                break;

When I initiate a download from the server, I get:

fork failed: Success
รจ                   rz waiting to receive.**B0100000023be50

rz is called, but it doesn't appear to be doing anything. Can someone tell me what is wrong with my code?

Thank you.

@ignatius , hi

what do you expect rz to do ?
can you show some initial output from an interactive session with rz outside of any c-program

secondly, some of your logic needs refining in the snippet of code shown.
(it would be helpful to show the entire function this code is part of , makes it easier for the team to assess.

thks

rz is used to download files using the ZModem protocol.

Here's the code.

static void con_escape(void) 
{
        char b;

        if (bb_got_signal) 
                rawmode();

        full_write1_str("\r\nConsole escape. Commands are:\r\n\n"
                        " d     download\r\n"
                        " u     uploadd\r\n");

        if (read(STDIN_FILENO, &b, 1) <= 0)
                doexit(EXIT_FAILURE);

        switch (b) {

        case 'u':
                system("sz --zmodem --try-8k --binary --restricted %s");
                break;
        case 'd':

        int zmodem_result=1;
        pid_t childpid;

                if ((childpid = fork()))
                { 
                        execlp("rz","rz",NULL); 
                        perror("exec() of rz failed"); 
                        exit(-1);
                }
                else if (childpid>0)
                        wait(&zmodem_result);
                else perror("fork failed");
                break;
        }

        if (bb_got_signal)
                cookmode();
 ret:
        bb_got_signal = 0;
}

"sz" is a place holder. It doesn't actually work.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.