Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/utils/tls - WARNSfy
details: https://anonhg.NetBSD.org/src/rev/d592f7217c18
branches: trunk
changeset: 765120:d592f7217c18
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Thu May 19 22:14:15 2011 +0000
description:
- WARNSfy
- KNF, ANSIfy, misc cosmetics
diffstat:
distrib/utils/tls/Makefile | 3 ++-
distrib/utils/tls/tls.c | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)
diffs (86 lines):
diff -r b72761daab28 -r d592f7217c18 distrib/utils/tls/Makefile
--- a/distrib/utils/tls/Makefile Thu May 19 22:12:35 2011 +0000
+++ b/distrib/utils/tls/Makefile Thu May 19 22:14:15 2011 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.7 2001/12/12 00:05:11 tv Exp $
+# $NetBSD: Makefile,v 1.8 2011/05/19 22:14:15 tsutsui Exp $
# Tiny ls (i.e. for boot media)
+WARNS?= 4
PROG= tls
NOMAN= # defined
diff -r b72761daab28 -r d592f7217c18 distrib/utils/tls/tls.c
--- a/distrib/utils/tls/tls.c Thu May 19 22:12:35 2011 +0000
+++ b/distrib/utils/tls/tls.c Thu May 19 22:14:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tls.c,v 1.4 2010/04/02 15:34:16 christos Exp $ */
+/* $NetBSD: tls.c,v 1.5 2011/05/19 22:14:15 tsutsui Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@@ -29,17 +29,19 @@
#include <sys/stat.h>
#include <dirent.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <unistd.h>
int iflag;
+int main(int, char *[]);
void show_long(char *fname);
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char *argv[])
{
DIR *dfp;
struct dirent *d;
@@ -56,19 +58,18 @@
dfp = opendir(".");
if (dfp == NULL) {
- perror("opendir");
- return;
+ err(EXIT_FAILURE, "opendir");
}
while ((d = readdir(dfp)) != NULL)
show_long(d->d_name);
closedir(dfp);
- exit(0);
+ exit(EXIT_SUCCESS);
}
/* XXX - This is system dependent... */
-char ifmt_name[16] = {
+const char ifmt_name[16] = {
'?', /* 0: nothing */
'P', /* 1: fifo (pipe) */
'C', /* 2: chr device */
@@ -88,8 +89,7 @@
};
void
-show_long(fname)
- char *fname;
+show_long(char *fname)
{
struct stat st;
int ifmt;
@@ -105,7 +105,7 @@
if (iflag) {
/* inode number */
- printf("%6d ", st.st_ino);
+ printf("%6d ", (int)st.st_ino); /* assume small fs */
}
/* fmt/mode */
Home |
Main Index |
Thread Index |
Old Index