Skip to content

Instantly share code, notes, and snippets.

@kwannoel
Created Sep 10, 2021
Embed
What would you like to do?
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