static char *calling_name;
static bool grepable = false;
static char *cmdstr = NULL;
+static const char *cmd_ptr = NULL;
static int io_bufsize = 64512;
char *buf = NULL;
int rc = 0;
- if (next_token_nr_talloc(talloc_tos(), NULL, &buf,NULL)) {
+ if (next_token_talloc(talloc_tos(), &cmd_ptr, &buf,NULL)) {
rc = do_cd(buf);
} else {
d_printf("Current directory is %s\n",client_get_cur_dir());
return 1;
}
- if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
string_replace(buf,'/','\\');
if (*buf == CLI_DIRSEP_CHAR) {
mask = talloc_strdup(ctx, buf + 1);
}
}
- if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
string_replace(buf,'/','\\');
if (*buf == CLI_DIRSEP_CHAR) {
mask = talloc_strdup(ctx, buf);
char *num;
char *data;
- if (!next_token_nr_talloc(ctx, NULL, &num, NULL)
- || !next_token_nr_talloc(ctx, NULL, &data, NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr, &num, NULL)
+ || !next_token_talloc(ctx, &cmd_ptr, &data, NULL)) {
d_printf("echo <num> <data>\n");
return 1;
}
return 1;
}
- if (!next_token_nr_talloc(ctx, NULL,&fname,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&fname,NULL)) {
d_printf("get <filename> [localname]\n");
return 1;
}
return 1;
}
- next_token_nr_talloc(ctx, NULL,&lname,NULL);
+ next_token_talloc(ctx, &cmd_ptr,&lname,NULL);
if (!lname) {
lname = fname;
}
}
close(fd);
- if (!next_token_nr_talloc(ctx,NULL,&fname,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&fname,NULL)) {
d_printf("more <filename>\n");
unlink(lname);
return 1;
abort_mget = false;
- while (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
mget_mask = talloc_strdup(ctx, client_get_cur_dir());
if (!mget_mask) {
return 1;
return 1;
}
- if (!next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
if (!recurse) {
d_printf("mkdir <dirname>\n");
}
return 1;
}
- if (!next_token_nr_talloc(ctx, NULL, &buf, NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
d_printf("altname <file>\n");
return 1;
}
return 1;
}
- if (!next_token_nr_talloc(ctx,NULL,&lname,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&lname,NULL)) {
d_printf("put <filename>\n");
return 1;
}
- if (next_token_nr_talloc(ctx, NULL,&buf,NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
rname = talloc_asprintf_append(rname, buf);
} else {
rname = talloc_asprintf_append(rname, lname);
{
TALLOC_CTX *ctx = talloc_tos();
char *new_fs = NULL;
- next_token_nr_talloc(ctx, NULL,&new_fs,NULL)
+ next_token_talloc(ctx, &cmd_ptr,&new_fs,NULL)
;
if (new_fs) {
client_set_fileselection(new_fs);
TALLOC_CTX *ctx = talloc_tos();
char *p = NULL;
- while (next_token_nr_talloc(ctx, NULL,&p,NULL)) {
+ while (next_token_talloc(ctx, &cmd_ptr,&p,NULL)) {
int ret;
struct file_list *temp_list;
char *quest, *lname, *rname;
char *buf = NULL;
int job;
- if (!next_token_nr_talloc(ctx, NULL, &buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr, &buf,NULL)) {
d_printf("cancel <jobid> ...\n");
return 1;
}
do {
job = atoi(buf);
do_cancel(job);
- } while (next_token_nr_talloc(ctx,NULL,&buf,NULL));
+ } while (next_token_talloc(ctx, &cmd_ptr,&buf,NULL));
return 0;
}
char *rname = NULL;
char *p = NULL;
- if (!next_token_nr_talloc(ctx, NULL, &lname,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr, &lname,NULL)) {
d_printf("print <filename>\n");
return 1;
}
if (!mask) {
return 1;
}
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("del <filename>\n");
return 1;
}
struct cli_state *targetcli;
char *targetname = NULL;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("wdel 0x<attrib> <wcard>\n");
return 1;
}
attribute = (uint16)strtol(buf, (char **)NULL, 16);
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("wdel 0x<attrib> <wcard>\n");
return 1;
}
struct cli_state *targetcli;
int fnum;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("open <filename>\n");
return 1;
}
mode_t mode;
int fnum;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("posix_open <filename> 0<mode>\n");
return 1;
}
return 1;
}
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("posix_open <filename> 0<mode>\n");
return 1;
}
mode_t mode;
int fnum;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("posix_mkdir <filename> 0<mode>\n");
return 1;
}
return 1;
}
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("posix_mkdir <filename> 0<mode>\n");
return 1;
}
char *targetname = NULL;
struct cli_state *targetcli;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("posix_unlink <filename>\n");
return 1;
}
char *targetname = NULL;
struct cli_state *targetcli;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("posix_rmdir <filename>\n");
return 1;
}
char *buf = NULL;
int fnum;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("close <fnum>\n");
return 1;
}
enum brl_type lock_type;
int fnum;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
return 1;
}
fnum = atoi(buf);
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
return 1;
}
return 1;
}
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
return 1;
}
start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("lock <fnum> [r|w] <hex-start> <hex-len>\n");
return 1;
}
SMB_BIG_UINT start, len;
int fnum;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("unlock <fnum> <hex-start> <hex-len>\n");
return 1;
}
fnum = atoi(buf);
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("unlock <fnum> <hex-start> <hex-len>\n");
return 1;
}
start = (SMB_BIG_UINT)strtol(buf, (char **)NULL, 16);
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("unlock <fnum> <hex-start> <hex-len>\n");
return 1;
}
char *targetname = NULL;
struct cli_state *targetcli;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("rmdir <dirname>\n");
return 1;
}
char *targetname = NULL;
struct cli_state *targetcli;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
d_printf("link <oldname> <newname>\n");
return 1;
}
char *targetname = NULL;
struct cli_state *targetcli;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
d_printf("symlink <oldname> <newname>\n");
return 1;
}
struct cli_state *targetcli;
mode_t mode;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
d_printf("chmod mode file\n");
return 1;
}
uint16 num_dir_acls = 0;
uint16 i;
- if (!next_token_nr_talloc(ctx,NULL,&name,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
d_printf("getfacl filename\n");
return 1;
}
SMB_STRUCT_STAT sbuf;
struct tm *lt;
- if (!next_token_nr_talloc(ctx,NULL,&name,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&name,NULL)) {
d_printf("stat file\n");
return 1;
}
struct cli_state *targetcli;
char *targetname = NULL;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf2,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf3,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf3,NULL)) {
d_printf("chown uid gid file\n");
return 1;
}
char *targetsrc;
char *targetdest;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
d_printf("rename <src> <dest>\n");
return 1;
}
struct cli_state *targetcli;
char *targetname;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL) ||
- !next_token_nr_talloc(ctx,NULL,&buf2,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL) ||
+ !next_token_talloc(ctx, &cmd_ptr,&buf2,NULL)) {
d_printf("hardlink <src> <dest>\n");
return 1;
}
bool ok;
SMB_STRUCT_STAT sbuf;
- ok = next_token_nr_talloc(ctx,NULL,&buf,NULL);
+ ok = next_token_talloc(ctx, &cmd_ptr,&buf,NULL);
if (ok && (sys_stat(buf,&sbuf) == 0)) {
newer_than = sbuf.st_mtime;
DEBUG(1,("Getting files newer than %s",
TALLOC_CTX *ctx = talloc_tos();
char *buf;
- if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
archive_level = atoi(buf);
} else {
d_printf("Archive level is %d\n",archive_level);
char *buf;
char *d;
- if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
chdir(buf);
}
d = TALLOC_ARRAY(ctx, char, PATH_MAX+1);
return 1;
}
- if (!next_token_nr_talloc(ctx, NULL, &fname, NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr, &fname, NULL)) {
d_printf("reget <filename>\n");
return 1;
}
}
local_name = fname;
- next_token_nr_talloc(ctx, NULL, &p, NULL);
+ next_token_talloc(ctx, &cmd_ptr, &p, NULL);
if (p) {
local_name = p;
}
return 1;
}
- if (!next_token_nr_talloc(ctx, NULL, &local_name, NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr, &local_name, NULL)) {
d_printf("reput <filename>\n");
return 1;
}
return 1;
}
- if (next_token_nr_talloc(ctx, NULL, &buf, NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) {
remote_name = talloc_asprintf_append(remote_name,
buf);
} else {
TALLOC_CTX *ctx = talloc_tos();
char *buf;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("Current VUID is %d\n", cli->vuid);
return 0;
}
TALLOC_CTX *ctx = talloc_tos();
char *l_username, *l_password;
- if (!next_token_nr_talloc(ctx,NULL,&l_username,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&l_username,NULL)) {
d_printf("logon <username> [<password>]\n");
return 0;
}
- if (!next_token_nr_talloc(ctx,NULL,&l_password,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&l_password,NULL)) {
char *pass = getpass("Password: ");
if (pass) {
l_password = talloc_strdup(ctx,pass);
char *buf;
int iosize;
- if (!next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (!next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
d_printf("iosize <n> or iosize 0x<n>. "
"Minimum is 16384 (0x4000), "
"max is 16776960 (0xFFFF00)\n");
int i=0,j;
char *buf;
- if (next_token_nr_talloc(ctx,NULL,&buf,NULL)) {
+ if (next_token_talloc(ctx, &cmd_ptr,&buf,NULL)) {
if ((i = process_tok(buf)) >= 0)
d_printf("HELP %s:\n\t%s\n\n",
commands[i].name,commands[i].description);
while (cmd[0] != '\0') {
char *line;
- const char *ptr;
char *p;
char *tok;
int i;
}
/* and get the first part of the command */
- ptr = line;
- if (!next_token_nr_talloc(ctx,&ptr,&tok,NULL)) {
+ cmd_ptr = line;
+ if (!next_token_talloc(ctx, &cmd_ptr,&tok,NULL)) {
continue;
}
static int process_stdin(void)
{
- const char *ptr;
int rc = 0;
while (1) {
}
/* and get the first part of the command */
- ptr = line;
- if (!next_token_nr_talloc(frame,&ptr,&tok,NULL)) {
+ cmd_ptr = line;
+ if (!next_token_talloc(frame, &cmd_ptr,&tok,NULL)) {
TALLOC_FREE(frame);
SAFE_FREE(line);
continue;