Created
August 1, 2013 07:39
-
-
Save JorgenEvens/6129245 to your computer and use it in GitHub Desktop.
Sets custom environment variables before the shell starts. Was usefull as a workaround to get TERM=xterm-color inject when using terminator on ubuntu.
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 <unistd.h> | |
#include <stdlib.h> | |
int main(int argc, char **argv) { | |
char* shell = getenv("SHELL"); | |
if( shell == NULL ) | |
shell = "bash"; | |
char* param[2]; | |
param[0] = shell; | |
param[1] = NULL; | |
int i = 0; | |
for( i=0; i<argc; i++ ) { | |
putenv(argv[i]); | |
} | |
execvp(shell, param); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment