Page MenuHomeFreeBSD

D9010.id.diff
No OneTemporary

D9010.id.diff

Index: head/usr.bin/indent/args.c
===================================================================
--- head/usr.bin/indent/args.c
+++ head/usr.bin/indent/args.c
@@ -177,13 +177,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: head/usr.bin/indent/indent.h
===================================================================
--- head/usr.bin/indent/indent.h
+++ head/usr.bin/indent/indent.h
@@ -45,5 +45,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: head/usr.bin/indent/indent.1
===================================================================
--- head/usr.bin/indent/indent.1
+++ head/usr.bin/indent/indent.1
@@ -30,7 +30,7 @@
.\" @(#)indent.1 8.1 (Berkeley) 7/1/93
.\" $FreeBSD$
.\"
-.Dd December 2, 2016
+.Dd January 2, 2017
.Dt INDENT 1
.Os
.Sh NAME
@@ -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: head/usr.bin/indent/indent.c
===================================================================
--- head/usr.bin/indent/indent.c
+++ head/usr.bin/indent/indent.c
@@ -98,6 +98,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;
/*-----------------------------------------------*\
@@ -194,9 +195,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) {

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 19, 4:18 AM (5 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25593247
Default Alt Text
D9010.id.diff (2 KB)

Event Timeline