Skip to content

Instantly share code, notes, and snippets.

@kwannoel
Created September 10, 2021 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwannoel/95ded50e616e27a3112d795053ec9296 to your computer and use it in GitHub Desktop.
Save kwannoel/95ded50e616e27a3112d795053ec9296 to your computer and use it in GitHub Desktop.
Try out multicall binaries
#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