newbie wants to compile SCP into his own application
dtucker at zip.com.au
Thu Feb 20 09:45:55 EST 2003
aplumb at westpac.com.au wrote:
> My question is, can I make this a module in my own application by using the
> scp.c source and ilnking the libraries mentioned above ? The reason is, I
> want to perform an SCP from my application, but I don't want to execute the
> external command line utility "scp". I want to be able to get a return
> value to indicate success or failure and handle this in my app.
Probably, but it's likely to be much easier (and less maintenance too)
to just fork/exec scp then wait() for completion and check the return
code. Is determining success/failure the only reason you want to embed
I've got some example code that might serve as a starting point if you
$ scp localhost:/bin/ls /tmp/ls
$ echo $?
$ scp localhost:/no/such /tmp/ls
scp: /no/such: No such file or directory
$ echo $?
Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4 37C9 C982 80C7 8FF4 FA69
Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.
More information about the openssh-unix-dev