/* * uupick() pick files out of uucppublic */ #include #include #include #include #include #include char *sys = ""; char *user; char pu[128]; char cmd[2], dir[100]; char line[100]; #if ATARIST char *kludges(); #else #define kludges gets #endif extern char *basename(); char program[] = "uupick"; char **systems; int syscount=0; main(argc, argv) char **argv; { struct glob_t st; register char *p, *q; register i; while (argc > 1) { --argc, ++argv; if (strcmp(argv[0], "-s") == 0) { sys = argv[1]; ++argv, --argc; } else { printf("Usage: uupick [-s system]\n"); exit(1); } } if ((user=getenv("LOGNAME")) == (char *)0) { printf("uupick: who are you?\n"); exit(2); } if (!getcfg()) exit(3); if ((systems = malloc(sizeof systems[0])) == (char**)0) { fprintf(stderr, "out of memory\n"); exit(1); } if (*sys) { #if GEMDOS sprintf(pu, "%s\\receive\\%s\\%s", PUBLIC, user, sys); #else sprintf(pu, "%s/receive/%s/%s", PUBLIC, user, sys); #endif systems[0] = strdup(pu); syscount=1; } else { #if GEMDOS sprintf(pu, "%s\\receive\\%s\\*.*", PUBLIC, user); #else sprintf(pu, "%s/receive/%s/*.*", PUBLIC, user); #endif for (p=glob(pu, (void*)0); p; p=glob((char*)0, (void*)0)) { systems = realloc(systems, (1+syscount)*sizeof systems[0]); systems[syscount++] = strdup(p); } } for (i=0; i #include char * kludges(s) register char *s; { register char *base=s; register c; while ((c=Crawcin()) != 4 && c != '\r') { if (c == 3) exit(EINVFN); else if (c == 4) break; else if (c == '\b') { if (s > base) { fputs("\b \b", stdout); --s; } else putchar(7); } else if (c == 'X'-'@') { puts("^X"); s = base; } else { *s++ = c; putchar((c >= ' ' && c <= '~') ? c : '?'); } fflush(stdout); } *s = 0; putchar('\n'); return (c=='\r') ? base : (char *)0; } #endif