Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/mscdlabel cosmetics: strip trailing blanks when the...



details:   https://anonhg.NetBSD.org/src/rev/2272c9d40b5c
branches:  trunk
changeset: 584355:2272c9d40b5c
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Sep 14 09:41:24 2005 +0000

description:
cosmetics: strip trailing blanks when the ISO volume label is printed

diffstat:

 usr.sbin/mscdlabel/iso9660.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r fdc032ade68e -r 2272c9d40b5c usr.sbin/mscdlabel/iso9660.c
--- a/usr.sbin/mscdlabel/iso9660.c      Wed Sep 14 08:59:37 2005 +0000
+++ b/usr.sbin/mscdlabel/iso9660.c      Wed Sep 14 09:41:24 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iso9660.c,v 1.1 2004/07/04 14:11:44 drochner Exp $ */
+/* $NetBSD: iso9660.c,v 1.2 2005/09/14 09:41:24 drochner Exp $ */
 
 #include <sys/types.h>
 #include <stdlib.h>
@@ -18,6 +18,12 @@
        char label[32 + 1], date[] = "yyyy/mm/dd hh:mm", *d;
 
        strlcpy(label, vd->volume_id, sizeof(label));
+       /* strip trailing blanks */
+       d = label + strlen(label);
+       while (d > label && *(d - 1) == ' ')
+               d--;
+       *d = '\0';
+
        d = vd->creation_date;
        memcpy(date, d, 4); /* year */
        memcpy(date + 5, d + 4, 2); /* month */



Home | Main Index | Thread Index | Old Index