Silly ticker-tape display program for the UNIX pc

Lenny Tropiano lenny at icus.islp.ny.us
Mon Oct 30 05:43:50 AEST 1989


This program is so silly there is no makefile, instructions, just source.
Compile it anyway you like... 

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  ticker.c
# Wrapped by lenny at icus on Sun Oct 29 13:42:09 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f ticker.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ticker.c\"
else
echo shar: Extracting \"ticker.c\" \(1388 characters\)
sed "s/^X//" >ticker.c <<'END_OF_ticker.c'
X/*
X** ticker.c
X**
X** Very silly program that displays a line of text scrolling in a ticker-tape
X** type fashion on the user-prompt line of the UNIX pc window
X**
X** Nothing like writing a program that is definately a resource hog! 
X**
X** usage: ticker /dev/wN "some text to scroll"
X**
X** By Lenny Tropiano, ICUS Software Systems (c) 1989   10/29/89
X** This is definately public domain! :-)
X**
X*/
X
X#include <stdio.h>
X#include <sys/window.h>
X#include <sys/signal.h>
X
Xint	winfd;
Xstruct  utdata ut;
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X	int	i;
X	void	erase(), ticker();
X
X	signal(SIGINT,erase);
X	signal(SIGTERM,erase);
X	signal(SIGQUIT,erase);
X
X	if (argc < 2) {
X		printf("usage: %s /dev/wN [text]\n",argv[0]);
X		exit(1);
X	}
X
X	if ((winfd = open(argv[1], 2)) == -1) {
X		perror("open()");
X		exit(1);
X	}
X
X	ut.ut_num = WTXTPROMPT;
X	if (ioctl(winfd, WIOCGETTEXT, &ut) == -1) {
X		perror("ioctl()");
X		exit(1);
X	}
X	if (argc == 3) {
X		sprintf(ut.ut_text,"%-80.80s",argv[2]);
X		while (TRUE) {
X			if (ioctl(winfd, WIOCSETTEXT, &ut) == -1) {
X				perror("ioctl()");
X				exit(1);
X			}
X			ticker(ut.ut_text);
X		}
X	}
X}
X
Xvoid ticker(string)
Xchar *string;
X{
X	char	newstr[80];
X
X	sprintf(newstr,"%s%c",&(string[1]),string[0]);
X	sprintf(string,"%-80.80s",newstr);
X}
X
Xvoid erase()
X{
X	sprintf(ut.ut_text,"%-80.80s"," ");
X	if (ioctl(winfd, WIOCSETTEXT, &ut) == -1) {
X		perror("ioctl()");
X		exit(1);
X	}
X	exit(0);
X}
END_OF_ticker.c
if test 1388 -ne `wc -c <ticker.c`; then
    echo shar: \"ticker.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of shell archive.
exit 0
-- 
| Lenny Tropiano            ICUS Software Systems      [w] +1 (516) 589-7930 |
| lenny at icus.islp.ny.us     Telex; 154232428 ICUS      [h] +1 (516) 968-8576 |
| {ames,pacbell,decuac,hombre,sbcs,attctc}!icus!lenny     attmail!icus!lenny |
+------- ICUS Software Systems -- PO Box 1;  Islip Terrace, NY  11752 -------+



More information about the Unix-pc.sources mailing list