lib/Tools/rmfifo
author wenzelm
Sat, 21 Mar 2009 20:00:23 +0100
changeset 30627 fb9e73c01603
parent 29143 72c960b2b83e
permissions -rwxr-xr-x
added polyml_pp.ML: toplevel pretty printing for Poly/ML 4.x and 5.x before 5.3;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28063
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     2
#
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     3
# Author: Makarius
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     4
#
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     5
# DESCRIPTION: remove named pipe
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     6
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     7
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     8
PRG="$(basename "$0")"
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
     9
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    10
function usage()
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    11
{
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    12
  echo
28650
a7ba12e0d3b7 tuned usage line;
wenzelm
parents: 28063
diff changeset
    13
  echo "Usage: isabelle $PRG NAME"
28063
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    14
  echo
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    15
  echo "  Remove an unused named pipe, after producing dummy output"
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    16
  echo "  to unblock the reader (blocks if no reader present)."
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    17
  echo
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    18
  exit 1
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    19
}
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    20
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    21
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    22
## main
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    23
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    24
[ "$#" != 1 ] && usage
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    25
FIFO="$1"; shift
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    26
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    27
if [ -p "$FIFO" ]; then
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    28
  echo -n "" >"$FIFO" && rm -f "$FIFO"
3533485fc7b8 IsabelleSystem.mk_fifo, IsabelleSystem.rm_fifo;
wenzelm
parents:
diff changeset
    29
fi