Skip to content

Instantly share code, notes, and snippets.

@mdippery
Created November 19, 2010 20:10
Show Gist options
  • Save mdippery/707075 to your computer and use it in GitHub Desktop.
Save mdippery/707075 to your computer and use it in GitHub Desktop.
For those times when you type `fail -t` instead of `tail -f`
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int i;
fprintf(stderr,
" FAIL WHALE! \n"
"W W W \n"
" W W W \n"
" '. W \n"
" .-\"\"-._ \\ \\.--|\n"
" / \"-..__) .-' \n"
"| _ / \n"
"\\'-.__, .__.,' \n"
" `'____'. \\--' \n"
"VVVVVVVVVVVVVVVVVVVVV\n");
fprintf(stderr, "It's entirely possible you meant to type `tail`, so let's try that.\n");
/* Sometimes you're a dumbass and type `fail -t` when you mean
`tail -f`, so correct '-t' (which isn't a legit tail option
anyway) to '-f'. */
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-t") == 0) {
argv[i] = "-f";
}
}
return execvp("tail", argv);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment