Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: fix content of profile_name



details:   https://anonhg.NetBSD.org/src/rev/a1f84efcfa01
branches:  trunk
changeset: 1023932:a1f84efcfa01
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 03 18:41:36 2021 +0000

description:
indent: fix content of profile_name

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

diffstat:

 usr.bin/indent/args.c   |  6 +++---
 usr.bin/indent/indent.c |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r c6ebdf5eec3d -r a1f84efcfa01 usr.bin/indent/args.c
--- a/usr.bin/indent/args.c     Sun Oct 03 18:20:13 2021 +0000
+++ b/usr.bin/indent/args.c     Sun Oct 03 18:41:36 2021 +0000
@@ -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 @@
 
 #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 @@
     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);
diff -r c6ebdf5eec3d -r a1f84efcfa01 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sun Oct 03 18:20:13 2021 +0000
+++ b/usr.bin/indent/indent.c   Sun Oct 03 18:41:36 2021 +0000
@@ -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 @@
 
 #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 @@
        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);
 



Home | Main Index | Thread Index | Old Index