home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / SHOW.ZIP / SHOW.C < prev    next >
Text File  |  1991-06-24  |  2KB  |  65 lines

  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int fp=1,ix,iy,max;
  6. FILE *fip;
  7. char inbuf[80];
  8. char fns[50][80];
  9.  
  10. int main(int argc, char *argv[])
  11.     { 
  12.     if ( 2>argc ) return printf("please specify the file of file names\n");
  13.     for ( fp=max=1 ; argc>fp ; fp++ )
  14.         {
  15.         fip=fopen(argv[fp],"r");
  16.         if ( NULL==fip ) printf("input file %s failed to open\n",argv[fp]);
  17.         else    
  18.             {
  19.             while ( fgets(inbuf,80,fip) )
  20.                 {
  21.                 for ( ix=0 ; ' '==inbuf[ix] ; ix++ )
  22.                     ;
  23.                 for ( iy=0 ; inbuf[ix] ; ix++,iy++ )
  24.                     {
  25.                     if ( 'a'<=inbuf[ix] && 'z'>=inbuf[ix] ) inbuf[ix]&='\xdf';
  26.                     if ( '\n'==inbuf[ix] )
  27.                         {
  28.                         fns[max][iy]='\0';
  29.                         break;
  30.                         }
  31.                     fns[max][iy]=inbuf[ix];
  32.                     }
  33.                 if ( strlen(fns[max]) ) max++;
  34.                 if ( 50==max ) 
  35.                     {
  36.                     printf("number of files exceeded, set to maximum (50) \n");
  37.                     break;
  38.                     }
  39.                 }
  40.             fclose(fip);
  41.             }
  42.         }
  43.     for ( fp=1 ; fp ; )
  44.         {
  45.         fip=fopen(fns[fp],"r");
  46.         if ( NULL==fip ) printf("Input file %s failed to open\n",fns[fp]);
  47.         else    
  48.             {
  49.             ix=0;
  50.             while ( fgets(inbuf,80,fip) )
  51.                 {
  52.                 printf("%s",inbuf);
  53.                 ix++;
  54.                 }
  55.             fclose(fip);
  56.             for ( ; ix<24 ; ix++ ) printf("\n");
  57.             }
  58.         fgets(inbuf,20,stdin);
  59.         if ( '+'==inbuf[0] && max>(fp+1) ) fp++;
  60.         if ( '-'==inbuf[0] && 1<fp ) fp--;
  61.         if ( 'Q'==inbuf[0] || 'q'==inbuf[0] ) fp=0;
  62.         }
  63.     return 0;
  64.     }
  65.