static int set_petdww_enabled(int value, void *param) { int val = value ? 1 : 0; if (!val) { if (petdww_enabled) { if (petdww_deactivate() < 0) { return -1; } } petdww_enabled = 0; return 0; } else { if (!petdww_enabled) { if (petdww_activate() < 0) { return -1; } } petdww_enabled = 1; return 0; } }
static int set_petdww_filename(const char *name, void *param) { if (petdww_filename != NULL && name != NULL && strcmp(name, petdww_filename) == 0) { return 0; } if (name != NULL && *name != '\0') { if (util_check_filename_access(name) < 0) { return -1; } } if (petdww_enabled) { petdww_deactivate(); util_string_set(&petdww_filename, name); petdww_activate(); } else { util_string_set(&petdww_filename, name); } return 0; }
void petdww_shutdown(void) { petdww_deactivate(); }