Index: fvwm/conditional.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/conditional.c,v retrieving revision 1.119 diff -u -r1.119 conditional.c --- fvwm/conditional.c 27 Jan 2007 11:33:15 -0000 1.119 +++ fvwm/conditional.c 9 Mar 2007 20:23:14 -0000 @@ -2085,6 +2085,202 @@ error = 1; } } + else if (StrEquals(cond, "EnvGreaterOrEqual")) + { + char *var_name; + flags_ptr = GetNextSimpleOption(flags_ptr, &var_name); + if (var_name) + { + const char *value = getenv(var_name); + char *pattern; + /* unfortunately, GetNextSimpleOption is + * broken, does not accept quoted empty "" */ + flags_ptr = GetNextSimpleOption( + flags_ptr, &pattern); + if (!value) + { + value = ""; + } + if (pattern) + { + match = + /* include empty string case */ + (!pattern[0] && !value[0]) + || + (atoi(value) >= atoi(pattern)); + } + else + { + error = 1; + } + } + else + { + error = 1; + } + } + else if (StrEquals(cond, "EnvGreater")) + { + char *var_name; + flags_ptr = GetNextSimpleOption(flags_ptr, &var_name); + if (var_name) + { + const char *value = getenv(var_name); + char *pattern; + /* unfortunately, GetNextSimpleOption is + * broken, does not accept quoted empty "" */ + flags_ptr = GetNextSimpleOption( + flags_ptr, &pattern); + if (!value) + { + value = ""; + } + if (pattern) + { + match = + /* include empty string case */ + (!pattern[0] && !value[0]) + || + (atoi(value) > atoi(pattern)); + } + else + { + error = 1; + } + } + else + { + error = 1; + } + } + else if (StrEquals(cond, "EnvLesser")) + { + char *var_name; + flags_ptr = GetNextSimpleOption(flags_ptr, &var_name); + if (var_name) + { + const char *value = getenv(var_name); + char *pattern; + /* unfortunately, GetNextSimpleOption is + * broken, does not accept quoted empty "" */ + flags_ptr = GetNextSimpleOption( + flags_ptr, &pattern); + if (!value) + { + value = ""; + } + if (pattern) + { + match = + /* include empty string case */ + (!pattern[0] && !value[0]) + || + (atoi(value) < atoi(pattern)); + } + else + { + error = 1; + } + } + else + { + error = 1; + } + } + else if (StrEquals(cond, "EnvLesserOrEqual")) + { + char *var_name; + flags_ptr = GetNextSimpleOption(flags_ptr, &var_name); + if (var_name) + { + const char *value = getenv(var_name); + char *pattern; + /* unfortunately, GetNextSimpleOption is + * broken, does not accept quoted empty "" */ + flags_ptr = GetNextSimpleOption( + flags_ptr, &pattern); + if (!value) + { + value = ""; + } + if (pattern) + { + match = + /* include empty string case */ + (!pattern[0] && !value[0]) + || + (atoi(value) <= atoi(pattern)); + } + else + { + error = 1; + } + } + else + { + error = 1; + } + } + else if (StrEquals(cond, "Compare")) + { + char *var_name; + flags_ptr = GetNextSimpleOption(flags_ptr, &var_name); + if (var_name) + { + const char *value = getenv(var_name); + char *operation; + char *pattern; + /* unfortunately, GetNextSimpleOption is + * broken, does not accept quoted empty "" */ + flags_ptr = GetNextSimpleOption( + flags_ptr, &operation); + flags_ptr = GetNextSimpleOption( + flags_ptr, &pattern); + if (!value) + { + value = ""; + } + if (operation && pattern) + { + if (strcmp(operation,">=") == 0) + { + match = (atoi(value) >= atoi(pattern)); + } + else + if (strcmp(operation,">") == 0) + { + match = (atoi(value) > atoi(pattern)); + } + else + if (strcmp(operation,"==") == 0) + { + match = (atoi(value) == atoi(pattern)); + } + else + if (strcmp(operation,"<") == 0) + { + match = (atoi(value) < atoi(pattern)); + } + else + if (strcmp(operation,"<=") == 0) + { + match = (atoi(value) <= atoi(pattern)); + } + else + { + match = (!pattern[0] && !value[0]); + } + } + else + { + error = 1; + } + } + else + { + error = 1; + } + } else if (StrEquals(cond, "EdgeIsActive")) { direction_t dir= DIR_NONE; Index: fvwm/fvwm.1.in =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.1.in,v retrieving revision 1.251 diff -u -r1.251 fvwm.1.in --- fvwm/fvwm.1.in 4 Feb 2007 20:25:30 -0000 1.251 +++ fvwm/fvwm.1.in 9 Mar 2007 20:23:32 -0000 @@ -11082,6 +11082,11 @@ .IR "Version operator x.y.z" , .IR "EnvIsSet varname" , .IR "EnvMatch varname pattern" , +.IR "EnvLesser varname pattern" , +.IR "EnvLesserOrEqual varname pattern" , +.IR "EnvGreaterOrEqual varname pattern" , +.IR "EnvGreater varname pattern" , +.IR "Compare varname operator pattern" , .IR "EdgeHasPointer direction" , .IR "EdgeIsActive direction" , .IR Start , @@ -11126,6 +11131,37 @@ .I pattern matches the given environment variable value. The pattern may contain special "*" and "?" chars. +The +.I "EnvGreaterOrEqual varname pattern" +test-condition is true if +.I pattern +matches or is greater than the given environment variable value. +The +.I "EnvGreater varname pattern" +test-condition is true if +.I pattern +is greater than the given environment variable value. +The +.I "EnvLesser varname pattern" +test-condition is true if +.I pattern +is lesser than the given environment variable value. +The +.I "EnvLesserOrEqual varname pattern" +test-condition is true if +.I pattern +matches or is lesser than the given environment variable value. + +The +.IB "Compare varname operator pattern " +test-condition is true if the logical operation defined by +.IB "varname", +.IB "operator " +and +.IB "pattern " +is true. Where +.IB "operator " +is one of >=, >, ==, <=, <. The .IB "EdgeHasPointer " [ direction ]