- #!/usr/bin/ksh93
- #
- # mkfifo - mkfifo emulation hack for Cygwin on NFS filesystems
- #
- # Simple hash full path of FIFO, create FIFO in /tmp
- # and use original pathname for softlink to FIFO in /tmp
- #
- # Script should be chmod +x and then in front of PATH,
- # before /usr/bin:/bin where the normal mkfifo resides
- #
- #
- # Written by Roland Mainz <roland.mainz@nrubsig.org>
- #
- function usage
- {
- OPTIND=0
- getopts -a "$0" "${mkfifo_usage}" OPT '-?'
- exit 2
- }
- typeset -r mkfifo_usage=$'+
- [-?\n@(#)\$Id: mkfifo (Roland Mainz) 2023-09-01 \$\n]
- [-author?Roland Mainz <roland.mainz@nrubsig.org>]
- [+NAME?mkfifo - mkfifo emulation hack for Cygwin nfs]
- [+DESCRIPTION?\bshlint\b is a lint for POSIX shell scripts.]
- [m:mode?set file permissions.]:[number]
- name
- [+SEE ALSO?\bshcomp\b(1), \bksh93\b(1)]
- '
- builtin getconf
- while getopts -a "${progname}" "${mkfifo_usage}" OPT ; do
- # printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|"
- case "${OPT}" in
- 'm') typeset fifomode="$OPTARG" ;;
- *) usage ;;
- esac
- done
- shift $(( OPTIND-1 ))
- (( $# > 0 )) || usage
- # reset PATH to the platform's default
- export PATH="$(getconf PATH)"
- integer retval=0
- typeset fifoname
- typeset hash
- typeset dummy
- for fifoname in "$@" ; do
- realpath "$fifoname" | md5sum | read hash dummy
- fifopath="/tmp/nfsfifo_${hash}.fifo"
- rm -f "$fifopath"
- if [[ -v fifomode ]] ; then
- mkfifo -m "$fifomode" "$fifopath"
- (( retval=$? ))
- else
- mkfifo "$fifopath"
- (( retval=$? ))
- fi
- if (( retval == 0 )) ; then
- ln -sf "$fifopath" "$fifoname"
- else
- break
- fi
- done
- exit $retval
- #EOF.
Cygwin mkfifo.nfs hack
Posted by Anonymous on Fri 1st Sep 2023 11:11
raw | new post
modification of post by Anonymous (view diff)
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.