资源简介
window下模拟linux系统,版本2.5.2,带vi组件
代码片段和文件信息
///////////////////////////////////////////////////////////////////////////////
//
/// \file 01_compress_easy.c
/// \brief Compress from stdin to stdout in multi-call mode
///
/// Usage: ./01_compress_easy PRESET < INFILE > OUTFILE
///
/// Example: ./01_compress_easy 6 < foo > foo.xz
//
// Author: Lasse Collin
//
// This file has been put into the public domain.
// You can do whatever you want with this file.
//
///////////////////////////////////////////////////////////////////////////////
#include
#include
#include
#include
#include
#include
static void
show_usage_and_exit(const char *argv0)
{
fprintf(stderr “Usage: %s PRESET < INFILE > OUTFILE\n“
“PRESET is a number 0-9 and can optionally be “
“followed by ‘e‘ to indicate extreme preset\n“
argv0);
exit(EXIT_FAILURE);
}
static uint32_t
get_preset(int argc char **argv)
{
// One argument whose first char must be 0-9.
if (argc != 2 || argv[1][0] < ‘0‘ || argv[1][0] > ‘9‘)
show_usage_and_exit(argv[0]);
// Calculate the preste level 0-9.
uint32_t preset = argv[1][0] - ‘0‘;
// If there is a second char it must be ‘e‘. It will set
// the LZMA_PRESET_EXTREME flag.
if (argv[1][1] != ‘\0‘) {
if (argv[1][1] != ‘e‘ || argv[1][2] != ‘\0‘)
show_usage_and_exit(argv[0]);
preset |= LZMA_PRESET_EXTREME;
}
return preset;
}
static bool
init_encoder(lzma_stream *strm uint32_t preset)
{
// Initialize the encoder using a preset. Set the integrity to check
// to CRC64 which is the default in the xz command line tool. If
// the .xz file needs to be decompressed with XZ embedded use
// LZMA_CHECK_CRC32 instead.
lzma_ret ret = lzma_easy_encoder(strm preset LZMA_CHECK_CRC64);
// Return successfully if the initialization went fine.
if (ret == LZMA_OK)
return true;
// Something went wrong. The possible errors are documented in
// lzma/container.h (src/liblzma/api/lzma/container.h in the source
// package or e.g. /usr/include/lzma/container.h depending on the
// install prefix).
const char *msg;
switch (ret) {
case LZMA_MEM_ERROR:
msg = “Memory allocation failed“;
break;
case LZMA_OPTIONS_ERROR:
msg = “Specified preset is not supported“;
break;
case LZMA_UNSUPPORTED_CHECK:
msg = “Specified integrity check is not supported“;
break;
default:
// This is most likely LZMA_PROG_ERROR indicating a bug in
// this program or in liblzma. It is inconvenient to have a
// separate error message for errors that should be impossible
// to occur but knowing the error code is important for
// debugging. That‘s why it is good to print the error code
// at least when there is no good error message to show.
msg = “Unknown error possibly a bug“;
break;
}
fprintf(stderr “Error initializing the encoder: %s (error code %u)\n“
msg ret);
return false;
}
static bool
compress(lzma_stream *strm FILE *infile FILE *outfile)
{
// This will be LZMA_RUN u
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 24595 2015-02-19 00:53 cygwin64\bin\addftinfo.exe
....S.. 21 2016-07-07 07:40 cygwin64\bin\apropos
文件 28179 2016-04-13 02:58 cygwin64\bin\arch.exe
文件 99869 2014-10-28 06:18 cygwin64\bin\ash.exe
....S.. 19 2016-07-07 07:40 cygwin64\bin\awk
文件 36371 2016-04-13 02:58 cygwin64\bin\ba
文件 36371 2016-04-13 02:58 cygwin64\bin\ba
文件 28179 2016-04-13 02:58 cygwin64\bin\ba
文件 701459 2015-09-25 04:58 cygwin64\bin\bash.exe
文件 7186 2015-09-25 04:57 cygwin64\bin\bashbug
文件 30739 2013-03-07 10:54 cygwin64\bin\bunzip2.exe
文件 30739 2013-03-07 10:54 cygwin64\bin\bzcat.exe
....S.. 17 2016-07-07 07:40 cygwin64\bin\bzcmp
文件 2128 2013-03-07 10:54 cygwin64\bin\bzdiff
....S.. 17 2016-07-07 07:40 cygwin64\bin\bzegrep
....S.. 17 2016-07-07 07:40 cygwin64\bin\bzfgrep
文件 1677 2013-03-07 10:54 cygwin64\bin\bzgrep
文件 30739 2013-03-07 10:54 cygwin64\bin\bzip2.exe
文件 12307 2013-03-07 10:54 cygwin64\bin\bzip2recover.exe
....S.. 17 2016-07-07 07:40 cygwin64\bin\bzless
文件 1259 2013-03-07 10:54 cygwin64\bin\bzmore
文件 1644 2016-04-10 14:48 cygwin64\bin\ca-legacy
文件 33811 2015-03-23 16:47 cygwin64\bin\cal.exe
....S.. 18 2016-07-07 07:40 cygwin64\bin\captoinfo
文件 49683 2016-04-13 02:58 cygwin64\bin\cat.exe
文件 32787 2015-10-09 10:22 cygwin64\bin\catman.exe
文件 52243 2016-04-13 02:58 cygwin64\bin\chcon.exe
文件 58899 2016-04-13 02:58 cygwin64\bin\chgrp.exe
文件 51219 2016-04-13 02:58 cygwin64\bin\chmod.exe
文件 61459 2016-04-13 02:58 cygwin64\bin\chown.exe
............此处省略5441个文件信息
相关资源
- cygwin1.7离线安装包
- Cygwin2.874安装包
- cygwin绿色版本
- cygwin-3.0.7-201905 完整绿色版
- Cygwin 64位免安装版
- Cygwin1.5.24-2
- Cygwin 下的NS3安装心得
- cygwin离线安装包地址
- cygwin1.rar
- Cygwin中make3.8.1的修正版
- cygwin1.dll
- 64位Cygwin
- Win10不需要Cygwin搭建大数据测试环境搭
- 在cygwin系统运行SLEUTH
- commview.dll、cygwin1.dll及ca2k.dll文件
- lcx工具,包括arm9和win版本
- so2lib实用工具(把cygwin生成的so或dl
评论
共有 条评论