#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 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 unsigned int | display_errors = 2 |
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 lzma_physmem(), and memlimit.
Referenced by memlimit_set(), and 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 memlimit_set_percentage().
Referenced by parse_options().
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. :-(
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().
uint64_t memlimit [static] |
Number of bytes to use memory at maximum.
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().