Displaying 20 results from an estimated 127 matches for "strtok".
Did you mean:
strtol
2000 Feb 04
0
Patch that allows equal sign in options
...Universitaetsstr.10, 78457 Konstanz, Germany
Phone: +49 7531 88 3814
=============================================================================
--- readconf.c.orig Mon Dec 6 01:47:29 1999
+++ readconf.c Thu Feb 3 22:37:54 2000
@@ -156,6 +156,7 @@
/* Characters considered whitespace in strtok calls. */
#define WHITESPACE " \t\r\n"
+#define WHITESPACE_EQ " \t\r\n="
/*
@@ -237,7 +238,7 @@
return 0;
/* Get the keyword. (Each line is supposed to begin with a keyword). */
- cp = strtok(cp, WHITESPACE);
+ cp = strtok(cp, WHITESPACE_EQ);
opcode = parse_token(...
2007 Oct 25
2
Using strtok via win32/api
Hi all,
I''m having a little trouble with strtok:
require ''win32/api''
include Win32
strtok = API.new(''strtok'', ''PP, ''P'', ''msvcrt'')
string = "A string\tof ,,tokens\nand some more tokens";
seps = " ,\t\n";
puts "Tokens:"
token = strt...
2000 Jul 05
1
OpenSSH-2.1.1p2: Is this misuse of strtok?
Is this a misuse of strtok() in OpenSSH-2.1.1p2?
readconf.c:process_config_line() calls strtok() to
parse config lines. When it finds oProtocol it calls
compat.c:proto_spec() which in turns uses strtok().
However on return of proto_spec(), process_config_line() calls
strtok() once more to (quoting from the source code)
/...
2007 Jan 19
1
Re: [nut-commits] svn commit r755 - in trunk: . clients
...; - char tmp[SMALLBUF], *s;
> + char *s, tmp[SMALLBUF];
>
> /* paranoia */
> if ((!buf) || (!upsname) || (!hostname) || (!port))
> return -1;
>
> - snprintf(tmp, sizeof(tmp), "%s", buf);
> -
> - /* split at the '@' character */
> - if ((s = strtok(tmp, "@")) == NULL)
> + if (snprintf(tmp, SMALLBUF, "%s", buf) < 1)
> {
> - fprintf(stderr, "upscli_splitname: no UPS name specified (upsname@hostname)\n");
> + fprintf(stderr, "upscli_splitname: can't parse empty string\n");
> re...
2011 Jan 26
1
[nut-commits] svn commit r2853 - in branches/windows_port: drivers include
...> --- branches/windows_port/include/wincompat.h Wed Jan 26 15:05:16
> 2011 (r2852)
> +++ branches/windows_port/include/wincompat.h Wed Jan 26 15:16:09
> 2011 (r2853)
> @@ -28,6 +28,7 @@
> #include "common.h"
>
> #define sleep(n) Sleep(1000 * n)
> +#define strtok_r(a,b,c) strtok(a,b)
>
> /* Network compatibility */
You probably want to use
> +#define strtok_r(a,b,c) strtok_s(a,b,c)
here. I'm not sure that never tokenize multiple strings at the same
time (in which case using strtok() would severely break).
Best regards, Arjen
--
Please k...
2003 Jan 16
3
unsafe_symlink change (Re: CVS update: rsync)
The patch from 2-1/2 years ago for changing copy-unsafe-links to follow
unsafe links on the destination side also included essentially this patch.
When I looked at it, however, I asked why in the world is unsafe_symlink()
doing strdup() in the first place. I think you could get rid of the
calls to strdup() and the new local variables and possibly do a couple
casts inside the function instead.
-
2017 Mar 22
1
Re: [PATCH] inspect: improve detection of Mageia install discs
...return -1;
> > + }
> > +
> > + lines = guestfs_head_n (g, 1, filename);
> > + if (lines == NULL)
> > + return -1;
>
> Could the above code be replaced by a call to
> guestfs_int_first_line_of_file ?
Indeed, good catch -- thanks!
> > + elem = strtok_r (lines[0], ",", &saveptr);
>
> You can probably use strtok here [I think?] if it's simpler.
I'd maybe if this was in the daemon, which runs single-threaded.
OTOH, using a non-reentrant strtok in the library might cause conflicts
with multithreaded applications using...
2008 Sep 07
1
[git pull v2] initial mntent.h, mount features, ipconfig fixes
[ gsi.de pretends this is massmailing so removed from CC's ]
hello hpa,
please review and on ack merge belows patchset.
changes from v1, thanks to review by kzak:
* add strtok_r()
* use it in getmntent_r()
* getment_r() parses mnt_freq and mnt_passno too
isn't that hard.
thanks
maks
git pull git://git.debian.org/~maks/klibc.git maks
for the changes:
maximilian attems (9):
[klibc] add strtok_r()
[klibc] Add initial mntent.h with setmntent() and endmnt...
2013 Sep 24
1
[PATCH 1/1] com32: hdt: fix memory leak
The dynamically alloc'd string to protect from strtok modification
has not been free'd on start_auto_mode() function
Signed-off-by: Felipe Pena <felipensp at gmail.com>
---
com32/hdt/hdt-cli.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/com32/hdt/hdt-cli.c b/com32/hdt/hdt-cli.c
index 7542da8..6c5baf1 100644
--- a/com32/hdt/hdt-c...
2006 Feb 01
1
[Bug 437] New: restore can segfaults when restoring corrupt policy counters
...egfault.
diff -uNr iptables-1.3.5.org/ip6tables-restore.c iptables-1.3.5/ip6tables-restore.c
--- iptables-1.3.5.org/ip6tables-restore.c 2005-06-24 18:34:19.000000000 +0200
+++ iptables-1.3.5/ip6tables-restore.c 2006-02-01 23:47:04.000000000 +0100
@@ -266,7 +266,10 @@
char *ctrs;
ctrs = strtok(NULL, " \t\n");
- parse_counters(ctrs, &count);
+ if (!ctrs || !parse_counters(ctrs, &count))
+ exit_error(PARAMETER_PROBLEM,
+ "invalid policy counters "
+ "for chain '%s'\n", chain);
} else {
memset(&c...
2003 Feb 12
2
rsync & ldap authentication
...and slow algorithm. null terminates
the result.
@@ -78,9 +83,23 @@
STRUCT_STAT st;
int ok = 1;
extern int am_root;
+ char *users, *tok;
if (!fname || !*fname) return 0;
+ /* this code was in auth_server() */
+ users = strdup(lp_auth_users(module));
+ if (!users) return 0;
+
+ for (tok=strtok(users," ,\t"); tok; tok = strtok(NULL," ,\t")) {
+ if (strcmp(tok, user) == 0) break;
+ }
+ free(users);
+
+ if (!tok) {
+ return 0;
+ }
+
fd = open(fname,O_RDONLY);
if (fd == -1) return 0;
@@ -132,6 +151,84 @@
return 1;
}
+#ifdef WITH_LDAP
+/* return the secret for...
2003 May 03
0
Storing rsync secrets in LDAP
...79,9 +84,23 @@
STRUCT_STAT st;
int ok = 1;
extern int am_root;
+ char *users, *tok;
if (!fname || !*fname) return 0;
+ /* this code was in auth_server() */
+ users = strdup(lp_auth_users(module));
+ if (!users) return 0;
+
+ for (tok=strtok(users," ,\t"); tok; tok = strtok(NULL," ,\t")) {
+ if (fnmatch(tok, user, 0) == 0) break;
+ }
+ free(users);
+
+ if (!tok) {
+ return 0;
+ }
+
fd = open(fname,O_RDONLY);
if (fd == -1) return 0;
@@ -133,6 +152,...
2000 Jan 30
0
More checks for param/loadparm.c
...s a pstring global, with the DOS_STRING attribute.
> ***************************************************************************/
> static BOOL handle_netbios_aliases(char *pszParmValue, char **parm_ptr) {
> char *p;
> pstring buf;
>
> *buf = '\0';
> for (p=strtok(pszParmValue, " \t"); p != NULL; p=strtok(NULL," \t")) {
> if (validate_netbios_name(p) == False)
> return False;
> pstrcat(buf,p);
> pstrcat(buf," ");
> }
> buf[MIN(strlen(buf)-1,sizeof(buf))] = '\0';
>
&g...
2003 Jul 05
2
Unhelpful error message when matching hosts in access list [PATCH]
...n(s);
+
+ return ((strspn(s, ".0123456789") == len)
+#ifdef INET6
+ || (strspn(s, ":0123456789ABCDEFabcdef") == len)
+#endif
+ );
+}
+
static int access_match(char *list, char *addr, char *host)
{
char *tok;
@@ -203,7 +218,9 @@
if (host) strlower(host);
for (tok=strtok(list2," ,\t"); tok; tok=strtok(NULL," ,\t")) {
- if (match_hostname(host, tok) || match_address(addr, tok)) {
+ if (match_hostname(host, tok)
+ || (likely_address(tok)
+ && match_address(addr, tok))) {
free(list2);
return 1;
}
2002 May 07
0
Fixing exclude/exclude wildcard handling
...(char *host, char *tok)
{
if (!host || !*host) return 0;
- return (fnmatch(tok, host, 0) == 0);
+ return wildmat(host, tok);
}
Index: authenticate.c
--- authenticate.c 2002/01/24 02:33:45 1.19
+++ authenticate.c 2002/05/08 04:19:50
@@ -239,7 +239,7 @@
if (!users) return NULL;
for (tok=strtok(users," ,\t"); tok; tok = strtok(NULL," ,\t")) {
- if (fnmatch(tok, user, 0) == 0) break;
+ if (wildmat(user, tok)) break;
}
free(users);
Index: exclude.c
--- exclude.c 2002/04/11 02:25:53 1.44
+++ exclude.c 2002/05/08 04:19:50
@@ -55,18 +55,7 @@
if (!ret->pattern)...
2000 Jan 13
2
sshd doesn't set SSH_AUTH_RHOSTS as supported authentication
...lt; SSH_AUTH_RHOSTS_RSA;
if (options.rsa_authentication)
auth_mask |= 1 << SSH_AUTH_RSA;
Now, in servconf.c, options.rhosts_authentication is set to 0 if
IgnoreRhosts is no:
case sIgnoreRhosts:
intptr = &options->ignore_rhosts;
parse_flag:
cp = strtok(NULL, WHITESPACE);
fprintf(stderr, "sIgnoreRhosts triggered as %s\n", cp);
if (!cp) {
fprintf(stderr, "%s line %d: missing yes/no argument.\n",
filename, linenum);
exit(1);
}
if (strcmp(cp, "yes") == 0)
value =...
1997 May 26
1
an anti-overflow wrapper
...;'))) {
syntax("Long line.");
exit(1);
}
*s = ''\0'';
/* ignore leading whitespace */
for(s = buff; *s && isspace(*s); s++)
;
if(*s == ''\0'' || *s == ''#'')
continue;
if(!(s = strtok(s, " \t"))) {
syntax("Syntax error.");
exit(1);
}
if(!strcmp(s, REALPROG)) {
if(!(s = strtok(NULL, " \t")) || !(t = strtok(NULL, " \t"))) {
syntax("Syntax error.");
exit(1);
}
len = strtoul(t, NULL, 0);...
2011 Jan 11
0
[PATCH, v2]: xl: move domain struct init functions to libxl
...*) realloc(d_config->vifs, sizeof (libxl_device_nic) * (d_config->num_vifs+1));
nic = d_config->vifs + d_config->num_vifs;
- init_nic_info(nic, d_config->num_vifs);
+ CHK_ERRNO( libxl_device_nic_init(nic, d_config->num_vifs) );
p = strtok(buf2, ",");
if (!p)
@@ -981,7 +835,7 @@ skip:
d_config->vif2s = realloc(d_config->vif2s, sizeof (libxl_device_net2) * (d_config->num_vif2s + 1));
net2 = d_config->vif2s + d_config->num_vif2s;
- init_net2_info(net2, d_confi...
2004 May 29
1
[patch] Filename conversion
...+
+/**
+ * Splits cmd on spaces.
+ */
+static void split_on_spaces(char* cmd, char** parts) {
+ int nparts=0;
+ char *tok;
+ char *cmd2 = strdup(cmd);
+ if (!cmd2) {
+ rprintf(FERROR, "Out of memory while parsing filename filter %s\n", cmd);
+ exit_cleanup(RERR_MALLOC);
+ }
+
+ for (tok=strtok(cmd2," ");tok;tok=strtok(NULL," ")) {
+ if (nparts>=MAX_ARGS) {
+ rprintf(FERROR, "Filename conversion command is too long: %s\n", cmd);
+ exit_cleanup(RERR_SYNTAX);
+ }
+ parts[nparts++] = tok;
+ }
+ parts[nparts] = NULL;
+}
+
+
+/**
+ * Runs the filename co...
2000 Jul 13
2
[PATCH] OpenSSH 2.1.1pl3 (portable), readconf.c and strsep(3)
The latest changes (replacing strtok with strsep) in OpenSSH's readconf.c
broke many ~/.ssh/config files. Actually those which uses more than one
whitespace character to separate keyword and value.
For instance my ~/.ssh/config file reads:
| BatchMode no
| Compression yes
| CompressionLevel 3
| FallBac...