Пример #1
0
int main( int argc, char **argv ) {
    // Check if zlib is ok.  Taken from zlib's example.c file.
    static const char* myVersion = ZLIB_VERSION;

    if( zlibVersion()[ 0 ] != myVersion[ 0 ] ) {
        fprintf( stderr, "incompatible zlib version\n" );
        exit( 1 );
    } else if( strcmp( zlibVersion(), ZLIB_VERSION ) != 0 ) {
        fprintf( stderr, "warning: different zlib version\n" );
    }

    // printf( "zlib version %s = 0x%04x, compile flags = 0x%lx\n", ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags() );
    // End of zlib check.

    QPEApplication a( argc, argv );
    Controller* controller = new Controller();
    //controller->loadTermData();
    if( !controller->init() ) {
        cerr << "Cannot initialize controller.  Check disk space and file permissions." << endl;
        exit( 2 );
    }

    QFont labelsFont( controller->getPreferences().getLabelsFont() ); 
    qApp->setFont( labelsFont );

    MainWindow* mainWindow = new MainWindow( controller );
    a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
    a.showMainWidget( mainWindow );
    return a.exec();
}
Пример #2
0
/* static */ bool wxZlibInputStream::CanHandleGZip()
{
  const char *dot = strchr(zlibVersion(), '.');
  int major = atoi(zlibVersion());
  int minor = dot ? atoi(dot + 1) : 0;
  return major > 1 || (major == 1 && minor >= 2);
}
Пример #3
0
int main(
    int argc,
    char *argv[])
{
    Byte *compr, *uncompr;
    uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */
    uLong uncomprLen = comprLen;
    static const char* myVersion = ZLIB_VERSION;

    if (zlibVersion()[0] != myVersion[0]) {
        fprintf(stderr, "incompatible zlib version\n");
        exit(1);

    } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) {
        fprintf(stderr, "warning: different zlib version\n");
    }

    printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
           ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());

    compr    = (Byte*)calloc((uInt)comprLen, 1);
    uncompr  = (Byte*)calloc((uInt)uncomprLen, 1);
    /* compr and uncompr are cleared to avoid reading uninitialized
     * data and to ensure that uncompr compresses well.
     */
    if (compr == Z_NULL || uncompr == Z_NULL) {
        printf("out of memory\n");
        exit(1);
    }
    test_compress(compr, comprLen, uncompr, uncomprLen);

    test_gzio((argc > 1 ? argv[1] : TESTFILE),
              uncompr, uncomprLen);

    test_deflate(compr, comprLen);
    test_inflate(compr, comprLen, uncompr, uncomprLen);

    test_large_deflate(compr, comprLen, uncompr, uncomprLen);
    test_large_inflate(compr, comprLen, uncompr, uncomprLen);

    test_flush(compr, &comprLen);
    test_sync(compr, comprLen, uncompr, uncomprLen);
    comprLen = uncomprLen;

    test_dict_deflate(compr, comprLen);
    test_dict_inflate(compr, comprLen, uncompr, uncomprLen);

    free(compr);
    free(uncompr);

    return 0;
}
Пример #4
0
static void __comp_fetch_init(void)
{
	char *ptr = NULL;
	int i;

#ifdef USE_SLZ
	slz_make_crc_table();
	slz_prepare_dist_table();
#endif
#if defined(USE_ZLIB) && defined(DEFAULT_MAXZLIBMEM)
	global.maxzlibmem = DEFAULT_MAXZLIBMEM * 1024U * 1024U;
#endif
#ifdef USE_ZLIB
	HA_SPIN_INIT(&comp_pool_lock);
	memprintf(&ptr, "Built with zlib version : " ZLIB_VERSION);
	memprintf(&ptr, "%s\nRunning on zlib version : %s", ptr, zlibVersion());
#elif defined(USE_SLZ)
	memprintf(&ptr, "Built with libslz for stateless compression.");
#else
	memprintf(&ptr, "Built without compression support (neither USE_ZLIB nor USE_SLZ are set).");
#endif
	memprintf(&ptr, "%s\nCompression algorithms supported :", ptr);

	for (i = 0; comp_algos[i].cfg_name; i++)
		memprintf(&ptr, "%s%s %s(\"%s\")", ptr, (i == 0 ? "" : ","), comp_algos[i].cfg_name, comp_algos[i].ua_name);

	if (i == 0)
		memprintf(&ptr, "%s none", ptr);

	hap_register_build_opts(ptr, 1);
	cfg_register_keywords(&cfg_kws);
}
Пример #5
0
static void
lz_assert(lua_State *L, int result, struct filter *flt) {
	z_stream* stream;
	if ( result == Z_OK || result == Z_STREAM_END || result == Z_BUF_ERROR )
		return;
	stream = flt->stream;
	switch ( result ) {
	case Z_NEED_DICT:
		lua_pushfstring(L, "RequiresDictionary: input stream requires a dictionary to be deflated (%s)", stream->msg);
		break;
	case Z_STREAM_ERROR:
		lua_pushfstring(L, "InternalError: inconsistent internal zlib stream (%s)", stream->msg);
		break;
	case Z_DATA_ERROR:
		lua_pushfstring(L, "InvalidInput: input string does not conform to zlib format or checksum failed");
		break;
	case Z_MEM_ERROR:
		lua_pushfstring(L, "OutOfMemory: not enough memory (%s)", stream->msg);
		break;
	case Z_VERSION_ERROR:
		lua_pushfstring(L, "IncompatibleLibrary: built with version %s, but dynamically linked with version %s (%s)",
			ZLIB_VERSION,  zlibVersion(), stream->msg);
		break;
	default:
		lua_pushfstring(L, "ZLibError: unknown code %d (%s)", result, stream->msg);
		break;
	}
	flt->end(stream);
	lua_error(L);
}
Пример #6
0
static int lz_assert(lua_State *L, int result, const z_stream* stream, const char* file, int line) {
    /* Both of these are "normal" return codes: */
    if ( result == Z_OK || result == Z_STREAM_END ) return result;
    switch ( result ) {
    case Z_NEED_DICT:
        lua_pushfstring(L, "RequiresDictionary: input stream requires a dictionary to be deflated (%s) at %s line %d",
                        stream->msg, file, line);
        break;
    case Z_STREAM_ERROR:
        lua_pushfstring(L, "InternalError: inconsistent internal zlib stream (%s) at %s line %d",
                        stream->msg, file, line);
        break;
    case Z_DATA_ERROR:
        lua_pushfstring(L, "InvalidInput: input string does not conform to zlib format or checksum failed at %s line %d",
                        file, line);
        break;
    case Z_MEM_ERROR:
        lua_pushfstring(L, "OutOfMemory: not enough memory (%s) at %s line %d",
                        stream->msg, file, line);
        break;
    case Z_BUF_ERROR:
        lua_pushfstring(L, "InternalError: no progress possible (%s) at %s line %d",
                        stream->msg, file, line);
        break;
    case Z_VERSION_ERROR:
        lua_pushfstring(L, "IncompatibleLibrary: built with version %s, but dynamically linked with version %s (%s) at %s line %d",
                        ZLIB_VERSION,  zlibVersion(), stream->msg, file, line);
        break;
    default:
        lua_pushfstring(L, "ZLibError: unknown code %d (%s) at %s line %d",
                        result, stream->msg, file, line);
    }
    lua_error(L);
    return result;
}
Пример #7
0
static SQRESULT sq_check_result(HSQUIRRELVM v, int result, const z_stream* stream) {
    /* Both of these are "normal" return codes: */
    if ( result == Z_OK || result == Z_STREAM_END ) return SQ_OK;
    switch ( result ) {
    case Z_NEED_DICT:
        return sq_throwerror(v, _SC("RequiresDictionary: input stream requires a dictionary to be deflated (%s)"),
                        stream->msg);
        break;
    case Z_STREAM_ERROR:
        return sq_throwerror(v, _SC("InternalError: inconsistent internal zlib stream (%s)"),
                        stream->msg);
        break;
    case Z_DATA_ERROR:
        return sq_throwerror(v, _SC("InvalidInput: input string does not conform to zlib format or checksum"));
        break;
    case Z_MEM_ERROR:
        return sq_throwerror(v, _SC("OutOfMemory: not enough memory (%s)"), stream->msg);
        break;
    case Z_BUF_ERROR:
        return sq_throwerror(v, _SC("InternalError: no progress possible (%s)"), stream->msg);
        break;
    case Z_VERSION_ERROR:
        return sq_throwerror(v, _SC("IncompatibleLibrary: built with version %s, but dynamically linked with version %s (%s)"),
                        ZLIB_VERSION,  zlibVersion(), stream->msg);
        break;
    default:
        return sq_throwerror(v, _SC("ZLibError: unknown code %d (%s)"), result, stream->msg);
    }
    return SQ_OK;
}
Пример #8
0
char *curl_version(void)
{
  static char version[200];
  char *ptr=version;
  size_t len;
  size_t left = sizeof(version);
  strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION );
  ptr=strchr(ptr, '\0');
  left -= strlen(ptr);

  len = Curl_ssl_version(ptr, left);
  left -= len;
  ptr += len;

