search for: strtok_r

Displaying 20 results from an estimated 195 matches for "strtok_r".

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 endmnten...
2000 Sep 24
1
strtok_r() HP-UX
Until I can determine what the issue and background is, you'll need to define _REENTRANT in the latest snapshot so the strtok_r() function prototype is pulled in from <string.h>. This is for HP-UX 11.0; I'm not sure about 10.20.
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 kee...
2011 Nov 22
0
[PATCH] kinit: Add ability to mount filesystems via /etc/fstab or cmdline
...[128] = { 0 }; + char *saveptr = NULL; + char *fs_opts_savedptr = NULL; + int opt_first = 1; + const char *opt; + + if (strncmp(argv[arg_i], "kinit_mount=", 12)) + continue; + /* + * Format: + * <fs_name>;<dir>;<fs_type>;[opt1],[optn...] + */ + fs_name = strtok_r(&argv[arg_i][12], ";", &saveptr); + if (!fs_name) { + fprintf(stderr, "Failed to parse fs_name\n"); + continue; + } + fs_dir = strtok_r(NULL, ";", &saveptr); + if (!fs_dir) { + fprintf(stderr, "Failed to parse fs_dir\n"); + continue; +...
2015 Jun 23
2
[PATCH] daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list.
...uf, sizeof buf, "%s/%s", dirs[i], prog); - if (access (buf, X_OK) == 0) + const char *pathc = getenv ("PATH"); + + if (!pathc) + return 0; + + const char *elem; + char *saveptr; + size_t len = strlen (pathc) + 1; + char path[len]; + strcpy (path, pathc); + + elem = strtok_r (path, ":", &saveptr); + while (elem) { + size_t n = strlen (elem) + strlen (prog) + 2; + char testprog[n]; + + snprintf (testprog, n, "%s/%s", elem, prog); + if (access (testprog, X_OK) == 0) return 1; + + elem = strtok_r (NULL, ":", &sa...
2016 Jan 27
4
[PATCH] lvm: support lvm2 older than 2.02.107
...skip trailing whitespace too. "pvs", I'm looking at you. */ + len = strlen (p)-1; + while (*p && c_isspace (p[len])) + p[len--] = '\0'; + + if (!*p) { /* Empty line? Skip it. */ + skip_line: + p = pend; + continue; + } + + lv_attr = strtok_r (p, ":", &saveptr); + if (!lv_attr) + goto skip_line; + + vg_name = strtok_r (NULL, ":", &saveptr); + if (!vg_name) + goto skip_line; + + lv_name = strtok_r (NULL, ":", &saveptr); + if (!lv_name) + goto skip_line; + + /* Ign...
2010 Nov 05
2
segmentation fault in blazer_status().
...de/bits/string2.h:1063 #1 blazer_status (cmd=<value optimized out>) at blazer.c:214 #2 0x0000000000403abb in upsdrv_updateinfo () at blazer.c:686 #3 0x0000000000406607 in main (argc=<value optimized out>, argv=<value optimized out>) at main.c:625 199| for (i = 0, val = strtok_r(buf+1, " ", &last); status[i].var; i++, val = strtok_r(NULL, " \r\n", &last)) { 200| 201| if (!val) { 202| upsdebugx(2, "%s: parsing failed", __func__); 203| return -1; 204| } 205|...
2001 Jun 07
0
Patch for systems with no setreuid()
...t getusershell glob inet_aton inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv setegid seteuid setlogin setproctitle setresgid setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop +for ac_func in arc4random atexit b64_ntop bcopy bindresvport_sa clock fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent getusershell glob inet_aton inet...
2012 Mar 08
3
[PATCH 0/3] kinit: Allow mount options
This patch series allows user-specified mount commands to be sent in via kernel command line ("kinit_mount=...") or via an embedded /etc/fstab file. The first patch is a cleanup of a patch sent last November by San Mehat (http://web.archiveorange.com/archive/v/EazJNBMORV2U7E0coh5h); the next two are small improvements or bug fixes.
2019 Nov 26
0
[PATCH common v2 1/3] options: Simplify selector parsing for --key options.
...G_LIST char **fields = + guestfs_int_split_string (':', selector); struct key_store_key key; - if (!selector) - error (EXIT_FAILURE, errno, "strdup"); + if (!fields) + error (EXIT_FAILURE, errno, "guestfs_int_split_string"); - /* 1: device */ - elem = strtok_r (selector, ":", &saveptr); - if (!elem) { + if (guestfs_int_count_strings (fields) != 3) { invalid_selector: - error (EXIT_FAILURE, 0, "invalid selector for --key: %s", selector_orig); + error (EXIT_FAILURE, 0, "invalid selector for --key: %s", selector...
2017 Mar 22
1
[PATCH v2] inspect: improve detection of Mageia install discs
...g, struct inspect_fs *fs, + const char *filename) +{ + CLEANUP_FREE char *line = NULL; + const char *elem; + char *saveptr; + + fs->type = OS_TYPE_LINUX; + + line = guestfs_int_first_line_of_file (g, filename); + if (line == NULL) + return -1; + + elem = strtok_r (line, ",", &saveptr); + while (elem) { + const char *equal = strchr (elem, '='); + if (equal == NULL || equal == elem) + return -1; + + const char *value = equal + 1; + + if (STRPREFIX (elem, "distribution=")) { + if (STREQ (value, "Magei...
2017 Mar 22
2
[PATCH] inspect: improve detection of Mageia install discs
...*/ + return -1; + if (size > MAX_SMALL_FILE_SIZE) { + error (g, _("size of %s is unreasonably large (%" PRIi64 " bytes)"), + filename, size); + return -1; + } + + lines = guestfs_head_n (g, 1, filename); + if (lines == NULL) + return -1; + + elem = strtok_r (lines[0], ",", &saveptr); + while (elem) { + const char *equal = strchr (elem, '='); + if (equal == NULL || equal == elem) + return -1; + + const char *value = equal + 1; + + if (STRPREFIX (elem, "distribution=")) { + if (STREQ (value, "M...
2016 Jan 28
0
[PATCH v2] lvm: support lvm2 older than 2.02.107
...skip trailing whitespace too. "pvs", I'm looking at you. */ + len = strlen (p)-1; + while (*p && c_isspace (p[len])) + p[len--] = '\0'; + + if (!*p) { /* Empty line? Skip it. */ + skip_line: + p = pend; + continue; + } + + lv_attr = strtok_r (p, ":", &saveptr); + if (!lv_attr) + goto skip_line; + + vg_name = strtok_r (NULL, ":", &saveptr); + if (!vg_name) + goto skip_line; + + lv_name = strtok_r (NULL, ":", &saveptr); + if (!lv_name) + goto skip_line; + + /* Ign...
2019 Nov 12
0
[PATCH 2/2] options: Allow multiple --key parameters and default keys.
...G_LIST char **fields = + guestfs_int_split_string (':', selector); struct key_store_key key; - if (!selector) - error (EXIT_FAILURE, errno, "strdup"); + if (!fields) + error (EXIT_FAILURE, errno, "guestfs_int_split_string"); - /* 1: device */ - elem = strtok_r (selector, ":", &saveptr); - if (!elem) { + if (guestfs_int_count_strings (fields) != 3) { invalid_selector: - error (EXIT_FAILURE, 0, "invalid selector for --key: %s", selector_orig); + error (EXIT_FAILURE, 0, "invalid selector for --key: %s", selector...
2015 Jun 23
0
Re: [PATCH] daemon: Rewrite prog_exists so it uses the actual PATH, not hard-coded list.
...access (buf, X_OK) == 0) > + const char *pathc = getenv ("PATH"); > + > + if (!pathc) > + return 0; > + > + const char *elem; > + char *saveptr; > + size_t len = strlen (pathc) + 1; > + char path[len]; > + strcpy (path, pathc); > + > + elem = strtok_r (path, ":", &saveptr); > + while (elem) { > + size_t n = strlen (elem) + strlen (prog) + 2; > + char testprog[n]; > + > + snprintf (testprog, n, "%s/%s", elem, prog); > + if (access (testprog, X_OK) == 0) > return 1; > + > +...
2001 May 22
1
[PATCH]: configure.in: Missing check for setvbuf
...t getusershell glob inet_aton inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv setegid seteuid setlogin setproctitle setresgid setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf tcgetpgrp utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop) +AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock fchown fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent getusershell glob inet_aton ine...
2017 Jul 14
0
[PATCH 14/27] daemon: Reimplement ‘lvs’ API in OCaml.
...skip trailing whitespace too. "pvs", I'm looking at you. */ - len = strlen (p)-1; - while (*p && c_isspace (p[len])) - p[len--] = '\0'; - - if (!*p) { /* Empty line? Skip it. */ - skip_line: - p = pend; - continue; - } - - lv_attr = strtok_r (p, ":", &saveptr); - if (!lv_attr) - goto skip_line; - - vg_name = strtok_r (NULL, ":", &saveptr); - if (!vg_name) - goto skip_line; - - lv_name = strtok_r (NULL, ":", &saveptr); - if (!lv_name) - goto skip_line; - - /* Ign...
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 li...
2017 Mar 22
0
Re: [PATCH] inspect: improve detection of Mageia install discs
...quot; PRIi64 " bytes)"), > + filename, size); > + 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 ? > + elem = strtok_r (lines[0], ",", &saveptr); You can probably use strtok here [I think?] if it's simpler. Rich. > + while (elem) { > + const char *equal = strchr (elem, '='); > + if (equal == NULL || equal == elem) > + return -1; > + > + const char *value...
2019 Nov 12
4
[PATCH 1/2] options: Fixes and enhancements to --key parsing.
The first patch fixes a rather serious bug, the second patch allows multiple --key parameters and default parameters. There is a third patch to libguestfs which adds a test, coming up. I did not yet review and fix the documentation. I think we need to centralize it in one place because at the moment the same documentation for --key is copy/pasted all over the tools. Rich.