\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#199: Specification of Alternatives to .wishrc/.tclshrc}
\date{May 12, 2004}
\author{R. Timothy Edwards, Don Porter}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#199}&\textbf{Specification of Alternatives to .wishrc/.tclshrc}\\\hline
Author&

R. Timothy Edwards \tipmail{tim}{stravinsky.jhuapl.edu}
\par
Don Porter \tipmail{dgp}{users.sf.net}
\\
Created&Wednesday, \(\text{12}^{\text{th}}\) May 2004\\
Type&Project\\
Tcl Version&\(8.6\)\\
State&Rejected\\
Vote&Done\\
Version&\tipversion$Revision: 1.8 $\\
Keywords&Tcl, Tk, shell, interactive\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP describes an extension of the command-line options to the ``wish'' and ``tclsh'' programs to allow the startup script to be redirected from the default \~{}/.wishrc (or \~{}/.tclshrc) to an alternative file.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

It is possible to run an application from a terminal that starts up a GUI or other event-based process but that, after setting up the event callback procedures, drops back into the terminal to allow a dual-input interface. As written, the only way to execute a script and return to the interpreter prompt in the terminal is to put the script in the ``.wishrc'' or ``.tclshrc'' startup script. One has to bend over backwards to write an application that will make this happen without actually changing the user's startup scripts. The shell script must redefine environment variable \textit{\$HOME} to point to the place where the script is that needs to be run, and the script itself then must be named ``.wishrc'' or ``.tclshrc'', or must have a symbolic link of that name pointing to it. The \textit{\$HOME} environment variable must be copied to another variable name if the application needs to reference the original value.

All this can be avoided by simply having a shell command-line option ``\textbf{-startup} \textit{filename}'' that allows the specification of a name other than ``.wishrc'' or ``.tclshrc'' in a directory path that is not necessarily the user's home directory, to be used as the startup script. This would not only be useful for the purpose outlined above, but also to simply bypass whatever commands are executed by the default startup script.

\section{Specification}

The command-line option for ``wish'' and ``tclsh'' would be extended to add the option \textbf{-startup}, for example:

\begin{quote}
\textbf{wish -startup} \textit{filename} [\textit{other options}]
\end{quote}

\section{Comments}

You are seeking interactivity following the evaluation of a start-up script. Is that the whole point? If so, then an alternative solution is provided at Tcl Patch 955470.

\url{http://sf.net/tracker/index.php?func=detail&aid=955470&group_id=10894&atid=310894}

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
