\hypertarget{opal_2util_2show__help_8h}{\section{opal/util/show\+\_\+help.h File Reference}
\label{opal_2util_2show__help_8h}\index{opal/util/show\+\_\+help.\+h@{opal/util/show\+\_\+help.\+h}}
}


The \char`\"{}show help\char`\"{} subsystem (S\+H\+S) in Open M\+P\+I is intended to help the developer convey meaningful information to the user (read longer than is convenient in a single printf), particularly when errors occur.  


{\ttfamily \#include \char`\"{}opal\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include $<$stdarg.\+h$>$}\\*
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef int($\ast$ \hyperlink{opal_2util_2show__help_8h_abdf0b6c4a6cde7c8b9194b3667f49261}{opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t} )(const char $\ast$filename, const char $\ast$topic, bool want\+\_\+error\+\_\+header,...)
\begin{DoxyCompactList}\small\item\em Look up a text message in a text file and display it to the stderr using printf()-\/like substitutions (d, s, etc.). \end{DoxyCompactList}\item 
\hypertarget{opal_2util_2show__help_8h_a12ab18be48cd8b552f598349752bb546}{typedef int($\ast$ \hyperlink{opal_2util_2show__help_8h_a12ab18be48cd8b552f598349752bb546}{opal\+\_\+show\+\_\+vhelp\+\_\+fn\+\_\+t} )(const char $\ast$filename, const char $\ast$topic, bool want\+\_\+error\+\_\+header, va\+\_\+list ap)}\label{opal_2util_2show__help_8h_a12ab18be48cd8b552f598349752bb546}

\begin{DoxyCompactList}\small\item\em This function does the same thing as opal\+\_\+show\+\_\+help(), but accepts a va\+\_\+list form of varargs. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{opal_2util_2show__help_8h_aaf2c7faf3a21fe9599ef8eb6af1a8467}{B\+E\+G\+I\+N\+\_\+\+C\+\_\+\+D\+E\+C\+L\+S O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int {\bfseries opal\+\_\+show\+\_\+help\+\_\+init} (void)}\label{opal_2util_2show__help_8h_aaf2c7faf3a21fe9599ef8eb6af1a8467}

\item 
\hypertarget{opal_2util_2show__help_8h_a17b7da103a1c85167d989e42dbff17d2}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int {\bfseries opal\+\_\+show\+\_\+help\+\_\+finalize} (void)}\label{opal_2util_2show__help_8h_a17b7da103a1c85167d989e42dbff17d2}

\item 
\hypertarget{opal_2util_2show__help_8h_a7228b18b045d0f1ef71f611ee31604bc}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C char $\ast$ \hyperlink{opal_2util_2show__help_8h_a7228b18b045d0f1ef71f611ee31604bc}{opal\+\_\+show\+\_\+help\+\_\+string} (const char $\ast$filename, const char $\ast$topic, bool want\+\_\+error\+\_\+header,...)}\label{opal_2util_2show__help_8h_a7228b18b045d0f1ef71f611ee31604bc}

\begin{DoxyCompactList}\small\item\em This function does the same thing as opal\+\_\+show\+\_\+help(), but returns its output in a string (that must be freed by the caller). \end{DoxyCompactList}\item 
\hypertarget{opal_2util_2show__help_8h_ab69b2be551b1d32806c8e31d7f8aa5c1}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C char $\ast$ \hyperlink{opal_2util_2show__help_8h_ab69b2be551b1d32806c8e31d7f8aa5c1}{opal\+\_\+show\+\_\+help\+\_\+vstring} (const char $\ast$filename, const char $\ast$topic, bool want\+\_\+error\+\_\+header, va\+\_\+list ap)}\label{opal_2util_2show__help_8h_ab69b2be551b1d32806c8e31d7f8aa5c1}

