#!/bin/sh # Copyright for the Uniform Repository Service (c) 1995, 1996, 1997, # 1998, # by Gerald Banon. All rights reserved. # Version 1.1 # abs \ homePath=/home/banon/URLib; \ exec $homePath/col/dpi.inpe.br/banon/1997/10.21.17.24/doc/tcl8.0/unix/tclsh "$0" ${1+"$@"} # Create in the local_doc a copy of an rtf document with an hyperlink base. # PATH_INFO = \ /home/banon/URLib::/sid.inpe.br/deise/1998/05.21.11.42/HomePage.rtf regexp {(.+)/([^/]+/[^/]+/[^/]+/[^/]+)/(.+)} \ $env(PATH_INFO) m homePath repository fileName # set homePath /home/banon/URLib # set repository sid.inpe.br/deise/1998/05.21.11.42 # set fileName HomePage.rtf set service dpi.inpe.br/banon/1995/08.08.00.00 set llFileName $homePath/col/$service/not_sent/.setenv/library_location if [catch {open \ $llFileName r} \ fileId] { puts stderr "cannot open $fileId" } else { set ll [string trim [read $fileId]] ;# ll (library location) close $fileId } set pathDirectory "" regexp {(.*/)[^/]} $fileName m pathDirectory # set x "{\\info{\\*\\hlinkbase http://hermes.dpi.inpe.br:1906/}}" # regsub "{\\\\\\*\\\\hlinkbase \[^\}\]*}" $x {} y # regsub "\{\\\\info" $y "\{\\\\info{\\*\\hlinkbase http://.../}" z set docFileName $homePath/col/$repository/doc/$fileName set localDocFileName $homePath/col/$repository/local_doc/$fileName if [file exists $docFileName] { if {![file exists $localDocFileName] || \ [file mtime $docFileName] > \ [file mtime $localDocFileName] || \ [file mtime $llFileName] > \ [file mtime $localDocFileName]} { # make or update the file in the local_doc if [catch {open \ $docFileName r} fileId] { puts stderr "cannot open $fileId" exit } else { set file [read $fileId] ;# read the file close $fileId # .rtf file processing ... regsub "{\\\\\\*\\\\hlinkbase \[^\}\]*}" \ $file {} file regsub "\{\\\\info" $file \ "\{\\\\info{\\*\\hlinkbase http://$ll/col/$repository/doc/$pathDirectory}" file catch {file mkdir \ $homePath/col/$repository/local_doc/$pathDirectory} message # exec echo $message | mail banon@dpi.inpe.br # can't create directory # "/dados/URLib/col/sid.inpe.br/deise/1998/05.21.11.42/local_doc": # permission denied if [catch {open \ $localDocFileName w} fileId] { puts stderr "cannot open $fileId" exit } else { puts $fileId $file close $fileId } } } puts "Location: http://$ll/col/$repository/local_doc/$fileName" puts {} } else { puts {Content-Type: text/html} puts {} puts {
} puts {