Re: [GUILT v2 24/29] disp no longer processes backslashes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 13, 2014 at 10:31:00PM +0200, Per Cederqvist wrote:
> Only one invocation of "disp" or "_disp" actually needed backslash
> processing.  In quite a few instances, it was wrong to do backslash
> processing, as the message contained data derived from the user.
> 
> Created the new function "disp_e" that should be used when backslash
> processing is required, and changed "disp" and "_disp" to use printf
> code %s instead of "%b".

Minor nit: "%s" (to match "%b")

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@xxxxxxxxxxxxxx>


> Signed-off-by: Per Cederqvist <cederp@xxxxxxxxx>
> ---
>  guilt | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/guilt b/guilt
> index 23cc2da..9947acc 100755
> --- a/guilt
> +++ b/guilt
> @@ -36,15 +36,24 @@ usage()
>  	exit 1
>  }
>  
> -# echo -n is a bashism, use printf instead
> +# Print arguments, but no trailing newline.
> +# (echo -n is a bashism, use printf instead)
>  _disp()
>  {
> -	printf "%b" "$*"
> +	printf "%s" "$*"
>  }
>  
> -# echo -e is a bashism, use printf instead
> +# Print arguments.
> +# (echo -E is a bashism, use printf instead)
>  disp()
>  {
> +	printf "%s\n" "$*"
> +}
> +
> +# Print arguments, processing backslash sequences.
> +# (echo -e is a bashism, use printf instead)
> +disp_e()
> +{
>  	printf "%b\n" "$*"
>  }
>  
> @@ -117,7 +126,7 @@ else
>  
>  	disp ""
>  	disp "Example:"
> -	disp "\tguilt push"
> +	disp_e "\tguilt push"
>  
>  	# now, let's exit
>  	exit 1
> -- 
> 1.8.3.1
> 

-- 
Reality is merely an illusion, albeit a very persistent one.
		- Albert Einstein
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]