Xmas funstuff - (nf)
utzoo!decvax!harpo!eagle!mhtsa!alice!npoiv!npois!houxm!ihnp4!ihldt!ll1!otuxa!nwuxc!inuxc!pur-ee!davy
utzoo!decvax!harpo!eagle!mhtsa!alice!npoiv!npois!houxm!ihnp4!ihldt!ll1!otuxa!nwuxc!inuxc!pur-ee!davy
Wed Dec 8 18:34:15 AEST 1982
#N:pur-ee:9200005:000:6242
pur-ee!davy Dec 8 10:57:00 1982
/**** DO NOT DELETE BELOW THIS LINE !!!
Yes folks, it's the newest thing in Christmas gift giving,
"Christmas by mail"! At the end of this letter, you will find your
gift in the form of a 'C' program. Simply follow the instructions
below, and then sit back and enjoy your gift.
ASSEMBLY INSTRUCTIONS (no tools needed):
1) Save this letter in a file called "gift.c". Then, edit
the file and delete all lines before the "DO NOT..." line
above.
If you are on one of the Purdue University VAX computers,
do the following:
1) Exit the editor, if you haven't already.
2) Type the following command:
cc. -O -s -N -o gift gift.c -lcurses -ltermcap
3) Run your program by typing "gift".
If you are not on one of the Purdue University VAX computers,
do the following:
1) If your system does not have the "nap()" system
call (a 1/60 second sleep()), delete that call
from the "output()" routine.
2) If your system does not have the Berkeley "curses"
library, you must do the following:
[a] delete the lines:
#include <curses.h>
initscr();
endwin();
[b] write a routine called "move(y, x)" which
will position the cursor on your terminal
at the given (x, y) coordinates. Note
that the 'y' coordinate is the first argu-
ment. The top left corner of your screen
should be (0,0). If you have an "adm3a",
"adm3a+", or "adm5" terminal, there is a
routine at the end of this program which
will do this for you.
[c] write a routine called "clear()" to clear
your terminal's screen. If you have one
of the terminals mentioned above, there is
a routine at the end of this program to
do this for you.
[d] Un-comment the routines supplied at the
end of the program.
4) If your system DOES have the "curses" library,
compile your program as follows:
cc -O -s -o gift gift.c -lcurses -ltermcap
NOTE: You may have to substitute "-ltermlib" for
"-ltermcap".
If your system DOES NOT have the "curses" library,
compile your program as follows:
cc -O -s -o gift gift.c
5) Execute your program, and enjoy. Please feel free
to give copies of this to all your friends.
Merry Christmas,
--Dave Curry
pur-ee!davy
*/
#include <curses.h>
main()
{
int x, y;
/*
* If you don't have the Berkeley "curses" library, delete
* this routine call.
*/
initscr();
clear();
refresh();
sleep(1);
output(2, 15, '*'); output(1, 15, '|'); output(1, 16, '/');
output(2, 16, '-'); output(3, 16, '\\'); output(3, 15, '|');
output(3, 14, '/'); output(2, 14, '-'); output(1, 14, '\\');
output(0, 15, '|'); output(2, 17, '-'); output(4, 15, '|');
output(2, 13, '-'); output(5, 15, '|');
move(0,0);
refresh();
sleep(2);
for (x=40, y=0; y < 16; x--, y++) output(y, x, '*');
for (x=26; x < 39; x++) output(15, x, '*');
for (y=16; y < 19; y++) output(y, 38, '*');
for (x=39; x < 44; x++) output(18, x, '*');
for (y=18; y > 15; y--) output(y, 43, '*');
for (x=43; x < 55; x++) output(15, x, '*');
for (y=15, x=55; y > (-1); y--, x--) output(y, x, '*');
move(0,0);
refresh();
sleep(2);
output2(11, 48, '+'); output2(9, 36, '+'); output2(14, 37, '+');
output2(2, 41, '+'); output2(13, 51, '+'); output2(11, 30, '+');
output2(8, 39, '+'); output2(7, 36, '+'); output2(10, 31, '+');
output2(11, 43, '+'); output2(14, 34, '+'); output2(4, 41, '+');
output2(3, 39, '+'); output2(14, 30, '+'); output2(9, 47, '+');
output2(13, 29, '+'); output2(13, 29, '+'); output2(6, 40, '+');
output2(12, 43, '+'); output2(6, 35, '+'); output2(14, 28, '+');
output2(11, 39, '+'); output2(12, 32, '+'); output2(5, 37, '+');
output2(14, 40, '+'); output2(11, 49, '+'); output2(10, 36, '+');
output2(13, 46, '+'); output2(13, 32, '+'); output2(8, 33, '+');
output2(14, 43, '+'); output2(8, 45, '+'); output2(14, 47, '+');
output2(12, 51, '+'); output2(7, 42, '+'); output2(10, 43, '+');
output2(11, 34, '+'); output2(8, 38, '+'); output2(14, 53, '+');
output2(8, 45, '+'); output2(12, 35, '+'); output2(9, 41, '+');
output2(6, 44, '+'); output2(10, 38, '+'); output2(12, 38, '+');
output2(13, 35, '+'); output2(5, 43, '+'); output2(10, 48, '+');
output2(12, 47, '+');
move(0,0);
refresh();
sleep(2);
output(19, 10, 'M'); output(19, 12, 'E'); output(19, 14, 'R');
output(19, 16, 'R'); output(19, 18, 'Y'); output(21, 5, 'C');
output(21, 7, 'H'); output(21, 9, 'R'); output(21, 11, 'I');
output(21, 13, 'S'); output(21, 15, 'T'); output(21, 17, 'M');
output(21, 19, 'A'); output(21, 21, 'S'); output(21, 23, '!');
move(0,0);
refresh();
sleep(2);
output(19, 62, 'H'); output(19, 64, 'A'); output(19, 66, 'P');
output(19, 68, 'P'); output(19, 70, 'Y'); output(21, 57, 'N');
output(21, 59, 'E'); output(21, 61, 'W'); output(21, 67, 'Y');
output(21, 69, 'E'); output(21, 71, 'A'); output(21, 73, 'R');
output(21, 75, '!');
move(0,0);
refresh();
sleep(5);
move(23, 0);
refresh();
/*
* If you don't have the Berkeley "curses" library, delete
* this routine call.
*/
endwin();
}
output(y, x, c)
int y, x;
char c;
{
mvaddch(y, x, c);
refresh();
/*
* If your system doesn't have the "nap()" system call,
* delete this line.
*/
nap(15);
}
output2(y, x, c)
int y, x;
char c;
{
mvaddch(y, x, c);
refresh();
}
/*
* Routines to use if you don't have the Berkeley "curses" library.
* This version of "move" will work for adm3a, adm3a+, and adm5 terminals,
* along with this version of "clear".
*
* Note: the adm terminals above use the following sequence for cursor
* control:
* 033=YX
* where:
* 033 = escape character
* Y = number between 0 and 23 added to 040 (space)
* X = number between 0 and 79 added to 040 (space)
*
* And a control-Z (ASCII 032) to clear the screen.
*
*/
/************** DELETE THIS LINE TO USE THESE ROUTINES *********************
#include <stdio.h>
move(y, x)
int y, x;
{
printf("\033=%c%c", (y+' '), (x+' '));
}
clear()
{
putchar('\032');
}
mvaddch(y, x, c)
int y, x;
char c;
{
move(y, x);
putchar(c);
}
refresh()
{
fflush(stdout);
}
************** DELETE THIS LINE TO USE THESE ROUTINES *********************/
More information about the Comp.sources.unix
mailing list