\begin{DoxyCompactList}\small\item\em This function does the same thing as \hyperlink{opal_2util_2show__help_8h_a7228b18b045d0f1ef71f611ee31604bc}{opal\+\_\+show\+\_\+help\+\_\+string()}, but accepts a va\+\_\+list form of varargs. \end{DoxyCompactList}\item 
O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int \hyperlink{opal_2util_2show__help_8h_a4759eef3b3581c9ae8fccbd887b93630}{opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir} (const char $\ast$directory)
\begin{DoxyCompactList}\small\item\em This function adds another search location for the files that back show\+\_\+help messages. \end{DoxyCompactList}\item 
\hypertarget{opal_2util_2show__help_8h_a26ccd3332aa87fb944b94207b11e6b4c}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int {\bfseries opal\+\_\+show\+\_\+help\+\_\+finish\+\_\+parsing} (void)}\label{opal_2util_2show__help_8h_a26ccd3332aa87fb944b94207b11e6b4c}

\end{DoxyCompactItemize}
\subsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\hypertarget{opal_2util_2show__help_8h_aaed26685e3842165c6a7412547748f02}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \hyperlink{opal_2util_2show__help_8h_abdf0b6c4a6cde7c8b9194b3667f49261}{opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t} {\bfseries opal\+\_\+show\+\_\+help}}\label{opal_2util_2show__help_8h_aaed26685e3842165c6a7412547748f02}

\item 
\hypertarget{opal_2util_2show__help_8h_aec7906aed0ed5f039306e7a795195276}{O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C \hyperlink{opal_2util_2show__help_8h_a12ab18be48cd8b552f598349752bb546}{opal\+\_\+show\+\_\+vhelp\+\_\+fn\+\_\+t} {\bfseries opal\+\_\+show\+\_\+vhelp}}\label{opal_2util_2show__help_8h_aec7906aed0ed5f039306e7a795195276}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \char`\"{}show help\char`\"{} subsystem (S\+H\+S) in Open M\+P\+I is intended to help the developer convey meaningful information to the user (read longer than is convenient in a single printf), particularly when errors occur. 

