\section{cmml-fortune.c File Reference}
\label{cmml-fortune_8c}\index{cmml-fortune.c@{cmml-fortune.c}}
{\tt \#include \char`\"{}config.h\char`\"{}}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$fcntl.h$>$}\par
{\tt \#include $<$ctype.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$unistd.h$>$}\par
{\tt \#include $<$cmml.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf DEFAULT\_\-DURATION}~\char`\"{}00:30\char`\"{}
\item 
\#define {\bf DEFAULT\_\-ENCODING}~\char`\"{}UTF-8\char`\"{}
\item 
\#define {\bf DEFAULT\_\-SHORT\_\-COMMAND}~\char`\"{}fortune -s -n 80\char`\"{}
\item 
\#define {\bf DEFAULT\_\-LONG\_\-COMMAND}~\char`\"{}fortune -l\char`\"{}
\item 
\#define {\bf BUFSIZE}~10000
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
static void {\bf PrintUsage} (char $\ast$prog)
\item 
static char $\ast$ {\bf get\_\-fortune} (char $\ast$command)
\item 
int {\bf main} (int argc, char $\ast$argv[$\,$])
\end{CompactItemize}


\subsection{Detailed Description}
cmml-fortune: generates a valid CMML document with random content.



\footnotesize\begin{verbatim}
Usage: cmml-fortune [options]
Generate a random CMML file using an external program
to provide text (fortune cookies by default).
 
Possible options:
  -d timespec, --duration timespec
                 Specify the duration of the generated CMML file
                 ('00:30' by default)
  -e encoding, --encoding encoding
                 Specify the encoding of the generated CMML file
                 ('UTF-8' by default)
 
  -o filename, --output filename
                 Specify the output filename. The file is written
                 to standard output by default.
 
  -s command,  --short-command command
                 Specify the command to use to generate short text
                 for the title and anchors ('fortune -s -n 80' by default)
  -l command,  --long-command command
                 Specify the command to use to generate long text
                 for descriptions ('fortune -l' by default)
  -h, --help     Display this help and exit
  -v, --version  Display version information and exit
\end{verbatim}
\normalsize
 

\subsection{Define Documentation}
\index{cmml-fortune.c@{cmml-fortune.c}!DEFAULT\_\-DURATION@{DEFAULT\_\-DURATION}}
\index{DEFAULT\_\-DURATION@{DEFAULT\_\-DURATION}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{DEFAULT\_\-DURATION}]{\setlength{\rightskip}{0pt plus 5cm}\#define DEFAULT\_\-DURATION~\char`\"{}00:30\char`\"{}}\label{cmml-fortune_8c_5705d5a4ff9c55f77a23a5e6b8d1af69}


DEFAULT\_\-DURATION: default duration of created CMML file 

Referenced by main(), and PrintUsage().\index{cmml-fortune.c@{cmml-fortune.c}!DEFAULT\_\-ENCODING@{DEFAULT\_\-ENCODING}}
\index{DEFAULT\_\-ENCODING@{DEFAULT\_\-ENCODING}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{DEFAULT\_\-ENCODING}]{\setlength{\rightskip}{0pt plus 5cm}\#define DEFAULT\_\-ENCODING~\char`\"{}UTF-8\char`\"{}}\label{cmml-fortune_8c_25f87d76c9037b0607adb59fe96aee4f}


DEFAULT\_\-ENCODING: default encoding format of created CMML file 

Referenced by main(), and PrintUsage().\index{cmml-fortune.c@{cmml-fortune.c}!DEFAULT\_\-SHORT\_\-COMMAND@{DEFAULT\_\-SHORT\_\-COMMAND}}
\index{DEFAULT\_\-SHORT\_\-COMMAND@{DEFAULT\_\-SHORT\_\-COMMAND}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{DEFAULT\_\-SHORT\_\-COMMAND}]{\setlength{\rightskip}{0pt plus 5cm}\#define DEFAULT\_\-SHORT\_\-COMMAND~\char`\"{}fortune -s -n 80\char`\"{}}\label{cmml-fortune_8c_6cd0dfa81cd4e57d549a3e19e42c0ad6}


DEFAULT\_\-SHORT\_\-COMMAND: default command to create short descriptions 

Referenced by main(), and PrintUsage().\index{cmml-fortune.c@{cmml-fortune.c}!DEFAULT\_\-LONG\_\-COMMAND@{DEFAULT\_\-LONG\_\-COMMAND}}
\index{DEFAULT\_\-LONG\_\-COMMAND@{DEFAULT\_\-LONG\_\-COMMAND}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{DEFAULT\_\-LONG\_\-COMMAND}]{\setlength{\rightskip}{0pt plus 5cm}\#define DEFAULT\_\-LONG\_\-COMMAND~\char`\"{}fortune -l\char`\"{}}\label{cmml-fortune_8c_1980662afa96ffe8f2b01dcecafec446}


DEFAULT\_\-LONG\_\-COMMAND: default command to create long descriptions 

Referenced by main(), and PrintUsage().\index{cmml-fortune.c@{cmml-fortune.c}!BUFSIZE@{BUFSIZE}}
\index{BUFSIZE@{BUFSIZE}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{BUFSIZE}]{\setlength{\rightskip}{0pt plus 5cm}\#define BUFSIZE~10000}\label{cmml-fortune_8c_eca034f67218340ecb2261a22c2f3dcd}


BUFSIZE: default buffer size for printing 

\subsection{Function Documentation}
\index{cmml-fortune.c@{cmml-fortune.c}!PrintUsage@{PrintUsage}}
\index{PrintUsage@{PrintUsage}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{PrintUsage}]{\setlength{\rightskip}{0pt plus 5cm}static void PrintUsage (char $\ast$ {\em prog})\hspace{0.3cm}{\tt  [static]}}\label{cmml-fortune_8c_f6ee0e4e38011fad22b9afdf7e318422}


PrintUsage: prints out help on how to use this program

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prog}]the program's name \end{description}
\end{Desc}


References DEFAULT\_\-DURATION, DEFAULT\_\-ENCODING, DEFAULT\_\-LONG\_\-COMMAND, and DEFAULT\_\-SHORT\_\-COMMAND.\index{cmml-fortune.c@{cmml-fortune.c}!get\_\-fortune@{get\_\-fortune}}
\index{get\_\-fortune@{get\_\-fortune}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{get\_\-fortune}]{\setlength{\rightskip}{0pt plus 5cm}static char$\ast$ get\_\-fortune (char $\ast$ {\em command})\hspace{0.3cm}{\tt  [static]}}\label{cmml-fortune_8c_eaf66beb09b216e25c5aa7b42f539ecd}


get\_\-fortune: generates random text using the given command

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em command}]the command to use to generate text\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the generated text \end{Desc}


References BUFSIZE.

Referenced by main().\index{cmml-fortune.c@{cmml-fortune.c}!main@{main}}
\index{main@{main}!cmml-fortune.c@{cmml-fortune.c}}
\subsubsection[{main}]{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, \/  char $\ast$ {\em argv}[$\,$])}\label{cmml-fortune_8c_0ddf1224851353fc92bfbff6f499fa97}


main function of cmml-fortune. 

References CMML\_\-Clip::anchor\_\-href, CMML\_\-Clip::anchor\_\-text, BUFSIZE, cmml\_\-clip\_\-destroy(), cmml\_\-clip\_\-new(), cmml\_\-clip\_\-pretty\_\-snprint(), cmml\_\-head\_\-destroy(), cmml\_\-head\_\-new(), cmml\_\-head\_\-pretty\_\-snprint(), cmml\_\-npt\_\-snprint(), cmml\_\-preamble\_\-destroy(), cmml\_\-preamble\_\-new(), cmml\_\-preamble\_\-snprint(), cmml\_\-time\_\-new(), DEFAULT\_\-DURATION, DEFAULT\_\-ENCODING, DEFAULT\_\-LONG\_\-COMMAND, DEFAULT\_\-SHORT\_\-COMMAND, CMML\_\-Clip::desc\_\-text, get\_\-fortune(), outfile, PrintUsage(), CMML\_\-Time::sec, CMML\_\-Time::t, and CMML\_\-Head::title.