398{
399 static char optbuf[32768];
400 int hunksize = 0, numhunk = -1, numelem = 0;
401 char fmtbuf[32], *
op = optbuf;
402 int i,
j,
k, opleft =
sizeof(optbuf);
403 unsigned char *dp =
data;
405 char comma;
406
407
409 error(
"pretty_print_option: bad code %d",
code);
410
411 if (emit_commas)
412 comma = ',';
413 else
414 comma = ' ';
415
416
418 if (!numhunk) {
419 warning(
"%s: Excess information in format string: %s",
422 break;
423 }
424 numelem++;
427 case 'A':
428 --numelem;
430 numhunk = 0;
431 break;
432 case 'X':
436 break;
439 numhunk = -2;
440 } else {
442 hunksize++;
443 comma = ':';
444 numhunk = 0;
445 }
447 break;
448 case 't':
451 numhunk = -2;
452 break;
453 case 'I':
454 case 'l':
455 case 'L':
456 hunksize += 4;
457 break;
458 case 's':
459 case 'S':
460 hunksize += 2;
461 break;
462 case 'b':
463 case 'B':
464 case 'f':
465 hunksize++;
466 break;
467 case 'e':
468 break;
469 default:
470 warning(
"%s: garbage in format string: %s",
473 break;
474 }
475 }
476
477
478 if (hunksize >
len) {
479 warning(
"%s: expecting at least %d bytes; got %d",
481 return ("<error>");
482 }
483
484 if (numhunk == -1 && hunksize <
len)
487
488
489 if (!numhunk)
490 numhunk =
len / hunksize;
491
492 if (numhunk > 0 && numhunk * hunksize <
len)
493 warning(
"%s: %d extra bytes at end of array",
495
496
497 if (numhunk < 0)
498 numhunk = 1;
499
500
501 for (
i = 0;
i < numhunk;
i++) {
502 for (
j = 0;
j < numelem;
j++) {
503 int opcount;
505 case 't':
506 if (emit_quotes) {
508 opleft--;
509 }
510 for (; dp <
data +
len; dp++) {
514 *dp != 0) {
516 "\\%03o", *dp);
518 opleft -= 4;
519 }
520 } else if (*dp == '"' ||
521 *dp == '\'' ||
522 *dp == '$' ||
523 *dp == '`' ||
524 *dp == '\\') {
527 opleft -= 2;
528 } else {
530 opleft--;
531 }
532 }
533 if (emit_quotes) {
535 opleft--;
536 }
537
539 break;
540 case 'I':
545 if (opcount >= opleft)
546 goto toobig;
547 opleft -= opcount;
548 dp += 4;
549 break;
550 case 'l':
553 if (opcount >= opleft || opcount == -1)
554 goto toobig;
555 opleft -= opcount;
556 dp += 4;
557 break;
558 case 'L':
561 if (opcount >= opleft || opcount == -1)
562 goto toobig;
563 opleft -= opcount;
564 dp += 4;
565 break;
566 case 's':
569 if (opcount >= opleft || opcount == -1)
570 goto toobig;
571 opleft -= opcount;
572 dp += 2;
573 break;
574 case 'S':
577 if (opcount >= opleft || opcount == -1)
578 goto toobig;
579 opleft -= opcount;
580 dp += 2;
581 break;
582 case 'b':
584 *(char *)dp++);
585 if (opcount >= opleft || opcount == -1)
586 goto toobig;
587 opleft -= opcount;
588 break;
589 case 'B':
591 if (opcount >= opleft || opcount == -1)
592 goto toobig;
593 opleft -= opcount;
594 break;
595 case 'x':
597 if (opcount >= opleft || opcount == -1)
598 goto toobig;
599 opleft -= opcount;
600 break;
601 case 'f':
604 if (opcount >= opleft)
605 goto toobig;
606 opleft -= opcount;
607 break;
608 default:
609 warning(
"Unexpected format code %c", fmtbuf[
j]);
610 }
613 if (opleft < 1)
614 goto toobig;
615 if (
j + 1 < numelem && comma !=
':') {
617 opleft--;
618 }
619 }
620 if (
i + 1 < numhunk) {
622 opleft--;
623 }
624 if (opleft < 1)
625 goto toobig;
626
627 }
628 return (optbuf);
629 toobig:
630 warning(
"dhcp option too large");
631 return ("<error>");
632}
ACPI_SIZE strlen(const char *String)
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
int32_t getLong(unsigned char *data)
u_int32_t getULong(unsigned char *data)
int16_t getShort(unsigned char *data)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j