summaryrefslogtreecommitdiff
path: root/usr/src/cmd/uname/uname.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/uname/uname.c')
-rw-r--r--usr/src/cmd/uname/uname.c118
1 files changed, 14 insertions, 104 deletions
diff --git a/usr/src/cmd/uname/uname.c b/usr/src/cmd/uname/uname.c
index 59d99a184e..2c43b50cd6 100644
--- a/usr/src/cmd/uname/uname.c
+++ b/usr/src/cmd/uname/uname.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -37,8 +35,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#define __EXTENSIONS__
#include <sys/types.h>
#include <stdio.h>
@@ -55,10 +51,6 @@
static void usage(void);
-#ifdef _iBCS2
-char *sysv3_env;
-#endif /* _iBCS2 */
-
/* ARGSUSED */
int
main(int argc, char *argv[], char *envp[])
@@ -69,12 +61,6 @@ main(int argc, char *argv[], char *envp[])
int pflg = 0, iflg = 0, Sflg = 0;
int errflg = 0, optlet;
int Xflg = 0;
-#ifdef _iBCS2
- char *ptr;
- char *newptr;
- int cnt;
- int done;
-#endif /* _iBCS2 */
struct utsname unstr, *un;
char fmt_string[] = " %.*s";
char *fs = &fmt_string[1];
@@ -84,73 +70,6 @@ main(int argc, char *argv[], char *envp[])
un = &unstr;
(void) uname(un);
-#ifdef _iBCS2
- /* Find out if user wants SYS V behavior */
- if (sysv3_env = getenv("SYSV3")) {
-
- /*
- * Now figure out what values are encoded in sysv3
- * Tokens are comma separated:
- * os, sysname, nodename, release, version, machtype
- */
- cnt = 0;
- ptr = sysv3_env;
- done = 0;
- while (!done && *ptr) {
- if ((newptr = strchr(ptr, ',')) == (char *)0)
- done = 1;
- else
- /* Null out the comma */
- *newptr = '\0';
-
- /* If ptr == newptr, there was no data for this token */
- if (ptr == newptr) {
- /* Step over null token and go around again */
- ptr = newptr + 1;
- cnt ++;
- continue;
- }
-
- switch (cnt++) {
- case 0:
- /* Ignore the os token for now. */
- break;
- case 1:
- strcpy(un->sysname, ptr);
- break;
- case 2:
- strcpy(un->nodename, ptr);
- break;
- case 3:
- strcpy(un->release, ptr);
- break;
- case 4:
- strcpy(un->version, ptr);
- break;
- case 5:
- strcpy(un->machine, ptr);
- break;
- default:
- done = 1;
- break;
- }
- ptr = newptr + 1;
- }
-
- /*
- * If SYSV3 is set to an empty string, fill in the structure
- * with reasonable default values.
- */
- if (!cnt) {
- strcpy(un->sysname, un->nodename);
- strcpy(un->release, "3.2");
- strcpy(un->version, "2");
- strcpy(un->machine, "i386");
- }
- }
-
-#endif /* _iBCS2 */
-
(void) setlocale(LC_ALL, "");
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
@@ -161,17 +80,8 @@ main(int argc, char *argv[], char *envp[])
switch (optlet) {
case 'a':
sflg++; nflg++; rflg++; vflg++; mflg++;
-#ifdef _iBCS2
- /*
- * If compat mode, don't print things ISC
- * doesn't have
- */
- if (!sysv3_env)
-#endif /* _iBCS2 */
- {
- pflg++;
- iflg++;
- }
+ pflg++;
+ iflg++;
break;
case 's':
sflg++;
@@ -211,7 +121,7 @@ main(int argc, char *argv[], char *envp[])
if ((Sflg > 1) ||
(Sflg && (sflg || nflg || rflg || vflg || mflg || pflg || iflg ||
- Xflg))) {
+ Xflg))) {
usage();
}
@@ -221,15 +131,15 @@ main(int argc, char *argv[], char *envp[])
if (len > SYS_NMLN - 1) {
(void) fprintf(stderr, gettext(
- "uname: name must be <= %d letters\n"),
- SYS_NMLN-1);
+ "uname: name must be <= %d letters\n"),
+ SYS_NMLN-1);
exit(1);
}
if (sysinfo(SI_SET_HOSTNAME, nodename, len) < 0) {
int err = errno;
(void) fprintf(stderr, gettext(
- "uname: error in setting name: %s\n"),
- strerror(err));
+ "uname: error in setting name: %s\n"),
+ strerror(err));
exit(1);
}
return (0);
@@ -264,7 +174,7 @@ main(int argc, char *argv[], char *envp[])
if (pflg) {
if (sysinfo(SI_ARCHITECTURE, procbuf, sizeof (procbuf)) == -1) {
(void) fprintf(stderr, gettext(
- "uname: sysinfo failed\n"));
+ "uname: sysinfo failed\n"));
exit(1);
}
(void) fprintf(stdout, fs, strlen(procbuf), procbuf);
@@ -273,7 +183,7 @@ main(int argc, char *argv[], char *envp[])
if (iflg) {
if (sysinfo(SI_PLATFORM, procbuf, sizeof (procbuf)) == -1) {
(void) fprintf(stderr, gettext(
- "uname: sysinfo failed\n"));
+ "uname: sysinfo failed\n"));
exit(1);
}
(void) fprintf(stdout, fs, strlen(procbuf), procbuf);
@@ -314,8 +224,8 @@ usage(void)
{
{
(void) fprintf(stderr, gettext(
- "usage: uname [-snrvmapiX]\n"
- " uname [-S system_name]\n"));
+ "usage: uname [-snrvmapiX]\n"
+ " uname [-S system_name]\n"));
}
exit(1);
}