Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Aug 1995 08:23:40 -0700
From:      "Jordan K. Hubbard" <jkh@time.cdrom.com>
To:        current@freebsd.org
Subject:   What do you think of these patches to echo?
Message-ID:  <4423.809796220@time.cdrom.com>

next in thread | raw e-mail | index | archive | help
If you think I'm going to commit this without review, you're
crazy.. :-)

Synopsis:
	add \c handling to echo (at the end of an arglist, is
	synonymous with echo -n ...)

Why:
	We can make ourselves iBCS2 compliant with an LKM, but we
	can't do anything about the differing semantics of various
	commands.

	Fortunately, very few installation shell scripts for SCO
	do things like `ps -deaf|..' but they DO do a lot of
	`echo "foo bar bar blatt?\c "' sorts of things and
	this looks really cheesy when you're installing WordPerfect
        for SCO or something.

Disclaimer:
	I don't propose that we change all the commands to be SCO
	compliant (heavens!) by any stretch, simply that the change to
	this one is innocuous enough that we get good "bang for the
	buck" in increasing the quality of our iBCS2 coverage from one
	very small change.

	POSIX doesn't seem to have anything to say about this at all.

Diffs:

Index: echo.c
===================================================================
RCS file: /home/ncvs/src/bin/echo/echo.c,v
retrieving revision 1.2
diff -c -r1.2 echo.c
*** 1.2	1994/09/24 02:55:18
--- echo.c	1995/08/28 19:54:00
***************
*** 62,69 ****
  	else
  		nflag = 0;
  
! 	while (*argv) {
! 		(void)printf("%s", *argv);
  		if (*++argv)
  			putchar(' ');
  	}
--- 63,76 ----
  	else
  		nflag = 0;
  
! 	while (argv[0]) {
! 		int len = strlen(argv[0]);
! 
! 		if (len >= 2 && !argv[1] && argv[0][len - 2] == '\\' && argv[0][len - 1] == 'c') {
! 			argv[0][len - 2] = '\0';
! 			nflag = 1;
! 		}
! 		(void)printf("%s", argv[0]);
  		if (*++argv)
  			putchar(' ');
  	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4423.809796220>