💾 Archived View for thrig.me › blog › 2024 › 02 › 07 › greeting.c captured on 2024-03-21 at 15:43:18.

View Raw

More Information

-=-=-=-=-=-=-

// greeting - show how to change the behavior of a program depending on
// the name it was invoked with
#include <stdio.h>
#include <string.h>

int
main(int argc, char *argv[])
{
	if (strcmp(argv[0], "./goodbye") == 0) {
		printf("goodbye\n");
	} else {
		printf("hello\n");
	}
}