diff options
author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2013-07-03 18:18:25 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2014-02-19 18:22:26 +0100 |
commit | 1d142c6237ded9994e4846fccb5c2ea085fb31ee (patch) | |
tree | d0982e03b5a72000889e773b0bc229ce417ee712 /source3/client | |
parent | 2945596011cc31df938692bdbad04e2feaee6fbb (diff) | |
download | samba-1d142c6237ded9994e4846fccb5c2ea085fb31ee.tar.gz samba-1d142c6237ded9994e4846fccb5c2ea085fb31ee.tar.xz samba-1d142c6237ded9994e4846fccb5c2ea085fb31ee.zip |
clitar.c: expand context structure and implement cmd_block()
Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/clitar.c | 81 |
1 files changed, 67 insertions, 14 deletions
diff --git a/source3/client/clitar.c b/source3/client/clitar.c index f28a3c3ed8b..ebf597033f3 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -22,19 +22,52 @@ #include "client/client_proto.h" #include "libsmb/libsmb.h" +/* XXX: used in client.c, we have to export it for now */ char tar_type = 0; +enum tar_type_t { + TAR_INCLUDE, /* I flag, default */ + TAR_INCLUDE_FILE, /* F flag */ + TAR_EXLUDE, /* X flag */ +}; + typedef struct { - /* - size in bytes of a block in the tar file - XXX: obsolete - */ - size_t blocksize; + /* include, include from file, exclude */ + enum tar_type_t type; + + /* size in bytes of a block in the tar file */ + int blocksize; + + /* flags */ + struct { + bool hidden; /* backup hidden file? */ + bool system; /* backup system file? */ + bool incremental; /* backup _only_ archived file? */ + bool reset; /* unset archive bit? */ + bool dry; /* don't write tar file? */ + } mode; + + /* path to tar archive name */ + char *tar_path; + + /* path to file list (F flag) */ + char *list_path } tar_ctx_t; -/* - * samba interactive commands - */ +static tar_ctx_t tar_ctx; + +static void tar_set_default (tar_ctx_t* t) +{ + memset(t, 0, sizeof(*t)); + + t->type = TAR_INCLUDE; + t->blocksize = 20; + t->mode.hidden = True; + t->mode.system = True; + t->mode.incremental = False; + t->mode.dry = False; +} + /**************************************************************************** Blocksize command @@ -42,7 +75,27 @@ Blocksize command int cmd_block(void) { - + /* XXX: from client.c */ + const extern char *cmd_ptr; + char *buf; + int size; + TALLOC_CTX *ctx = talloc_tos(); + + if (!next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) { + DEBUG(0, ("blocksize <n>\n")); + return 1; + } + + size = atoi(buf); + if (size < 0 || size > 65535) { + DEBUG(0, ("blocksize out of range")); + return 1; + } + + tar_ctx.blocksize = size; + DEBUG(2,("blocksize is now %d\n", size)); + + return 0; } /**************************************************************************** @@ -51,7 +104,7 @@ command to set incremental / reset mode int cmd_tarmode(void) { - + return 0; } /**************************************************************************** @@ -60,7 +113,7 @@ Feeble attrib command int cmd_setmode(void) { - + return 0; } @@ -70,7 +123,7 @@ Principal command for creating / extracting int cmd_tar(void) { - + return 0; } /**************************************************************************** @@ -79,7 +132,7 @@ Command line (option) version int process_tar(void) { - + return 0; } /**************************************************************************** @@ -88,5 +141,5 @@ Parse tar arguments. Sets tar_type, tar_excl, etc. int tar_parseargs(int argc, char *argv[], const char *Optarg, int Optind) { - + return 0; } |