LIBJODYCODE(3)
π NAME π
okay so this is the libjodycode(3) manual page β yes, the manual name is libjodycode β and the whole NAME vibe is: shared code used by several tools written by Jody Bruchon. bestie, that's the tea ββ¨
π SYNOPSIS π
#include <libjodycode.h>
drop that include in and you're literally in, no cap π
π¦ 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. iconic behavior honestly π
β¨ APPLICATION USAGE β¨
this is the part where the library actually gets used β grab your emotional support terminal and let's go π«Ά
π Standard C library swap-in calls π
these are the swap-in calls, literally the standard C library but with the jc_ glow-up:
int jc_access(const char *pathname, int mode)
int jc_closedir(JC_DIR * const restrict dirp)
int jc_fclose(FILE *stream)
int jc_chmod(const char * filename, uint32_t mode)
int jc_feof(FILE *stream)
int jc_ferror(FILE * stream)
char *jc_fgets(char * restrict s, int size, FILE * restrict stream)
FILE *jc_fopen(const char *pathname, const JC_WCHAR_T *mode)
size_t jc_fread(void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream)
int jc_fputs(const char * restrict s, FILE * restrict stream)
size_t jc_fwrite(const void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream)
char *jc_getcwd(char * const restrict pathname, const size_t size)
int jc_link(const char *path1, const char *path2)
JC_DIR *jc_opendir(const char * restrict path)
ssize_t jc_read(int fd, void *buf, size_t count)
struct JC_DIRENT *jc_readdir(JC_DIR * const restrict dirp)
int jc_rename(const char *oldpath, const char *newpath)
int jc_remove(const char *pathname)
int jc_stat(const char * const filename, struct JC_STAT * const restrict buf)
const char *jc_strerror(int errnum)
long jc_strtol(const char * restrict nptr, char ** restrict endptr, int base)
unsigned long jc_strtoul(const char * restrict nptr, char ** restrict endptr, int base)
long long jc_strtoll(const char * restrict nptr, char ** restrict endptr, int base)
unsigned long long jc_strtoull(const char * restrict nptr, char ** restrict endptr, int base)
int jc_utime(const char * filename, const struct JC_UTIMBUF *times)
ssize_t jc_write(int fd, const void *buf, size_t count)
β° Alarm API β°
alarm-core, bestie:
int jc_start_alarm(const unsigned int seconds, const int repeat)
int jc_stop_alarm(void)
int jc_alarm_ring
jc_alarm_ringβ number of alarm triggers that have occurred; writable by the program.
π¦ Batch file list API π¦
batch file info, no cap:
struct jc_fileinfo_batch *jc_fileinfo_batch_alloc(const int filecnt, const int stat, const int namlen)
void jc_fileinfo_batch_free(struct jc_fileinfo_batch * const restrict batch)
π§ Cacheinfo API π§
cacheinfo moment:
struct jc_proc_cacheinfo *jc_get_proc_cacheinfo(int cleanup)
π Directory API π
directory girlies rise:
size_t jc_get_d_namlen(const struct JC_DIRENT * const restrict dirent)
π¨ Error API π¨
errors but make it libjodycode:
const char *jc_get_errname(int errnum)
int jc_print_error(int errnum)
int32_t jc_errno
jc_errnoβ libjodycode equivalent to C library'serrno.
π§Έ jodyhash API π§Έ
hash vibes only:
int jc_block_hash(const enum jc_e_hash type, jodyhash_t *data, jodyhash_t *hash, const size_t count)
enum jc_e_hash
#define JODY_HASH_VERSION
enum jc_e_hashβ selects hash type to perform,NORMALorROLLING.#define JODY_HASH_VERSIONβ version of jody_hash the library currently uses.
π Linkfiles API π
link 'em up:
int jc_linkfiles(struct jc_fileinfo_batch * const restrict batch, const enum jc_e_link linktype)
enum jc_e_link
enum jc_e_linkβ selects type of link to perform:SYMLINK,HARDLINK, orREFLINK.
π OOM (out-of-memory) API π
out-of-memory handlers, keeping it real:
void jc_oom(const char * restrict msg)
void jc_nullptr(const char * func)
π€οΈ Path manipulation API π€οΈ
path manipulation, because paths are messy:
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 π
size suffix table, periodt:
const struct jc_size_suffix jc_size_suffix[]
π’ Numerically correct string comparison API π’
numbers compared correctly, as they should be:
int jc_numeric_strcmp(char * restrict c1, char * restrict c2, int insensitive)
π§΅ String API π§΅
string functions, and yes the trailing quotes in the original are literally part of the copied signatures:
int jc_fwprint(FILE * const restrict stream, const char * const restrict str, const int cr)
int jc_strncaseeq(const char *s1, const char *s2, const size_t len)
int jc_strcaseeq(const char *s1, const char *s2)
int jc_strneq(const char *s1, const char *s2, const size_t len)
int jc_streq(const char *s1, const char *s2)
JC_STR_T *jc_str_init(const char *string, uint32_t len)
int jc_strteq(const JC_STR_T *s1, const JC_STR_T *s2)
int jc_strtneq(const JC_STR_T *s1, const JC_STR_T *s2, const size_t len)
int jc_strtcaseeq(const JC_STR_T *s1, const JC_STR_T *s2)
int jc_strtncaseeq(const JC_STR_T *s1, const JC_STR_T *s2, const size_t len)
int jc_strtcmp(const JC_STR_T *s1, const JC_STR_T * s2 )"
int jc_strtncmp(const JC_STR_T *s1, const JC_STR_T * s2, size_t len )"
int jc_strtcasecmp(const JC_STR_T *s1, const JC_STR_T *s2 )"
int jc_strtncasecmp(const JC_STR_T *s1, const JC_STR_T *s2, size_t len)
JC_STR_Tβ structure for a string with its length prefixed as a 32-bit unsigned integer. Members:len= length,str= string.
π°οΈ Time API π°οΈ
time stuff, but make it libjodycode:
time_t jc_strtoepoch(const char * const datetime)
int jc_nttime_to_unixtime(const FILETIME * const restrict filetime, struct JC_TIMESPEC * const restrict unixtime)
int jc_unixtime_to_nttime(const struct JC_TIMESPEC * const restrict unixtime, FILETIME * const restrict filetime)
struct JC_TIMESPEC
struct JC_UTIMBUF
struct JC_TIMESPECβ libjodycode equivalent tostruct timespecfromtime.h.struct JC_UTIMBUFβ libjodycode equivalent tostruct utimbuffromutime.h.
π·οΈ Version API π·οΈ
version info, because knowing what you're running is self-care:
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 []
int jc_get_kernel_version(void)
jc_get_kernel_versionβ (Linux only) get current Linux kernel version as an integer.
πͺ Windows-specific stat() mode test definitions πͺ
these are the Windows-specific stat() mode test definitions, literally:
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)β is it a Windows compressed file?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 π
Windows Unicode calls, all lined up:
int jc_ffd_to_dirent(JC_DIR **dirp, HANDLE hFind, WIN32_FIND_DATA *ffd)
void jc_set_output_modes(const int out, const int err)
int jc_setup_unicode_terminal(int argc, JC_WCHAR_T **wargv, char ***argv, int * stdout_tty)
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 πͺ
wide equivalence definitions, exactly as the original lists them:
JC_WCHAR_Tβwchar_tfor Windows Unicode,charotherwiseJC_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.hF_OKJC_R_OKβunistd.hR_OKJC_W_OKβunistd.hW_OKJC_X_OKβunistd.hX_OK
π Windows Unicode conversion shortcut definitions π
conversion shortcuts, short and sweet:
M2W(char *a, JC_WCHAR_T *b)β convert stringato wide stringbusingMultiByteToWideChar()W2M(JC_WCHAR_T *a, char *b)β convert wide stringato normal stringbusingWideCharToMultiByte()
π NOTES π
libjodycode is created and maintained by Jody Bruchon <jody@jodybruchon.com> π«Ά
- general information, help, and tech info:
http://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 π
okay legal bestie, here is the whole MIT License, copied exactly because laws do not do vibes-only:
MIT License
Copyright (c) 2014-2026 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.
mwah π β this page is from source/version 4.2.0, dated 2026-10-20. now go slay some shared code, bestie! π«Άβ¨
π¦ where this page comes from
- arch rolling: libjodycode 4.2-1 Β· MIT
- nixpkgs unstable: libjodycode 4.2
- Copyright (C) 2023-2026 by Jody Bruchon <jody@jodybruchon.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms