home *** CD-ROM | disk | FTP | other *** search
- #ifndef ORI_ADD_LIB_READ
- # define ORI_ADD_LIB_READ
- # include <stdio.h>
- # include <unistd.h>
- # include <h/os.h>
- # include <lib/ori_bool.h>
- /*{{{}}}*/
- /*{{{ string stuff*/
- # ifdef UNSIGNED_FUNC
- unsigned char *ustrcpy(unsigned char*,const unsigned char*);
- unsigned char *ustrcat(unsigned char*,const unsigned char*);
- unsigned char *ustrstr(const unsigned char*,const unsigned char*);
- int ustrcmp(const unsigned char*,const unsigned char*);
- size_t ustrlen(const unsigned char*);
- # else
- # define ustrcpy ((unsigned char *(*)(unsigned char*,const unsigned char*))strcpy)
- # define ustrcat ((unsigned char *(*)(unsigned char*,const unsigned char*))strcat)
- # define ustrstr ((unsigned char *(*)(const unsigned char*,const unsigned char*))strstr)
- # define ustrcmp ((int (*)(const unsigned char*,const unsigned char*))strcmp)
- # define ustrlen ((size_t (*)(const unsigned char*))strlen)
- # endif
- /*}}} */
- /*{{{ stdio stuff*/
- /*{{{ constants, can be defined outside too!*/
- /*{{{ HOME_CHAR*/
- # ifndef HOME_CHAR
- # define HOME_CHAR '~'
- # endif
- /*}}} */
- /*{{{ path data*/
- # ifndef PATH_SEP
- # define PATH_SEP "/"
- # define PATH_C '/'
- # endif
- # ifndef LIST_SEP
- # define LIST_SEP ":"
- # define LIST_C ':'
- # define LIST_C_1 '\001'
- # endif
- # ifndef CURR_DIR
- # define CURR_DIR "."
- # endif
- # ifndef PREV_DIR
- # define PREV_DIR ".."
- # endif
- /*}}} */
- /*{{{ root test*/
- # ifndef IS_ROOT
- # define IS_ROOT(s) ((s)[0]=='/')
- # endif
- /*}}} */
- /*{{{ OS_NULL_DEVICE*/
- # ifndef OS_NULL_DEVICE
- # define OS_NULL_DEVICE "/dev/null"
- # endif
- /*}}} */
- /*{{{ CHMOD_PRIVATE*/
- # ifndef CHMOD_PRIVATE
- # define CHMOD_PRIVATE(f) chmod(f,0600)
- # endif
- /*}}} */
- /*{{{ OS_READPERM*/
- # ifndef OS_READPERM
- # define OS_READPERM(fn,bp) 0
- # endif
- /*}}} */
- /*}}} */
- /*{{{ functions*/
- extern unsigned char *dir_name(unsigned char*const,unsigned char const*);
- extern unsigned char *join_fd(unsigned char*const,unsigned char const*const);
- extern boolean is_file(FILE*const,char const*const);
- # define is_dir(f,s) (!is_file(f,s))
- /*}}} */
- /*}}} */
- /*{{{ pwent-stuff*/
- extern char *home_expand(char*const);
- extern void start_getpwent(void);
- extern char const *next_getpwent(void);
- extern void end_getpwent(void);
- /*}}} */
- /*{{{ origami project malloc*/
- # include <stdlib.h>
- # ifdef MALLOC_PAKET
- # define ORImalloc(x) malloc(MALLOC_PAKET(x))
- # define ORIrealloc(p,x) realloc(p,MALLOC_PAKET(x))
- # define ORIfree(p) free(p)
- # else
- # define ORImalloc(x) malloc(x)
- # define ORIrealloc(p,x) realloc(p,x)
- # define ORIfree(p) free(p)
- # endif
- /*}}} */
- /*{{{ ori_assert*/
- # ifdef ASSERT
- # define ori_assert(check,com) \
- ((check)\
- ?0\
- :(fprintf(stderr,"assertation failed (%s) in %s %d\n",com,__FILE__,__LINE__),\
- abort(),\
- 0\
- )\
- )
- # else
- # define ori_assert(check,str)
- # endif
- /*}}} */
- #endif
-