Man page - libjodycode(7)

Packages contains this manual

Manual

LIBJODYCODE

NAME
SYNOPSIS
Standard calls API
Alarm API
Cacheinfo API
Error API
jodyhash API
OOM (out-of-memory) API
Path manipulation API
Size Suffix API
Numerically correct string comparison API
String API
Time API
Version API
Windows stat() mode test definitions
Windows Unicode API
Windows Unicode wide equivalence definitions
Windows Unicode conversion shortcut definitions
DESCRIPTION
NOTES
LICENSE

NAME

libjodycode - shared code used by several tools written by Jody Bruchon

SYNOPSIS

#include <libjodycode.h>

Standard calls API

int jc_access(const char * pathname , int mode )
FILE *jc_fopen(const char *
pathname , const JC_WCHAR_T * mode )
int jc_fwprint(FILE * const restrict
stream , const char * const restrict str , const int cr )
int jc_link(const char *
path1 , const char * path2 );
int jc_rename(const char *
oldpath , const char * newpath )
int jc_remove(const char *
pathname )
int jc_stat(const char *
filename , struct JC_STAT * buf )

Alarm API

int jc_alarm_ring
int jc_start_alarm(const unsigned int
seconds , const int repeat )
int jc_stop_alarm(void)

Cacheinfo API

void jc_get_proc_cacheinfo(struct jc_proc_cacheinfo * pci )

Error API

const char *jc_get_errname(int errnum )
const char *jc_get_errdesc(int
errnum )
int jc_print_error(int
errnum )

jodyhash API

int jc_block_hash(jodyhash_t * data , jodyhash_t * hash , const size_t count )

JODY_HASH_VERSION

version of jody_hash the library currently uses

OOM (out-of-memory) API

void jc_oom(const char * const restrict msg )
void jc_nullptr(const char * restrict
func )

Path manipulation API

int jc_collapse_dotdot(char * const path )
int jc_make_relative_link_name(const char * const
src , const char * const dest , char * rel_path )

Size Suffix API

const struct jc_size_suffix jc_size_suffix[]

Numerically correct string comparison API

int jc_numeric_strcmp(char * restrict c1 , char * restrict c2 , int insensitive )

String API

int jc_strncaseeq(const char * s1 , const char * s2 , size_t len )
int jc_strcaseeq(const char *
s1 , const char * s2 )
int jc_strneq(const char *
s1 , const char * s2 , size_t len )
int jc_streq(const char *
s1 , const char * s2 )

Time API

time_t jc_strtoepoch(const char * const datetime )
time_t jc_nttime_to_unixtime(const uint64_t * const restrict
timestamp )
time_t jc_unixtime_to_nttime(const uint64_t * const restrict
timestamp )

Version API

const char *jc_version
const char *jc_verdate
const int jc_api_version
const int jc_api_featurelevel
const int jc_jodyhash_version
const unsigned char jc_api_versiontable[]

Windows stat() mode test definitions

S_ISARCHIVE(st_mode)

is Windows archive attribute set?

S_ISRO(st_mode)

is Windows read-only attribute set?

S_ISHIDDEN(st_mode)

is Windows hidden attribute set?

S_ISSYSTEM(st_mode)

is Windows system attribute set?

S_ISCRYPT(st_mode)

is it a Windows encrypted file/dir?

S_ISDIR(st_mode)

is it a directory?

S_ISCOMPR(st_mode)

Windows compressed attribute set

S_ISREPARSE(st_mode)

is it a Windows reparse point?

S_ISSPARSE(st_mode)

is it a Windows sparse file?

S_ISTEMP(st_mode)

is it a Windows temporary file?

S_ISREG(st_mode)

is it a regular file?

Windows Unicode API

void jc_set_output_modes(unsigned int modes )
void jc_slash_convert(char *
path )
int jc_string_to_wstring(const char * const restrict
string , JC_WCHAR_T ** wstring )
int jc_widearg_to_argv(int
argc , JC_WCHAR_T ** wargv , char ** argv )

Windows Unicode wide equivalence definitions

JC_WCHAR_T

wchar_t for Windows Unicode, char otherwise

JC_FILE_MODE_RDONLY

string "rb"

JC_FILE_MODE_WRONLY

string "wb"

JC_FILE_MODE_RW

string "w+b"

JC_FILE_MODE_RW_EXISTING

string "r+b"

JC_FILE_MODE_WRONLY_APPEND

string "ab"

JC_FILE_MODE_RW_APPEND

string "a+b"

JC_FILE_MODE_RDONLY_SEQ

string "rbS" (Windows) or "rb"

JC_FILE_MODE_WRONLY_SEQ

string "wbS" (Windows) or "wb"

JC_FILE_MODE_RW_SEQ

string "w+bS" (Windows) or "w+b"

JC_FILE_MODE_RW_EXISTING_SEQ

string "r+bS" (Windows) or "r+b"

JC_FILE_MODE_WRONLY_APPEND_SEQ

string "abS" (Windows) or "ab"

JC_FILE_MODE_RW_APPEND_SEQ

string "a+bS" (Windows) or "a+b"

JC_F_OK

unistd.h F_OK

JC_R_OK

unistd.h R_OK

JC_W_OK

unistd.h W_OK

JC_X_OK

unistd.h X_OK

Windows Unicode conversion shortcut definitions

M2W(char * a , JC_WCHAR_T * b )
convert string a to wide string b using MultiByteToWideChar()

W2M(JC_WCHAR_T * a , char * b )
convert wide string a to normal string b using WideCharToMultiByte()

DESCRIPTION

libjodycode is a software code library containing code shared among several of the programs written by Jody Bruchon such as imagepile, jdupes, winregfs, and zeromerge. These shared pieces of code were copied between each program as they were updated. As the number of programs increased and keeping these pieces of code synced became more annoying, the decision was made to combine all of them into a single reusable shared library.

NOTES

libjodycode is created and maintained by Jody Bruchon <jody@jodybruchon.com>

General information, help, and tech info: https://www.jdupes.com/

Development, source code, releases: https://codeberg.org/jbruchon/libjodycode

If you find this software useful, please consider financially supporting its development through the author’s home page:

https://www.jodybruchon.com/

LICENSE

MIT License

Copyright (c) 2014-2025 Jody Lee Bruchon <jody@jodybruchon.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.