Vrun
Karl Meiser
koala at ddsw1.MCS.COM
Mon Nov 7 04:53:41 AEST 1988
This is a simple program I wrote to mimick a program named 'display'
for xenix on a '386. Its not quite as fancy, but its public domain
and it does its job.
"vrun.c" follows:
-- CUT HERE --
#include <stdio.h>
#include <curses.h>
#include <signal.h>
/*
*
* Visual Run V1.0 (C) Karl Meiser
*
* This is a simple little program that I wrote up to be helpfull
* for monitoring various things. Its fairly simple to use,
* simply define your $TERM and run.
*
* Usage: vrun command [args]
*
* Because of the way its set up, it can even be used with
* shell scipts through the notation 'vrun [kc]sh script'.
*
* The screen is limited to 24 lines.
*
* To compile:
*
* cc vrun.c -lcurses -ltermcap -o vrun
*
*
* (C) Karl Meiser 09/03/88 koala at ddsw1.mcs.com
*
* This software is free and I place no restrictions on usage,
* copying, or modification as long as my name remains on it as
* well as this message.
*
* I am in no way liable for this software, or its results.
*
*/
sig()
{
clear();
refresh();
resetty();
endwin();
exit(0);
}
main(argc, argv)
int argc;
char *argv[];
{
char cmd[80], str[256];
unsigned short int a, b;
FILE *fp;
if (argc < 2) {
fprintf(stderr, "Usage: %s command [args]\n", argv[0]);
exit(1);
}
cmd[0] = '\0';
for (a = 1; a < argc; a++) {
strcat(cmd, argv[a]);
strcat(cmd, " ");
}
initscr();
savetty();
noecho();
nonl();
clear();
signal(SIGINT, sig);
signal(SIGQUIT, sig);
signal(SIGHUP, sig);
while (1) {
fp = popen(cmd, "r");
a = 0;
do {
if (!fgets(str, 255, fp)) break;
str[80] = '\0';
mvprintw(a, 0, "%s", str);
clrtoeol();
a++;
} while (a < 24);
for (b = a; b < 24; b++) {
move(b, 0);
clrtoeol();
}
pclose(fp);
move(a, 0);
refresh();
sleep(5);
}
}
-- CUT HERE --
--
Karl Meiser Beginner programmer
koala at ddsw1.mcs.com
Running Karmik 1+ 312 968-3042
--
Karl Meiser koala at _d_d_s_w_1
koala at m-net
koala at chinet
koala at igloo
More information about the Alt.sources
mailing list