Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/infocmp infocmp: strip versioning from aliases as well



details:   https://anonhg.NetBSD.org/src/rev/39922f273392
branches:  trunk
changeset: 1008652:39922f273392
user:      roy <roy%NetBSD.org@localhost>
date:      Mon Mar 30 00:22:18 2020 +0000

description:
infocmp: strip versioning from aliases as well

diffstat:

 usr.bin/infocmp/infocmp.c |  26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 70f8066d5bf2 -r 39922f273392 usr.bin/infocmp/infocmp.c
--- a/usr.bin/infocmp/infocmp.c Mon Mar 30 00:09:06 2020 +0000
+++ b/usr.bin/infocmp/infocmp.c Mon Mar 30 00:22:18 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: infocmp.c,v 1.15 2020/03/29 19:10:08 roy Exp $ */
+/* $NetBSD: infocmp.c,v 1.16 2020/03/30 00:22:18 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: infocmp.c,v 1.15 2020/03/29 19:10:08 roy Exp $");
+__RCSID("$NetBSD: infocmp.c,v 1.16 2020/03/30 00:22:18 roy Exp $");
 
 #include <sys/ioctl.h>
 
@@ -715,6 +715,8 @@
                use_terms(t, argc - optind, argv + optind);
 
        if ((optind + 1 != argc && nflag == 0) || uflag != 0) {
+               char *alias, *aliascpy, *delim;
+
                if (uflag == 0)
                        printf("# Reconstructed from %s\n",
                             _ti_database == NULL ?
@@ -724,8 +726,24 @@
                if (term != NULL)
                        *term = '\0';
                printf("%s", t->name);
-               if (t->_alias != NULL && *t->_alias != '\0')
-                       printf("|%s", t->_alias);
+               alias = aliascpy = estrdup(t->_alias);
+               while (alias != NULL && *alias != '\0') {
+                       putchar('|');
+                       delim = strchr(alias, TERMINFO_VDELIM);
+                       if (delim != NULL)
+                               *delim++ = '\0';
+                       printf("%s", alias);
+                       if (delim != NULL) {
+                               while (*delim != '\0' && *delim != '|')
+                                       delim++;
+                               if (*delim == '\0')
+                                       alias = NULL;
+                               else
+                                       alias = delim + 1;
+                       } else
+                               alias = NULL;
+               }
+               free(aliascpy);
                if (t->desc != NULL && *t->desc != '\0')
                        printf("|%s", t->desc);
                printf(",\n");



Home | Main Index | Thread Index | Old Index