home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "config.h"
- #include "support.h"
-
- #define VERDATE " 1.00 (30 Sep 90) "
-
- static char *version20 = "$VER: uupath" VERDATE "\n\r";
-
- void main(int argc, char **argv)
- {
- datum key, path;
- int argcount;
- char *buf;
-
- if(argc == 1)
- {
- fprintf(stdout, "AmigaUUCP Plus: uupath" VERDATE "\n");
- fprintf(stdout, "Usage: uupath system [...]\n");
- exit(0);
- }
-
- if(dbminit(MakeConfigPath(UULIB, "palias")) < 0)
- exit(20);
-
- for(argcount = 1; argcount < argc; argcount++)
- {
- key.dptr = argv[argcount];
- key.dsize = strlen(argv[argcount]) + 1; /* NULL terminated */
-
- path = fetch(key);
- if(path.dptr != NULL)
- {
- buf = malloc(strlen(path.dptr) + 1);
- if(buf != NULL)
- {
- if(strcmp(path.dptr, "%s") == 0)
- {
- }
- else
- {
- strcpy(buf, path.dptr);
- *(buf + strlen(buf) - 3) = '\0'; /* Cut off '!%s' */
-
- fprintf(stdout, "%s\n", buf);
- }
- free(buf);
- }
- else
- {
- fprintf(stderr, "Insufficient free store.\n");
- exit(20);
- }
- }
- else
- {
- fprintf(stdout, "%s: no path found\n", argv[argcount]);
- }
- }
- exit(0);
- }
-