Source-Changes-HG archive

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

[src/trunk]: src/lib/libutil __CONCAT does token pasting, not string concatna...



details:   https://anonhg.NetBSD.org/src/rev/813ecc47998c
branches:  trunk
changeset: 500878:813ecc47998c
user:      cgd <cgd%NetBSD.org@localhost>
date:      Tue Dec 19 23:09:02 2000 +0000

description:
__CONCAT does token pasting, not string concatnation.  if something like:
        __CONCAT("PATH=",_PATH_STDPATH);
actually works to concantate strings, it's because the preprocessor expands
it into "PATH=""whatever _PATH_STDPATH is" as separate strings, and then
ANSI string concatenation is performed on that.  It's more straightforward
to just use ANSI string concatenation directly, and newer GCCs complain
(rightly) about mis-use of token pasting.

diffstat:

 lib/libutil/ttyaction.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r b899c8e42205 -r 813ecc47998c lib/libutil/ttyaction.c
--- a/lib/libutil/ttyaction.c   Tue Dec 19 22:39:34 2000 +0000
+++ b/lib/libutil/ttyaction.c   Tue Dec 19 23:09:02 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ttyaction.c,v 1.14 2000/07/05 11:46:42 ad Exp $        */
+/*     $NetBSD: ttyaction.c,v 1.15 2000/12/19 23:09:02 cgd Exp $       */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ttyaction.c,v 1.14 2000/07/05 11:46:42 ad Exp $");
+__RCSID("$NetBSD: ttyaction.c,v 1.15 2000/12/19 23:09:02 cgd Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -67,7 +67,7 @@
 #endif
 
 static char *actfile = _PATH_TTYACTION;
-static char *pathenv = __CONCAT("PATH=",_PATH_STDPATH);
+static char *pathenv = "PATH=" _PATH_STDPATH;
 
 int
 ttyaction(const char *tty, const char *act, const char *user)



Home | Main Index | Thread Index | Old Index