Redirection CGI scripts

Written in C and bash

C

I have written this redirection cgi script in C because my computer is a little slow for the perl and bash scripts.

redir.c

/* redir.c version 1.0 Copyright 1996 Vince Busam
 * The standard redirection script.
 * Weeds out MSIE, and Netscape (including all other frame-browsers)
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define SERVER "http://sixpak.resnet.ucla.edu/"

int main()
{
	char *http;
	
	http = getenv("HTTP_USER_AGENT");
	
	if (strstr(http,"MSIE") != 0)
		{	
			printf("Location:%smsie.html\n\n",SERVER);
			return 0;
		}
	if (strstr(http,"Mozilla/2.0") != 0)
		{
			printf("Location:%sindexf.html\n\n",SERVER);
			return 0;
		}
	if (strstr(http,"Mozilla/3.0") != 0)
		{
			printf("Location:%sindexf.html\n\n",SERVER);
			return 0;
		}

	printf("Location:%shome.html\n\n",SERVER);	
	return 0;
}
Simply change the SERVER variable, and the actual file names to customize it for your compter. Compile, and viola! A faster redir script.
I have noticed a 20% increase in speed.

Bash

The redir.bash file is the old one, which is slower, but easier to change.