http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.16.tar.gz
[xscreensaver] / hacks / glx / engine.c
index f2a956f5438341f0dc1642b5b0e00776bad74a88..4744f3cb58ab8d88b22b38bb1e8b1c97d447b9b2 100644 (file)
@@ -88,10 +88,10 @@ static XrmOptionDescRec opts[] = {
 };
 
 static argtype vars[] = {
-  {(caddr_t *) &which_engine, "engine", "Engine", DEF_ENGINE, t_String},
-  {(caddr_t *) &move,         "move",   "Move",   DEF_WANDER, t_Bool},
-  {(caddr_t *) &spin,         "spin",   "Spin",   DEF_SPIN,   t_Bool},
-  {(caddr_t *) &do_titles,    "titles", "Titles", DEF_TITLES, t_Bool},
+  {&which_engine, "engine", "Engine", DEF_ENGINE, t_String},
+  {&move,         "move",   "Move",   DEF_WANDER, t_Bool},
+  {&spin,         "spin",   "Spin",   DEF_SPIN,   t_Bool},
+  {&do_titles,    "titles", "Titles", DEF_TITLES, t_Bool},
 };
 
 ModeSpecOpt engine_opts = {countof(opts), opts, countof(vars), vars, NULL};
@@ -251,13 +251,18 @@ engine_type engines[] = {
 #define ENG engines[engineType]
 
 /* given a number of cylinders and an included angle, finds matching engine */
-int find_engine(const char *name)
+int
+find_engine(char *name)
 {
   unsigned int i;
+  char *s;
 
   if (!name || !*name || !strcasecmp (name, "(none)"))
     return (random() % countof(engines));
 
+  for (s = name; *s; s++)
+    if (*s == '-' || *s == '_') *s = ' ';
+
   for (i = 0; i < countof(engines); i++) {
     if (!strcasecmp(name, engines[i].engineName))
       return i;