Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ls Rename ls.c::main() -> ls.c::ls_main(), and add a wra...
details: https://anonhg.NetBSD.org/src/rev/8b5451ee2cb7
branches: trunk
changeset: 473023:8b5451ee2cb7
user: lukem <lukem%NetBSD.org@localhost>
date: Mon May 17 12:16:03 1999 +0000
description:
Rename ls.c::main() -> ls.c::ls_main(), and add a wrapper in main.c::main().
This allows other programs to link in against ls (e.g, ftpd), without having
to have hacks to deal with multiple main()s.
Yes, I know this is ugly. The clean alternative (move lots of this
into libutil, yada yada yada) isn't fun, and the effort probably isn't
justified...
diffstat:
bin/ls/Makefile | 4 +-
bin/ls/extern.h | 4 ++-
bin/ls/ls.c | 8 ++----
bin/ls/main.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 69 insertions(+), 8 deletions(-)
diffs (132 lines):
diff -r aca81cfb538a -r 8b5451ee2cb7 bin/ls/Makefile
--- a/bin/ls/Makefile Mon May 17 11:12:44 1999 +0000
+++ b/bin/ls/Makefile Mon May 17 12:16:03 1999 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.10 1997/07/20 22:37:18 christos Exp $
+# $NetBSD: Makefile,v 1.11 1999/05/17 12:16:03 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 6/2/93
PROG= ls
-SRCS= cmp.c stat_flags.c ls.c print.c util.c
+SRCS= cmp.c ls.c main.c print.c stat_flags.c util.c
.include <bsd.prog.mk>
diff -r aca81cfb538a -r 8b5451ee2cb7 bin/ls/extern.h
--- a/bin/ls/extern.h Mon May 17 11:12:44 1999 +0000
+++ b/bin/ls/extern.h Mon May 17 12:16:03 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.9 1999/02/12 14:35:48 kleink Exp $ */
+/* $NetBSD: extern.h,v 1.10 1999/05/17 12:16:03 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -46,6 +46,8 @@
int sizecmp __P((const FTSENT *, const FTSENT *));
int revsizecmp __P((const FTSENT *, const FTSENT *));
+int ls_main __P((int, char *[]));
+
void prcopy __P((char *, char *, int));
void printacol __P((DISPLAY *));
void printcol __P((DISPLAY *));
diff -r aca81cfb538a -r 8b5451ee2cb7 bin/ls/ls.c
--- a/bin/ls/ls.c Mon May 17 11:12:44 1999 +0000
+++ b/bin/ls/ls.c Mon May 17 12:16:03 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ls.c,v 1.37 1999/05/04 11:55:22 simonb Exp $ */
+/* $NetBSD: ls.c,v 1.38 1999/05/17 12:16:03 lukem Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@@ -46,7 +46,7 @@
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-__RCSID("$NetBSD: ls.c,v 1.37 1999/05/04 11:55:22 simonb Exp $");
+__RCSID("$NetBSD: ls.c,v 1.38 1999/05/17 12:16:03 lukem Exp $");
#endif
#endif /* not lint */
@@ -69,8 +69,6 @@
#include "ls.h"
#include "extern.h"
-int main __P((int, char *[]));
-
static void display __P((FTSENT *, FTSENT *));
static int mastercmp __P((const FTSENT **, const FTSENT **));
static void traverse __P((int, char **, int));
@@ -111,7 +109,7 @@
int f_whiteout; /* show whiteout entries */
int
-main(argc, argv)
+ls_main(argc, argv)
int argc;
char *argv[];
{
diff -r aca81cfb538a -r 8b5451ee2cb7 bin/ls/main.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ls/main.c Mon May 17 12:16:03 1999 +0000
@@ -0,0 +1,61 @@
+/* $NetBSD: main.c,v 1.1 1999/05/17 12:16:03 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+#ifndef lint
+__RCSID("$NetBSD: main.c,v 1.1 1999/05/17 12:16:03 lukem Exp $");
+#endif /* not lint */
+
+#include <sys/types.h>
+#include <fts.h>
+
+#include "ls.h"
+#include "extern.h"
+
+int main __P((int, char *[]));
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+
+ return (ls_main(argc, argv));
+ /* NOTREACHED */
+}
Home |
Main Index |
Thread Index |
Old Index