From owner-freebsd-current Wed Aug 30 08:23:46 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id IAA07854 for current-outgoing; Wed, 30 Aug 1995 08:23:46 -0700 Received: from time.cdrom.com (time.cdrom.com [192.216.222.226]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id IAA07847 for ; Wed, 30 Aug 1995 08:23:43 -0700 Received: from localhost (localhost [127.0.0.1]) by time.cdrom.com (8.6.12/8.6.9) with SMTP id IAA04425 for ; Wed, 30 Aug 1995 08:23:41 -0700 To: current@freebsd.org Subject: What do you think of these patches to echo? Date: Wed, 30 Aug 1995 08:23:40 -0700 Message-ID: <4423.809796220@time.cdrom.com> From: "Jordan K. Hubbard" Sender: current-owner@freebsd.org Precedence: bulk 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(' '); }