aboutsummaryrefslogtreecommitdiffstats
path: root/doc/api-documentation/html/nasb_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api-documentation/html/nasb_8cpp-source.html')
-rw-r--r--doc/api-documentation/html/nasb_8cpp-source.html121
1 files changed, 121 insertions, 0 deletions
diff --git a/doc/api-documentation/html/nasb_8cpp-source.html b/doc/api-documentation/html/nasb_8cpp-source.html
new file mode 100644
index 0000000..f8110b3
--- /dev/null
+++ b/doc/api-documentation/html/nasb_8cpp-source.html
@@ -0,0 +1,121 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>nasb.cpp Source File</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body>
+<!-- Generated by Doxygen 1.2.15 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; </center>
+<hr><h1>nasb.cpp</h1><div class="fragment"><pre>00001
+00002
+00003 <font class="preprocessor">#include &lt;ctype.h&gt;</font>
+00004 <font class="preprocessor">#include &lt;stdio.h&gt;</font>
+00005 <font class="preprocessor">#include &lt;fcntl.h&gt;</font>
+00006 <font class="preprocessor">#include &lt;errno.h&gt;</font>
+00007
+00008 <font class="preprocessor">#ifndef __GNUC__</font>
+00009 <font class="preprocessor"></font><font class="preprocessor">#include &lt;io.h&gt;</font>
+00010 <font class="preprocessor">#else</font>
+00011 <font class="preprocessor"></font><font class="preprocessor">#include &lt;unistd.h&gt;</font>
+00012 <font class="preprocessor">#endif</font>
+00013 <font class="preprocessor"></font>
+00014 <font class="preprocessor">#include &lt;swcomprs.h&gt;</font>
+00015
+00016 <font class="keyword">class </font>FileCompress: <font class="keyword">public</font> SWCompress {
+00017 <font class="keywordtype">int</font> ifd;
+00018 <font class="keywordtype">int</font> ofd;
+00019 <font class="keywordtype">int</font> ufd;
+00020 <font class="keywordtype">int</font> zfd;
+00021 <font class="keyword">public</font>:
+00022 FileCompress(<font class="keywordtype">char</font> *);
+00023 ~FileCompress();
+00024 <font class="keywordtype">int</font> GetChars(<font class="keywordtype">char</font> *, <font class="keywordtype">int</font> len);
+00025 <font class="keywordtype">int</font> SendChars(<font class="keywordtype">char</font> *, <font class="keywordtype">int</font> len);
+00026 <font class="keywordtype">void</font> Encode();
+00027 <font class="keywordtype">void</font> Decode();
+00028 };
+00029
+00030
+00031 FileCompress::FileCompress(<font class="keywordtype">char</font> *fname)
+00032 {
+00033 <font class="keywordtype">char</font> buf[256];
+00034
+00035 <font class="preprocessor">#ifndef O_BINARY</font>
+00036 <font class="preprocessor"></font><font class="preprocessor">#define O_BINARY 0</font>
+00037 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
+00038 <font class="preprocessor"></font>
+00039 ufd = open(fname, O_RDWR|O_CREAT|O_BINARY);
+00040
+00041 sprintf(buf, <font class="stringliteral">"%s.zzz"</font>, fname);
+00042 zfd = open(buf, O_RDWR|O_CREAT|O_BINARY);
+00043 }
+00044
+00045
+00046 FileCompress::~FileCompress(<font class="keywordtype">char</font> *fname)
+00047 {
+00048 close(ufd);
+00049 close(zfd);
+00050 }
+00051
+00052
+00053 <font class="keywordtype">int</font> FileCompress::GetChars(<font class="keywordtype">char</font> *buf, <font class="keywordtype">int</font> len)
+00054 {
+00055 <font class="keywordflow">return</font> read(ifd, buf, len);
+00056 }
+00057
+00058
+00059 <font class="keywordtype">int</font> FileCompress::SendChars(<font class="keywordtype">char</font> *buf, <font class="keywordtype">int</font> len)
+00060 {
+00061 <font class="keywordflow">return</font> write(ofd, buf, len);
+00062 }
+00063
+00064
+00065 <font class="keywordtype">void</font> FileCompress::Encode()
+00066 {
+00067 ifd = ufd;
+00068 ofd = zfd;
+00069
+00070 SWCompress::Encode();
+00071 }
+00072
+00073
+00074 <font class="keywordtype">void</font> FileCompress::Decode()
+00075 {
+00076 ifd = zfd;
+00077 ofd = ufd;
+00078
+00079 SWCompress::Decode();
+00080 }
+00081
+00082
+00083 main(<font class="keywordtype">int</font> argc, <font class="keywordtype">char</font> **argv)
+00084 {
+00085 <font class="keywordtype">int</font> decomp = 0;
+00086 SWCompress *fobj;
+00087
+00088 <font class="keywordflow">if</font> (argc != 2) {
+00089 fprintf(stderr, <font class="stringliteral">"usage: %s &lt;filename|filename.zzz&gt;\n"</font>, argv[0]);
+00090 exit(1);
+00091 }
+00092
+00093 <font class="keywordflow">if</font> (strlen(argv[1]) &gt; 4) {
+00094 <font class="keywordflow">if</font> (!strcmp(&amp;argv[1][strlen(argv[1])-4], <font class="stringliteral">".zzz"</font>)) {
+00095 argv[1][strlen(argv[1])-4] = 0;
+00096 decomp = 1;
+00097 }
+00098 }
+00099
+00100 fobj = <font class="keyword">new</font> FileCompress(argv[1]);
+00101
+00102 <font class="keywordflow">if</font> (decomp)
+00103 fobj-&gt;Decode();
+00104 <font class="keywordflow">else</font> fobj-&gt;Encode();
+00105
+00106 <font class="keyword">delete</font> fobj;
+00107 }
+</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:12:59 2002 for The Sword Project by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.png" alt="doxygen" align="middle" border=0
+width=110 height=53></a>1.2.15 </small></address>
+</body>
+</html>