home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
m4env.tcl
< prev
next >
Wrap
Text File
|
1997-11-12
|
2KB
|
103 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1995
#
# File: %W%
# Author: Marcel Bancken
# Description: m4env script
#---------------------------------------------------------------------------
# SccsId = %W% %G% Copyright 1997 Cayenne Software Inc.
source [m4_path_name tcl libocl.tcl]
require platform.tcl
require procs.tcl
require messagehdl.tcl
proc usage {} {
wmtkfatal "Usage: m4env \[-h|\[\[-c\] \[-e\] \[-u\]\]\]\n \
\tprints M4 variables in sh format; options:\n \
\t-e: also export M4 variables\n \
\t-c: csh format\n \
\t-h: prints this message\n \
\t-u: open ORB and use customization files"
}
proc print {csh export} {
set m4vars [List new]
m4_var foreach m4var {
$m4vars append $m4var
}
$m4vars sort
set setCmd ""
set exportCmd ""
set assign "="
if $csh {
if $export {
set setCmd "setenv "
set assign " "
} else {
set setCmd "set "
}
} elseif $export {
set exportCmd "export "
}
$m4vars foreach m4var {
# Adapt value
set value [m4_var get $m4var]
regsub -all "'" $value {'"'"'} value
if $csh {
regsub -all "!" $value {\!} value
}
# Print value
set line "$setCmd$m4var$assign'$value';"
if {"$exportCmd" != ""} {
append line " $exportCmd$m4var;"
}
puts $line
}
}
set argc 0
set csh 0
set export 0
set useORB 0
foreach arg $argv {
case $arg in {
{-c} {
set csh 1
}
{-e} {
set export 1
}
{-u} {
set useORB 1
}
{default} {
usage
}
}
incr argc 1
}
if $useORB {
# ModuleHandler must be available
if [isCommand OtkRegister::extGui] {
OtkRegister::extGui
}
set mh [ModuleHandler new]
$mh setCurrentContext
} elseif [isCommand ClientContext] {
m4_var set M4_levelpath ""
m4_var set M4_levelpath_ids ""
set cc [ClientContext::global]
}
print $csh $export
exit