summaryrefslogtreecommitdiffstats
path: root/source3/client
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2013-07-09 15:10:44 +0200
committerAndreas Schneider <asn@samba.org>2014-02-19 18:22:26 +0100
commit60eec86ceb08814dabb986219f756d1645efb82c (patch)
tree4f18d1ec8e87bd07129bfe1abf633cdd7a60f735 /source3/client
parentb753900b09e6b5001042e45388b72ad36e8a0093 (diff)
downloadsamba-60eec86ceb08814dabb986219f756d1645efb82c.tar.gz
samba-60eec86ceb08814dabb986219f756d1645efb82c.tar.xz
samba-60eec86ceb08814dabb986219f756d1645efb82c.zip
clitar.c, client.c: add flag to know if there's a tar operation to do.
- remove tar_type global. Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com> [ddiss@samba.org: rebase against lp_cli_maxprotocol() changes] Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/client')
-rw-r--r--source3/client/client.c10
-rw-r--r--source3/client/clitar.c15
-rw-r--r--source3/client/clitar_proto.h1
3 files changed, 16 insertions, 10 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index b85da0856a..b74ec73370 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -47,7 +47,6 @@
extern int do_smb_browse(void); /* mDNS browsing */
extern bool override_logfile;
-extern char tar_type;
static int port = 0;
static char *service;
@@ -5379,7 +5378,7 @@ static int do_message_op(struct user_auth_info *a_info)
main program
****************************************************************************/
- int main(int argc,char *argv[])
+int main(int argc,char *argv[])
{
const char **const_argv = discard_const_p(const char *, argv);
char *base_directory = NULL;
@@ -5392,6 +5391,8 @@ static int do_message_op(struct user_auth_info *a_info)
int rc = 0;
bool tar_opt = false;
bool service_opt = false;
+ extern struct tar tar_ctx;
+
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -5508,7 +5509,6 @@ static int do_message_op(struct user_auth_info *a_info)
* position of the -T option in the raw argv[]. */
{
int i;
- extern struct tar tar_ctx;
for (i = 1; i < argc; i++) {
if (strncmp("-T", argv[i],2)==0)
@@ -5608,7 +5608,7 @@ static int do_message_op(struct user_auth_info *a_info)
if(new_name_resolve_order)
lp_set_cmdline("name resolve order", new_name_resolve_order);
- if (!tar_type && !query_host && !service && !message) {
+ if (!tar_to_process(&tar_ctx) && !query_host && !service && !message) {
poptPrintUsage(pc, stderr, 0);
exit(1);
}
@@ -5623,7 +5623,7 @@ static int do_message_op(struct user_auth_info *a_info)
max_protocol = lp_client_max_protocol();
- if (tar_type) {
+ if (!tar_to_process(&tar_ctx)) {
if (cmdstr)
process_command_string(cmdstr);
rc = do_tar_op(base_directory);
diff --git a/source3/client/clitar.c b/source3/client/clitar.c
index 6c3bbd7d4f..83b4a96fc5 100644
--- a/source3/client/clitar.c
+++ b/source3/client/clitar.c
@@ -26,11 +26,6 @@
#define LEN(x) (sizeof(x)/sizeof((x)[0]))
#define TAR_MAX_BLOCK_SIZE 65535
-/*
- * XXX: used in client.c, we have to export it for now.
- * corresponds to the transfer operation. Can be '\0', 'c' or 'x'
- */
-char tar_type = 0;
enum tar_operation {
TAR_NO_OPERATION,
@@ -51,6 +46,8 @@ enum {
};
struct tar {
+ bool to_process;
+
/* flags */
struct tar_mode {
enum tar_operation operation; /* create, extract */
@@ -145,6 +142,7 @@ static void tar_dump(struct tar *t)
XSET(TAR_EXCLUDE),
};
+ XBOOL(t->to_process);
XTABLE(t->mode.operation, op);
XTABLE(t->mode.selection, sel);
XINT(t->mode.blocksize);
@@ -218,6 +216,11 @@ static bool tar_read_inclusion_file (struct tar *t, const char* filename)
return 1;
}
+bool tar_to_process (struct tar *t)
+{
+ return t->to_process;
+}
+
/**
* cmd_block - interactive command to change tar blocksize
*
@@ -461,6 +464,7 @@ int tar_parse_args(struct tar* t, const char *flag, const char **val, int valsiz
t->mode.operation = TAR_NO_OPERATION;
t->mode.selection = TAR_NO_SELECTION;
t->mode.dry = false;
+ t->to_process = false;
while (*flag) {
switch(*flag++) {
@@ -609,6 +613,7 @@ int tar_parse_args(struct tar* t, const char *flag, const char **val, int valsiz
}
}
+ t->to_process = true;
tar_dump(t);
return 1;
}
diff --git a/source3/client/clitar_proto.h b/source3/client/clitar_proto.h
index e66c9f9ad8..1069070362 100644
--- a/source3/client/clitar_proto.h
+++ b/source3/client/clitar_proto.h
@@ -28,5 +28,6 @@ int cmd_setmode(void);
int cmd_tar(void);
int process_tar(void);
int tar_parse_args(struct tar *tar, const char *flag, const char **val, int valsize);
+bool tar_to_process(struct tar *tar);
#endif /* _CLITAR_PROTO_H_ */