/* -*-c,save-*- */ /* * USQMAIN.C - USQ main line * Robert Heller. Created: Sat Nov 8, 1986 18:19:30.22 * Last Mod: * */ #include #define ERROR -1 #define CPM68K /* CPM68K - *RPH* */ #ifdef CPM68K #define VERSION "3.3A (CP/M-68K) Nov 8, 1986" #define void int #else #define VERSION "3.3 12/13/85" #endif /* This must follow all include files */ unsigned int dispcnt; /* How much of each file to preview */ char ffflag; /* should formfeed separate preview from different files */ main(argc, argv) int argc; char *argv[]; { void obey(); int i,c; char inparg[16]; /* parameter from input */ dispcnt = 0; /* Not in preview mode */ printf("File unsqueezer version %s (original author: R. Greenlaw)\n\n", VERSION); /* Process the parameters in order */ for(i = 1; i < argc; ++i) obey(argv[i]); if(argc < 2) { printf("Enter file names, one line at a time, or type to quit."); do { printf("\n*"); for(i = 0; i < 16; ++i) { if((c = getchar()) == EOF) c = '\n'; /* force empty (exit) command */ if((inparg[i] = c) == '\n') { inparg[i] = '\0'; break; } } if(inparg[0] != '\0') obey(inparg); } while(inparg[0] != '\0'); } } /* eject^Leject */ void obey(p) char *p; { void unsqueeze(); char *q; if(*p == '-') { if(ffflag = ((*(p+1) == 'F') || (*(p+1) == 'f'))) ++p; /* Set number of lines of each file to view */ dispcnt = 65535; /* default */ if(*(p+1)) if((dispcnt = atoi(p + 1)) == 0) printf("\nBAD COUNT %s", p + 1); return; } /* Check for ambiguous (wild-card) name */ for(q = p; *q != '\0'; ++q) if(*q == '*' || *q == '?') { printf("\nCan't accept ambiguous name %s", p); return; } unsqueeze(p); }