Index: args.c =================================================================== --- args.c +++ args.c @@ -100,6 +100,7 @@ {"T", PRO_SPECIAL, 0, KEY, 0}, {"U", PRO_SPECIAL, 0, KEY_FILE, 0}, {"V", PRO_SPECIAL, 0, VERSION, 0}, + {"P", PRO_SPECIAL, 0, IGN, 0}, {"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation}, {"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop}, {"bad", PRO_BOOL, false, ON, &blanklines_after_declarations}, @@ -179,13 +180,16 @@ * given in these files. */ void -set_profile(void) +set_profile(const char *profile_name) { FILE *f; char fname[PATH_MAX]; static char prof[] = ".indent.pro"; - snprintf(fname, sizeof(fname), "%s/%s", getenv("HOME"), prof); + if (profile_name == NULL) + snprintf(fname, sizeof(fname), "%s/%s", getenv("HOME"), prof); + else + snprintf(fname, sizeof(fname), "%s", profile_name + 2); if ((f = fopen(option_source = fname, "r")) != NULL) { scan_profile(f); (void) fclose(f); Index: indent.h =================================================================== --- indent.h +++ indent.h @@ -47,5 +47,5 @@ void pr_comment(void); void set_defaults(void); void set_option(char *); -void set_profile(void); +void set_profile(const char *); void writefdef(struct fstate *f, int); Index: indent.1 =================================================================== --- indent.1 +++ indent.1 @@ -74,6 +74,7 @@ .Op Fl \&ldi Ns Ar n .Op Fl \&lp | Fl nlp .Op Fl npro +.Op Fl P Ns Ar file .Op Fl pcs | Fl npcs .Op Fl psl | Fl npsl .Op Fl sac | Fl nsac @@ -383,6 +384,9 @@ and .Sq Pa ~/.indent.pro , to be ignored. +.It Fl P Ns Ar file +Read profile from +.Ar file . .It Fl pcs , npcs If true .Pq Fl pcs Index: indent.c =================================================================== --- indent.c +++ indent.c @@ -94,6 +94,7 @@ int type_code; /* the type of token, returned by lexi */ int last_else = 0; /* true iff last keyword was an else */ + const char *profile_name = NULL; /*-----------------------------------------------*\ @@ -190,9 +191,11 @@ for (i = 1; i < argc; ++i) if (strcmp(argv[i], "-npro") == 0) break; + else if (argv[i][0] == '-' && argv[i][1] == 'P' && argv[i][2] != '\0') + profile_name = argv[i]; /* non-empty -P (set profile) */ set_defaults(); if (i >= argc) - set_profile(); + set_profile(profile_name); for (i = 1; i < argc; ++i) {