Netrc is the established standard for specifying a user name and
password for outgoing FTP connections. ncftpput uses a
different format (though very similar).
To read both formats, you could do things like
this, inside .../ncftp-3.1.5/sh_util/gpshare.c
ReadConfigFile(const char *fn, FTPCIPtr cip) :
if( fscanf(fp, "machine %s", tmp) == 1)
strncpy(tmp, wherever, ...)
else if(fscanf(fp, "host %s", tmp) == 1)
strncpy(tmp, wherever, ...)
else if(fscanf(fp, "user %s", tmp) == 1)
strncpy(tmp, wherever, ...)
...
else if(fscanf(fp, "%s", tmp) == 1)
fprintf(stderr, "Unrecognized token in %s: %s\n", filename, tmp);