Xref: utzoo unix-pc.sources:417 comp.sys.att:7913 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!att!icus!lenny From: lenny@icus.islp.ny.us (Lenny Tropiano) Newsgroups: unix-pc.sources,comp.sys.att Subject: Silly ticker-tape display program for the UNIX pc Keywords: ticker-tape, scrolling messages Message-ID: <1001@icus.islp.ny.us> Date: 29 Oct 89 18:43:50 GMT Organization: ICUS Software Systems, Islip, New York Lines: 110 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 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 X#include X#include 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