summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-02-07 18:36:13 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-02-07 18:36:13 +0000
commitc4f6fbdceaec2d64d6bb7dba46d91ef61c0983ca (patch)
treeae4c2c23f880a979e356abde0b48b22eebc9d0e7 /usr/src/cmd
parenta07632cea359a68576961f7b45238a6a37a82945 (diff)
parent6d6fcbbb256ba9a8fe3e6076ae8a1f493b1f1a99 (diff)
downloadillumos-joyent-c4f6fbdceaec2d64d6bb7dba46d91ef61c0983ca.tar.gz
[illumos-gate merge]
commit 6d6fcbbb256ba9a8fe3e6076ae8a1f493b1f1a99 6600 cmd/fm should use the msgfmt(1) that Makefile.master tells it to commit aeac2d873b68a43f6650e0d0f021c02f5a653a21 6606 pysolaris has no translations but pretends otherwise commit f3b6506e5de00944c5a877f02a83b5e850f37ef5 6564 F_FLOCKW and F_FLOCK are undefined symbols in SPARC build commit 238d8f47d92b5b99a374f9639e0704420d3aef77 6601 Various GLD drivers return EINVAL instead of ENOTSUP for unused mac_prop_id_t's commit 4870e0a7381ec2ec57437062574e6ddc3dd48d7f 6582 initial reorg adding sys/null.h for 5218 6487 clean up __STDC__ ifdefs in rpcsvc/dbm.h 6563 fmtmsg.h should be simplified and neither define NULL nor _NULL Conflicts: usr/src/lib/Makefile
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/backup/dump/lftw.c4
-rw-r--r--usr/src/cmd/cron/elm.c1
-rw-r--r--usr/src/cmd/fm/dicts/Makefile2
-rw-r--r--usr/src/cmd/lvm/rpc.metamedd/med_hash.h6
-rw-r--r--usr/src/cmd/mdb/common/libstand/sys/salib.h7
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_modapi.h11
-rw-r--r--usr/src/cmd/print/Makefile3
-rw-r--r--usr/src/cmd/sgs/messages/Makefile.com2
-rw-r--r--usr/src/cmd/sgs/rtld/common/_a.out.h4
-rw-r--r--usr/src/cmd/sh/pwd.c150
-rw-r--r--usr/src/cmd/svr4pkg/libinst/pathdup.c1
-rw-r--r--usr/src/cmd/ypcmd/ypxfr.c3
12 files changed, 73 insertions, 121 deletions
diff --git a/usr/src/cmd/backup/dump/lftw.c b/usr/src/cmd/backup/dump/lftw.c
index 8dfcf7db70..d0a9da65ce 100644
--- a/usr/src/cmd/backup/dump/lftw.c
+++ b/usr/src/cmd/backup/dump/lftw.c
@@ -26,8 +26,6 @@
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/* LINTLIBRARY */
/*
* ftw - file tree walk
@@ -101,8 +99,6 @@
#include <unistd.h>
#include <ftw.h>
-#define NULL 0
-
static int pwdfd;
static int lf_xftw(
diff --git a/usr/src/cmd/cron/elm.c b/usr/src/cmd/cron/elm.c
index a61ced60ad..7956a0f26b 100644
--- a/usr/src/cmd/cron/elm.c
+++ b/usr/src/cmd/cron/elm.c
@@ -63,7 +63,6 @@
extern void *xmalloc(size_t);
#define INFINITY 2147483647L /* upper bound on time */
-#define NULL 0 /* a null pointer */
#define TRUE 1
#define FALSE 0
diff --git a/usr/src/cmd/fm/dicts/Makefile b/usr/src/cmd/fm/dicts/Makefile
index 8e0bbd1545..22bebd3ae8 100644
--- a/usr/src/cmd/fm/dicts/Makefile
+++ b/usr/src/cmd/fm/dicts/Makefile
@@ -101,7 +101,7 @@ $(ROOTLCDIR)/%: %
$(INS.file)
%.mo: %.po
- msgfmt -s -o $@ $<
+ $(MSGFMT) -o $@ $<
lint:
@for name in $(DCNAMES); do\
diff --git a/usr/src/cmd/lvm/rpc.metamedd/med_hash.h b/usr/src/cmd/lvm/rpc.metamedd/med_hash.h
index 4886770354..e378fa154d 100644
--- a/usr/src/cmd/lvm/rpc.metamedd/med_hash.h
+++ b/usr/src/cmd/lvm/rpc.metamedd/med_hash.h
@@ -27,16 +27,10 @@
#ifndef _MED_HASH_H
#define _MED_HASH_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
-#ifndef NULL
-#define NULL 0
-#endif /* NULL */
-
typedef struct item_t {
void *key;
int keyl;
diff --git a/usr/src/cmd/mdb/common/libstand/sys/salib.h b/usr/src/cmd/mdb/common/libstand/sys/salib.h
index c46cdabd26..131efc5b57 100644
--- a/usr/src/cmd/mdb/common/libstand/sys/salib.h
+++ b/usr/src/cmd/mdb/common/libstand/sys/salib.h
@@ -27,9 +27,8 @@
#ifndef _SYS_SALIB_H
#define _SYS_SALIB_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
+#include <sys/null.h>
#include <time.h>
#ifdef __cplusplus
@@ -78,10 +77,6 @@ extern size_t strspn(const char *, const char *);
extern char *strpbrk(const char *, const char *);
extern char *strtok(char *, const char *);
-#ifndef NULL
-#define NULL (0)
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_modapi.h b/usr/src/cmd/mdb/common/mdb/mdb_modapi.h
index c6b4956b3b..f9a2baa323 100644
--- a/usr/src/cmd/mdb/common/mdb/mdb_modapi.h
+++ b/usr/src/cmd/mdb/common/mdb/mdb_modapi.h
@@ -37,6 +37,7 @@
*/
#include <sys/types.h>
+#include <sys/null.h>
#include <gelf.h>
#ifdef __cplusplus
@@ -44,16 +45,10 @@ extern "C" {
#endif
/*
- * Make sure that NULL, TRUE, FALSE, MIN, and MAX have the usual definitions
+ * Make sure that TRUE, FALSE, MIN, and MAX have the usual definitions
* so module writers can depend on these macros and defines.
+ * Make sure NULL is available to module writers by including <sys/null.h>.
*/
-#ifndef NULL
-#if defined(_LP64) && !defined(__cplusplus)
-#define NULL 0L
-#else
-#define NULL 0
-#endif
-#endif
#ifndef TRUE
#define TRUE 1
diff --git a/usr/src/cmd/print/Makefile b/usr/src/cmd/print/Makefile
index c22b11279c..d8c55ef13a 100644
--- a/usr/src/cmd/print/Makefile
+++ b/usr/src/cmd/print/Makefile
@@ -22,7 +22,6 @@
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
#
# cmd/print/Makefile
#
@@ -89,7 +88,7 @@ _msg_test: scripts
@/bin/cat messages.po scripts/scripts.po | sed '/domain/d' > $(POFILE)
echo 'domain "SUNW_OST_OSCMD"' > SUNW_OST_OSCMD.po
cat $(POFILE) >> SUNW_OST_OSCMD.po
- msgfmt SUNW_OST_OSCMD.po
+ $(MSGFMT) SUNW_OST_OSCMD.po
@$(RM) messages.po $(POFILE) SUNW_OST_OSCMD.po
clean strip cstyle lint: $(SUBDIRS)
diff --git a/usr/src/cmd/sgs/messages/Makefile.com b/usr/src/cmd/sgs/messages/Makefile.com
index 8a57a7094b..0dd50a2a08 100644
--- a/usr/src/cmd/sgs/messages/Makefile.com
+++ b/usr/src/cmd/sgs/messages/Makefile.com
@@ -33,8 +33,6 @@ TEXT_DOMAIN= SUNW_OST_SGS
POFILE= sgs.po
-MSGFMT= msgfmt
-
# The following message files are generated as part of each utilites build via
# sgsmsg(1l). By default each file is formatted as a portable object file
# (.po) - see msgfmt(1). If the sgsmsg -C option has been employed, each file
diff --git a/usr/src/cmd/sgs/rtld/common/_a.out.h b/usr/src/cmd/sgs/rtld/common/_a.out.h
index 36d5993c9b..0924f01af0 100644
--- a/usr/src/cmd/sgs/rtld/common/_a.out.h
+++ b/usr/src/cmd/sgs/rtld/common/_a.out.h
@@ -26,6 +26,7 @@
#define _A_DOT_OUT_DOT_H
#include <sys/types.h>
+#include <sys/null.h>
#include <sys/mman.h>
#include <a.out.h>
#include <_rtld.h>
@@ -63,9 +64,6 @@ typedef struct _rt_aout_private {
/*
* Special defines for a.out format file class.
*/
-#ifndef NULL
-#define NULL 0
-#endif
#define N_UNDF 0x0 /* undefined */
#define N_ABS 0x2 /* absolute */
#define N_COMM 0x12 /* common (internal to ld) */
diff --git a/usr/src/cmd/sh/pwd.c b/usr/src/cmd/sh/pwd.c
index d6e06074fd..631434454d 100644
--- a/usr/src/cmd/sh/pwd.c
+++ b/usr/src/cmd/sh/pwd.c
@@ -20,6 +20,10 @@
*/
/*
+ * Copyright 2015 PALO, Richard.
+ */
+
+/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -28,8 +32,7 @@
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-/*
+/*
* UNIX shell
*/
@@ -41,11 +44,11 @@
#include "defs.h"
#define DOT '.'
-#define NULL 0
-#define SLASH '/'
-#define PARTLY 2
+#define NULLCHAR '\0'
+#define SLASH '/'
+#define PARTLY 2
-static void rmslash();
+static void rmslash(unsigned char *string);
#ifdef __STDC__
extern const char longpwd[];
#else
@@ -70,27 +73,25 @@ cwd(unsigned char *dir)
/* Now remove any .'s */
pdir = dir;
- if(*dir == SLASH)
+ if (*dir == SLASH)
pdir++;
- while(*pdir) /* remove /./ by itself */
- {
- if((*pdir==DOT) && (*(pdir+1)==SLASH))
- {
+ while (*pdir) { /* remove /./ by itself */
+ if ((*pdir == DOT) && (*(pdir+1) == SLASH)) {
movstr(pdir+2, pdir);
continue;
}
pdir++;
- while ((*pdir) && (*pdir != SLASH))
+ while ((*pdir) && (*pdir != SLASH))
pdir++;
- if (*pdir)
+ if (*pdir)
pdir++;
}
/* take care of trailing /. */
- if(*(--pdir)==DOT && pdir > dir && *(--pdir)==SLASH) {
- if(pdir > dir) {
- *pdir = NULL;
+ if (*(--pdir) == DOT && pdir > dir && *(--pdir) == SLASH) {
+ if (pdir > dir) {
+ *pdir = NULLCHAR;
} else {
- *(pdir+1) = NULL;
+ *(pdir+1) = NULLCHAR;
}
}
@@ -101,14 +102,12 @@ cwd(unsigned char *dir)
/* Now that the dir is canonicalized, process it */
- if(*dir==DOT && *(dir+1)==NULL)
- {
+ if (*dir == DOT && *(dir+1) == NULLCHAR) {
return;
}
- if(*dir==SLASH)
- {
+ if (*dir == SLASH) {
/* Absolute path */
pcwd = cwdname;
@@ -119,73 +118,62 @@ cwd(unsigned char *dir)
{
/* Relative path */
- if (didpwd == FALSE)
+ if (didpwd == FALSE)
return;
- didpwd = PARTLY;
+ didpwd = PARTLY;
pcwd = cwdname + length(cwdname) - 1;
- if(pcwd != cwdname+1)
+ if (pcwd != cwdname+1)
*pcwd++ = SLASH;
}
- while(*dir)
- {
- if(*dir==DOT &&
- *(dir+1)==DOT &&
- (*(dir+2)==SLASH || *(dir+2)==NULL))
- {
+ while (*dir) {
+ if (*dir == DOT &&
+ *(dir+1) == DOT &&
+ (*(dir+2) == SLASH || *(dir+2) == NULLCHAR)) {
/* Parent directory, so backup one */
- if( pcwd > cwdname+2 )
+ if (pcwd > cwdname+2)
--pcwd;
- while(*(--pcwd) != SLASH)
+ while (*(--pcwd) != SLASH)
;
pcwd++;
dir += 2;
- if(*dir==SLASH)
- {
+ if (*dir == SLASH) {
dir++;
}
continue;
}
- if (pcwd >= &cwdname[PATH_MAX+1])
- {
- didpwd=FALSE;
+ if (pcwd >= &cwdname[PATH_MAX+1]) {
+ didpwd = FALSE;
return;
}
*pcwd++ = *dir++;
- while((*dir) && (*dir != SLASH))
- {
- if (pcwd >= &cwdname[PATH_MAX+1])
- {
- didpwd=FALSE;
+ while ((*dir) && (*dir != SLASH)) {
+ if (pcwd >= &cwdname[PATH_MAX+1]) {
+ didpwd = FALSE;
return;
}
*pcwd++ = *dir++;
- }
- if (*dir)
- {
- if (pcwd >= &cwdname[PATH_MAX+1])
- {
- didpwd=FALSE;
+ }
+ if (*dir) {
+ if (pcwd >= &cwdname[PATH_MAX+1]) {
+ didpwd = FALSE;
return;
}
*pcwd++ = *dir++;
}
}
- if (pcwd >= &cwdname[PATH_MAX+1])
- {
- didpwd=FALSE;
+ if (pcwd >= &cwdname[PATH_MAX+1]) {
+ didpwd = FALSE;
return;
}
- *pcwd = NULL;
+ *pcwd = NULLCHAR;
--pcwd;
- if(pcwd>cwdname && *pcwd==SLASH)
- {
+ if (pcwd > cwdname && *pcwd == SLASH) {
/* Remove trailing / */
- *pcwd = NULL;
+ *pcwd = NULLCHAR;
}
- return;
}
void
@@ -195,27 +183,28 @@ cwd2()
unsigned char *pcwd;
/* check if there are any symbolic links in pathname */
- if(didpwd == FALSE)
+ if (didpwd == FALSE)
return;
pcwd = cwdname + 1;
- if(didpwd == PARTLY) {
- while (*pcwd)
- {
+ if (didpwd == PARTLY) {
+ while (*pcwd) {
char c;
- while((c = *pcwd++) != SLASH && c != '\0');
- *--pcwd = '\0';
- if (lstat((char *)cwdname, &stat1) == -1
- || (stat1.st_mode & S_IFMT) == S_IFLNK) {
+ do {
+ c = *pcwd++;
+ } while (c != SLASH && c != NULLCHAR);
+ *--pcwd = NULLCHAR;
+ if (lstat((char *)cwdname, &stat1) == -1 ||
+ (stat1.st_mode & S_IFMT) == S_IFLNK) {
didpwd = FALSE;
*pcwd = c;
return;
}
*pcwd = c;
- if(c)
+ if (c)
pcwd++;
}
didpwd = TRUE;
- } else
+ } else
if (stat((char *)cwdname, &stat1) == -1) {
didpwd = FALSE;
return;
@@ -225,11 +214,10 @@ cwd2()
* consist of symbolic links with ".."
*/
- if (stat(".", &stat2) == -1
- || stat1.st_dev != stat2.st_dev
- || stat1.st_ino != stat2.st_ino)
+ if (stat(".", &stat2) == -1 ||
+ stat1.st_dev != stat2.st_dev ||
+ stat1.st_ino != stat2.st_ino)
didpwd = FALSE;
- return;
}
unsigned char *
@@ -238,9 +226,9 @@ cwdget()
cwd2();
if (didpwd == FALSE) {
if (getcwd((char *)cwdname, PATH_MAX+1) == NULL)
- *cwdname = 0;
+ *cwdname = NULLCHAR;
didpwd = TRUE;
- }
+ }
return (cwdname);
}
@@ -265,11 +253,10 @@ cwdprint(void)
}
for (cp = cwdname; *cp; cp++) {
- prc_buff(*cp);
+ prc_buff(*cp);
}
prc_buff(NL);
- return;
}
/*
@@ -277,16 +264,13 @@ cwdprint(void)
*/
static void
-rmslash(string)
- unsigned char *string;
+rmslash(unsigned char *string)
{
unsigned char *pstring;
pstring = string;
- while(*pstring)
- {
- if(*pstring==SLASH && *(pstring+1)==SLASH)
- {
+ while (*pstring) {
+ if (*pstring == SLASH && *(pstring+1) == SLASH) {
/* Remove repeated SLASH's */
movstr(pstring+1, pstring);
@@ -296,11 +280,9 @@ rmslash(string)
}
--pstring;
- if(pstring>string && *pstring==SLASH)
- {
+ if (pstring > string && *pstring == SLASH) {
/* Remove trailing / */
- *pstring = NULL;
+ *pstring = NULLCHAR;
}
- return;
}
diff --git a/usr/src/cmd/svr4pkg/libinst/pathdup.c b/usr/src/cmd/svr4pkg/libinst/pathdup.c
index 950d8bc5ed..39c92ce2ce 100644
--- a/usr/src/cmd/svr4pkg/libinst/pathdup.c
+++ b/usr/src/cmd/svr4pkg/libinst/pathdup.c
@@ -46,7 +46,6 @@
* memory fragmentation to 12.5%
*/
#define MEMSIZ PATH_MAX*8
-#define NULL 0
struct dup {
char mem[MEMSIZ];
diff --git a/usr/src/cmd/ypcmd/ypxfr.c b/usr/src/cmd/ypcmd/ypxfr.c
index 15846cbc28..c6a8d403aa 100644
--- a/usr/src/cmd/ypcmd/ypxfr.c
+++ b/usr/src/cmd/ypcmd/ypxfr.c
@@ -32,8 +32,6 @@
* California.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* This is a user command which gets a NIS data base from some running
* server, and gets it to the local site by using the normal NIS client
@@ -72,7 +70,6 @@
*/
#include <ndbm.h>
-#undef NULL
#define DATUM
#include <stdio.h>