I recently had to do some scripting around OpenSSH's version of sftp and
noticed that the exit codes don't seem to be documented anywhere (of course,
outside the source code that is). Does anyone know where I can find a list
of exit codes for the sftp program and what each one means?

I'm actually porting a shell script that use to use SSH Communications's
version of sftp2, which has a list of documented exit codes and the script
handles the exit codes based on their meaning. By trial and error, I've
figured out that OpenSSH's sftp returns '1' for the situation I was fixing,
but I want to make sure it handles all conditions/exit codes appropriately.

Any pointers to information would be appreciated (documentation or specific
source file or ?). Thanks!