]> git.ipfire.org Git - thirdparty/asterisk.git/commit
utils: Create ast_strsep function that ignores separators inside quotes
authorGeorge Joseph <george.joseph@fairview5.com>
Thu, 18 Sep 2014 19:23:39 +0000 (19:23 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Thu, 18 Sep 2014 19:23:39 +0000 (19:23 +0000)
commitad8ef9175ad92f90d5ad1c8429fc71d791dae42f
treed2b7961aca136b4db7de7bde117a0a86743efc07
parentde72f3edbc6385a5ff438484a6b31d5548de1caf
utils: Create ast_strsep function that ignores separators inside quotes

This function acts like strsep with three exceptions...
* The separator is a single character instead of a string.
* Separators inside quotes are treated literally instead of like separators.
* You can elect to have leading and trailing whitespace and quotes
stripped from the result and have '\' sequences unescaped.

Like strsep, ast_strsep maintains no internal state and you can call it
recursively using different separators on the same storage.

Also like strsep, for consistent results, consecutive separators are not
collapsed so you may get an empty string as a valid result.

Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3989/
........

Merged revisions 423476 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 423478 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@423480 65c4cc65-6c06-0410-ace0-fbb531ad65f3
include/asterisk/strings.h
main/utils.c
tests/test_strings.c