repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
frankjas/libjr
libjr/misc/cmpstrqs.c
#include "ezport.h" #include <string.h> #include "jr/string.h" jr_int jr_strpcmp(void_arg_1,void_arg_2) const void * void_arg_1; const void * void_arg_2; { char ** sa1 = (void *) void_arg_1 ; char ** sa2 = (void *) void_arg_2 ; return(strcmp(*sa1,*sa2)) ; } jr_int jr_stricmp(void_arg_1, void_arg_...
frankjas/libjr
libjr/missing/memset.c
<gh_stars>0 #define _POSIX_SOURCE 1 #include "ezport.h" #include <string.h> /* * This routine conforms to the ANSI standard * description for 'memset(dest,value,nbytes)' * used for setting arbitrary byte streams to * a single value (usually zero). * We provide the source because * some C environments are not pro...
frankjas/libjr
libjr/avl_tree/avl_trav.c
#define AVL_TRAV_SRC #include "project.h" void jr_AVL_TreeTraverseInOrder(avl_tree, printfn, data_arg) jr_AVL_Tree * avl_tree; void (*printfn)() ; void * data_arg; { jr_AVL_TreeTraverseElementInOrder (avl_tree, jr_AVL_TreeRootPtr (avl_tree), printfn, data_arg); } void jr_AVL_TreeTraverseElementInOrder(...
frankjas/libjr
libjr/missing/xdr_float.c
<reponame>frankjas/libjr /* $NetBSD: xdr_float.c,v 1.9 1995/06/05 11:48:26 pk Exp $ */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or mo...
frankjas/libjr
libjr/misc/cmpfilnm.c
#include "ezport.h" #include <string.h> #include "jr/string.h" jr_int jr_trailing_filename_pcmp(sa1,sa2) char ** sa1 ; char ** sa2 ; { char * trailing1 = strrchr(*sa1, '/') ; char * trailing2 = strrchr(*sa2, '/') ; if (trailing1 == 0) trailing1 = *sa1 ; else trailing1++ ; if (trailing2 == 0) trailing2 ...
frankjas/libjr
libjr/missing/setvbuf.c
#define _POSIX_SOURCE 1 #include "ezport.h" #ifdef missing_setvbuf_objects #include <stdio.h> #include <errno.h> #ifndef _IOFBF # define _IOFBF 0 #endif extern void setlinebuf PROTO ((FILE *stream)); extern void setbuffer PROTO ((FILE *stream, char *buf, int size)); int setvbuf (stream, buf, mode, size) FILE *...
frankjas/libjr
include/jr/intset.h
#ifndef _intseth #define _intseth #include "ezport.h" typedef struct { jr_int *array; jr_int next_index; jr_int max_size; } jr_IntSet; extern jr_IntSet *jr_IntSetCreate PROTO((void)) ; extern void jr_IntSetInit PROTO((jr_IntSet *iset)) ; extern jr_IntSet *jr_IntSetCreateFromIntStr PROTO((jr_int *ia)) ; e...
frankjas/libjr
libjr/misc/cmpmisc.c
<filename>libjr/misc/cmpmisc.c #include "ezport.h" #include <string.h> #include <ctype.h> #include "jr/misc.h" jr_int jr_rev_strcmp (s, t) const char *s, *t; { return (- strcmp (s, t)); } jr_int jr_opt_strcmp (str1, str2) const char * str1; const char * str2; { if (str1 == 0 && str2 == 0) return 0; if (str1...
frankjas/libjr
libjr/alist/alistfnd.c
#include "project.h" void *jr_AListFindElementPtr (list, el_ptr, cmpfn) jr_AList * list; const void * el_ptr; jr_int (*cmpfn)(); { jr_int diff; jr_int mid_index; jr_int low_index; jr_int high_index; low_index = 0; high_index = jr_AListSize (list); while (low_index != high_index) { mi...
frankjas/libjr
include/jr/strtab.h
<filename>include/jr/strtab.h #ifndef __jr_strtab_h___ #define __jr_strtab_h___ #include "ezport.h" #include "jr/htable.h" typedef struct { jr_HTable string_table [1]; } jr_StringTableType; /* ** 11/3/05: Benefit of adding suffix "Type", can grep for all occurences ** of variable declarations more easily. */ ...
frankjas/libjr
libjr/syscalls/tmpdir.c
#define _POSIX_SOURCE 1 #include "ezport.h" #ifdef ostype_winnt # include <windows.h> # include <stdlib.h> #endif #include <stdio.h> #include <string.h> #include "jr/error.h" # ifdef ostype_winnt jr_int jr_GetTempDir (tmp_dir_buf, tmp_dir_buf_length, error_buf) char * tmp_dir_buf; jr_int tmp_dir_buf_length; ...
frankjas/libjr
include/jr/avl_tree.h
#ifndef __AVL_HEADER__ #define __AVL_HEADER__ #include "ezport.h" #include <stdio.h> #include <stdarg.h> typedef struct { void * root_node; jr_int element_size; jr_int (*cmpfn) (); void * cmpfn_arg; jr_int prefix_size; unsigned allocates_elements : 1; unsigned maintains_size : 1; } jr_AVL_Tree; ...
frankjas/libjr
libjr/jr_malloc/jr_exit.c
#include "ezport.h" #include <stdio.h> #include <stdlib.h> #include "jr/malloc.h" #include "jr/error.h" #include "jr/trace.h" #include "jr/apr.h" const char * jr_ProgramName = 0; /* ** 5-17-2011 Note: referencing jr_ProgramName links in the APR */ void jr_exit (exit_status) jr_int exit_status; { jr_int status; ...
frankjas/libjr
libjr/syscalls/jr_chown.c
<reponame>frankjas/libjr<gh_stars>0 #include "ezport.h" #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <pwd.h> #include <grp.h> #include "jr/syscalls.h" #include "jr/error.h" jr_int jr_FileNameSetOwner ( const char * path, const char * owner_nam...
frankjas/libjr
libjr/misc/crcsum.c
#include "ezport.h" #include "jr/misc.h" /* An array useful for CRC calculations that use 0x1021 as the "seed" */ /* taken originally from the "mcvert" program */ unsigned short jr_MacBinarySeedArrayCRC[] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc1...
frankjas/libjr
libjr/symtab/project.h
#ifndef _stable_localh #define _stable_localh #define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include <string.h> #include <assert.h> #include "jr/malloc.h" #include "jr/misc.h" #include "jr/string.h" #include "jr/symtab.h" /******** jr_ST_TypeStructs, jr_ST_Symbols, and jr_ST_Identifiers ********/...
frankjas/libjr
libjr/syscalls/jr_chmod.c
<reponame>frankjas/libjr<gh_stars>0 #include "ezport.h" #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <string.h> #include "jr/syscalls.h" #include "jr/error.h" jr_int jr_FileNameSetPerms ( const char * path, jr_int perm_flags, char * error_buf) { jr_int status; status = c...
frankjas/libjr
libjr/misc/heapbase.c
#include "ezport.h" #ifdef ostype_winnt #include <malloc.h> #endif #include "jr/misc.h" /* ** 6-8-2011: Used by jr_malloc() diagnostics to compare pointers ** from different runs of a program. */ #ifdef ostype_winnt void *jr_heap_base() { return (void *) _get_heap_handle(); } #else void *jr_heap_base() { retu...
frankjas/libjr
include/jr/time.h
#ifndef _timeh #define _timeh #include "ezport.h" #include "jr/long.h" /* ** 7/31/06: Provide a portable time interface ** Define a jr_time_t to be an integer type of some kind, i.e. can be passed by value, ** compared to other integer types. */ typedef jr_int jr_seconds_t; /* 2/20/07: seconds since 1/1/70 */ t...
frankjas/libjr
libjr/missing/sigprocmask.c
<filename>libjr/missing/sigprocmask.c<gh_stars>0 #define _POSIX_SOURCE 1 #include "ezport.h" #ifdef missing_sigaction_objects #include <stdio.h> #include <errno.h> #include <sys/types.h> #include <unistd.h> #include <signal.h> int sigprocmask (how, set, oldset) int how ; const sigset_t * set ; sigset_t...
frankjas/libjr
libjr/dlist/dlistdel.c
#include "project.h" void *jr_DListExtractElement (list, el) jr_DList * list; const void * el; { void * next = jr_DListNextElementPtr (list, el); void * prev = jr_DListPrevElementPtr (list, el); if (next) { jr_DListPrevElementPtr (list, next) = prev; } else if (jr_DListTailPtr (list) == el) { jr_DList...
frankjas/libjr
libjr/missing/backtrace.c
<reponame>frankjas/libjr #define _POSIX_SOURCE 1 #include "ezport.h" /* * 3/31/2005: This is untested code. It doesn't work on ppc */ #if defined (missing_backtrace) && !defined (cpu_ppc) /* * 3/31/2005: the power pc has a non-standard stack. It grows larger * and doesn't contain the return address. */ int ...
frankjas/libjr
libjr/missing/sigset.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <signal.h> #include <errno.h> #ifdef missing_sigset_objects int sigaddset(set, signo) sigset_t * set ; int signo ; { int mask = sigmask(signo) ; if ((signo <= 0) || (signo > 31)) { errno = EINVAL ; return(-1) ; } *set |= mask ; return(0) ...
frankjas/libjr
libjr/syscalls/critical.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <string.h> #include <signal.h> #include "jr/syscalls.h" # ifndef ostype_winnt void jr_critical_section (how, opt_void_old_mask_ptr) char * how; void * opt_void_old_mask_ptr; { sigset_t * old_mask_ptr = opt_void_old_mask_ptr; sigset_t new_mask; si...
frankjas/libjr
libjr/misc/esis_lib.c
<filename>libjr/misc/esis_lib.c #include "esis_prj.h" char *jr_ESIS_ReadWordWithIsLast (rfp, char_list, is_last_ptr) FILE * rfp; jr_AList * char_list; jr_int * is_last_ptr; { jr_int c; jr_AListEmpty (char_list); while ((c = jr_ESIS_getc (rfp)) != EOF) { if (c == '\n' || c == ' ') { ...
frankjas/libjr
libjr/alist/alist.c
#include "project.h" jr_AList *jr_AListCreate (objsize) jr_int objsize ; { jr_AList *list = (jr_AList *) jr_malloc (sizeof (jr_AList)); jr_AListInit (list, objsize); return (list); } void jr_AListInit (list, objsize) jr_AList * list; jr_int objsize; { list->buffer = 0; list->buffer_capacity = 0; ...
frankjas/libjr
include/jr/login.h
<gh_stars>0 #ifndef __JR_LOGIN_H__ #define __JR_LOGIN_H__ #include "ezport.h" typedef struct { jr_int total_number_of_users ; /* total number of user's logged in */ jr_int number_of_logins ; /* number of times this user was logged in on different ttys */ char * user_name ; /* a jr_strduped string copied from...
frankjas/libjr
include/jr/ezport/ansi.h
#ifndef __EZPORT_ANSI_H__ #define __EZPORT_ANSI_H__ /* * The ANSI standard specifies that there should be a #define for * the constant __STDC__ if you are using an ANSI compiler. * * 3/9/07: some compilers don't define __STDC__ even if the support * ANSI constructs when they also add other non-ANSI constructs. *...
frankjas/libjr
libjr/syscalls/move.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <errno.h> #include <string.h> #include <unistd.h> #include "jr/syscalls.h" #include "jr/error.h" #include "jr/string.h" #include "jr/malloc.h" jr_int jr_MoveFileName (old_file_path, new_file_path, error_buf) const char * old_file_path; const char * new_file_pat...
frankjas/libjr
libjr/string/jr_regex.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <stdlib.h> #include <sys/types.h> #include <regex.h> #include "jr/string.h" #include "jr/alist.h" #include "jr/malloc.h" #include "jr/error.h" jr_int jr_RegExMatch ( const char * source_string, const char * pattern_string, jr_int flags, char * ...
frankjas/libjr
libjr/symtab/st_init.c
<gh_stars>0 #include "project.h" jr_ST_SymbolTable *jr_ST_SymbolTableCreate (data_size, field_data_size) jr_int data_size; jr_int field_data_size; { jr_ST_SymbolTable * symbol_table; symbol_table = jr_malloc (sizeof (jr_ST_SymbolTable)); jr_ST_SymbolTableInit (symbol_table, data_size, field_data_size...
frankjas/libjr
libjr/syscalls/jr_mktmp.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <string.h> #include <stdlib.h> #include "jr/misc.h" #include "jr/long.h" #include "jr/error.h" #include "jr/malloc.h" #include "jr/syscalls.h" #include "jr/time.h" void jr_MkTemp (tmp_name_template) char * tmp_name_template; { static int SeedWasSet = 0; ...
frankjas/libjr
include/jr/error.h
#ifndef __jr_error_h___ #define __jr_error_h___ #include "ezport.h" #define jr_INTERNAL_ERROR -1 #define jr_MISUSE_ERROR -2 #define jr_PERMISSION_ERROR -3 #define jr_NOT_FOUND_ERROR -4 #define jr_IS_FOUND_ERROR -5 #define jr_TIME_OUT_ERROR -6 #define jr_NO_ROOM_ERROR ...
frankjas/libjr
libjr/string/vwordsip.c
#include "ezport.h" #include <stdio.h> #include <string.h> #include "jr/malloc.h" #include "jr/misc.h" #include "jr/vector.h" jr_int jr_VectorizeIntoWordsInPlace(str, sep, vector, vector_size) char * str ; const char * sep ; char ** vector ; jr_int vector_size ; { char *begin; jr_int curr_index; fo...
frankjas/libjr
libjr/symtab/st_type.c
<reponame>frankjas/libjr #include "project.h" jr_ST_TypeStruct *jr_ST_TypeCreate (type_kind, base_sym, num_stars, list) jr_int type_kind; jr_ST_Symbol * base_sym; jr_int num_stars; jr_AList * list; { jr_ST_TypeStruct *new_type = jr_malloc (sizeof (jr_ST_TypeStruct)); jr_ST_TypeInit (new_type, type...
frankjas/libjr
libjr/llist/llistmrg.c
<reponame>frankjas/libjr #include "project.h" void jr_LListMergeWithUniqueFlag (list1, list2, cmpfn, unique) jr_LList * list1; jr_LList * list2; jr_int (*cmpfn) (); jr_int unique; { void * prev1; void * curr1; void * curr2; void * new; jr_int comp; prev1 = 0; curr1 = jr_LListHeadPtr (list1); curr2 ...
frankjas/libjr
libjr/syscalls/chkpass.c
<filename>libjr/syscalls/chkpass.c #define _POSIX_SOURCE 1 #include "ezport.h" #include <pwd.h> #include <unistd.h> #include <string.h> #include "jr/syscalls.h" jr_int jr_CheckUnixPassword(username, unencrypted_password_text, pw_entry_arg) char * username ; char * unencrypted_password_text ; void * pw_entry_a...
frankjas/libjr
libjr/syscalls/globvec.c
<reponame>frankjas/libjr #include "ezport.h" #if defined (USG) && !defined (Xenix) # if !defined (USGr3) && ! defined (USGr4) # define USGr3 # endif /* USGr3 */ #endif /* USG && !Xenix */ #include <stdlib.h> #include <sys/types.h> #include <sys/errno.h> #include <errno.h> #include <sys/param.h> #if defined (_POSIX_...
frankjas/libjr
libjr/misc/intstr.c
<filename>libjr/misc/intstr.c #include "ezport.h" #include "jr/misc.h" #include <limits.h> /* Author: <NAME> Creation Date: March 1987 */ jr_int jr_intstrcmp (is1, is2) const jr_int *is1 ; const jr_int *is2; { for (; *is1 != jr_INT_NULL; is1++, is2++) { if (*is2 == jr_INT_NULL) return (1); if (*is1 != *is2)...
frankjas/libjr
libjr/syscalls/exitstr.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <sys/wait.h> #include "jr/syscalls.h" char *jr_ExitStatusToString (status_buf, status) char * status_buf; jr_int status; { if (WIFEXITED(status)) { sprintf(status_buf, "exit status: %d", WEXITSTATUS(status)) ; } if (WIFSTOPPED(status)) { sprintf(status...
frankjas/libjr
libjr/htable/htabldel.c
#include "project.h" void jr_HTableDeleteIndex (htable, delete_index) jr_HTable * htable; jr_int delete_index; { assert (jr_HTableIsValidIndex (htable, delete_index)); /* * do an assert since deleting an invalid index could create * a htable with weird bucket lists which would cause * error symptoms diffi...
frankjas/libjr
libjr/missing/getuid.c
<gh_stars>0 #define _POSIX_SOURCE 1 #include "ezport.h" #ifdef missing_getuid #include <stdio.h> #include <sys/types.h> #include <unistd.h> uid_t getuid() { return(0) ; } #else static void NotCalled () /* define this so ranlib doesn't complain */ { NotCalled (); /* use it so the compiler doesn't complain */ }...
frankjas/libjr
include/jr/math.h
<filename>include/jr/math.h #ifndef _jr_math_h__ #define _jr_math_h__ #include "ezport.h" extern double jr_DegreesToRadians PROTO((double degrees)) ; extern double jr_RadiansToDegrees PROTO((double radians)) ; extern double jr_DegreesToRadians PROTO((double degrees)) ; extern double jr_PointAngleInD...
frankjas/libjr
libjr/jr_malloc/project.h
<filename>libjr/jr_malloc/project.h #ifndef _local_jr_malloc_h #define _local_jr_malloc_h #define _POSIX_C_SOURCE 200809L #include "ezport.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include "jr/error.h" #include "jr/trace.h" #include "jr/htable.h" #include "jr/misc.h" #include...
frankjas/libjr
include/jr/long.h
<reponame>frankjas/libjr<filename>include/jr/long.h #ifndef _long_long_h__ #define _long_long_h__ #include "ezport.h" /* * struct assignment and parameter passing * is allowed by most non-ANSI compilers. * K&R edition 1 even states (pg 209) that * allow forbidden, will probably be allowed * in the future. * *...
frankjas/libjr
libjr/string/ctltoesc.c
#include "ezport.h" #include <stdio.h> #include <string.h> #include "jr/string.h" /* * memmove takes care of overlapping copies */ void jr_CopyControlCharsToEscapedChars(target, bounds_arg, source) char * target ; jr_int bounds_arg ; const char * source ; { const char * escape_string ; jr_int escape_le...
frankjas/libjr
libjr/struct/jr_ulong.c
#include "ezport.h" #include <assert.h> #include <ctype.h> #include <stdio.h> #include "jr/long.h" #include "jr/error.h" #ifdef jr_IS_64_BIT jr_int jr_ULongCmp (long1, long2) jr_ULong long1; jr_ULong long2; { if (long1 > long2) { return (1); } if (long1 < long2) { return (-1); } return (0); } jr_i...
frankjas/libjr
libjr/syscalls/isdir.c
#include "ezport.h" #include "jr/syscalls.h" #include "jr/apr.h" jr_int jr_PathIsDirectory(pathname, error_buf) const char * pathname ; char * error_buf; { struct jr_stat stat_buf[1]; jr_int status; jr_int is_dir; status = jr_stat(pathname, stat_buf, error_buf); if (status != 0) { return status; } ...
frankjas/libjr
libjr/missing/waitpid.c
<reponame>frankjas/libjr #define _POSIX_SOURCE 1 #include "ezport.h" #ifdef missing_waitpid #include <sys/types.h> #include <sys/wait.h> #include <sys/resource.h> extern int wait4 PROTO (( int pid, union wait * statusp, int options, struct rusage * rusage )); pid_t waitpid(pid, st...
frankjas/libjr
libjr/syscalls/pathabs.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <string.h> #include <unistd.h> #include "jr/syscalls.h" #include "jr/string.h" #include "jr/error.h" jr_int jr_FileNameToAbsolutePath(result, result_length, filename) char * result ; jr_int result_length; const char * filename ; { jr_int status; /* *...
frankjas/libjr
include/jr/bufio.h
<reponame>frankjas/libjr<filename>include/jr/bufio.h #ifndef _jr_buf_io_h___ #define _jr_buf_io_h___ #include "ezport.h" #include <stdio.h> #include "jr/alist.h" #include "jr/apr.h" typedef struct jr_buffered_io jr_BufferedIoType; typedef jr_int (jr_BufferedIoRawReadFn) ( void * raw_read_arg, un...
frankjas/libjr
libjr/string/struquot.c
<filename>libjr/string/struquot.c #include "ezport.h" #include <stdio.h> #include <string.h> #include <ctype.h> #include "jr/string.h" void jr_StringUnQuote(str) char *str ; { char *lastchr ; if (*str == '"') { jr_int nbytes = strlen(str+1) + 1 ; memmove(str, str+1, nbytes) ; } lastchr = (char *) strchr(st...
frankjas/libjr
libjr/syscalls/touch.c
<reponame>frankjas/libjr #define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include <sys/types.h> #include <sys/time.h> #include <unistd.h> #include <time.h> #include <errno.h> #include <string.h> #include "jr/syscalls.h" #include "jr/time.h" #include "jr/error.h" jr_seconds_t jr_FileNameModTimeTouch(...
frankjas/libjr
libjr/syscalls/which.c
<filename>libjr/syscalls/which.c #define _POSIX_SOURCE 1 #include "ezport.h" #include <sys/types.h> #include <sys/stat.h> #include <sys/file.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include "jr/malloc.h" #include "jr/vector.h" #include "jr/misc.h" #include "jr/syscalls.h" #...
frankjas/libjr
libjr/io/logfile.h
#ifndef __log_proj_h___ #define __log_proj_h___ #define _POSIX_SOURCE 1 #include "ezport.h" #include <errno.h> #include <string.h> #include "jr/string.h" #include "jr/malloc.h" #include "jr/log.h" #include "jr/io.h" #include "jr/syscalls.h" #include "jr/time.h" #include "jr/error.h" extern jr_int jr_LogEntryInitFr...
frankjas/libjr
libjr/misc/binsrch.c
#include "ezport.h" #include <stdio.h> #include <ctype.h> #include "jr/misc.h" /* * Our convention is that if the search results in a ptr * which is really the non-zero place where the key SHOULD * be inserted even if it isn't there, then the function * should have 'InsertPtr' as part of its name. * * A simple...
frankjas/libjr
libjr/missing/strchr.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <string.h> /* This function is identical to 'index(str,c)' */ #ifdef missing_strchr char *strchr(str, chr) const char *str ; int chr ; { for (; *str; str++) { if (*str == chr) return((char *) str) ; } if (chr == 0) return((char *) str) ; return(0) ; } ...
frankjas/libjr
include/jr/log.h
<reponame>frankjas/libjr #ifndef __jr_log_h___ #define __jr_log_h___ #include "ezport.h" #include <stdio.h> #include "jr/alist.h" #include "jr/nettype.h" #include "jr/log.h" #include "jr/apr.h" typedef struct { char * file_name; jr_file_t file_info[1]; jr_int opened_how; jr_int block_size; jr_U...
frankjas/libjr
libjr/misc/jr_error.c
<filename>libjr/misc/jr_error.c<gh_stars>0 #include "ezport.h" #include <stdio.h> #include <string.h> #include <stdarg.h> #include "jr/trace.h" #include "jr/misc.h" #include "jr/malloc.h" #include "jr/error.h" static jr_int jr_ErrorBufMaxLength = jr_ERROR_LEN; static jr_int jr_ErrorWasSimulated = 0; static co...
frankjas/libjr
libjr/alist/alistdel.c
<gh_stars>0 #include "project.h" void *jr_AListDeletedTailPtr (list) jr_AList *list; { if (jr_AListSize(list) == 0) return (0); list->free_ptr -= list->objsize; list->free_index--; return (list->free_ptr + list->prefix_size); } void jr_AListTruncate (list, i) jr_AList * list; jr_int i; { if (i >= jr_AListS...
frankjas/libjr
libjr/string/sgetline.c
<reponame>frankjas/libjr #include "ezport.h" #include <stdio.h> #include "jr/string.h" char *jr_StringFgets(target, bounds_arg, source) char * target ; jr_int bounds_arg ; const char * source ; { jr_int target_array_bounds ; jr_int i ; if (*source == '\0') return(0) ; target_array_bounds = bounds_arg - ...
frankjas/libjr
libjr/misc/tabstops.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <stdlib.h> #include "jr/misc.h" jr_int jr_EnvTabStops () { char * value_str; jr_int tabstops = 0; value_str = getenv ("TABSTOPS"); if (value_str) { tabstops = atoi (value_str); } if (tabstops == 0) { tabstops = 8; } return tabstops; }
frankjas/libjr
include/jr/ezport/replace.h
<reponame>frankjas/libjr<gh_stars>0 #ifndef __EZPORT_REPLACE_H__ #define __EZPORT_REPLACE_H__ #ifdef replace_buggy_inet_ntoa # define inet_ntoa(in_addr) jr_inet_ntoa(in_addr) extern char *jr_inet_ntoa PROTO ((struct in_addr sin_addr)); #endif #ifdef replace_buggy_getenv # define getenv(name) jr_system_getenv (n...
frankjas/libjr
libjr/io/prn_data.c
<gh_stars>0 #include "ezport.h" #include <ctype.h> #include "jr/io.h" void jr_PrintArbitraryData (wfp, void_ptr, data_length, max_width) FILE * wfp; const void * void_ptr; jr_int data_length; jr_int max_width; { const char * data_ptr = void_ptr; jr_int truncated_data; jr_int non_printing_data; j...
frankjas/libjr
libjr/llist/llistcpy.c
#include "project.h" jr_LList *jr_LListCopy (dest, src) jr_LList *dest; jr_LList *src; { void *obj; jr_LListInit (dest, src->objsize); jr_LListSetPrefixSize (dest, jr_LListPrefixSize (src)); jr_LListForEachElementPtr (src, obj) { jr_LListSetNewTail(dest, obj); } return (dest); }
frankjas/libjr
libjr/dlist/dlistadd.c
#include "project.h" void *jr_DListInsertElement (list, next_const_ptr, new_const_ptr) jr_DList * list ; const void * next_const_ptr ; const void * new_const_ptr ; { void * next = (void *) next_const_ptr; void * new = (void *) new_const_ptr; void * prev; jr_DListNextElementPtr (list, new) = next; ...
frankjas/libjr
libjr/avl_tree/avl_pfx.c
#include "project.h" void jr_AVL_TreeSetContainers ( jr_AVL_Tree * avl_tree, ...) { va_list arg_list; va_start (arg_list, avl_tree); jr_AVL_TreeSetContainersFromVA_List (avl_tree, arg_list); va_end (arg_list); } void jr_AVL_TreeSetContainersFromVA_List (avl_tree, arg_list) jr_AVL_Tree * avl_tree; v...
frankjas/libjr
libjr/alist/alistadd.c
#include "project.h" void *jr_AListNewTailPtr (list) jr_AList *list; { if (jr_AListSize(list) == list->buffer_capacity) { jr_AListIncreaseCapacity (list, jr_AListSize(list) + 1); } list->free_ptr += list->objsize; list->free_index++; return (list->free_ptr - list->objsize + list->prefix_size); } void *jr_...
frankjas/libjr
libjr/string/ttyname.c
<reponame>frankjas/libjr<gh_stars>0 #include "ezport.h" #include <string.h> #include "jr/string.h" char *jr_TTY_LettersFromDeviceName(dev_name) char * dev_name ; { char *tty_string ; char *tty_letters ; if (tty_string = strstr(dev_name, "ttydf")) { tty_letters = tty_string + 5 ; } else if (tty_string = strst...
frankjas/libjr
libjr/string/lcase.c
<reponame>frankjas/libjr #include "ezport.h" #include "jr/string.h" void jr_ConvertToUpperCase(string) char *string ; { for (; *string ; string++) { *string = jr_toupper(*string) ; } } void jr_ConvertToLowerCase (string) char *string ; { for (; *string ; string++) { *string = jr_tolower(*string) ; } } voi...
frankjas/libjr
libjr/jr_malloc/jr_malloc.c
<reponame>frankjas/libjr<filename>libjr/jr_malloc/jr_malloc.c #include "project.h" static jr_MallocStatStruct jr_MallocStatInfo [1]; static jr_MallocDiagStruct jr_MallocDiagInfo [1]; static jr_int jr_MallocClearOnFree = 1 ; static unsigned jr_int jr_MallocMaxRequestSize = jr_MALLOC_DEFAULT_MAX_REQUEST; ...
frankjas/libjr
include/jr/esis/lib.h
<reponame>frankjas/libjr #ifndef __esis_lib_h___ #define __esis_lib_h___ #include "ezport.h" #include <stdio.h> #include "jr/alist.h" #include "jr/llist.h" #include "jr/htable.h" #include "jr/attribut.h" #define jr_ESIS_ILLEGAL_INPUT_ERROR -1; #define jr_ESIS_NOT_IMPLEMENTED_ERROR -2; #define jr_ESIS_NOT_CON...
frankjas/libjr
libjr/io/mailtime.c
#include "mailproj.h" #include <setjmp.h> #include <signal.h> static sigjmp_buf JumpBuffer ; static void local_alarm_handler(signum) int signum ; { siglongjmp (JumpBuffer , 17) ; } jr_int jr_MailServerValidateWithTimeOut ( smtp_server_name, opt_sender_address, time_out_seconds, error_buf ) const ...
frankjas/libjr
libjr/string/pathtail.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <string.h> #include "jr/string.h" const char *jr_PathTail (file_path) const char * file_path; { const char * path_tail; path_tail = strrchr (file_path, '/'); if (path_tail) { path_tail ++; } else { path_tail = file_path; } return path_tail; } ...
frankjas/libjr
libjr/io/paragrph.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #ifndef missing_regex_h # include <regex.h> #endif #include "jr/inputbuf.h" #include "jr/string.h" #include "jr/trace.h" #include "jr/paragrph.h" #include "jr/malloc.h" char * jr_ParagraphReadNewString(paragraph...
frankjas/libjr
libjr/jr_malloc/memdup.c
#include "ezport.h" #include <string.h> #include "jr/malloc.h" void * jr_memdup (p, n) const void * p; size_t n; { void * np ; np = (void *) jr_malloc (n); memcpy(np, p, n) ; return(np) ; }
frankjas/libjr
libjr/misc/shortstr.c
#include "ezport.h" #include <limits.h> #include "jr/misc.h" /* Author: <NAME> Creation Date: March 1987 */ jr_int jr_shortstrcmp (is1, is2) const short *is1 ; const short *is2; { for (; *is1 != jr_SHRT_NULL; is1++, is2++) { if (*is2 == jr_SHRT_NULL) return (1); if (*is1 != *is2) return (*is1 - *is2); } ...
frankjas/libjr
libjr/syscalls/jr_stat.c
#include "jr_apr.h" void jr_stat_init ( jr_stat_t * jr_stat_ptr) { memset (jr_stat_ptr, 0, sizeof (*jr_stat_ptr)); } void jr_stat_asgn_apr_finfo ( jr_stat_t * jr_stat_ptr, const apr_finfo_t * apr_finfo_ptr) { jr_stat_init (jr_stat_ptr); if (sizeof (apr_finfo_ptr->size) <= sizeof (jr_int)) { jr_ULo...
frankjas/libjr
libjr/misc/hashstr.c
<reponame>frankjas/libjr #include "jr/misc.h" #include <limits.h> #include <ctype.h> #include <string.h> jr_int jr_strhash_old (void_arg_1) const void * void_arg_1; { const char * str = void_arg_1; size_t length = strlen (str); unsigned jr_int hash_value = 0; jr_int i; for (i=0; str[i]; i++) { has...
frankjas/libjr
libjr/syscalls/jr_unlink.c
#include "ezport.h" #include <apr-1/apr_pools.h> #include <apr-1/apr_file_io.h> #include "jr/syscalls.h" #include "jr/apr.h" #include "jr/error.h" jr_int jr_Unlink ( const char * file_path, char * error_buf) { apr_pool_t * apr_pool_ptr; jr_int status; jr_apr_initialize(); apr_pool_create (&apr_po...
frankjas/libjr
libjr/replace/getenv.c
#define _POSIX_SOURCE 1 #include "ezport.h" #ifdef replace_buggy_getenv #include <stdlib.h> #include <string.h> #undef getenv extern char **environ; char *jr_system_getenv (search_str) const char * search_str ; { char ** vp ; char * ptr_to_lhs ; char * ptr_to_equal_sign ; int search_length ; int le...
frankjas/libjr
libjr/struct/bitset.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include <string.h> #include "jr/bitset.h" #include "jr/misc.h" #include "jr/malloc.h" void jr_BitSetInit (bset, num_bits) jr_BitSet * bset; jr_int num_bits; { memset (bset, 0, sizeof (*bset)); if (num_bits > 0) { jr_BitSetChangeNumBits (bset...
frankjas/libjr
libjr/alist/alistpfx.c
<gh_stars>0 #include "project.h" void jr_AListSetContainers (jr_AList *list, ...) { va_list arg_list; va_start (arg_list, list); jr_AListSetContainersFromVA_List (list, arg_list); va_end (arg_list); } void jr_AListSetContainersFromVA_List (list, arg_list) jr_AList * list; va_list arg_list; { jr_...
frankjas/libjr
libjr/jr_malloc/jr_strdup.c
#include "ezport.h" #include <string.h> #include "jr/misc.h" #include "jr/malloc.h" char * jr_strdup(str) const char * str ; { char * result = jr_malloc (strlen(str) + 1) ; strcpy(result, str) ; return(result) ; } char * jr_strndup(str, max_length) const char * str ; size_t max_length; { size_t str...
frankjas/libjr
libjr/string/ccnt.c
<reponame>frankjas/libjr #include "ezport.h" #include "jr/string.h" jr_int jr_CountAllOfChar (search_string, char_val_counted) const char * search_string ; jr_int char_val_counted; { jr_int retval=0 ; for (;*search_string; search_string++) { if (*search_string == char_val_counted) retval++ ; } return(ret...
frankjas/libjr
libjr/syscalls/jr_popen.c
#include "ezport.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include "jr/syscalls.h" #include "jr/error.h" FILE *jr_popen ( const char * command_str, const char * mode_str, char * error_buf) { FILE * fp; fp = popen (command_str, mode_str); if (fp == 0) { j...
frankjas/libjr
libjr/jr_malloc/mempre.c
#include "jr/malloc.h" jr_int jr_MallocRecordPtrsOnly = jr_MALLOC_BEGIN_CPP_INIT_VALUE;
frankjas/libjr
libjr/misc/pfx_init.c
#include "pfx_proj.h" jr_PrefixInfoType jr_PrefixInfoArray [jr_PREFIX_MAX_TYPES]; jr_int jr_PrefixNumTypes = 0; static jr_mutex_t jr_PrefixMutex[1]; jr_thread_once_declare_and_init (ThreadOnceControl); void jr_PrefixMutexInit () { jr_mutex_init (jr_PrefixMutex, 0); } void jr_PrefixAddContainerType ( ...
frankjas/libjr
include/jr/ezport/microsoft.h
#ifndef __JR_EZPORT_MICROSOFT_H___ #define __JR_EZPORT_MICROSOFT_H___ /* ** GNU/ANSI Fixes */ #ifndef __attribute__ # define __attribute__(arg) #endif #ifdef needs_winnt_snprintf #ifndef snprintf # define snprintf _snprintf #endif #endif #ifdef needs_winnt_vsnprintf #ifndef vsnprintf # define vsnprintf _vsnpri...
frankjas/libjr
libjr/struct/bitsetpn.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include "jr/bitset.h" void jr_BitSetPrint (bset, wfp) jr_BitSet * bset; FILE * wfp; { register jr_int num_ints = bset->num_bits >> jr_INT_BIT_SIZE_POWER; jr_int i; if (bset->num_bits & jr_INT_BIT_SIZE_MASK) { /* If n is not a multiple of...
frankjas/libjr
libjr/syscalls/safecopy.c
<reponame>frankjas/libjr<filename>libjr/syscalls/safecopy.c #define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include <signal.h> #include <errno.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include "jr/io.h" #include "jr/syscalls.h" #include "jr/error.h" #include "jr/malloc.h" #inclu...
frankjas/libjr
libjr/dlist/dlistcmp.c
#include "project.h" void *jr_DListFindElementPtr (list, obj, cmpfn) jr_DList * list; void * obj; jr_int (*cmpfn) (); { char * current; jr_DListForEachElementPtr (list, current) { if ((*cmpfn) (obj, current) == 0) return (current); } return (0); } jr_int jr_DListCmp (list1, list2, cmpfn) jr_DList ...
frankjas/libjr
libjr/misc/memswtch.c
<gh_stars>0 #include "ezport.h" #include "jr/misc.h" void jr_memswitch (vp1, vp2, nbytes) void * vp1; void * vp2; jr_int nbytes; { char * p1 = vp1; char * p2 = vp2; jr_int i; jr_int c; for (i=0; i < nbytes; i++, p1++, p2++) { c = *p1; *p1 = *p2; *p2 = c; } } jr_int jr_memisset (vp1, value, ...
frankjas/libjr
libjr/string/url_str.c
<reponame>frankjas/libjr #define _POSIX_SOURCE 1 #include "ezport.h" #include <ctype.h> #include "jr/string.h" #include "jr/alist.h" char *jr_StringEncodeForURL (input_string) const char * input_string; { jr_AList result_chars[1]; char small_buf[16]; char * encoded_string; jr_int curr_c...
frankjas/libjr
libjr/syscalls/modtime.c
#define _POSIX_SOURCE 1 #include "ezport.h" #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include "jr/syscalls.h" time_t jr_FilePtrModifiedTime(fp) FILE *fp ; { struct stat buf ; jr_int fd = fileno(fp) ; if (fstat(fd,&buf) != 0) { return(0) ; } return(buf.st_mtime) ; } time_t jr_FileDes...
frankjas/libjr
libjr/misc/freeref.c
#include "ezport.h" #include "jr/misc.h" #include "jr/malloc.h" void jr_freeref(sa) char ** sa ; { jr_free(*sa) ; }
frankjas/libjr
libjr/misc/tracevar.c
<gh_stars>0 #define is_libjr_build #include "jr/trace.h" jr_trace_t jr_TraceValues[jr_TRACE_NUM_VALUES];
frankjas/libjr
libjr/io/maillib.c
#include "mailproj.h" jr_int jr_MailStringMessage ( smtp_server_name, sender_address, recipient_address, opt_header_vector, message_string, error_buf ) char * smtp_server_name; char * sender_address; char * recipient_address; char ** opt_header_vector; char * me...
frankjas/libjr
libjr/missing/setpgid.c
#define _POSIX_SOURCE 1 #include "ezport.h" #ifdef missing_setpgid #include <sys/types.h> #include <unistd.h> #include <sys/ioctl.h> int setpgid(pid, pgrp) pid_t pid ; pid_t pgrp ; { if (pgrp == 0) { pgrp = getpid() ; } if (pid == 0) { pid = getpid() ; } return setpgrp(pid, pgrp) ; } #else static voi...
frankjas/libjr
libjr/syscalls/copyfd.c
<reponame>frankjas/libjr #define _POSIX_SOURCE 1 #include "ezport.h" #include <unistd.h> #include "jr/io.h" jr_int jr_FileDescCopy(wfd, rfd, buf, bufsize) jr_int wfd ; jr_int rfd ; void * buf ; jr_int bufsize ; { ssize_t nbytes ; while (nbytes = read(rfd, buf, bufsize)) { if (...