/* * set_profile reads $HOME/.indent.pro and ./.indent.pro and handles arguments * given in these files. */ void set_profile(void) { FILE *f; char fname[BUFSIZ]; char *home; static char prof[] = ".indent.pro"; home = getenv("HOME"); if (home != NULL && *home != '\0') { if (snprintf(fname, sizeof fname, "%s/%s", home, prof) >= sizeof fname) { warnc(ENAMETOOLONG, "%s/%s", home, prof); return; } if ((f = fopen(option_source = fname, "r")) != NULL) { scan_profile(f); (void) fclose(f); } } if ((f = fopen(option_source = prof, "r")) != NULL) { scan_profile(f); (void) fclose(f); } option_source = "Command line"; }
/* * set_profile reads $HOME/.indent.pro and ./.indent.pro and handles arguments * given in these files. */ void set_profile(void) { FILE *f; char fname[PATH_MAX]; static char prof[] = ".indent.pro"; snprintf(fname, sizeof(fname), "%s/%s", getenv("HOME"), prof); if ((f = fopen(option_source = fname, "r")) != NULL) { scan_profile(f); (void) fclose(f); } if ((f = fopen(option_source = prof, "r")) != NULL) { scan_profile(f); (void) fclose(f); } option_source = "Command line"; }
/* * set_profile reads $HOME/.indent.pro and ./.indent.pro and handles * arguments given in these files. */ void set_profile() { register FILE *f; char fname[BUFSIZ]; static char prof[] = ".indent.pro"; sprintf(fname, "%s/%s", getenv("HOME"), prof); if ((f = fopen(fname, "r")) != NULL) { scan_profile(f); (void) fclose(f); } if ((f = fopen(prof, "r")) != NULL) { scan_profile(f); (void) fclose(f); } }