Module Name:    src
Committed By:   rillig
Date:           Sun Oct  3 18:41:36 UTC 2021

Modified Files:
        src/usr.bin/indent: args.c indent.c

Log Message:
indent: fix content of profile_name

Previously, profile_name included the leading "-P", which was confusing.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/indent/args.c
cvs rdiff -u -r1.96 -r1.97 src/usr.bin/indent/indent.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.39 src/usr.bin/indent/args.c:1.40
--- src/usr.bin/indent/args.c:1.39	Sun Sep 26 21:05:48 2021
+++ src/usr.bin/indent/args.c	Sun Oct  3 18:41:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.39 2021/09/26 21:05:48 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.40 2021/10/03 18:41:36 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.39 2021/09/26 21:05:48 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.40 2021/10/03 18:41:36 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -154,7 +154,7 @@ set_profile(const char *profile_name)
     if (profile_name == NULL)
 	snprintf(fname, sizeof(fname), "%s/%s", getenv("HOME"), prof);
     else
-	snprintf(fname, sizeof(fname), "%s", profile_name + 2);
+	snprintf(fname, sizeof(fname), "%s", profile_name);
     if ((f = fopen(option_source = fname, "r")) != NULL) {
 	scan_profile(f);
 	(void)fclose(f);

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.96 src/usr.bin/indent/indent.c:1.97
--- src/usr.bin/indent/indent.c:1.96	Thu Sep 30 21:48:12 2021
+++ src/usr.bin/indent/indent.c	Sun Oct  3 18:41:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.96 2021/09/30 21:48:12 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.97 2021/10/03 18:41:36 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.96 2021/09/30 21:48:12 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.97 2021/10/03 18:41:36 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -447,7 +447,7 @@ main_parse_command_line(int argc, char *
 	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) */
+	    profile_name = argv[i] + 2;	/* non-empty -P (set profile) */
     if (i >= argc)
 	set_profile(profile_name);
 

Reply via email to