#ifdef HAVE_LIBZ
  len = snprintf(ptr, left, " zlib/%s", zlibVersion());
  left -= len;
  ptr += len;
#endif
#ifdef USE_ARES
  /* this function is only present in c-ares, not in the original ares */
  len = snprintf(ptr, left, " c-ares/%s", ares_version(NULL));
  left -= len;
  ptr += len;
#endif
#ifdef USE_LIBIDN
  if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {
    len = snprintf(ptr, left, " libidn/%s", stringprep_check_version(NULL));
    left -= len;
    ptr += len;
  }
#endif

  return version;
}
Пример #9
0
/* Gzip handler. */
static CURLcode gzip_init_writer(struct connectdata *conn,
                                 contenc_writer *writer)
{
  zlib_params *zp = (zlib_params *) &writer->params;
  z_stream *z = &zp->z;     /* zlib state structure */

  if(!writer->downstream)
    return CURLE_WRITE_ERROR;

  /* Initialize zlib */
  z->zalloc = (alloc_func) zalloc_cb;
  z->zfree = (free_func) zfree_cb;

  if(strcmp(zlibVersion(), "1.2.0.4") >= 0) {
    /* zlib ver. >= 1.2.0.4 supports transparent gzip decompressing */
    if(inflateInit2(z, MAX_WBITS + 32) != Z_OK) {
      return process_zlib_error(conn, z);
    }
    zp->zlib_init = ZLIB_INIT_GZIP; /* Transparent gzip decompress state */
  }
  else {
    /* we must parse the gzip header and trailer ourselves */
    if(inflateInit2(z, -MAX_WBITS) != Z_OK) {
      return process_zlib_error(conn, z);
    }
    zp->trailerlen = 8; /* A CRC-32 and a 32-bit input size (RFC 1952, 2.2) */
    zp->zlib_init = ZLIB_INIT; /* Initial call state */
  }

  return CURLE_OK;
}
Пример #10
0
Z1Ctx *createZ1(Z1Ctx *Zc,int de){
	int siz = sizeof(Z64_stream);
	const char *ver;
	Z64_stream *Z1;
	int rcode;

	if( gzipInit() != 0 ){
		fprintf(stderr,"----createZ1 FATAL Zlib unavailable\n");
		return 0;
	}
	ver = zlibVersion();
	Z1 = (Z64_stream*)malloc(siz);
	bzero(Z1,siz);

	Z1->zalloc = zalloc;
	Z1->zfree = zfree;
	Z1->opaque = Zc;
	Zc->z1_Z1 = Z1;
	if( de ){
		rcode = XdeflateInit_(Zc,Z_BEST_SPEED,ver,siz);
	}else{
		rcode = XinflateInit_(Zc,ver,siz);
	}
	if( rcode != Z_OK ){
		fprintf(stderr,"----createZ1(de=%d)=%X rcode=%d\n",de,p2i(Z1),rcode);
	}
	return Zc;
}
Пример #11
0
curl_version_info_data *curl_version_info(CURLversion stamp)
{
#ifdef USE_SSL
  static char ssl_buffer[80];
  Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
  version_info.ssl_version = ssl_buffer;
#endif

#ifdef HAVE_LIBZ
  version_info.libz_version = zlibVersion();
  /* libz left NULL if non-existing */
#endif
#ifdef USE_ARES
  {
    int aresnum;
    version_info.ares = ares_version(&aresnum);
    version_info.ares_num = aresnum;
  }
#endif
#ifdef USE_LIBIDN
  /* This returns a version string if we use the given version or later,
     otherwise it returns NULL */
  version_info.libidn = stringprep_check_version(LIBIDN_REQUIRED_VERSION);
  if(version_info.libidn)
    version_info.features |= CURL_VERSION_IDN;
#endif
  (void)stamp; /* avoid compiler warnings, we don't use this */

  return &version_info;
}
Пример #12
0
LUALIB_API int luaopen_luvi(lua_State *L) {
#ifdef WITH_OPENSSL
  char buffer[1024];
#endif
  lua_newtable(L);
#ifdef LUVI_VERSION
  lua_pushstring(L, ""LUVI_VERSION"");
  lua_setfield(L, -2, "version");
#endif
  lua_newtable(L);
#ifdef WITH_OPENSSL
  snprintf(buffer, sizeof(buffer), "%s, lua-openssl %s",
    SSLeay_version(SSLEAY_VERSION), LOPENSSL_VERSION);
  lua_pushstring(L, buffer);
  lua_setfield(L, -2, "ssl");
#endif
#ifdef WITH_ZLIB
  lua_pushstring(L, zlibVersion());
  lua_setfield(L, -2, "zlib");
#endif
#ifdef WITH_WINSVC
  lua_pushboolean(L, 1);
  lua_setfield(L, -2, "winsvc");
#endif
  lua_setfield(L, -2, "options");
  return 1;
}
Пример #13
0
int upx_zlib_init(void)
{
#if defined(UPX_OFFICIAL_BUILD)
    if (strcmp(ZLIB_VERSION, zlibVersion()) != 0)
        return -2;
#endif
    return 0;
}
Пример #14
0
ZlibUtils::ZlibUtils() :
isFirstTime_(true), compressionErrorCount_(0) {
	deflateStream_.zalloc = Z_NULL;
	deflateStream_.zfree = Z_NULL;
	deflateStream_.opaque = Z_NULL;

	inflateStream_.zalloc = Z_NULL;
	inflateStream_.zfree = Z_NULL;

	static const char* currentVersion = ZLIB_VERSION;
	if (currentVersion[0] != zlibVersion()[0]) {
		GS_THROW_USER_ERROR(GS_ERROR_CM_INCOMPATIBLE_ZLIB_VERSION,
				"the zlib library version (zlib_version) is incompatible"
				<< " with the version assumed, " << currentVersion
				<< ", but the library version, " << zlibVersion());
	}
}
Пример #15
0
 JSBool SJS_PluginInit(JSContext *cx, sjs_data *rtd)
 {
     PLUGIN_API_CHECK;
     grtd = rtd;
     JS_snprintf(version, 200, "zlib/%s", zlibVersion());
     zip = JSZip::JSInit(cx, JS_GetGlobalObject(cx), NULL);
     return (zip != NULL);
 }
