/build/buildd/xz-utils-4.999.9beta+20100527/src/xzdec/xzdec.c File Reference

Simple single-threaded tool to uncompress .xz or .lzma files. More...

#include "sysdefs.h"
#include "lzma.h"
#include <stdarg.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include "getopt.h"
#include "tuklib_progname.h"
#include "tuklib_exit.h"

Defines

#define TOOL_FORMAT   "xz"

Functions

static void lzma_attribute ((format(printf, 1, 2)))
static void lzma_attribute ((noreturn))
static void memlimit_set_percentage (uint32_t percentage)
static void memlimit_set (uint64_t new_memlimit)
static void memlimit_init (void)
static uint64_t str_to_uint64 (const char *value, uint64_t max)
 Convert a string to uint64_t.
static void parse_options (int argc, char **argv)
 Parses command line options.
static void uncompress (lzma_stream *strm, FILE *file, const char *filename)
int main (int argc, char **argv)

Variables

static uint64_t memlimit
 Number of bytes to use memory at maximum.
static uint64_t total_ram
 Total amount of physical RAM.
static unsigned int display_errors = 2

Detailed Description

Simple single-threaded tool to uncompress .xz or .lzma files.


Function Documentation

static void memlimit_set_percentage ( uint32_t  percentage  )  [static]

Find out the amount of physical memory (RAM) in the system, and set the memory usage limit to the given percentage of RAM.

References memlimit, and total_ram.

Referenced by parse_options().

static void memlimit_set ( uint64_t  new_memlimit  )  [static]

Set the memory usage limit to give number of bytes. Zero is a special value to indicate the default limit.

References memlimit, and total_ram.

Referenced by memlimit_init(), and parse_options().

static void memlimit_init ( void   )  [static]

Get the total amount of physical RAM and set the memory usage limit to the default value.

References lzma_physmem(), memlimit_set(), and total_ram.

static uint64_t str_to_uint64 ( const char *  value,
uint64_t  max 
) [static]

Convert a string to uint64_t.

This is rudely copied from src/xz/util.c and modified a little. :-(

Parameters:
max Return value when the string "max" was specified.
static void parse_options ( int  argc,
char **  argv 
) [static]

Parses command line options.

References display_errors, memlimit_set(), memlimit_set_percentage(), and str_to_uint64().


Variable Documentation

uint64_t memlimit [static]

Number of bytes to use memory at maximum.

Referenced by memlimit_set(), and memlimit_set_percentage().

uint64_t total_ram [static]

Total amount of physical RAM.

Referenced by memlimit_init(), memlimit_set(), and memlimit_set_percentage().

unsigned int display_errors = 2 [static]

Error messages are suppressed if this is zero, which is the case when --quiet has been given at least twice.

Referenced by parse_options().

Generated on Mon May 31 10:13:11 2010 for XZ Utils by  doxygen 1.6.3