[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Good joke (Was: Re: [MailServer Notification]Attachment Blocking Notification)
From:       Steffen Nurpmeso <steffen () sdaoden ! eu>
Date:       2024-02-14 20:18:18
Message-ID: 20240214201818.4qvNR-Zy () steffen%sdaoden ! eu
[Download RAW message or body]

Administrator wrote in
 <27769766AF8F4611A87C44993387EA1A@ARRS.ARRISI.com>:
 |The quote-rndtrip.sh has been blocked since it violated the Microsoft 
 |Exchange attachment policy and Delete entire message has been taken on 
 |2/14/2024 3:12:02 PM.
 |If you have any questions, please contact ARRIS IT. Thank you
 |
 |Message details:
 |Server: ATLEXOWA3
 |Found in: SMTP
 |Sender: steffen@sdaoden.eu;
 |Recipient: harv@gmx.de;busybox@busybox.net;
 |Subject: Re: Failing shell code under busybox 1.36.1 that worked with 
 |1.31.1
 |Attachment name: quote-rndtrip.sh 
 --End of <27769766AF8F4611A87C44993387EA1A@ARRS.ARRISI.com>

I almost laughed.
Then inline.

And good-bye.

#!/bin/sh -
#@ Round trip quote strings in POSIX shell.  For example
#@   set -- x 'a \ b' "foo'" "\\'b\\a\\r\\" AƤ
#@   printf "%s: <%s><%s><%s><%s><%s>\n" "$#" "${1}" "${2}" "${3}" "$4" "$5"
#@   saved_parameters=`quote_rndtrip "$@"`
#@   eval "set -- $saved_parameters"
#@   printf "%s: <%s><%s><%s><%s><%s>\n" "$#" "${1}" "${2}" "${3}" "$4" "$5"
#
# 2017 Robert Elz (kre).
# 2017 - 2022 Steffen Nurpmeso <steffen@sdaoden.eu>.
# Public Domain

# Though slower use a subshell version instead of properly restoring $IFS
# and flags, as elder shells may not be able to properly restore flags via
# "set +o" as later standardized in POSIX, and it seems overkill to handle
# all possible forms of output "set +o" may or may not actually generate.
quote__rndtrip() (
	case "$1" in
	*\'*) ;;
	*) printf "'%s'" "$1"; return 0;;
	esac
	a="$1" s= e=
	while case "$a" in
		\'*) a=${a#?}; s="${s}\\\\'";;
		*\') a=${a%?}; e="${e}\\\\'";;
		'') printf "${s}${e}"; exit 0;;
		*) false;;
		esac
	do
		continue
	done
	IFS=\'
	set -f
	set -- $a
	r="${1}"
	shift
	for a
	do
		r="${r}'\\''${a}"
	done
	printf "${s}'%s'${e}" "${r}"
	exit 0
)

quote_rndtrip() (
	j=
	for i
	do
		[ -n "$j" ] && printf ' '
		j=' '
		quote__rndtrip "$i"
	done
)

quote_string() (
	j=
	for i
	do
		[ -n "$j" ] && printf '\\ '
		j=' '
		quote__rndtrip "$i"
	done
)

# s-sht-mode

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic