"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "lha-114i/src/extract.c" of archive lha-114i.tar.gz:


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 /* ------------------------------------------------------------------------ */
    2 /* LHa for UNIX    															*/
    3 /*				extract.c -- extrcat from archive							*/
    4 /*																			*/
    5 /*		Modified          		Nobutaka Watazaki							*/
    6 /*																			*/
    7 /*	Ver. 1.14 	Source All chagned				1995.01.14	N.Watazaki		*/
    8 /* ------------------------------------------------------------------------ */
    9 #include "lha.h"
   10 
   11 int
   12 decode_lzhuf(infp, outfp, original_size, packed_size, name, method)
   13 	FILE           *infp;
   14 	FILE           *outfp;
   15 	long            original_size;
   16 	long            packed_size;
   17 	char           *name;
   18 	int             method;
   19 {
   20 	interface.method = method;
   21 	interface.dicbit = 13;	/* method + 8; -lh5- */
   22 	interface.infile = infp;
   23 	interface.outfile = outfp;
   24 	interface.original = original_size;
   25 	interface.packed = packed_size;
   26 
   27 	switch (method) {
   28 	case LZHUFF0_METHOD_NUM:
   29 	case LARC4_METHOD_NUM:
   30 		start_indicator(name, original_size
   31 			      ,verify_mode ? "Testing " : "Melting ", 2048);
   32 		copyfile(infp, (verify_mode ? NULL : outfp), original_size, 2);
   33 		break;
   34 	case LARC_METHOD_NUM:		/* -lzs- */
   35 		interface.dicbit = 11;
   36 		start_indicator(name, original_size
   37 				,verify_mode ? "Testing " : "Melting "
   38 				,1 << interface.dicbit);
   39 		decode(&interface);
   40 		break;
   41 	case LZHUFF1_METHOD_NUM:		/* -lh1- */
   42 	case LZHUFF4_METHOD_NUM:		/* -lh4- */
   43 	case LARC5_METHOD_NUM:			/* -lz5- */
   44 		interface.dicbit = 12;
   45 		start_indicator(name, original_size
   46 				,verify_mode ? "Testing " : "Melting "
   47 				,1 << interface.dicbit);
   48 		decode(&interface);
   49 		break;
   50 	case LZHUFF6_METHOD_NUM:		/* -lh6- */	/* Added N.Watazaki (^_^) */
   51 #ifdef SUPPORT_LH7
   52 	case LZHUFF7_METHOD_NUM:                /* -lh7- */
   53 #endif
   54 	    interface.dicbit = (method - LZHUFF6_METHOD_NUM) + 15;
   55 
   56 	default:
   57 		start_indicator(name, original_size
   58 				,verify_mode ? "Testing " : "Melting "
   59 				,1 << interface.dicbit);
   60 		decode(&interface);
   61 	}
   62 	finish_indicator(name, verify_mode ? "Tested  " : "Melted  ");
   63 
   64 	return crc;
   65 }
   66 
   67 /* Local Variables: */
   68 /* mode:c */
   69 /* tab-width:4 */
   70 /* End: */