79 ch = (char) u;
if (!stralloc_append(&key,&ch))
die_nomem(); u >>= 8;
80 ch = (char) u;
if (!stralloc_append(&key,&ch))
die_nomem(); u >>= 8;
81 ch = (char) u;
if (!stralloc_append(&key,&ch))
die_nomem(); u >>= 8;
82 ch = (char) u;
if (!stralloc_append(&key,&ch))
die_nomem();
180 int flagnotexist = 0;
185 unsigned int next, i, j;
187 unsigned int slpos,hashpos,pos;
190 char *oldflags = (
char *) 0;
191 char *
code = (
char *) 0;
192 const char *
cfname = (
char *) 0;
195 keyadd((
unsigned long) getpid());
196 keyadd((
unsigned long) getppid());
197 euid = (
unsigned long) geteuid();
199 keyadd((
unsigned long) getgid());
200 gettimeofday(&
tv,(
struct timezone *) 0);
205 for (pos = 0; pos < (
unsigned int)
NO_FLAGS; pos++) {
208 for (pos = 0; pos < 10;
popt[pos++] = (
char *) 0);
210 while ((
opt = getoptb(argc,(
char **)argv,
211 "+aAbBcC:dDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0:3:4:5:6:7:8:9:")) != opteof) {
212 if (
opt ==
'v' ||
opt ==
'V')
217 if (
opt >=
'a' &&
opt <=
'z') {
219 if (
opt ==
'e') flagforce++;
220 }
else if (
opt >=
'A' &&
opt <=
'Z') {
222 }
else if (
opt >=
'0' &&
opt <=
'9') {
224 }
else if (
opt ==
'+') {
226 flags[
'e' -
'a'] = 3;
233 if (flagforce_p > 1 || flagforce > 1)
238 if (!(
dir = *argv++)) die_usage();
243 if (
flags[
'e' -
'a'] & 1) {
251 buffer_init(&
bi,buffer_unixread,
fdin,textbuf,
sizeof(textbuf));
254 if (getln(&
bi,&line,&
match,
'\n') == -1)
257 if (line.s[0] ==
'#')
continue;
258 if (line.len == 1)
break;
259 if (line.s[1] !=
':')
break;
260 line.s[line.len - 1] =
'\0';
279 case 'F': oldflags =
cmdline.s + pos;
break;
280 default:
if (ch ==
'0' || (ch >=
'3' && ch <=
'9')) {
281 if (usecfg && !
popt[ch -
'0'])
287 pos += str_len(
cmdline.s + pos) + 1;
292 if ((p = *argv++) != 0) {
294 if ((p = *argv++) != 0) {
298 if ((p = *argv++) != 0) {
302 if ((p = *argv++) != 0) {
318 if (usecfg && oldflags &&
flags[
'e' -
'a']) {
319 while ((ch = *(oldflags++))) {
320 if (ch >=
'a' && ch <=
'z') {
322 if (!
flags[ch -
'a'])
330 if (ch >=
'a' && ch <=
'z') {
331 if (!
flags[ch -
'a'])
337 for (pos = 0; pos < (
unsigned int)
NO_FLAGS; pos++) {
349 for (ch = 0; ch <=
'z' -
'a'; ch++) {
358 slpos = str_len(
dot);
359 while ((--slpos > 0) &&
dot[slpos] !=
'/');
360 if (
dot[slpos] ==
'/') {
361 if (!stralloc_copyb(&
template,
dot,slpos + 1))
die_nomem();
362 slpos += str_chr(
dot+slpos,
'-');
365 pos = slpos + str_chr(
dot+slpos,
'-');
369 slpos = pos + str_chr(
dot+pos,
'-');
384 if (!
flags[
'c' -
'a']) {
389 if ((
fdin = open_read(
template.s)) == -1)
397 if ((
fdin = open_read(
template.s)) == -1)
404 if ((
fdin = open_read(
template.s)) == -1)
419 buffer_init(&
bi,buffer_unixread,
fdin,textbuf,
sizeof(textbuf));
423 if (getln(&
bi,&line,&
match,
'\n') == -1)
432 if (getln(&
bi,&line,&
match,
'\n') == -1)
436 if (line.s[0] ==
'#')
439 if (line.s[0] ==
'<' && line.s[1] ==
'/') {
440 if (line.s[str_chr(line.s,
'.')])
445 pos = str_chr(line.s + 2,
'#') + 2;
450 while ((ch = line.s[pos]) &&
451 (line.s[pos] !=
'/' && line.s[pos+1] !=
'>')) {
459 if (ch ==
'E' && !flagnot || (ch ==
'e' && flagnot)) {
460 if (
flags[
'e' -
'a'] && !flagforce)
462 }
else if (ch >=
'a' && ch <=
'z') {
464 }
else if (ch >=
'A' && ch <=
'Z') {
466 }
else if (ch >=
'0' && ch <=
'9') {
473 if (line.s[pos] !=
'/' || line.s[pos+1] !=
'>')
478 while (line.s[pos = str_chr(line.s+pos,
'/')+pos]) {
479 if (line.s[pos+1] ==
'>')
489 if (line.s[2] ==
'+') {
497 }
else if (line.s[2] ==
':') {
499 slpos = str_chr(line.s + 3,
'/') + 3;
509 }
else if (line.s[2] ==
'-') {
549 if (
flagdo && flagnotexist) {
558 }
else if (!
flagdo)
continue;
565 pos = next + str_chr(line.s + next,
'<');
567 line.s[pos+1] ==
'#' &&
569 line.s[pos+3] ==
'#' &&
570 line.s[pos+4] ==
'>') {
571 if (!stralloc_catb(&outline,line.s + last + 1,pos - last - 1))
die_nomem();
572 switch (line.s[pos+2]) {
574 last = pos + 4; next = pos + 5;
break;
577 last = pos + 4; next = pos + 5;
break;
578 case 'D':
if (!stralloc_cats(&outline,
dir))
die_nomem();
579 last = pos + 4; next = pos + 5;
break;
581 last = pos + 4; next = pos + 5;
break;
583 last = pos + 4; next = pos + 5;
break;
585 last = pos + 4; next = pos + 5;
break;
586 case 'T':
if (!stralloc_cats(&outline,
dot))
die_nomem();
587 last = pos + 4; next = pos + 5;
break;
590 last = pos + 4; next = pos + 5;
break;
594 if ((line.s[pos+2] >=
'0') && (line.s[pos+2] <=
'9')) {
595 if (
popt[line.s[pos+2] -
'0'])
596 if (!stralloc_cats(&outline,
popt[line.s[pos+2]-
'0']))
599 if (!stralloc_catb(&outline,line.s+pos,5))
die_nomem();
600 last = pos + 4; next = pos + 5;
break;
606 if (!stralloc_catb(&outline,line.s+last+1,line.len-last-1))
619 if (!
flags[
'e' -
'a']) {
621 f_put(key.s,key.len);
const char * logmsg(const char *dir, unsigned long num, unsigned long listno, unsigned long subs, int done)