Ignore:
Timestamp:
Aug 17, 2024, 3:15:21 PM (6 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
df2e00f
Parents:
afb15cf
Message:

first attempt changing end-of-file to an exception

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/.expect/copyfile.txt

    rafb15cf r3ac5fd8  
    1010// Created On       : Fri Jun 19 13:44:05 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  5 21:20:07 2023
    13 // Update Count     : 5
     12// Last Modified On : Sat Aug 17 14:18:47 2024
     13// Update Count     : 11
    1414//
    1515
     
    2222
    2323        try {
    24                 choose ( argc ) {
    25                   case 2, 3:
     24                choose ( argc ) {                                                               // terminate if command-line errors
     25                  case 3, 2:
    2626                        open( in, argv[1] );                                            // open input file first as output creates file
    2727                        if ( argc == 3 ) open( out, argv[2] );          // do not create output unless input opens
    2828                  case 1: ;                                                                             // use default files
    29                   default:
     29                  default:                                                                              // wrong number of options
    3030                        exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]";
    3131                } // choose
     
    4141
    4242        char ch;
    43         for () {                                                                                        // read all characters
    44                 in | ch;
    45           if ( eof( in ) ) break;                                                       // eof ?
    46                 out | ch;
    47         } //for
     43        try {
     44                for () {                                                                                // read all characters
     45                        in | ch;
     46                        out | ch;
     47                } // for
     48        } catch( end_of_file * ) {
     49        } // try
    4850} // main
    49 
    50 // Local Variables: //
    51 // tab-width: 4 //
    52 // compile-command: "cfa copyfile.cfa" //
    53 // End: //
Note: See TracChangeset for help on using the changeset viewer.