#include "common.h" /* predeclared */ static String *getdbfiles(void); static int translate(char*, char*, String*, String*); static int lookup(char*, String*, String*, String*); static int compare(String*, char*); static int debug; #define DEBUG if(debug) /* loop through the names to be translated */ void main(int argc, char *argv[]) { String *alias; /* the alias for the name */ char *thissys; /* name of this system */ String *files; /* list of files to search */ int i, rv; ARGBEGIN { case 'd': debug = 1; break; } ARGEND if (chdir(MAILROOT) < 0) { perror("translate(chdir):"); exit(1); } if (chdir("lib") < 0) { perror("translate(chdir):"); exit(1); } /* get environmental info */ thissys = sysname_read(); files = getdbfiles(); alias = s_new(); /* loop through the names to be translated (from standard input) */ for(i=0; i='A' && (c)<='Z' ? (c)-('A'-'a'):(c)) static int compare(String *s1, char *p2) { char *p1 = s_to_c(s1); int rv; DEBUG print("comparing %s to %s\n", p1, p2); while((rv = lower(*p1) - lower(*p2)) == 0) { if (*p1 == '\0') break; p1++; p2++; } return rv; }