Submitted by: Damon Harper Date: 2006-08-26 Summary: Enhance the echo command in comsatd / .biffrc This patch makes the `echo' .biffrc action for comsatd behave more like the shell version of `echo': 1. Multiple arguments to echo are accepted, and are echoed back separated by single spaces. This way you can use echo without having to quote the entire string. 2. A newline is appended by default, unless the first argument to echo is `-n'. 3. With no arguments, a single newline is produced. This allows much easier to read constructions like the following contrived example: echo echo New "mail :: for" address@hidden: echo --- echo From: $H{From} echo Subject: $H{Subject} echo -n $B(,5) echo --- NOTE: This does introduce one backwards-incompatibility, in that current .biffrc echo commands will have an extra newline appended. --- mailutils-1.0.orig/comsat/action.c 2005-08-29 03:21:54.000000000 -0700 +++ mailutils-1.0/comsat/action.c 2006-08-25 15:39:41.000000000 -0700 @@ -369,7 +369,24 @@ } else if (strcmp (argv[0], "echo") == 0) { - action_echo (tty, cr, argv[1]); + int newline = 1; + if (argc > 1) + { + int c = 1; + if (strcmp (argv[1], "-n") == 0) + { + newline = 0; + c++; + } + for (; c < argc; c++) + { + action_echo (tty, cr, argv[c]); + if (c < argc - 1) + action_echo (tty, cr, " "); + } + } + if (newline) + action_echo (tty, cr, "\n"); nact++; } else if (strcmp (argv[0], "exec") == 0)