public
Created

For those times when you type `fail -t` instead of `tail -f`

  • Download Gist
fail.c
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#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);
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.