Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!internet!dunigan@ornl-msr (Tom Dunigan) From: dunigan@ornl-msr (Tom Dunigan) Newsgroups: net.sources Subject: program to repetitively display command on crt Message-ID: <5699@brl-tgr.ARPA> Date: Fri, 9-Nov-84 16:52:05 EST Article-I.D.: brl-tgr.5699 Posted: Fri Nov 9 16:52:05 1984 Date-Received: Sat, 10-Nov-84 06:25:40 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 47 /* display.c * do screen update with given command * usage is display [-seconds] command [commandargs] * examples: display w or display ls -l or display -2 df * to build, cc with -lcurses -ltermlib */ #include #include char c; char command[80]; FILE *p, *popen(); int interval=5; /* number of seconds to pause */ main(argc,argv) int argc; char **argv; { int row,i; if (argc==1){printf("Usage display [-seconds] command\n");exit();} if (**(argv+1) == '-') { /* interval specified */ if (--argc == 1){printf("Usage display [-seconds] command\n");exit();} interval = atoi(*++argv + 1); } while(--argc>0){ strcat(command,*++argv); strcat(command," "); } initscr(); clear(); for(;;){ move(0,0); row=0; p=popen(command,"r"); if (p==NULL){printf("failed\n"); exit();} while( (c=getc(p)) != EOF){ if (c == '\n'){clrtoeol();move(++row,0);} else addch(c); } pclose(p); clrtobot(); refresh(); sleep(interval); } }