summaryrefslogtreecommitdiffstats
path: root/m_property.c
diff options
context:
space:
mode:
authorulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-26 04:15:56 +0000
committerulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-12-26 04:15:56 +0000
commit2b517dc714c02f654d032e9d68815281a613cafa (patch)
tree4394b60d8a5ba616d83e6d0ec92156dc1c897c97 /m_property.c
parent9e434fa014f57084f3593ae7410429f201c0244b (diff)
downloadmpv-2b517dc714c02f654d032e9d68815281a613cafa.tar.bz2
mpv-2b517dc714c02f654d032e9d68815281a613cafa.tar.xz
Support ?(!NAME:TEXT) format for expanding string by property.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25529 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'm_property.c')
-rw-r--r--m_property.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/m_property.c b/m_property.c
index 2b9b04d4d7..d5e40bcd6c 100644
--- a/m_property.c
+++ b/m_property.c
@@ -146,11 +146,16 @@ char* m_properties_expand_string(m_option_t* prop_list,char* str, void *ctx) {
} else if(str[0] == '?' && str[1] == '(' && (e = strchr(str+2,':'))) {
lvl++;
if(!skip) {
- int pl = e-str-2;
+ int is_not = str[2] == '!';
+ int pl = e - str - (is_not ? 3 : 2);
char pname[pl+1];
- memcpy(pname,str+2,pl);
+ memcpy(pname, str + (is_not ? 3 : 2), pl);
pname[pl] = 0;
- if(m_property_do(prop_list,pname,M_PROPERTY_GET,NULL,ctx) < 0)
+ if(m_property_do(prop_list,pname,M_PROPERTY_GET,NULL,ctx) < 0) {
+ if (!is_not)
+ skip = 1, skip_lvl = lvl;
+ }
+ else if (is_not)
skip = 1, skip_lvl = lvl;
}
str = e+1, l = 0;