%
% This file was automatically produced at Feb 27 2003, 22:51:56 by
% c2latex fork-example-2.c
%
\expandafter\ifx\csname indentation\endcsname\relax%
\newlength{\indentation}\fi
\setlength{\indentation}{0.5em}
\begin{flushleft}
\hspace*{8\indentation}printf( {\tt"before fork$\backslash$n"} );\mbox{}\\
\hspace*{8\indentation}{\bf if} ( ( pid = fork() ) $<$ 0 ) \{\mbox{}\\
\hspace*{16\indentation}fprintf( stderr, {\tt"fork error$\backslash$n"} );\mbox{}\\
\hspace*{16\indentation}exit( 1 );\mbox{}\\
\hspace*{8\indentation}\} {\bf else} {\bf if} ( pid == 0 ) \{  \hfill{$/\ast$\it{} child $\ast/$}\mbox{}\\
\hspace*{16\indentation}++glob;\mbox{}\\
\hspace*{16\indentation}++var;\mbox{}\\
\hspace*{8\indentation}\} {\bf else}\mbox{}\\
\hspace*{16\indentation}sleep( 2 );     {$/\ast$\it{} parent $\ast/$}\mbox{}\\
\hspace*{8\indentation}printf( {\tt"pid $=$ \%d, glob $=$ \%d, var $=$ \%d$\backslash$n"},\mbox{}\\
\hspace*{16\indentation}getpid(), glob, var );\mbox{}\\
\hspace*{8\indentation}exit( 0 );\mbox{}\\
\}\mbox{}\\
\end{flushleft}