Пример #16
0
static void
get_mergecap_runtime_info(GString *str)
{
  /* zlib */
#if defined(HAVE_LIBZ) && !defined(_WIN32)
  g_string_append_printf(str, ", with libz %s", zlibVersion());
#endif
}
Пример #17
0
curl_version_info_data *curl_version_info(CURLversion stamp)
{
  static bool initialized;
#ifdef USE_LIBSSH2
  static char ssh_buffer[80];
#endif
#ifdef USE_SSL
  static char ssl_buffer[80];
#endif

  if(initialized)
    return &version_info;

#ifdef USE_SSL
  Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
  version_info.ssl_version = ssl_buffer;
#endif

#ifdef HAVE_LIBZ
  version_info.libz_version = zlibVersion();
  /* libz left NULL if non-existing */
#endif
#ifdef USE_ARES
  {
    int aresnum;
    version_info.ares = ares_version(&aresnum);
    version_info.ares_num = aresnum;
  }
#endif
#ifdef USE_LIBIDN2
  /* This returns a version string if we use the given version or later,
     otherwise it returns NULL */
  version_info.libidn = idn2_check_version(IDN2_VERSION);
  if(version_info.libidn)
    version_info.features |= CURL_VERSION_IDN;
#elif defined(USE_WIN32_IDN)
  version_info.features |= CURL_VERSION_IDN;
#endif

#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
#ifdef _LIBICONV_VERSION
  version_info.iconv_ver_num = _LIBICONV_VERSION;
#else
  /* version unknown */
  version_info.iconv_ver_num = -1;
#endif /* _LIBICONV_VERSION */
#endif

#ifdef USE_LIBSSH2
  snprintf(ssh_buffer, sizeof(ssh_buffer), "libssh2/%s", LIBSSH2_VERSION);
  version_info.libssh_version = ssh_buffer;
#endif

  (void)stamp; /* avoid compiler warnings, we don't use this */

  initialized = true;
  return &version_info;
}
Пример #18
0
/*
 * All command line parameters have the syntax "-f string" or "-fstring"
 * OPTIONS:
 * -d filename - specify d:line file
 * -f filename - specify config file
 * -h hostname - specify server name
 * -k filename - specify k:line file
 * -l filename - specify log file
 * -n          - do not fork, run in foreground
 * -v          - print daemon version and exit
 * -x          - set debug level, if compiled for debug logging
 */
