In Linux, is it possible to merge two binary programs into a single executable while still allowing both programs to execute?
I have several program binaries without source code and I wish to append them with my small program to display additional data for the user. Here is a small example:
prog1.c displays time information:
#include <stdio.h>
#include <time.h>
int main(){
time_t t = time(NULL);
struct tm time_stamp = *localtime(&t);
printf("Date: %d-%d-%d (mm/dd/yyyy) \n",time_stamp.tm_mon+1,time_stamp.tm_mday, time_stamp.tm_year+1900);
printf("Time: %d:%d \n", time_stamp.tm_hour, time_stamp.tm_min);
return 0;
}
prog2.c displays author info:
#include <stdio.h>
void main(){
printf("INFO: Originally developed by Jake.");
}
I wish to append prog1 with my prog2 such that calling prog1 will execute the prog2 and display author info as well. Output would look like:
Date: 11-19-2015 (mm/dd/yyyy)
Time: 11:46
INFO: Originally developed by Jake.
The idea sounds similar to self-extracting archives but have not seen a working example. Simply appending prog2 to the end of prog1 using cat, dd etc. attaches the prog2 but will not execute it.
./prog1; ./prog2?dependenciesso if the user want's to install them using a package manager, they will be asked to download these two other programs too, then you can just call them with bash. Or you can bundle these programs with yours and use bash again, like other comments said.prog1&prog2? Pleae edit your question to improve it. Sounds like an XY problem