trespect sysname - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 01bcf9f98223e08ec51a34bec5977110ddd94814 (DIR) parent 9fe5a6216669a8f32c9bb6375b396db88961f7d8 (HTM) Author: rsc <devnull@localhost> Date: Sun, 30 Jan 2005 16:28:53 +0000 respect sysname Diffstat: M bin/awd | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) --- (DIR) diff --git a/bin/awd b/bin/awd t@@ -1,3 +1,30 @@ #!/bin/sh -label `pwd` +usage() { + echo 'usage: awd [label]' 1>&2 + exit 1 +} +case $# in +1) + case "$1" in + -*) + usage + ;; + esac + sys=$1 + ;; +0) + sys=`hostname` + ;; +*) + usage +esac + +p="`pwd`" +case "$p" in +*/) + label $p-$sys + ;; +*) + label $p/-$sys +esac