ARCv2

 view release on metacpan or  search on metacpan

scripts/arcx  view on Meta::CPAN

		} elsif (!defined $args{r}) {
			addhistoryfile(@ARGV);
			unless ($arc->ProcessCommand(@ARGV)) {
				err($arc->IsError());
				$retval = 1;
				next;
			}
		} else {
			addhistoryfile(@ARGV);
			if ($arc->CommandStart(@ARGV)) {
				if ($arc->CommandWrite($args{r})) {
					$arc->CommandEOF();
					while ($_ = $arc->CommandRead()) {
						print $_;
					}
					unless ($arc->CommandEnd()) {
						err($arc->IsError());
						$retval = 1;
						next;
					}
				} else {
					err($arc->IsError());
					$retval = 1;
					next;
				}
			} else {
				err($arc->IsError());
				$retval = 1;
				next;
			}
		}
		$arc->Quit();
	} else {
		err("Could not connect to '$args{h}:$args{p}': ",$arc->IsError());
		$retval = 1;
		next;
	}
	verbout("Available SASL mechanisms return by the server: ",join(", ",@{$arc->{server_sasl_mechanisms}}));
	last;
}

exit $retval;

sub showhelp
{
	print <<EOT;
internal command for this client:
  ?      for this help
  \\q,^D  quit
EOT
}

sub usage
{
	my $msg = shift;
	print STDERR <<EOT;
$msg
$0 [-h <hostname>] [-p <port>] [-l <loglevel]
   [-L <logdestination] [-n] [-v] [-S <service>]
   [-F -f <history>] [-u|-U <username>] [-a|-A <authname>]
   [-w|-W <password>] [-s <mech>] [-t <timeout in sec>]
   [-r <string>] [-V] [-C <conffile>] [command [command-arguments]]

  (Remark: Some parameters behave different in comparison to the old arc)

  -h <hostname>    specify the ARCv2 server
  -p <port>        port to connect (default: $Arc::DefaultPort)
  -t <timeout>     specify the timeout in seconds (default: 30 secs)
  -0               use old protocol type (unencrypted protocol conn.)
  -C <conffile>    use <conffile> as source for server-command-mapping.
                   (default: $Arc::ConfigPath/arcx.conf)

  -r <string>      use this string as stdin value for the command

  -S <service>     name of the service used for arc auth (default: arc)
  -s <mech>        use <mech> as authentication mechanism for SASL
  -n               do nothing, just try to authenticate
  -v               be verbose

  -U <username>    username for authentication (dep. on SASL mechanism)
  -u               ask for username
  -A <authz name>  username for authorization (dep. SASL mechanism)
  -a               ask for authname
  -W <password>    password (dep. on SASL mechanism)
  -w               ask for password

  -f <history>     filename for command history (def: $ENV{HOME}/.archistory)
  -F               don't add commands to the history file

  -l <loglevel>    loglevel (see man Arc) (default: 0, error msgs will be on stderr)
  -L <logdest>     log destination (possible values: 'syslog' (def) or 'stderr')
  -V               display version information

$Arc::Copyright
$Arc::Contact
EOT

	exit 1;
}


sub username
{
	if (defined $args{U} && $args{U} ne "") {
		return $args{U};
	} elsif (defined $args{u}) {
		print STDERR "Enter your username: "; return <STDIN>;
	} else {
		return $ENV{'USER'};
	}
}

sub authname
{
	if (defined $args{A} && $args{A} ne "") {
		return $args{A};
	} elsif (defined $args{a}) {
		print STDERR "Enter your name for authorization: "; return <STDIN>;
	} else {
		return $ENV{'USER'};
	}
}

sub password
{
	if (defined $args{P} && $args{P} ne "") {
		return $args{P};
	} elsif (defined $args{p}) {



( run in 0.575 second using v1.01-cache-2.11-cpan-39bf76dae61 )