Пример #1
0
void dump_config(struct config* cfg)
{
	printf("#include \"init.h\"\n\n");
	printf("#define NULL ((void*)0)\n");	/* eh */

	dump_tab("builtin_tab", cfg->inittab);
	dump_env("builtin_env", cfg->env);

	printf("static struct config builtin = {\n");
	printf("\t.inittab = builtin_tab + 1,\n");
	printf("\t.initnum = %i,\n", cfg->initnum);
	printf("\t.env = builtin_env,\n");
	printf("};\n\n");

	printf("struct config* cfg = &builtin;\n");
}
Пример #2
0
spec_select_action(char* from_buf, int from_count, int action, char* to_buf)
{
    char *cp, *rindex(), *malloc();
    struct stat statbuf;
#ifdef SYSV
    void onintr(), oops();
#else
    int onintr(), oops();
#endif  /* SYSV */



#ifdef COMPATIBLE
    nomagic = 1;	/* Original didn't have a magic number */
#endif /* COMPATIBLE */


    if(maxbits < INIT_BITS) maxbits = INIT_BITS;
    if (maxbits > BITS) maxbits = BITS;
    maxmaxcode = 1 << maxbits;

    InCnt = from_count;
    InBuff = (unsigned char *)from_buf;
    OutBuff = (unsigned char *)to_buf;
    do_decomp = action;

	if (do_decomp == 0) {
		compress();
#ifdef DEBUG
		if(verbose)		dump_tab();
#endif /* DEBUG */
	} else {
	    /* Check the magic number */
	    if (nomagic == 0) {
		if ((getbyte() != (magic_header[0] & 0xFF))
		 || (getbyte() != (magic_header[1] & 0xFF))) {
		    fprintf(stderr, "stdin: not in compressed format\n");
		    exit(1);
		}
		maxbits = getbyte();	/* set -b from file */
		block_compress = maxbits & BLOCK_MASK;
		maxbits &= BIT_MASK;
		maxmaxcode = 1 << maxbits;
		fsize = 100000;		/* assume stdin large for USERMEM */
		if(maxbits > BITS) {
			fprintf(stderr,
			"stdin: compressed with %d bits, can only handle %d bits\n",
			maxbits, BITS);
			exit(1);
		}
	    }
#ifndef DEBUG
	    decompress();
#else
	    if (debug == 0)	decompress();
	    else		printcodes();
	    if (verbose)	dump_tab();
#endif /* DEBUG */
	}

    return( OutBuff - (unsigned char *)to_buf );
}