본문 바로가기

분류 전체보기683

strtoumax uintmax_t strtoumax(const char *nptr, char **endptr, int base) #include #include #include /* * Convert a string to a uintmax_t. * * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ uintmax_t strtoumax(const char *nptr, char **endptr, int base) { const char *s; uintmax_t acc, cutoff; int c; int neg, any, cutlim; /* * See strtoq for comme.. 2016. 7. 9.
tfind void * tfind(const void *vkey, void * const *vrootp, int (*compar)(const void *, const void *)) #include typedef struct node_t { char *key; struct node_t *llink, *rlink; } node; /* find a node, or return 0 */ void * tfind(const void *vkey, void * const *vrootp, int (*compar)(const void *, const void *)) { char *key = (char *)vkey; node **rootp = (node **)vrootp; if (rootp == (struct node_t **)0).. 2016. 7. 9.
tsearch void * tsearch(const void *vkey, void **vrootp, int (*compar)(const void *, const void *)) #include #include typedef struct node_t { char *key; struct node_t *left, *right; } node; /* find or insert datum into search tree */ void * tsearch(const void *vkey, void **vrootp, int (*compar)(const void *, const void *)) { node *q; char *key = (char *)vkey; node **rootp = (node **)vrootp; if (rootp == .. 2016. 7. 9.
system int system(const char *command) #include &ltsys/types.h&gt #include &ltsys/wait.h&gt #include &ltsignal.h&gt #include &ltstdlib.h&gt #include &ltunistd.h&gt #include &ltpaths.h&gt extern char **environ; int system(const char *command) { pid_t pid; sig_t intsave, quitsave; sigset_t mask, omask; int pstat; char *argp[] = {"sh", "-c", NULL, NULL}; if (!command)/* just checking... */ return(1); argp.. 2016. 7. 9.