#!/bin/sh # This is a shar archive. # The rest of this file is a shell script which will extract: # # 5_12.c 5_12.cmp 5_12a.c 5_12a.cmp 5_12b.c 5_12b.cmp 5_12c.c makefile # # To extract the files from this shell archive file simply # create a directory for this file, move the archive file # to it and enter the command # # sh filename # # The files will be extracted automatically. # Note: Do not use csh. # # Archive created: Mon Jul 30 23:02:52 EDT 1990 # echo x - 5_12.c sed 's/^X//' > 5_12.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include // bogus class which prints out messages // upon construction and destruction class bogus { public: bogus() { cout << "Initialize\n"; } ~bogus() { cout << "Clean up\n"; } }; bogus y; main() { cout << "Hello, world\n"; return 0; // DELETE } !EOF! ls -l 5_12.c echo x - 5_12.cmp sed 's/^X//' > 5_12.cmp << '!EOF!' Initialize Hello, world Clean up !EOF! ls -l 5_12.cmp echo x - 5_12a.c sed 's/^X//' > 5_12a.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include // bogus class which prints out messages // upon construction and destruction class bogus { public: bogus() { cout << "Initialize\n"; } ~bogus() { cout << "Clean up\n"; } }; ostream &cout2 = cout; #define cout class bogus y; cout2 main() { cout << "Hello, world\n"; return 0; // DELETE } !EOF! ls -l 5_12a.c echo x - 5_12a.cmp sed 's/^X//' > 5_12a.cmp << '!EOF!' Initialize Hello, world Clean up !EOF! ls -l 5_12a.cmp echo x - 5_12b.c sed 's/^X//' > 5_12b.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include main() { cout << "Hello, world\n"; return 0; // DELETE } !EOF! ls -l 5_12b.c echo x - 5_12b.cmp sed 's/^X//' > 5_12b.cmp << '!EOF!' Hello, world !EOF! ls -l 5_12b.cmp echo x - 5_12c.c sed 's/^X//' > 5_12c.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ Initialize Hello, world Clean up !EOF! ls -l 5_12c.c echo x - makefile sed 's/^X//' > makefile << '!EOF!' CC= CC -I. -I../../CC all: 5_12 5_12a 5_12b 5_12: 5_12.c $(CC) 5_12.c -o 5_12 5_12a: 5_12a.c $(CC) 5_12a.c -o 5_12a 5_12b: 5_12b.c $(CC) 5_12b.c -o 5_12b CMP= 5_12.cmp 5_12a.cmp 5_12b.cmp OUT= 5_12.out 5_12a.out 5_12b.out 5_12.out: 5_12 ; 5_12 > 5_12.out 5_12a.out: 5_12a ; 5_12a > 5_12a.out 5_12b.out: 5_12b ; 5_12b > 5_12b.out test: all $(OUT) $(CMP) cmp 5_12.out 5_12.cmp cmp 5_12a.out 5_12a.cmp cmp 5_12b.out 5_12b.cmp echo tests done !EOF! ls -l makefile # The following exit is to ensure that extra garbage # after the end of the shar file will be ignored. exit 0