diff options
author | kstailey <kstailey@cvs.openbsd.org> | 1997-10-08 14:57:32 +0000 |
---|---|---|
committer | kstailey <kstailey@cvs.openbsd.org> | 1997-10-08 14:57:32 +0000 |
commit | b8c915a2b948eac2fdb3315fdc2dd83772ad9231 (patch) | |
tree | 96529c0eb6fcbe605c838a7b04258afdd7d2df7f | |
parent | 1e62493be5c4335cf5b9a55346f4e949db18c218 (diff) |
use shorter uname version string
-rw-r--r-- | sys/compat/svr4/svr4_stat.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c index c7dc4d870a7..1b785dff2d9 100644 --- a/sys/compat/svr4/svr4_stat.c +++ b/sys/compat/svr4/svr4_stat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: svr4_stat.c,v 1.8 1996/05/02 13:06:33 deraadt Exp $ */ +/* $OpenBSD: svr4_stat.c,v 1.9 1997/10/08 14:57:31 kstailey Exp $ */ /* $NetBSD: svr4_stat.c,v 1.21 1996/04/22 01:16:07 christos Exp $ */ /* @@ -399,7 +399,7 @@ svr4_sys_uname(p, v, retval) struct svr4_sys_uname_args *uap = v; struct svr4_utsname sut; extern char ostype[], hostname[], osrelease[], version[], machine[]; - + char *cp, *dp, *ep; bzero(&sut, sizeof(sut)); @@ -412,8 +412,17 @@ svr4_sys_uname(p, v, retval) strncpy(sut.release, osrelease, sizeof(sut.release)); sut.release[sizeof(sut.release) - 1] = '\0'; - strncpy(sut.version, version, sizeof(sut.version)); - sut.version[sizeof(sut.version) - 1] = '\0'; + dp = sut.version; + ep = &sut.version[sizeof(sut.version) - 1]; + for (cp = version; *cp && *cp != '('; cp++) + ; + for (cp++; *cp && *cp != ')' && dp < ep; cp++) + *dp++ = *cp; + for (; *cp && *cp != '#'; cp++) + ; + for (; *cp && *cp != ':' && dp < ep; cp++) + *dp++ = *cp; + *dp = '\0'; strncpy(sut.machine, machine, sizeof(sut.machine)); sut.machine[sizeof(sut.machine) - 1] = '\0'; |