The S\+H\+S allows the storage of arbitrary-\/length help messages in text files which can be parameterized by text filename, message name, P\+O\+S\+I\+X locale, and printf()-\/style parameters (e.\+g., \char`\"{}\%s\char`\"{}, \char`\"{}\%d\char`\"{}, etc.). Note that the primary purpose of the S\+H\+S is to display help messages, but it can actually be used to display any arbitrary text messages.

The function opal\+\_\+show\+\_\+help() is used to find a help message and display it. Its important parameters are a filename, message name, and printf()-\/style varargs parameters used to substitute into the message.

It was originally intended that this system would support a very simple version of i18n-\/like support, but we got (strong) feedback that i18n support was not desired. So it never happened.

As such, the file lookup is quite straightforward -- the caller passes in the filename to find the help message, and the S\+H\+S looks for that file in \$pkgdatadir (typically \$prefix/share/openmpi).

Once the file is successfully opened, the S\+H\+S looks for the appropriate help message to display. It looks for the message name in the file, reads in the message, and displays it. printf()-\/like substitutions are performed (e.\+g., d, s, etc.) -- opal\+\_\+show\+\_\+help() takes a variable legnth argument list that are used for these substitutions.

The format of the help file is simplistic\+:


\begin{DoxyItemize}
\item Comments begin with \#. Any characters after a \# on a line are ignored. It is not possible to escape a \#.
\item Message names are on a line by themselves and marked with \mbox{[}\mbox{]}. Names can be any A\+S\+C\+I\+I string within the \mbox{[}\mbox{]} (excluding the characters newline, linefeed, \mbox{[}, \mbox{]}, and \#).
\item Messages are any characters between message names and/or the end of the file.
\end{DoxyItemize}

Here's a sample helpfile\+:

\subsection*{This is a comment.}

\mbox{[}topic 1\mbox{]} Here's the first message. Let's substitute in an integer\+: d. The quick brown fox jumped over the lazy s. \subsection*{This is another comment -- it's not displayed in the first message.}

\mbox{[}another\+:topic\+:foo\+:foo\+:foo\mbox{]} This is the second message. Let's just keep rolling along to get to the second line in the message for this example. 

It is expected that help messages will be grouped by filename; similar messages should be in a single file. For example, an M\+C\+A component may install its own helpfile in Open M\+P\+I's \$pkgdatadir, and therefore the component can invoke opal\+\_\+show\+\_\+help() to display its own help messages.

Message files in \$pkgdatadir have a naming convention\+: they generally start with the prefix \char`\"{}help-\/\char`\"{} and are followed by a name descriptive of what kind of messages they contain. M\+C\+A components should generally abide by the M\+C\+A prefix rule, with the exception that they should start the filename with \char`\"{}help-\/\char`\"{}, as mentioned previously. 

\subsection{Typedef Documentation}
\hypertarget{opal_2util_2show__help_8h_abdf0b6c4a6cde7c8b9194b3667f49261}{\index{opal/util/show\+\_\+help.\+h@{opal/util/show\+\_\+help.\+h}!opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t@{opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t}}
\index{opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t@{opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t}!opal/util/show\+\_\+help.\+h@{opal/util/show\+\_\+help.\+h}}
\subsubsection[{opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ opal\+\_\+show\+\_\+help\+\_\+fn\+\_\+t)(const char $\ast$filename, const char $\ast$topic, bool want\+\_\+error\+\_\+header,...)}}\label{opal_2util_2show__help_8h_abdf0b6c4a6cde7c8b9194b3667f49261}


Look up a text message in a text file and display it to the stderr using printf()-\/like substitutions (d, s, etc.). 


\begin{DoxyParams}{Parameters}
{\em filename} & \hyperlink{classFile}{File} where the text messages are contained. \\
\hline
{\em topic} & String index of which message to display from the text file. \\
\hline
{\em want\+\_\+error\+\_\+header} & Display error-\/bar line header and footer with the message. \\
\hline
{\em varargs} & Any additional parameters are substituted, printf()-\/style into the help message that is displayed.\\
\hline
\end{DoxyParams}
This function looks for the filename in the \$pkgdatadir (typically \$prefix/share/openmpi), and looks up the message based on the topic, and displays it. If want\+\_\+error\+\_\+header is true, a header and footer of asterisks are also displayed. 

\subsection{Function Documentation}
\hypertarget{opal_2util_2show__help_8h_a4759eef3b3581c9ae8fccbd887b93630}{\index{opal/util/show\+\_\+help.\+h@{opal/util/show\+\_\+help.\+h}!opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir@{opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir}}
\index{opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir@{opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir}!opal/util/show\+\_\+help.\+h@{opal/util/show\+\_\+help.\+h}}
\subsubsection[{opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir}]{\setlength{\rightskip}{0pt plus 5cm}O\+P\+A\+L\+\_\+\+D\+E\+C\+L\+S\+P\+E\+C int opal\+\_\+show\+\_\+help\+\_\+add\+\_\+dir (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{directory}
\end{DoxyParamCaption}
)}}\label{opal_2util_2show__help_8h_a4759eef3b3581c9ae8fccbd887b93630}


This function adds another search location for the files that back show\+\_\+help messages. 

Locations will be searched starting with the prefix installation directory, then cycled through any additional directories in the order they were added

This interface allows libraries that use O\+M\+P\+I to take advantage of the show\+\_\+help functionality. O\+M\+P\+I defines the show\+\_\+help directory based on where O\+M\+P\+I was installed. However, if the library wants to use show\+\_\+help to provide error output specific to itself, then it nees to tell show\+\_\+help how to find its own show\+\_\+help files -\/ without interfering with the linked O\+R\+T\+E libs when they need to do show\+\_\+help. 

References opal\+\_\+argv\+\_\+append\+\_\+nosize().

