home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / txtutils.lbr / MS.CZ / MS.C
Encoding:
C/C++ Source or Header  |  1993-10-25  |  640 b   |  39 lines

  1. /* copyright (c) 1982    Peter Baker */
  2.  
  3. /* multiple space from an input file to the standard output */
  4. /* ms -n infile */
  5.  
  6. #include <stdio.h>
  7.  
  8. main( argc, argv )
  9. int argc;
  10. char **argv;
  11. {
  12.     FILE fd;
  13.     int i, n;
  14.     char c;
  15.  
  16.     if( argc != 3 )
  17.     {
  18.         printf( "\nUsage: ms -n infile \n" );
  19.         exit( 1 );
  20.     }
  21.     if( ( fd = fopen( argv[2], "r" ) ) == NULL )
  22.     {
  23.         printf( "\nms can't open %s for reading\n", argv[2] );
  24.         exit( 2 );
  25.     }
  26.     n = atoi( argv[1]+1 );
  27.     while( ( c = getc( fd ) ) != EOF )
  28.     {
  29.         putchar( c );
  30.         if( c == '\n' )
  31.         {
  32.             for( i = 1 ; i < n ; i++ )
  33.                 putchar( '\n' );
  34.         }
  35.     }
  36. }
  37. toi( argv[1]+2 );
  38.         else
  39.