why - your helpful confidant

Kevin Carothers kevin at ttidca.TTI.COM
Sat Jul 29 06:49:33 AEST 1989


Howdy 

I took dave k's "why.c" and improved it -- at least *I* like it
================================================================
main (argc, argv)
int argc;
char *argv[];
{
	int w;
	int i;
	char *p;

	w = argc -1;
	if(w)
		{
		printf("I don't know why ");
		for (i=1; i <= w; i++) {
		    if(!(strcmp(argv[i], "I") && strcmp(argv[i], "i"))) {
		        printf("you ");
			argv[i] = "";
			}
		    else if(!(strcmp(argv[i], "me"))) {
			argv[i] = "you ";
			if (argc >2)
			    {
			    p = argv[2];
			    argv[2] = argv[1];
			    argv[1] = p;
			    }
			}
		    }

		for (i=1; i <= w; i++) {
		    printf("%s ", argv[i]);
		    }
		}
	else
		{
		if((getpid() % 2) == 0)
			printf("Why not?");
		else
			printf("Just because.");
		}
	printf("\n");
}

== try me ===

--
                     U.S. Out of North America
   The Name:   Kevin Carothers   !{csun,psivax,rdlvax}!ttidca!kevin



More information about the Alt.sources mailing list