static void parse_command_line(int argc, char* argv[])
{
  const char* options = "d:f:h:k:l:nvx:"; 
  int         opt;

  while ((opt = getopt(argc, argv, options)) != EOF) {
    switch (opt) {
    case 'd': 
      if (optarg)
        ConfigFileEntry.dpath = optarg;
      break;
    case 'f':
#ifdef CMDLINE_CONFIG
      if (optarg)
        ConfigFileEntry.configfile = optarg;
#endif
      break;
    case 'k':
#ifdef KPATH
      if (optarg)
        ConfigFileEntry.klinefile = optarg;
#endif
      break;
    case 'h':
      if (optarg)
        strncpy_irc(me.name, optarg, HOSTLEN);
      break;
    case 'l':
      if (optarg)
        logFileName = optarg;
      break;
    case 'n':
      bootDaemon = 0; 
      break;
    case 'v':
      printf("ircd %s\n\tzlib %s\n\tircd_dir: %s\n", ircd_version,
#ifndef ZIP_LINKS
             "not used",
#else
              zlibVersion(),
#endif
              ConfigFileEntry.dpath);
      exit(0);
      break;   /* NOT REACHED */
    case 'x':
#ifdef  DEBUGMODE
      if (optarg) {
        debuglevel = atoi(optarg);
        debugmode = optarg;
      }
#endif
      break;
    default:
      bad_command();
      break;
    }
  }
}
Пример #19
0
char *curl_version(void)
{
    static char version[200];
    char *ptr=version;
    size_t len;
    size_t left = sizeof(version);
    strcpy(ptr, LIBCURL_NAME "/" LIBCURL_VERSION );
    len = strlen(ptr);
    left -= len;
    ptr += len;

    if(left > 1) {
        len = Curl_ssl_version(ptr + 1, left - 1);

        if(len > 0) {
            *ptr = ' ';
            left -= ++len;
            ptr += len;
        }
    }

#ifdef HAVE_LIBZ
    len = snprintf(ptr, left, " zlib/%s", zlibVersion());
    left -= len;
    ptr += len;
#endif
#ifdef USE_ARES
    /* this function is only present in c-ares, not in the original ares */
    len = snprintf(ptr, left, " c-ares/%s", ares_version(NULL));
    left -= len;
    ptr += len;
#endif
#ifdef USE_LIBIDN
    if(stringprep_check_version(LIBIDN_REQUIRED_VERSION)) {
        len = snprintf(ptr, left, " libidn/%s", stringprep_check_version(NULL));
        left -= len;
        ptr += len;
    }
#endif
#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
#ifdef _LIBICONV_VERSION
    len = snprintf(ptr, left, " iconv/%d.%d",
                   _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);
#else
    /* version unknown */
    len = snprintf(ptr, left, " iconv");
#endif /* _LIBICONV_VERSION */
    left -= len;
    ptr += len;
#endif
#ifdef USE_LIBSSH2
    len = snprintf(ptr, left, " libssh2/%s", CURL_LIBSSH2_VERSION);
    left -= len;
    ptr += len;
#endif

    return version;
}
jint Java_com_tencent_mobileqq_persistence_FTSDatatbaseDao_initFTS(JNIEnv* env, jobject thiz)
{
    int errCode = sqlite3_open_v2(DB_FILE, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
    if (SQLITE_OK != errCode)
    {
        logError("Can't open database IndexQQMsg.db, ", sqlite3_errmsg(db));

        sqlite3_close(db);
        return errCode;
    }

    errCode = sqlite3_exec(db, "PRAGMA cache_size=4000;", NULL, NULL, NULL);
    if (SQLITE_OK != errCode)
    {
        logError("Can't set PRAGMA cache_size = 4000, ", sqlite3_errmsg(db));

        sqlite3_close(db);
        return errCode;
    }

    errCode = sqlite3_create_function(db, "qqcompress", 1, SQLITE_UTF8, NULL, qqcompress, NULL, NULL);
    if (SQLITE_OK != errCode)
    {
        logError("Can't create function, ", sqlite3_errmsg(db));

        sqlite3_close(db);
        return errCode;
    }

    errCode = sqlite3_create_function(db, "qquncompress", 1, SQLITE_UTF8, NULL, qquncompress, NULL, NULL);
    if (SQLITE_OK != errCode)
    {
        logError("Can't create function, ", sqlite3_errmsg(db));

        sqlite3_close(db);
        return errCode;
    }

    char* sql = "CREATE VIRTUAL TABLE IF NOT EXISTS IndexMsg USING fts4(type, content, contentindex, oid, ext1, ext2,ext3,exts, compress=qqcompress, uncompress=qquncompress);";
    // char* sql = "CREATE VIRTUAL TABLE IF NOT EXISTS IndexMsg USING fts4(type, content, contentindex, oid, ext1, ext2,ext3,exts);";
    errCode = sqlite3_exec(db, sql, NULL, NULL, NULL);
    if (SQLITE_OK != errCode)
    {
        logError("Can't create virtual table IndexMsg, ", sqlite3_errmsg(db));

        sqlite3_close(db);
        return errCode;
    }

#ifdef ZIP
    const char* version = zlibVersion();
    logInfo("FTS init zlib version = ", version);
#endif

    logInfo("FTS init...", NULL);
    return 0;
}
Пример #21
0
QString getVersionString ()
{
	QString result = QString("avalon 1.0rc3 build ") + QString::number(getBuildNumber());

#ifdef AVALON_USE_ZLIB
	result += ", zlib " + QString(zlibVersion());
#endif

	return result;
}
Пример #22
0
rc_t call_zlib( void )
{
    const char * zlib_vers;

    zlib_vers = zlibVersion();
    if ( zlib_vers == NULL )
        return RC( rcExe, rcCondition, rcValidating, rcInterface, rcInvalid );
    OUTMSG (( "zlib version is : '%s'\n", zlib_vers ));

    return 0;
}
Пример #23
0
int main(int, char **)
{
    z_streamp stream;
    stream = 0;
    const char *ver = zlibVersion();
    ver = 0;
    // compress2 was added in zlib version 1.0.8
    int res = compress2(0, 0, 0, 0, 1);
    res = 0;
    return 0;
}
Пример #24
0
int camlzip_zlibversion(void)
{
  CAMLparam0 ();
  CAMLlocal1 (v);
#ifdef HAVE_ZLIBVERSION
  v = copy_string (zlibVersion());
  CAMLreturn (v);
#else
  failwith("zlibVersion not found");
#endif
}
Пример #25
0
void help(int exitval)
{
  printf("untgz version 0.2.1\n"
         "  using zlib version %s\n\n",
         zlibVersion());
  printf("Usage: untgz file.tgz            extract all files\n"
         "       untgz file.tgz fname ...  extract selected files\n"
         "       untgz -l file.tgz         list archive contents\n"
         "       untgz -h                  display this help\n");
  exit(exitval);
}
Пример #26
0
void debug_init(void)
{
#ifdef HAVE_SYS_UTSNAME_H
   struct utsname buf;
#endif
   DEBUG_LOCK;
   
   if ((debug_file = fopen (GBL_DEBUG_FILE, "w")) == NULL)
      ERROR_MSG("Couldn't open for writing %s", GBL_DEBUG_FILE);
   
   fprintf (debug_file, "\n==============================================================\n\n");
                   
  	fprintf (debug_file, "-> ${prefix}        %s\n", INSTALL_PREFIX);
  	fprintf (debug_file, "-> ${exec_prefix}   %s\n", INSTALL_EXECPREFIX);
  	fprintf (debug_file, "-> ${bindir}        %s\n", INSTALL_BINDIR);
  	fprintf (debug_file, "-> ${libdir}        %s\n", INSTALL_LIBDIR);
  	fprintf (debug_file, "-> ${sysconfdir}    %s\n", INSTALL_SYSCONFDIR);
  	fprintf (debug_file, "-> ${datadir}       %s\n\n", INSTALL_DATADIR);

  	fprintf (debug_file, "-> %s %s\n\n", GBL_PROGRAM, GBL_VERSION);
   #ifdef HAVE_SYS_UTSNAME_H
      uname(&buf);
      fprintf (debug_file, "-> running on %s %s %s\n", buf.sysname, buf.release, buf.machine);
   #endif
   #if defined (__GNUC__) && defined (__GNUC_MINOR__)
      fprintf (debug_file, "-> compiled with gcc %d.%d (%s)\n", __GNUC__, __GNUC_MINOR__, GCC_VERSION);
   #endif
   #if defined (__GLIBC__) && defined (__GLIBC_MINOR__)
      fprintf (debug_file, "-> glibc version %d.%d\n", __GLIBC__, __GLIBC_MINOR__);
   #endif
   fprintf(debug_file, "-> %s\n", pcap_lib_version());
   fprintf(debug_file, "-> libnet version %s\n", LIBNET_VERSION);
   fprintf(debug_file, "-> libz version %s\n", zlibVersion());
   #ifdef HAVE_PCRE
   fprintf(debug_file, "-> libpcre version %s\n", pcre_version());
   #endif
   #ifdef HAVE_OPENSSL 
      fprintf (debug_file, "-> lib     %s\n", SSLeay_version(SSLEAY_VERSION));
      fprintf (debug_file, "-> headers %s\n", OPENSSL_VERSION_TEXT);
   #endif
   #ifdef HAVE_NCURSES 
      fprintf (debug_file, "-> %s\n", curses_version());
   #endif
   #ifdef HAVE_GTK 
      fprintf (debug_file, "-> gtk+ %d.%d.%d\n", gtk_major_version, gtk_minor_version, gtk_micro_version);
   #endif
   fprintf (debug_file, "\n\nDEVICE OPENED FOR %s DEBUGGING\n\n", GBL_PROGRAM);
   fflush(debug_file);
   
   DEBUG_UNLOCK;
   
   atexit(debug_close);
}
Пример #27
0
const char *ZlibVersion(){
	if( 0 < zlib_dl )
	{
		if( isCYGWIN() ){
			gzipInit();
		}
		return zlibVersion();
	}
	if( zlib_dl == 0 )
		return "Not Yet";
	return "Not Found";
}
Пример #28
0
TInt CTestlibz::libzversion()
	{
	__UHEAP_MARK;
	char buf[]="1.2.3";
	INFO_PRINTF1(_L("zlibVersion()\n"));
	if( (strcmp( buf, zlibVersion() ) != 0) ){
		INFO_PRINTF1(_L("zlibversion failed\n"));
		return KErrGeneral;
		}
	__UHEAP_MARKEND;
	return KErrNone;
	}
Пример #29
0
/* {{{ PHP_MINFO_FUNCTION */
static PHP_MINFO_FUNCTION(zlib)
{
	php_info_print_table_start();
	php_info_print_table_header(2, "ZLib Support", "enabled");
	php_info_print_table_row(2, "Stream Wrapper", "compress.zlib://");
	php_info_print_table_row(2, "Stream Filter", "zlib.inflate, zlib.deflate");
	php_info_print_table_row(2, "Compiled Version", ZLIB_VERSION);
	php_info_print_table_row(2, "Linked Version", (char *) zlibVersion());
	php_info_print_table_end();

	DISPLAY_INI_ENTRIES();
}
Пример #30
0
int main(int argc, char *argv[]) {
  ParseOptions(argc, argv);
  if (test_mode == HELP_MODE) {
    printf("Usage: %s [OPTION]... [FILE]...\n"
        "Version: zlib-%s\n"
        "Options:\n"
        "  -d, --deflate  圧縮します (default)\n"
        "  -i, --inflate  伸長します\n"
        "  -g, --gzip     gzip 形式で圧縮します\n"
        "  -z, --zlib     zlib 形式で圧縮します (default)\n"
        "  -l, --level=[0-9]    圧縮レベルを指定します (default: 6)\n"
        "  -o, --output=[FILE]  出力ファイルを指定します (default: stdout)\n"
        "  -h, --help     このヘルプを表示します\n",
        argv[0], zlibVersion());
    return 0;
  }

  FILE *output_file = stdout;
  if (output_file_name != NULL) {
    output_file = fopen(output_file_name, "wb");
    if (output_file == NULL) {
      ERROR("%s", output_file_name);
    }
  }

  // 入力ファイルの指定がなければ,標準入力を使います.
  if (optind >= argc) {
    Code(stdin, output_file);
  } else {
    for (int i = optind; i < argc; ++i) {
      const char *input_file_name = argv[i];
      FILE *input_file = fopen(input_file_name, "rb");
      if (input_file == NULL) {
        ERROR("%s", input_file_name);
      }

      Code(input_file, output_file);
      if (fclose(input_file) != 0) {
        ERROR("%s", input_file_name);
      }
    }
  }

  if (output_file != stdout) {
    if (fclose(output_file) != 0) {
      ERROR("%s", output_file_name);
    }
  }

  return 0;
}