HardenedBSD/lib/libftp/doc/example.tex

60 lines
2.3 KiB
TeX
Raw Normal View History

%%
%% Creator: ansic2latex (from <stdin>)
%% Date: Tue Dec 27 16:14:26 1994
%%
\expandafter\ifx\csname indentation\endcsname\relax
\newlength{\indentation}\fi
\setlength{\indentation}{0.5em}
\begin{flushleft}
\mbox{}\\
{\em /$\ast$\hspace*{1\indentation}Include\hspace*{1\indentation}standard\hspace*{1\indentation}libftp's\hspace*{1\indentation}header\hspace*{1\indentation}$\ast$/}\mbox{}\\
\mbox{}\\
{\tt\#include} $<${\tt FtpLibrary.h}$>$ \mbox{}\\
\mbox{}\\
\mbox{}\\
main({\bf int\/} argc, {\bf char\/} $\ast$argv[])\mbox{}\\
\{\mbox{}\\
\mbox{}\\
\hspace*{2\indentation}FILE $\ast$input,$\ast$output;\mbox{}\\
\hspace*{2\indentation}{\bf int\/} c;\mbox{}\\
\hspace*{2\indentation}\mbox{}\\
\mbox{}\\
\hspace*{2\indentation}{\bf if\/} (argc$<$3)\mbox{}\\
\hspace*{4\indentation}exit(fprintf(stderr,{\tt "Usage: \%s input-file output-file$\backslash$n"},argv[0]));\mbox{}\\
\mbox{}\\
\hspace*{2\indentation}FtplibDebug(yes);\mbox{}\\
\hspace*{2\indentation}\mbox{}\\
\hspace*{2\indentation}{\bf if\/} ((input=Ftpfopen(argv[1],{\tt "r"}))==NULL)\mbox{}\\
\hspace*{4\indentation}\{\mbox{}\\
\hspace*{6\indentation}perror(argv[1]);\mbox{}\\
\hspace*{6\indentation}exit(1);\mbox{}\\
\hspace*{4\indentation}\}\mbox{}\\
\hspace*{2\indentation}\mbox{}\\
\hspace*{2\indentation}{\bf if\/} ((output=Ftpfopen(argv[2],{\tt "w"}))==NULL)\mbox{}\\
\hspace*{4\indentation}\{\mbox{}\\
\hspace*{6\indentation}perror(argv[2]);\mbox{}\\
\hspace*{6\indentation}exit(1);\mbox{}\\
\hspace*{4\indentation}\}\mbox{}\\
\hspace*{2\indentation}\mbox{}\\
\hspace*{2\indentation}{\bf while\/} ( (c=getc(input)) $\neq$ EOF \&\& (putc(c,output)$\neq$EOF) );\mbox{}\\
\mbox{}\\
\hspace*{2\indentation}{\bf if\/} (ferror(input))\mbox{}\\
\hspace*{4\indentation}\{\mbox{}\\
\hspace*{6\indentation}perror(argv[1]);\mbox{}\\
\hspace*{6\indentation}exit(1);\mbox{}\\
\hspace*{4\indentation}\}\mbox{}\\
\hspace*{2\indentation}\mbox{}\\
\hspace*{2\indentation}{\bf if\/} (ferror(output))\mbox{}\\
\hspace*{4\indentation}\{\mbox{}\\
\hspace*{6\indentation}perror(argv[1]);\mbox{}\\
\hspace*{6\indentation}exit(1);\mbox{}\\
\hspace*{4\indentation}\}\mbox{}\\
\mbox{}\\
\hspace*{2\indentation}Ftpfclose(input);\mbox{}\\
\hspace*{2\indentation}Ftpfclose(output);\mbox{}\\
\mbox{}\\
\hspace*{2\indentation}exit(0);\mbox{}\\
\hspace*{2\indentation}\mbox{}\\
\}\mbox{}\\
\end{flushleft}