dd-ex: function to generate files of arbitrary size

The arithmetic functions need to generate files of arbitrary size. The original version of dd-ex used to copy the required number of bytes from /dev/zero, but unfortunately this is not portable. The function zero does something similar: it copies the shell script to standard output until it receives a "broken pipe" signal - this function is piped into a copy of dd which just reads the required number of bytes (not shown here - see the arithmetic functions for this).
  # this is used to generate garbage files

  zero () {
    # execute this in a subshell
    ( trap the "broken pipe" signal
      trap 'go=false' 13

      # true and false are functions defined elsewhere
      go=true
      while $go
      do
	# copy the script to standard output
	$dd "if=$0"
	# if something goes wrong, we stop (the only possible
	# reasons are a broken pipe or a weird thing happening
	# to the script which makes it unreadable)
	case "$?" in
	  0) ;;
	  *) go=false ;;
	esac
      done
    ) 2>/dev/null
    # the standard error is redirected away so we won't see
    # the "broken pipe" on the terminal
  }