char *StrLeft(const char * const s, size_t length) { char *h; unsigned l; DBG_ENTER("StrLeft", Suppl_dynstr) if(!s) { eno_set(EINVAL); DBG_RETURN_S( 0) }
/* * Duplicate a portion of a string */ char *StrDupe(const char * const beg, const char * const end) { char *p; size_t len; DBG_ENTER("StrDupe", Suppl_dynstr) DBG_ARGUMENTS( ("begin=%p, end=%p", beg, end) ) if(!beg) { eno_set(EINVAL); DBG_RETURN_S( 0) }
DFN_GLOB *dfnglobinit(const char * const pattern, unsigned flags) { const char *p; DFN_GLOB *g; DBG_ENTER("dfnglobinit", Suppl_dfn) DBG_ARGUMENTS( ("pattern=\"%s\", flags=0x%04x", pattern, flags) ) if(!pattern || !*pattern) { eno_set(EINVAL); DBG_RETURN_P(0) }
char *dfnglobfilename(DFN_GLOB * const g) { struct ffblk *ff; DBG_ENTER("dfnglobfilename", Suppl_dfn) DBG_ARGUMENTS( ("glob=\"%p\"", g) ) if(!g) { eno_set(EINVAL); DBG_RETURN_S(0) }
char *dfnpath(int drive) { char *h; DBG_ENTER("dfnpath", Suppl_dfn) DBG_ARGUMENTS( ("drive=%u ('%c')", drive, drive < 32? '.': drive) ) if(isupper(drive)) drive -= 'A' - 1; else if(islower(drive)) drive -= 'a' - 1; else if((unsigned)drive > 32) { eno_set( ENODEV); DBG_RETURN_S( 0) }
void *eno_malloc(const size_t len) { void *h; DBG_ENTER("eno_malloc", Suppl_error) DBG_ARGUMENTS( ("size=%u", len) ) chkHeap if(0 == (h = malloc(len))) eno_set( ENOMEM); chkHeap DBG_RETURN_P(h) }
word env_findVar(const word segm, const char * const var) { word offset; int len; DBG_ENTER("env_findVar", Suppl_env) DBG_ARGUMENTS( ("env=%u, var=\"%s\"", segm, var) ) chkMem /* for security reason, check if environment is present at all */ if(!segm || !var) { eno_set(EINVAL); DBG_RETURN_U( -1) /* No env --> no var can be found */ }
char *StrQuote(const char * const s, const STR_QUOTES * const quotes) { char *result; char *metachars; const char *p; const char *q; int right, ch; static char buf_l[2] = " "; static char buf_r[2] = " "; DBG_ENTER("StrQuote", Suppl_dynstr) assert(quotes); DBG_ARGUMENTS( ("s=\"%s\"", s) ) if(!s) { eno_set(EINVAL); DBG_RETURN_S(0) }