return(MR_SUCCESS);
}
+
+/* BEGIN KLUDGE
+ special-case `ghal "*" "name"' since Ingres does it slowly */
+
+int get_hostalias(q, argv, cl, action, actarg)
+ struct query *q;
+ char *argv[];
+ client *cl;
+ int (*action)();
+ int actarg;
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ char *alias=argv[0], *machine=argv[1], qual[BUFSIZ], *p;
+ int id;
+ EXEC SQL END DECLARE SECTION;
+
+ for(p=machine; *p; p++) {
+ if(*p=='%' || *p=='_') break;
+ if(*p=='*') {
+ p++;
+ if(*p=='%') p++;
+ }
+ }
+ if(!*p) {
+ /* machine has no wildcards, so we can do it the fast way */
+ EXEC SQL REPEATED SELECT mach_id INTO :id FROM machine
+ WHERE name=:machine;
+ if(ingres_errno) return(mr_errcode);
+
+ sprintf(qual, "a.mach_id = %d AND m.mach_id = %d AND a.name LIKE '%s' ESCAPE '*'", id, id, alias);
+ return do_retrieve(q, qual, 0, action, actarg);
+ }
+
+ /* not the special case... do the normal query */
+ build_qual(q->qual, q->argc, argv, qual);
+ return do_retrieve(q, qual, 0, action, actarg);
+}
+
+/* END KLUDGE */