1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

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>
This commit is contained in:
Aurélien Aptel
2013-07-03 18:18:25 +02:00
committed by Andreas Schneider
parent 2945596011
commit 1d142c6237

View File

@ -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;
}