#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mspack.h>
#include <sys/stat.h>
#include <error.h>
Go to the source code of this file.
◆ create_output_name()
| char* create_output_name |
( |
char * |
fname | ) |
|
◆ ensure_filepath()
| static int ensure_filepath |
( |
char * |
path | ) |
|
|
static |
Ensures that all directory components in a filepath exist. New directory components are created, if necessary.
- Parameters
-
| path | the filepath to check |
- Returns
- non-zero if all directory components in a filepath exist, zero if components do not exist and cannot be created
Definition at line 35 of file chmextract.c.
41 if (*
p !=
'/')
continue;
static static fork const void static count static fd const char const char static newpath const char static path const char path
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig mkdir
References mkdir, ok, p, path, S_ISDIR, stat, and user_umask.
Referenced by main().
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 76 of file chmextract.c.
92 if ((chm = chmd->
open(chmd, *
argv))) {
100 for (
i = 0;
i < numf;
i++) {
102 printf(
"Extracting %s\n", outname);
104 if (chmd->
extract(chmd,
f[
i], outname)) {
105 printf(
"%s: extract error on \"%s\": %s\n",
112 chmd->
close(chmd, chm);
115 printf(
"%s: can't open -- %s\n", *
argv, ERROR(chmd));
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz umask
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char argv
void qsort(void *a, size_t n, size_t es, int(*cmp)(const void *, const void *))
z_const unsigned char * next
void(* close)(struct mschm_decompressor *self, struct mschmd_header *chm)
int(* extract)(struct mschm_decompressor *self, struct mschmd_file *file, const char *filename)
struct mschmd_header *(* open)(struct mschm_decompressor *self, const char *filename)
References argv, calloc(), mschm_decompressor::close, create_output_name(), ensure_filepath(), mschm_decompressor::extract, f, file, mschmd_header::files, free(), i, mspack_create_chm_decompressor(), mspack_destroy_chm_decompressor(), MSPACK_SYS_SELFTEST, file::next, NULL, mschm_decompressor::open, printf(), qsort(), sortfunc(), umask, and user_umask.
◆ sortfunc()
Definition at line 69 of file chmextract.c.
73 return (diff < 0) ? -1 : ((diff > 0) ? 1 : 0);
References a, and b.
Referenced by main().
◆ user_umask