ossp-pkg/l2/l2_ch_prefix.c 1.19 -> 1.20
--- l2_ch_prefix.c 2002/01/02 17:07:38 1.19
+++ l2_ch_prefix.c 2002/07/25 12:28:55 1.20
@@ -30,8 +30,10 @@
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
+#include <sys/utsname.h>
#include "l2.h"
+#include "l2_p.h"
/* declare private channel configuration */
typedef struct {
@@ -94,6 +96,7 @@
size_t nBuf;
l2_level_t rv;
int bSubst;
+ struct utsname uts;
cpSC = buf; /* string current pointer */
cpSE = buf+strlen(buf); /* string end pointer */
@@ -108,8 +111,16 @@
bSubst = TRUE;
break;
}
+ case 'N': {
+ if (uname(&uts) == 0)
+ l2_util_sprintf(caBuf, sizeof(caBuf), uts.nodename);
+ else
+ l2_util_sprintf(caBuf, sizeof(caBuf), "localhost");
+ bSubst = TRUE;
+ break;
+ }
case 'P': {
- sprintf(caBuf, "%lu", (unsigned long)getpid());
+ l2_util_sprintf(caBuf, sizeof(caBuf), "%lu", (unsigned long)getpid());
bSubst = TRUE;
break;
}
|
|