#!/bin/sh # This is a shar archive. # The rest of this file is a shell script which will extract: # # 3_17a.c 3_17b.c 3_17c.c 3_17d.c 3_17e.c 3_17f1.c 3_17f2.c 3_17f3.c 3_17f4.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 22:58:46 EDT 1990 # echo x - 3_17a.c sed 's/^X//' > 3_17a.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ // Example 1 of indentation styles // Kernighan-Ritchie style #include int main(int, char**) { int a; for (a = 0; a < 4; ) { a++; } if (a > 1) { printf(">1"); } else { printf("<2"); } switch (a) { case 3: printf("3"); break; default: printf("!=3"); break; } do { printf("DW"); } while (a++ < 8); } !EOF! ls -l 3_17a.c echo x - 3_17b.c sed 's/^X//' > 3_17b.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ // Example 2 of indentation styles #include int main(int, char**) { int a; for (a = 0; a < 4; ) { a++; } if (a > 1) { printf(">1"); } else { printf("<2"); } switch (a) { case 3: printf("3"); break; default: printf("!=3"); break; } do { printf("DW"); } while (a++ < 8); } !EOF! ls -l 3_17b.c echo x - 3_17c.c sed 's/^X//' > 3_17c.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ // Example 3 of indentation styles #include int main(int, char**) { int a; for (a = 0; a < 4; ) { a++; } if (a > 1) { printf(">1"); } else { printf("<2"); } switch (a) { case 3: printf("3"); break; default: printf("!=3"); break; } do { printf("DW"); } while (a++ < 8); } !EOF! ls -l 3_17c.c echo x - 3_17d.c sed 's/^X//' > 3_17d.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ int main(int, char**) !EOF! ls -l 3_17d.c echo x - 3_17e.c sed 's/^X//' > 3_17e.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ int main(int, char**) !EOF! ls -l 3_17e.c echo x - 3_17f1.c sed 's/^X//' > 3_17f1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ T* ptr; !EOF! ls -l 3_17f1.c echo x - 3_17f2.c sed 's/^X//' > 3_17f2.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ T *ptr; !EOF! ls -l 3_17f2.c echo x - 3_17f3.c sed 's/^X//' > 3_17f3.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ T* ptr1, ptr2; !EOF! ls -l 3_17f3.c echo x - 3_17f4.c sed 's/^X//' > 3_17f4.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ T *ptr1, *ptr2; !EOF! ls -l 3_17f4.c echo x - makefile sed 's/^X//' > makefile << '!EOF!' CC= CC -I. -I../../CC all: 3_17a 3_17b 3_17c 3_17a: 3_17a.c $(CC) 3_17a.c -o 3_17a 3_17b: 3_17b.c $(CC) 3_17b.c -o 3_17b 3_17c: 3_17c.c $(CC) 3_17c.c -o 3_17c test: all 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