Subject: ln.diff for bin/19431
To: None <tech-userlevel@netbsd.org>
From: Jason R. Fink <jrf@adresearch.com>
List: tech-userlevel
Date: 12/17/2002 22:37:57
--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hullo,

Here is the first of some work I am doing
to add verbose mode to some utils (see bin/19431).

Feedback would be appreciated,

	j

-- 
Jay Fink http://pyxis.homeunix.net/
NetBSD Developer http://www.netbsd.org/
Senior SysAdmin/Programmer, Ipsos http://www.ipsos.com/

--sdtB3X0nJg68CQEu
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="ln.diff"

? ln.cat1
Index: ln.1
===================================================================
RCS file: /cvsroot/basesrc/bin/ln/ln.1,v
retrieving revision 1.16
diff -u -r1.16 ln.1
--- ln.1	2002/09/25 15:18:39	1.16
+++ ln.1	2002/12/18 03:32:47
@@ -44,11 +44,11 @@
 .Nd make links
 .Sh SYNOPSIS
 .Nm
-.Op Fl fhns
+.Op Fl fhnsv
 .Ar source_file
 .Op Ar target_file
 .Nm ""
-.Op Fl fhns
+.Op Fl fhnsv
 .Ar source_file ... target_dir
 .Sh DESCRIPTION
 The
@@ -87,6 +87,10 @@
 implementations.
 .It Fl s
 Create a symbolic link.
+.It Fl v
+Cause
+.Nm
+to be verbose, showing files as they are processed.
 .El
 .Pp
 By default
Index: ln.c
===================================================================
RCS file: /cvsroot/basesrc/bin/ln/ln.c,v
retrieving revision 1.20
diff -u -r1.20 ln.c
--- ln.c	2002/10/30 22:52:10	1.20
+++ ln.c	2002/12/18 03:32:47
@@ -60,8 +60,10 @@
 int	fflag;				/* Unlink existing files. */
 int	hflag;				/* Check new name for symlink first. */
 int	sflag;				/* Symbolic, not hard, link. */
+int	vflag;				/* Verbose output */
 					/* System link call. */
 int (*linkf)(const char *, const char *);
+char	linkch;
 
 int	linkit(char *, char *, int);
 void	usage(void);
@@ -75,7 +77,7 @@
 	char *sourcedir;
 
 	setprogname(argv[0]);
-	while ((ch = getopt(argc, argv, "fhns")) != -1)
+	while ((ch = getopt(argc, argv, "fhnsv")) != -1)
 		switch (ch) {
 		case 'f':
 			fflag = 1;
@@ -87,6 +89,9 @@
 		case 's':
 			sflag = 1;
 			break;
+		case 'v':
+			vflag = 1;
+			break;
 		case '?':
 		default:
 			usage();
@@ -96,6 +101,7 @@
 	argc -= optind;
 
 	linkf = sflag ? symlink : link;
+	linkch = sflag ? '-' : '=';
 
 	switch(argc) {
 	case 0:
@@ -162,6 +168,8 @@
 		warn("%s", source);
 		return (1);
 	}
+	if (vflag)
+		(void)printf("%s %c> %s\n", source, linkch, target);
 
 	return (0);
 }

--sdtB3X0nJg68CQEu--