#!/bin/sh
# This is a shar archive.
# The rest of this file is a shell script which will extract:
#
# 2_1a.c 2_1a.cmp 2_1b.c 2_1b.cmp 2_1c.c 2_1d.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:57:45 EDT 1990
#
echo x - 2_1a.c
sed 's/^X//' > 2_1a.c << '!EOF!'
/* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
/* The C++ Answer Book */
/* Tony Hansen */
/* All rights reserved. */
#include <stream.h>
main()
{
    cout << "Hello, world\n";
}
!EOF!
ls -l 2_1a.c
echo x - 2_1a.cmp
sed 's/^X//' > 2_1a.cmp << '!EOF!'
Hello, world
!EOF!
ls -l 2_1a.cmp
echo x - 2_1b.c
sed 's/^X//' > 2_1b.c << '!EOF!'
/* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
/* The C++ Answer Book */
/* Tony Hansen */
/* All rights reserved. */
#include <stream.h>
int main(int, char**)
{
    cout << "Hello, world\n";
    return 0;
}
!EOF!
ls -l 2_1b.c
echo x - 2_1b.cmp
sed 's/^X//' > 2_1b.cmp << '!EOF!'
Hello, world
!EOF!
ls -l 2_1b.cmp
echo x - 2_1c.c
sed 's/^X//' > 2_1c.c << '!EOF!'
/* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
/* The C++ Answer Book */
/* Tony Hansen */
/* All rights reserved. */
$ CC hello.c -o hello
!EOF!
ls -l 2_1c.c
echo x - 2_1d.c
sed 's/^X//' > 2_1d.c << '!EOF!'
/* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
/* The C++ Answer Book */
/* Tony Hansen */
/* All rights reserved. */
$ hello
Hello, world
$
!EOF!
ls -l 2_1d.c
echo x - makefile
sed 's/^X//' > makefile << '!EOF!'
CC= CC -I. -I../../CC
all: 2_1a 2_1b

2_1a: 2_1a.c
	$(CC) 2_1a.c -o 2_1a

2_1b: 2_1b.c
	$(CC) 2_1b.c -o 2_1b

test: all 2_1a.cmp 2_1b.cmp
	-2_1a > 2_1a.out
	cmp 2_1a.out 2_1a.cmp
	2_1b > 2_1b.out
	cmp 2_1b.out 2_1b.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
