Last active
August 18, 2020 11:27
-
-
Save pouyatafti/cd9f277b714acf60fccdb581c981fbdb to your computer and use it in GitHub Desktop.
Linux process Moomin ASCII art (via ps x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <unistd.h> | |
char *moomin[] = { | |
" . ,", | |
"ASCII art (c) Maija Haavisto (@DiamonDie)", | |
"", | |
" \"._.' `' mh/VK", | |
" `. `, `. .'", | |
" . .' `. `' ;", | |
" `--' , __,..- ' .", | |
" `. .' . '", | |
"\\W; . \"` .", | |
",,. . ` . `. .", | |
" . `. `. .", | |
" . . `. .", | |
" . .", | |
" `.", | |
" . `\"-.___.\"", | |
" ._ .'", | |
" . :", | |
" . \" \" `.", | |
" . (.) (.)--._", | |
" _ \\", | |
" . `.", | |
" .';_.';", | |
}; | |
int | |
main(int argc, char **argv) { | |
long s = 0, p = 0, n = sizeof(moomin)/sizeof(char *); | |
char *ps = *argv; | |
while (argc--) | |
s += strlen(*argv++) + 1; | |
while (--n) | |
if (fork() == 0) break; | |
strncpy(ps, moomin[n], s-1); | |
ps[s-1] = 0; | |
while (1) { | |
sleep(10); | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BUFFER=".................................." | |
cc -o moomin moomin.c | |
./moomin $BUFFER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment