free(tmp_info);
}
OBJ(if_existing) {
- if (obj->data.ifblock.str
- && !check_contains(obj->data.ifblock.s,
- obj->data.ifblock.str)) {
- DO_JUMP;
- } else if (obj->data.ifblock.s
- && access(obj->data.ifblock.s, F_OK)) {
+ char *spc;
+
+ spc = strchr(obj->data.ifblock.s, ' ');
+ if (!spc && access(obj->data.ifblock.s, F_OK)) {
DO_JUMP;
+ } else if (spc) {
+ *spc = '\0';
+ if (check_contains(obj->data.ifblock.s, spc + 1))
+ DO_JUMP;
+ *spc = ' ';
}
}
OBJ(if_mounted) {
obj->sub = malloc(sizeof(struct text_object));
extract_variable_text_internal(obj->sub, arg);
END OBJ_IF_ARG(if_existing, 0, "if_existing needs an argument or two")
- char buf1[256], buf2[256];
- int r = sscanf(arg, "%255s %255[^\n]", buf1, buf2);
-
- if (r == 1) {
- obj->data.ifblock.s = strndup(buf1, text_buffer_size);
- obj->data.ifblock.str = NULL;
- } else {
- obj->data.ifblock.s = strndup(buf1, text_buffer_size);
- obj->data.ifblock.str = strndup(buf2, text_buffer_size);
- }
- DBGP("if_existing: '%s' '%s'", obj->data.ifblock.s, obj->data.ifblock.str);
+ obj->data.ifblock.s = strndup(arg, text_buffer_size);
END OBJ_IF_ARG(if_mounted, 0, "if_mounted needs an argument")
obj->data.ifblock.s = strndup(arg, text_buffer_size);
#ifdef __linux__
case OBJ_if_mounted:
case OBJ_if_running:
free(data.ifblock.s);
- free(data.ifblock.str);
break;
case OBJ_head:
case OBJ_tail:
break;
case OBJ_if_gw:
free(data.ifblock.s);
- free(data.ifblock.str);
case OBJ_gw_iface:
case OBJ_gw_ip:
free_gateway_info();
break;
case OBJ_if_smapi_bat_installed:
free(data.ifblock.s);
- free(data.ifblock.str);
break;
#endif /* IBM */
#ifdef NVIDIA