Module Name: src Committed By: tsutsui Date: Thu May 19 22:14:15 UTC 2011
Modified Files: src/distrib/utils/tls: Makefile tls.c Log Message: - WARNSfy - KNF, ANSIfy, misc cosmetics To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/distrib/utils/tls/Makefile cvs rdiff -u -r1.4 -r1.5 src/distrib/utils/tls/tls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/utils/tls/Makefile diff -u src/distrib/utils/tls/Makefile:1.7 src/distrib/utils/tls/Makefile:1.8 --- src/distrib/utils/tls/Makefile:1.7 Wed Dec 12 00:05:11 2001 +++ src/distrib/utils/tls/Makefile Thu May 19 22:14:15 2011 @@ -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 Index: src/distrib/utils/tls/tls.c diff -u src/distrib/utils/tls/tls.c:1.4 src/distrib/utils/tls/tls.c:1.5 --- src/distrib/utils/tls/tls.c:1.4 Fri Apr 2 15:34:16 2010 +++ src/distrib/utils/tls/tls.c Thu May 19 22:14:15 2011 @@ -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 */