A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/sftp__sample_8cpp_source.html below:

NCBI C++ ToolKit: src/sample/app/sftp/sftp_sample.cpp Source File

48

arg_desc->SetUsageContext(

GetArguments

().GetProgramBasename(),

"SFTP API sample"

);

51

arg_desc->AddOptionalKey(

"expected-key"

,

"PUBLIC_KEY"

,

"Limit trust to specified (base64-encoded) public key"

,

CArgDescriptions::eString

);

54

arg_desc->AddFlag(

"ftp"

,

"Use FTP instead of SFTP"

);

55

arg_desc->AddFlag(

"echo"

,

"Echo input data"

);

56

arg_desc->AddFlag(

"stream-flags"

,

"Output stream state flags after each comand"

);

57

arg_desc->AddFlag(

"update-known-hosts"

,

"Update known hosts (~/.ssh/known_hosts) if host is trusted (affects other SSH/SFTP clients!)"

);

58

arg_desc->AddFlag(

"do-not-trust-new-host"

,

"Do not trust new (unknown) host"

);

59

arg_desc->AddFlag(

"trust-changed-host"

,

"Trust host with changed public key"

);

66

cout <<

"================================================================================\n"

;

68  if

(!getline(is, line)) {

82  const auto

& host = args[

"HOST"

].AsString();

83  const auto

echo = args[

"echo"

].AsBoolean();

84  const auto flags

= args[

"stream-flags"

].AsBoolean();

85  auto

&

input

= args[

"input-file"

].AsInputFile();

86

unique_ptr<iostream> sftp_stream;

89  const auto

& user = args[

"user"

].HasValue() ? args[

"user"

].AsString() :

"ftp"

s;

90  const auto

& password = args[

"password"

].HasValue() ? args[

"password"

].AsString() :

"none"

s;

91

sftp_stream = make_unique<CConn_FtpStream>(host, user, password, args[

"path"

].AsString());

93

CSFTP_Session::SParams params(host);

96

params.SetUser(args[

"user"

].AsString());

99  if

(args[

"password"

].

HasValue

()) {

100

params.SetPassword(args[

"password"

].AsString());

103  if

(args[

"update-known-hosts"

].AsBoolean()) {

104

params.SetFlag(CSFTP_Session::fUpdateKnownHosts);

107  if

(args[

"do-not-trust-new-host"

].AsBoolean()) {

108

params.SetFlag(CSFTP_Session::fDoNotTrustNewHost);

111  if

(args[

"trust-changed-host"

].AsBoolean()) {

112

params.SetFlag(CSFTP_Session::fTrustChangedHost);

115  if

(args[

"expected-key"

].

HasValue

()) {

116

params.SetExpectedKey(args[

"expected-key"

].AsString());

119

CSFTP_Session sftp_session(params);

120

sftp_stream = make_unique<CSFTP_Stream>(sftp_session, args[

"path"

].AsString());

126

*sftp_stream << line << endl;

128  if

(

auto cmd

= string_view(line).substr(0, line.find(

' '

)); (

cmd

==

"STOR"

sv) || (

cmd

==

"APPE"

sv)) {

129  if

(!getline(

input

, line)) {

134

cout << line << endl;

137

*sftp_stream << line;

141

cout <<

"--------------------------------------------------------------------------------\n"

;

147  const auto

s = sftp_stream->rdstate();

148  auto l

= [s](

auto f

) {

return bool

(s &

f

); };

149

cout <<

"bad="

<<

l

(ios_base::badbit) <<

", fail="

<<

l

(ios_base::failbit) <<

", eof="

<<

l

(ios_base::eofbit) << endl;

151

sftp_stream->clear();

157 int main

(

int

argc,

const char

* argv[])

virtual int Run()

Run the application.

virtual void Init()

Initialize the application.

virtual const CArgs & GetArgs(void) const

Get parsed command line arguments.

int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)

Main function (entry point) for the NCBI application.

virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)

Setup the command line argument descriptions.

const CNcbiArguments & GetArguments(void) const

Get the application's cached unprocessed command-line arguments.

@ eInputFile

Name of file (must exist and be readable)

@ eString

An arbitrary string.

bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)

Copy the entire contents of stream "is" to stream "os".

Defines the CNcbiApplication and CAppException classes for creating NCBI applications.

bool s_GetCommandLine(istream &is, string &line, bool echo)

int main(int argc, const char *argv[])

static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4