pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 81f23 by Anonymous on Fri 1st Sep 2023 11:11
original post 31d07f8 by Anonymous on Fri 1st Sep 2023 04:11
Download diff
Show old version | new version | both versions

    
11
#!/usr/bin/ksh93
22
33
#
44
# mkfifo - mkfifo emulation hack for Cygwin on NFS filesystems
55
#
66
# Simple hash full path of FIFO, create FIFO in /tmp
77
# and use original pathname for softlink to FIFO in /tmp
88
#
99
# Script should be chmod +x and then in front of PATH,
1010
# before /usr/bin:/bin where the normal mkfifo resides
1111
#
1212
1313
#
1414
# Written by Roland Mainz <roland.mainz@nrubsig.org>
1515
#
1616
1717
function usage
1818
{
1919
	OPTIND=0
2020
	getopts -a "$0" "${mkfifo_usage}" OPT '-?'
2121
	exit 2
2222
}
2323
2424
typeset -r mkfifo_usage=$'+
2525
[-?\n@(#)\$Id: mkfifo (Roland Mainz) 2023-09-01 \$\n]
2626
[-author?Roland Mainz <roland.mainz@nrubsig.org>]
2727
[+NAME?mkfifo - mkfifo emulation hack for Cygwin nfs]
2828
[+DESCRIPTION?\bshlint\b is a lint for POSIX shell scripts.]
2929
[m:mode?set file permissions.]:[number]
3030
3131
name
3232
3333
[+SEE ALSO?\bshcomp\b(1), \bksh93\b(1)]
3434
'
3535
3636
builtin getconf
3737
3838
while getopts -a "${progname}" "${mkfifo_usage}" OPT ; do
3939
#	printmsg "## OPT=|${OPT}|, OPTARG=|${OPTARG}|"
4040
	case "${OPT}" in
4141
		'm')	typeset fifomode="$OPTARG" ;;
4242
		*)	usage ;;
4343
	esac
4444
done
4545
shift $(( OPTIND-1 ))
4646
4747
(( $# > 0 )) || usage
4848
4949
# reset PATH to the platform's default
5050
export PATH="$(getconf PATH)"
5151
5252
integer retval=0
5353
typeset fifoname
5454
typeset hash
5555
typeset dummy
5656
5757
for fifoname in "$@" ; do
5858
	realpath "$fifoname" | md5sum | read hash dummy
5959
	fifopath="/tmp/nfsfifo_${hash}.fifo"
6060
	rm -f "$fifopath"
6161
6262
	if [[ -v fifomode ]] ; then
6363
		mkfifo -m "$fifomode" "$fifopath"
6464
		(( retval=$? ))
6565
	else
6666
		mkfifo "$fifopath"
6767
		(( retval=$? ))
6868
	fi
6969
	if (( retval == 0 )) ; then
7070
		ln -sf "$fifopath" "$fifoname"
7171
	else
7272
		break
7373
	fi
7474
done
7575
7676
exit $retval
7777
#EOF.
7878

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.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at