Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/root/acme/msgs/Save

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc

rfork e

if(~ $#file 0 && ~ $#winid 0 ){
	echo must run under o/live or acme >[1=2]
	exit fail
}

d=`{pwd}
if(~ $#file 0){
	w = /mnt/acme/$winid
	file = `{cat $w/tag | sed 's/ .*//'}
}
if not
	file=`{echo $file | sed 's/\[(.*) .*/\1/'}


switch($file){
case */text
	d =`{basename -d $d}
	d =`{basename -d $d}
case /mail/box/$user/*
	;
case *
	echo Save in a strange place?
	exit no
}

for(m in $*){
	if (! test -e $d/$m){
		echo $d/$m does not exist >[1=2]
		exit fail
	}
}

dfile=/tmp/arch.$pid

switch($file){
case */text
	Arch
	echo $file | sed 's,([0-9]+)/text,a.\1/text,' | mlist > $dfile
case /mail/box/$user/*
	Arch | mlist > $dfile
}

for (m in $*) {
	cat $dfile $d/$m > $d/$m^_ && mv $d/$m^_ $d/$m
}
rm -f $dfile
if(! ~ $#winid 0)
	echo clean >$w/ctl >[2]/dev/null



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].