Created
September 10, 2021 18:00
-
-
Save kwannoel/95ded50e616e27a3112d795053ec9296 to your computer and use it in GitHub Desktop.
Try out multicall binaries
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 <stdio.h> | |
#include <string.h> | |
// Try it out: | |
// gcc multicall.c -o multi | |
// chmod +x multi | |
// ln -s multi hello | |
// ./hello | |
// ln -s multi bye | |
// ./bye | |
int entry_hello(); | |
int entry_bye(); | |
int main(int argc, char* argv[]) { | |
if (strcmp(argv[0], "./hello") == 0) { | |
entry_hello(); | |
} | |
if (strcmp(argv[0], "./bye") == 0) { | |
entry_bye(); | |
} | |
} | |
int entry_hello() { | |
// printf() displays the string inside quotation | |
printf("Hello, World!"); | |
return 0; | |
} | |
int entry_bye() { | |
// printf() displays the string inside quotation | |
printf("Bye, World!"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment