The sunrup.c file is the source code to the 'sunrup' command which I use to filter the 'rup' command.
The filter does two things. First, it changes the output of the rup
command from:
name uptime load-averages
to:
telnetable-url uptime load-averages
and secondly, it removes the 'rup' entries for Starfish and Stingray.
I could add back in starfish and stingray, and make them without the
telnet-able URL, but at least for now this works pretty good.
sunrup.c:
/* sunrup.c - by Erik Seielstad <erik@acs.brockport.edu> */ /* --- a simple 'rup' filter for the Web. */ /* Disclaimer: I make no claims that this program works. Use at your */ /* Disclaimer: own risk. */ #include <stdio.h> main() { char line[100]; char hname[15]; /* printf("Content-type: text/html\n\n<pre>"); */ /* originally I planned on using the C program to add the header */ /* information, but I chose to change that method, moving these two */ /* outputs into the sunrup.cgi */ /* shell script. */ gets(line); /* discards the RUP command's "collecting responses" line */ while(gets(line)) /* while we receive lines from the 'rup' command */ { strncpy(hname, line, 13); /* grab first 13 characters of a line */ hname[12] = '\0'; /* just to be safe, make sure we have */ /* a NULL character at the end of out */ /* string. */ /* remove leading whitespace */ while (*hname == ' ') strcpy(hname, hname+1); /* if the name is NOT a host we are trying to hide */ if ( (strcmp(hname, "startp.acs.b") != 0) ) if ( (strcmp(hname, "starfish") != 0) ) if ( (strcmp(hname, "stingray") != 0) ) { /* print the anchor 'telnet' address then rest of the RUP output */ /* ** notice we need to quote the double-quotes in the URL */ printf("<a href=\"telnet://%s.acs.brockport.edu/\">%12s</a>%s\n", hname, hname, line+13); } } /* unnecessary trailer stuff (like links back to my pages */ /* this could easily have gone in the shell script. */ printf("</pre><hr><center>\n"); printf("<a href=\"/iinc.com/erik/resume/resjob0.html\">[Back to Resume]</a> - "); printf("<a href=\"/brockport/erik/sunlab/\">[Sun Lab]</a> - "); printf("<a href=\"/brockport/erik/sunlab/howto.html\">[How to do Sunrup.cgi]</a> - "); printf("<a href=\"/brockport/erik/\">[Home]</a>\n"); printf("</center>\n"); }