+#ifdef HAVE_CGI
+static struct interpreter *uh_interpreters = NULL;
+
+struct interpreter * uh_interpreter_add(const char *extn, const char *path)
+{
+ struct interpreter *new = NULL;
+
+ if( (new = (struct interpreter *)
+ malloc(sizeof(struct interpreter))) != NULL )
+ {
+ memset(new, 0, sizeof(struct interpreter));
+
+ memcpy(new->extn, extn, min(strlen(extn), sizeof(new->extn)-1));
+ memcpy(new->path, path, min(strlen(path), sizeof(new->path)-1));
+
+ new->next = uh_interpreters;
+ uh_interpreters = new;
+
+ return new;
+ }
+
+ return NULL;
+}
+
+struct interpreter * uh_interpreter_lookup(const char *path)
+{
+ struct interpreter *cur = NULL;
+ const char *e;
+
+ for( cur = uh_interpreters; cur; cur = cur->next )
+ {
+ e = &path[max(strlen(path) - strlen(cur->extn), 0)];
+
+ if( !strcmp(e, cur->extn) )
+ return cur;
+ }
+
+ return NULL;
+}
+#endif