summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorrb151345 <none@none>2005-09-30 13:16:00 -0700
committerrb151345 <none@none>2005-09-30 13:16:00 -0700
commit20120a7c0174b82c10a30ab711e93ffd8619096b (patch)
tree206860d5127834097bcadeb49595e553040e794d /usr/src
parent49e7ca4919cec3229f6fab9730bafc7cf24dab23 (diff)
downloadillumos-joyent-20120a7c0174b82c10a30ab711e93ffd8619096b.tar.gz
6268933 cmd/aset and gcc don't get along
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/aset/util/geteuid.c10
-rw-r--r--usr/src/cmd/aset/util/homedir.c16
-rw-r--r--usr/src/cmd/aset/util/is_readable.c24
-rw-r--r--usr/src/cmd/aset/util/is_writable.c24
-rw-r--r--usr/src/cmd/aset/util/minmode.c22
-rw-r--r--usr/src/cmd/aset/util/nls.c14
-rw-r--r--usr/src/cmd/aset/util/realpath.c12
-rw-r--r--usr/src/cmd/aset/util/str_to_mode.c13
8 files changed, 76 insertions, 59 deletions
diff --git a/usr/src/cmd/aset/util/geteuid.c b/usr/src/cmd/aset/util/geteuid.c
index 2ca6fecb71..7cd3f72fe9 100644
--- a/usr/src/cmd/aset/util/geteuid.c
+++ b/usr/src/cmd/aset/util/geteuid.c
@@ -20,13 +20,15 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990, 1991 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-char sccsid[] = "@(#) geteuid.c 1.2 1/3/91 09:47:04";
+#pragma ident "%Z%%M% %I% %E% SMI"
-main()
+int
+main(int argc, char **argv)
{
printf("%i\n", getuid());
+ return (0);
}
diff --git a/usr/src/cmd/aset/util/homedir.c b/usr/src/cmd/aset/util/homedir.c
index 0f00177567..8a9ab1b3b8 100644
--- a/usr/src/cmd/aset/util/homedir.c
+++ b/usr/src/cmd/aset/util/homedir.c
@@ -20,21 +20,23 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990, 1991 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <pwd.h>
#include <stdio.h>
-/* homedir: returns home directory of a given user.
+/*
+ * homedir: returns home directory of a given user.
* return status: 0 if successful;
* 1 if not.
*/
-main()
+int
+main(int argc, char **argv)
{
struct passwd *getpwnam();
struct passwd *pwstruct;
@@ -44,8 +46,8 @@ main()
pwstruct = getpwnam(username);
if (pwstruct == NULL) {
printf("NONE\n");
- exit(1);
+ return (1);
}
printf("%s\n", pwstruct->pw_dir);
- exit(0);
+ return (0);
}
diff --git a/usr/src/cmd/aset/util/is_readable.c b/usr/src/cmd/aset/util/is_readable.c
index facf2cbf74..1f4c399b79 100644
--- a/usr/src/cmd/aset/util/is_readable.c
+++ b/usr/src/cmd/aset/util/is_readable.c
@@ -20,47 +20,49 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990, 1991 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/stat.h>
-/* Checks group (-g) or world (default) readability.
+/*
+ * Checks group (-g) or world (default) readability.
* Returns as exit code: 0 = readable
* 1 = not readable
*/
+int
main(int argc, char **argv)
{
int group = 0, xmode = 0;
struct stat statb;
if (argc < 2) {
- printf("Usage: %s [-g] file\n",argv[0]);
- exit(0);
+ printf("Usage: %s [-g] file\n", argv[0]);
+ return (0);
}
if (argc > 2) {
- if (!strcmp(argv[1], "-g")) {
+ if (strcmp(argv[1], "-g") == 0) {
group = 1;
argc--;
argv++;
}
}
- if (stat(*++argv,&statb) < 0) {
- exit(2);
+ if (stat(*++argv, &statb) < 0) {
+ return (2);
}
if (group)
xmode = statb.st_mode & S_IRGRP;
- else
+ else
xmode = statb.st_mode & S_IROTH;
- exit(!xmode);
+ return (!xmode);
}
diff --git a/usr/src/cmd/aset/util/is_writable.c b/usr/src/cmd/aset/util/is_writable.c
index b041ecc936..67eb5e3dde 100644
--- a/usr/src/cmd/aset/util/is_writable.c
+++ b/usr/src/cmd/aset/util/is_writable.c
@@ -20,46 +20,48 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990, 1991 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/stat.h>
-/* Checks group (-g) or world (default) writeability.
+/*
+ * Checks group (-g) or world (default) writeability.
* Returns as exit code: 0 = writable
* 1 = not writable
*/
+int
main(int argc, char **argv)
{
int group = 0, xmode = 0;
struct stat statb;
if (argc < 2) {
- printf("Usage: %s [-g] file\n",argv[0]);
- exit(0);
+ printf("Usage: %s [-g] file\n", argv[0]);
+ return (0);
}
if (argc > 2) {
- if (!strcmp(argv[1], "-g")) {
+ if (strcmp(argv[1], "-g") == 0) {
group = 1;
argc--;
argv++;
}
}
- if (stat(*++argv,&statb) < 0) {
- exit(2);
+ if (stat(*++argv, &statb) < 0) {
+ return (2);
}
if (group)
xmode = statb.st_mode & S_IWGRP;
- else
+ else
xmode = statb.st_mode & S_IWOTH;
- exit(!xmode);
+ return (!xmode);
}
diff --git a/usr/src/cmd/aset/util/minmode.c b/usr/src/cmd/aset/util/minmode.c
index 69c683cef1..7d6caf5d25 100644
--- a/usr/src/cmd/aset/util/minmode.c
+++ b/usr/src/cmd/aset/util/minmode.c
@@ -20,11 +20,11 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990-2002 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/stat.h>
@@ -32,13 +32,15 @@
#define USAGE "Usage: minmode pathname mode\n"
-/* minmode: takes a pathname and a mode representation in octal, sets
+/*
+ * minmode: takes a pathname and a mode representation in octal, sets
* the new mode to be stricter than both the current mode and the specified
* mode.
* If successful, prints the new mode (exit status = 0);
* if unsuccessful, prints the usage message (exit status = -1).
*/
+int
main(int argc, char **argv)
{
char *bufp;
@@ -51,23 +53,23 @@ main(int argc, char **argv)
if (argc != 3) {
printf("%s\n", USAGE);
- exit(1);
+ return (1);
}
mode = strtol(argv[2], &bufp, 8);
if (*bufp != '\0') {
printf("minmode: invalid mode - %s\n", argv[2]);
printf("%s\n", USAGE);
- exit(1);
+ return (1);
}
if (stat(argv[1], &sbuf)) {
printf("minmode: can't stat %s\n", argv[1]);
perror(0);
printf("%s\n", USAGE);
- exit(1);
+ return (1);
}
- currmode = ((long) sbuf.st_mode) & 07777;
+ currmode = ((long)sbuf.st_mode) & 07777;
perm = mode & 0777;
sbits = mode & 007000;
@@ -77,7 +79,7 @@ main(int argc, char **argv)
newsbits = sbits | currsbits;
newmode = newsbits | newperm;
if (newmode == currmode)
- exit(1);
+ return (1);
printf("%o\n", newmode);
- exit(0);
+ return (0);
}
diff --git a/usr/src/cmd/aset/util/nls.c b/usr/src/cmd/aset/util/nls.c
index f19d16ae7a..d598e71be7 100644
--- a/usr/src/cmd/aset/util/nls.c
+++ b/usr/src/cmd/aset/util/nls.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -324,7 +324,7 @@ main(int argc, char *argv[])
if (opterr) {
(void) fprintf(stderr, gettext(
"usage: ls -1RaAdCxmnlogrtucpFbqisfL [files]\n"));
- exit(2);
+ return (2);
}
if (fflg) {
@@ -373,7 +373,7 @@ main(int argc, char *argv[])
if (((flist = malloc(maxfils * sizeof (struct lbuf *))) == NULL) ||
((nxtlbf = malloc(quantn * sizeof (struct lbuf))) == NULL)) {
perror("ls");
- exit(2);
+ return (2);
}
if ((amino = (argc-optind)) == 0) {
/*
@@ -393,7 +393,7 @@ main(int argc, char *argv[])
if ((ep = gstat((*argv[optind] ? argv[optind] : dotp), 1))
== NULL) {
if (nomocore)
- exit(2);
+ return (2);
err = 2;
optind++;
continue;
@@ -414,7 +414,7 @@ main(int argc, char *argv[])
for (; i < nargs; i++) {
pdirectory(flist[i]->ln.namep, Rflg || (amino > 1), nargs);
if (nomocore)
- exit(2);
+ return (2);
/* -R: print subdirectories found */
while (dfirst || cdfirst) {
/* Place direct subdirs on front in right order */
@@ -430,7 +430,7 @@ main(int argc, char *argv[])
dfirst = dfirst->dc_next;
pdirectory(dtemp->dc_name, 1, nargs);
if (nomocore)
- exit(2);
+ return (2);
free(dtemp->dc_name);
free(dtemp);
}
@@ -551,7 +551,7 @@ pentry(struct lbuf *ap)
if (mflg && !lflg)
curcol += printf("%llu ", p->lnum);
else
- curcol += printf((p->lnum < 10000000000) ? "%10llu "
+ curcol += printf((p->lnum < 10000000000ULL) ? "%10llu "
: "%llu ", p->lnum);
if (sflg)
curcol += printf((mflg && !lflg) ? "%lld " :
diff --git a/usr/src/cmd/aset/util/realpath.c b/usr/src/cmd/aset/util/realpath.c
index 0c1c716d19..bd4bc06af8 100644
--- a/usr/src/cmd/aset/util/realpath.c
+++ b/usr/src/cmd/aset/util/realpath.c
@@ -20,14 +20,16 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990, 1991 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/param.h>
+#include <stdlib.h>
+int
main(int argc, char **argv)
{
char *realpath();
@@ -36,6 +38,8 @@ main(int argc, char **argv)
if (realpath(argv[1], resolved_path) == NULL) {
printf("\n");
- } else
+ } else
printf("%s\n", resolved_path);
+
+ return (0);
}
diff --git a/usr/src/cmd/aset/util/str_to_mode.c b/usr/src/cmd/aset/util/str_to_mode.c
index ec1f3fe703..e370d33465 100644
--- a/usr/src/cmd/aset/util/str_to_mode.c
+++ b/usr/src/cmd/aset/util/str_to_mode.c
@@ -20,20 +20,22 @@
* CDDL HEADER END
*/
/*
- * Copyright 1990, 1991 Sun Microsystems, Inc. All Rights Reserved.
- *
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
+#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
-/* Takes a (10 char) permission string (as returned by ls -l) and prints
+/*
+ * Takes a (10 char) permission string (as returned by ls -l) and prints
* the equivalent octal number.
* E.g. -rwsr-xr-- => 04754
*/
+int
main(int argc, char **argv)
{
char *perm;
@@ -41,7 +43,7 @@ main(int argc, char **argv)
if ((argc != 2) || (strlen(argv[1]) != 10)) {
printf("-1\n");
- exit(1);
+ return (1);
}
perm = argv[1];
@@ -83,4 +85,5 @@ main(int argc, char **argv)
result = result | 01000;
printf("%05o\n", result);
+ return (0);
}