sftp can't fine batchfile "No such file or directory"

Hi,

I've got a C program that is using execlp to run a non-interactive sftp (using a batchfile) session to send some files to another system.

Just before doing that, I create the batchfile called sftp_batch on the fly:

 V8_26_1:sun-->cat /workspace/sftp_batch
cd /tmp/newsftp
put test.file test.file
quit

So, as you can see, the file exists.
The execlp command is:

  execlp ("/usr/bin/sftp", "/usr/bin/sftp", "-v","-b /workspace/sftp_batch", usr_host, NULL);

I have run it manually and it works fine. When I run the program, this is what I get:

 adbspl01 -m S -f test.file -d "2nd sftp" -t 5
No such file or directory ( /workspace/sftp_batch).
sftp process (28802) exited with status 65280

Any ideas?

Thanks,
Fiaran

system:(SunOS 5.10)
ssh: (Sun_SSH_1.1, SSH protocols 1.5/2.0, OpenSSL 0x0090704f)

exec doesn't split strings for you, so you should have "-b" and "/workspace/sftp_batch" separate. Putting it all in one string may tell it to look for the file "-b /workspace/sftp_batch".

Well, that's a great big doh!

And a big thank you!

Fiaran