#!/bin/sh # This is a shar archive. # The rest of this file is a shell script which will extract: # # 4_5a.c 4_5a0.c 4_5b.c 4_5b0.c 4_5b1.c 4_5c.c 4_5c0.c 4_5d.c 4_5e1.c 4_5e2.c 4_5f1.c 4_5f2.c 4_5g1.c 4_5g2.c 4_5h1.c 4_5h2.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:01:42 EDT 1990 # echo x - 4_5a.c sed 's/^X//' > 4_5a.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ const int BUFSIZ = 1024; const int EOF = -1; !EOF! ls -l 4_5a.c echo x - 4_5a0.c sed 's/^X//' > 4_5a0.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #define BUFSIZ 1024 #define EOF -1 !EOF! ls -l 4_5a0.c echo x - 4_5b.c sed 's/^X//' > 4_5b.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ struct FILE { ... }; !EOF! ls -l 4_5b.c echo x - 4_5b0.c sed 's/^X//' > 4_5b0.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #define FILE struct _iobuf !EOF! ls -l 4_5b0.c echo x - 4_5b1.c sed 's/^X//' > 4_5b1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ typedef struct _iobuf FILE; !EOF! ls -l 4_5b1.c echo x - 4_5c.c sed 's/^X//' > 4_5c.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ inline int getc(FILE *p) { return --p->_cnt >= 0 ? *p->_ptr++ & 0377 : _filbuf(p); } inline int getchar() { return getc(stdin); } inline int fileno(FILE *p) { return p->_file; } !EOF! ls -l 4_5c.c echo x - 4_5c0.c sed 's/^X//' > 4_5c0.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #define getc(p) (--(p)->_cnt < 0 ? \ _filbuf(p) : \ (int) *(p)->_ptr++) #define getchar() getc(stdin) #define fileno(p) (p)->_file !EOF! ls -l 4_5c0.c echo x - 4_5d.c sed 's/^X//' > 4_5d.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ extern FILE* fopen(const char*, const char*); extern char* fgets(char*, int, FILE*); extern int fprintf(FILE*, const char* ...); !EOF! ls -l 4_5d.c echo x - 4_5e1.c sed 's/^X//' > 4_5e1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ main(argc, argv) int argc; char **argv; !EOF! ls -l 4_5e1.c echo x - 4_5e2.c sed 's/^X//' > 4_5e2.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ main(int argc, char **argv) !EOF! ls -l 4_5e2.c echo x - 4_5f1.c sed 's/^X//' > 4_5f1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ extern char *malloc(); int *x = (int *) malloc(sizeof(int) * 40); !EOF! ls -l 4_5f1.c echo x - 4_5f2.c sed 's/^X//' > 4_5f2.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ int *x = new int[40]; !EOF! ls -l 4_5f2.c echo x - 4_5g1.c sed 's/^X//' > 4_5g1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ free((char*) x); !EOF! ls -l 4_5g1.c echo x - 4_5g2.c sed 's/^X//' > 4_5g2.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ delete x; !EOF! ls -l 4_5g2.c echo x - 4_5h1.c sed 's/^X//' > 4_5h1.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ x = realloc((char*)x, sizeof(int) * 80); !EOF! ls -l 4_5h1.c echo x - 4_5h2.c sed 's/^X//' > 4_5h2.c << '!EOF!' /* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */ /* The C++ Answer Book */ /* Tony Hansen */ /* All rights reserved. */ #include int *nx = new int[80]; memcpy((char*)nx, (char*)x, 40 * sizeof(int)) delete x; x = nx; !EOF! ls -l 4_5h2.c echo x - makefile sed 's/^X//' > makefile << '!EOF!' test: @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