- commentary typos
This commit is contained in:
parent
c29a0f371a
commit
f251ec6847
@ -103,9 +103,9 @@ static llist_t *configs; /* list of -c usaged and them stat() after parsed */
|
|||||||
static llist_t *Iop; /* list of -I include usaged */
|
static llist_t *Iop; /* list of -I include usaged */
|
||||||
|
|
||||||
static char *pwd; /* current work directory */
|
static char *pwd; /* current work directory */
|
||||||
static size_t replace; /* replace current work derectory to build dir */
|
static size_t replace; /* replace current work directory with build dir */
|
||||||
|
|
||||||
static const char *kp; /* KEY path, argument of -k usaged */
|
static const char *kp; /* KEY path, argument of -k used */
|
||||||
static size_t kp_len;
|
static size_t kp_len;
|
||||||
static struct stat st_kp; /* stat(kp) */
|
static struct stat st_kp; /* stat(kp) */
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ static void c_lex(const char *fname, long fsize)
|
|||||||
int state;
|
int state;
|
||||||
int line;
|
int line;
|
||||||
char *id = id_s;
|
char *id = id_s;
|
||||||
size_t id_len = 0; /* stupid initialize */
|
size_t id_len = 0; /* stupid initialization */
|
||||||
unsigned char *optr, *oend;
|
unsigned char *optr, *oend;
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
@ -328,7 +328,7 @@ static void c_lex(const char *fname, long fsize)
|
|||||||
put_id(c);
|
put_id(c);
|
||||||
getc1();
|
getc1();
|
||||||
}
|
}
|
||||||
/* have str begined with c, readed == strlen key and compared */
|
/* str begins with c, read == strlen key and compared */
|
||||||
if(diu == id_len && !memcmp(id, preproc[diu], diu)) {
|
if(diu == id_len && !memcmp(id, preproc[diu], diu)) {
|
||||||
state = diu + '0';
|
state = diu + '0';
|
||||||
id_len = 0; /* common for save */
|
id_len = 0; /* common for save */
|
||||||
@ -427,7 +427,7 @@ too_long:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* bb_simplify_path special variant for apsolute pathname */
|
/* bb_simplify_path special variant for absolute pathname */
|
||||||
static size_t bb_qa_simplify_path(char *path)
|
static size_t bb_qa_simplify_path(char *path)
|
||||||
{
|
{
|
||||||
char *s, *p;
|
char *s, *p;
|
||||||
@ -477,7 +477,7 @@ static void parse_inc(const char *include, const char *fname)
|
|||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
lo = Iop;
|
lo = Iop;
|
||||||
p = strrchr(fname, '/'); /* fname have absolute pathname */
|
p = strrchr(fname, '/'); /* fname has absolute pathname */
|
||||||
w = (p-fname);
|
w = (p-fname);
|
||||||
/* find from current directory of source file */
|
/* find from current directory of source file */
|
||||||
ap = bb_asprint("%.*s/%s", w, fname, include);
|
ap = bb_asprint("%.*s/%s", w, fname, include);
|
||||||
@ -502,15 +502,14 @@ static void parse_inc(const char *include, const char *fname)
|
|||||||
|
|
||||||
/* find from "-I include" specified directories */
|
/* find from "-I include" specified directories */
|
||||||
free(ap);
|
free(ap);
|
||||||
/* lo->data have absolute pathname */
|
/* lo->data has absolute pathname */
|
||||||
ap = bb_asprint("%s/%s", lo->data, include);
|
ap = bb_asprint("%s/%s", lo->data, include);
|
||||||
lo = lo->link;
|
lo = lo->link;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur = xmalloc(sizeof(bb_key_t));
|
cur = xmalloc(sizeof(bb_key_t));
|
||||||
cur->keyname = ap;
|
cur->keyname = cur->stored_path = ap;
|
||||||
cur->key_sz = key_sz;
|
cur->key_sz = key_sz;
|
||||||
cur->stored_path = ap;
|
|
||||||
cur->value = cur->checked = p_i;
|
cur->value = cur->checked = p_i;
|
||||||
if(p_i == NULL && noiwarning)
|
if(p_i == NULL && noiwarning)
|
||||||
fprintf(stderr, "%s: Warning: #include \"%s\" not found\n", fname, include);
|
fprintf(stderr, "%s: Warning: #include \"%s\" not found\n", fname, include);
|
||||||
@ -529,7 +528,7 @@ static void parse_conf_opt(const char *opt, const char *val, size_t key_sz)
|
|||||||
|
|
||||||
cur = check_key(key_top, opt, key_sz);
|
cur = check_key(key_top, opt, key_sz);
|
||||||
if(cur != NULL) {
|
if(cur != NULL) {
|
||||||
/* present already */
|
/* already present */
|
||||||
cur->checked = NULL; /* store only */
|
cur->checked = NULL; /* store only */
|
||||||
if(cur->value == NULL && val == NULL)
|
if(cur->value == NULL && val == NULL)
|
||||||
return;
|
return;
|
||||||
@ -569,7 +568,7 @@ static void parse_conf_opt(const char *opt, const char *val, size_t key_sz)
|
|||||||
first_chars[(int)*k] = *k;
|
first_chars[(int)*k] = *k;
|
||||||
|
|
||||||
cur->stored_path = k = bb_asprint("%s/%s.h", kp, k);
|
cur->stored_path = k = bb_asprint("%s/%s.h", kp, k);
|
||||||
/* key converting [A-Z_] -> [a-z/] */
|
/* key conversion [A-Z_] -> [a-z/] */
|
||||||
for(p = k + kp_len + 1; *p; p++) {
|
for(p = k + kp_len + 1; *p; p++) {
|
||||||
if(*p >= 'A' && *p <= 'Z')
|
if(*p >= 'A' && *p <= 'Z')
|
||||||
*p = *p - 'A' + 'a';
|
*p = *p - 'A' + 'a';
|
||||||
@ -605,7 +604,7 @@ static void store_keys(void)
|
|||||||
}
|
}
|
||||||
/* size_t -> ssize_t :( */
|
/* size_t -> ssize_t :( */
|
||||||
rw_ret = (ssize_t)recordsz;
|
rw_ret = (ssize_t)recordsz;
|
||||||
/* check kp/key.h, compare after previous usage */
|
/* check kp/key.h, compare after previous use */
|
||||||
cmp_ok = 0;
|
cmp_ok = 0;
|
||||||
k = cur->stored_path;
|
k = cur->stored_path;
|
||||||
if(stat(k, &st)) {
|
if(stat(k, &st)) {
|
||||||
@ -741,7 +740,7 @@ parse_chd(const char *fe, const char *p, size_t dirlen)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* from libbb but inline for fast */
|
/* from libbb but inlined for speed considerations */
|
||||||
static inline llist_t *llist_add_to(llist_t *old_head, char *new_item)
|
static inline llist_t *llist_add_to(llist_t *old_head, char *new_item)
|
||||||
{
|
{
|
||||||
llist_t *new_head;
|
llist_t *new_head;
|
||||||
@ -764,7 +763,7 @@ static void scan_dir_find_ch_files(const char *p)
|
|||||||
|
|
||||||
dirs = llist_add_to(NULL, bb_simplify_path(p));
|
dirs = llist_add_to(NULL, bb_simplify_path(p));
|
||||||
replace = strlen(dirs->data);
|
replace = strlen(dirs->data);
|
||||||
/* emulate recursive */
|
/* emulate recursion */
|
||||||
while(dirs) {
|
while(dirs) {
|
||||||
d_add = NULL;
|
d_add = NULL;
|
||||||
while(dirs) {
|
while(dirs) {
|
||||||
@ -804,7 +803,7 @@ int main(int argc, char **argv)
|
|||||||
llist_t *fl;
|
llist_t *fl;
|
||||||
|
|
||||||
{
|
{
|
||||||
/* for bb_simplify_path, this program have not chdir() */
|
/* for bb_simplify_path, this program has no chdir() */
|
||||||
/* libbb-like my xgetcwd() */
|
/* libbb-like my xgetcwd() */
|
||||||
unsigned path_max = 512;
|
unsigned path_max = 512;
|
||||||
|
|
||||||
@ -864,7 +863,7 @@ int main(int argc, char **argv)
|
|||||||
for(i = 0; i < UCHAR_MAX; i++) {
|
for(i = 0; i < UCHAR_MAX; i++) {
|
||||||
if(ISALNUM(i))
|
if(ISALNUM(i))
|
||||||
isalnums[i] = i;
|
isalnums[i] = i;
|
||||||
/* set unparsed chars for speed up of parser */
|
/* set unparsed chars to speed up the parser */
|
||||||
else if(i != CHR && i != STR && i != POUND && i != REM)
|
else if(i != CHR && i != STR && i != POUND && i != REM)
|
||||||
first_chars[i] = ANY;
|
first_chars[i] = ANY;
|
||||||
}
|
}
|
||||||
@ -924,7 +923,6 @@ static char *bb_asprint(const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* partial libbb routine as is */
|
/* partial libbb routine as is */
|
||||||
|
|
||||||
static char *bb_simplify_path(const char *path)
|
static char *bb_simplify_path(const char *path)
|
||||||
{
|
{
|
||||||
char *s, *start, *p;
|
char *s, *start, *p;
|
||||||
@ -932,7 +930,7 @@ static char *bb_simplify_path(const char *path)
|
|||||||
if (path[0] == '/')
|
if (path[0] == '/')
|
||||||
start = bb_xstrdup(path);
|
start = bb_xstrdup(path);
|
||||||
else {
|
else {
|
||||||
/* is not libbb, but this program have not chdir() */
|
/* is not libbb, but this program has no chdir() */
|
||||||
start = bb_asprint("%s/%s", pwd, path);
|
start = bb_asprint("%s/%s", pwd, path);
|
||||||
}
|
}
|
||||||
p = s = start;
|
p = s = start;
|
||||||
|
Loading…
Reference in New Issue
Block a user