4577651 [rkeene@sledge /home/rkeene/devel/dact-0.8.37]$ cat -n comp_fail.c
 1 /*
 2  * Copyright (C) 2001, 2002, and 2003  Roy Keene
 3  *
 4  * This program is free software; you can redistribute it and/or
 5  * modify it under the terms of the GNU General Public License
 6  * as published by the Free Software Foundation; either version 2
 7  * of the License, or (at your option) any later version.
 8  *
 9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  *      email: dact@rkeene.org
19  */
20 
21 
22 /*
23     Ignore requests for compression and return errors for decompression.
24     Stub algorithm.
25 
26 */
27 
28 
29 #include "dact.h"
30 #include "comp_fail.h"
31 #include <stdio.h>
32 #ifdef HAVE_UNISTD_H
33 #include <unistd.h>
34 #endif
35 #ifdef HAVE_STDLIB_H
36 #include <stdlib.h>
37 #endif
38 
39 
40 /*
41     mode        - DACT_MODE_COMPR or DACT_MODE_DECMP
42                 Determine whether to compress or decompress.
43     prev_block  - Previous (uncompressed) block.
44     curr_block  - The data to be compressed.
45     out_block   - Where to put data after compression.
46     blk_size    - Size of prev_block and curr_block.
47 */
48 int comp_fail_algo(int mode, unsigned char *prev_block, unsigned char *curr_block, char *out_block, int blk_size, int
	bufsize) {
49     switch(mode) {
50         case DACT_MODE_COMPR:
51             return(comp_fail_compress(prev_block, curr_block, out_block, blk_size, bufsize));
52             break; /* Heh */
53         case DACT_MODE_DECMP:
54             return(comp_fail_decompress(prev_block, curr_block, out_block, blk_size, bufsize));
55             break;
56         default:
57             printf("Unsupported mode: %i\n", mode);
58             return(-1);
59     }
60 }
61 
62 int comp_fail_compress(unsigned char *prev_block, unsigned char *curr_block, char *out_block, int blk_size, int bufsize)
	{
63     return(-1);
64 }
65 
66 int comp_fail_decompress(unsigned char *prev_block, unsigned char *curr_block, char *out_block, int blk_size, int
	bufsize) {
67     printf("You tried to decompress a file with an algorithm that is not compiled into your version.  Output will be
	unusable.\n");
68     return(0);
69 }
4577652 [rkeene@sledge /home/rkeene/devel/dact-0.8.37]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2004-04-04 07:01:49