563{
564 char empty[17] = { " " };
566 char pp[128], *p, *s, *ps;
569
570 p = pp;
571 s = ss;
572 memset(pp, 0, 128);
573
574
579 }
580
581 while (*s) {
582 if (*s == 'G') {
583 while (*s)
584 *p++ = *s++;
585 break;
586 }
587 if ((*s == 'B') || (*s == 'C') ||
588 (*s == 'N') || (*s == 'A') ||
589 (*s == 'F') || (*s == 'C') ||
590 (*s == 'R') || (*s == 'W') ||
591 (*s == 'G') || (*s == 'H') || (*s == 'E') || (*s == 'Q'))
592 *p++ = ' ';
593 else if ((*s == 'X') || (*s == 'D') || (*s == 'O')) {
594 *p++ = ' ';
595 *p++ = *s++;
596 while (*s)
597 *p++ = *s++;
598 break;
599 };
600 *p++ = *s++;
601 }
602 *p++ = ' ';
603
604 p = pp;
605
606 if ((cmd = strpbrk(p, "P")))
608 if ((cmd = strpbrk(p, "G"))) {
611 break;
612 if (strstr(p + 2,
MCStd[
i]) != NULL)
614 }
616 }
617 if ((cmd = strpbrk(p, "H")))
619 if ((cmd = strpbrk(p, "J@")))
621 if ((cmd = strpbrk(p, "X"))) {
622 ps = strchr(cmd, ' ');
623 *ps = 0;
625 tmp = strtoul((cmd + 1), NULL, 16);
626 if (tmp <= 0xffffff) {
629 } else
630 printf("mcnaf-E- Data out of range 0x0:0xffffff\n");
631 } else {
632 tmp = strtoul((cmd + 1), NULL, 16);
633 if (tmp <= 0xffff) {
636 } else
637 printf("mcnaf-E- Data out of range 0x0:0xffff\n");
638 }
639 strncpy(cmd, empty, strlen(cmd));
640 *ps = ' ';
641 }
642 if ((cmd = strpbrk(p, "O"))) {
643 ps = strchr(cmd, ' ');
644 *ps = 0;
646 tmp = strtoul((cmd + 1), NULL, 8);
647 if (tmp <= 077777777) {
650 } else
651 printf("mcnaf-E- Data out of range O0:O77777777\n");
652 } else {
653 tmp = strtoul((cmd + 1), NULL, 8);
654 if (tmp <= 0177777) {
657 } else
658 printf("mcnaf-E- Data out of range O0:O177777\n");
659 }
660 strncpy(cmd, empty, strlen(cmd));
661 *ps = ' ';
662 }
663 if ((cmd = strpbrk(p, "D"))) {
664 ps = strchr(cmd, ' ');
665 *ps = 0;
667 tmp = strtoul((cmd + 1), NULL, 10);
668 if (tmp <= 0xffffff) {
671 } else
672 printf("mcnaf-E- Data out of range 0:16777215\n");
673 } else {
674 tmp = strtoul((cmd + 1), NULL, 10);
675 if (tmp <= 0xffff) {
678 } else
679 printf("mcnaf-E- Data out of range 0:65535\n");
680 }
681 strncpy(cmd, empty, strlen(cmd));
682 *ps = ' ';
683 }
684 if ((cmd = strchr(p, 'B'))) {
685 ps = strchr(cmd, ' ');
686 *ps = 0;
687 tmp = atoi((cmd + 1));
688 if (tmp < 8) {
691 } else
692 printf("mcnaf-E- B out of range 0:7\n");
693 *ps = ' ';
694 }
695 if ((cmd = strchr(p, 'C'))) {
696 ps = strchr(cmd, ' ');
697 *ps = 0;
698 tmp = atoi((cmd + 1));
699 if (tmp < 8) {
702 } else
703 printf("mcnaf-E- C out of range 0:7\n");
704 *ps = ' ';
705 }
706 if ((cmd = strchr(p, 'N'))) {
707 ps = strchr(cmd, ' ');
708 *ps = 0;
709 tmp = atoi((cmd + 1));
710 if (tmp < 32) {
713 } else
714 printf("mcnaf-E- N out of range 0:31\n");
715 *ps = ' ';
716 }
717 if ((cmd = strchr(p, 'A'))) {
718 ps = strchr(cmd, ' ');
719 *ps = 0;
720 tmp = atoi((cmd + 1));
721 if (tmp < 16) {
724 } else
725 printf("mcnaf-E- A out of range 0:15\n");
726 *ps = ' ';
727 }
728 if ((cmd = strchr(p, 'F'))) {
729 ps = strchr(cmd, ' ');
730 *ps = 0;
731 tmp = atoi((cmd + 1));
732 if (tmp < 32) {
735 } else
736 printf("mcnaf-E- F out of range 0:31\n");
737 *ps = ' ';
738 }
739 if ((cmd = strchr(p, 'R'))) {
740 ps = strchr(cmd, ' ');
741 *ps = 0;
742 tmp = atoi((cmd + 1));
743 if (tmp < 1000) {
744 if (tmp == 0)
745 tmp = 1;
747 } else
748 printf("mcnaf-E- R out of range 1:1000\n");
749 *ps = ' ';
750 }
751 if ((cmd = strchr(p, 'W'))) {
752 ps = strchr(cmd, ' ');
753 *ps = 0;
754 tmp = atoi((cmd + 1));
755 if (tmp < 10001)
757 else
758 printf("mcnaf-E- W out of range 0:10000\n");
759 *ps = ' ';
760 }
761 if ((cmd = strchr(p, 'M'))) {
762 ps = strchr(cmd, ' ');
763 *ps = 0;
764 tmp = atoi((cmd + 1));
765 if (tmp ==
D16 || tmp ==
D24)
767 else
768 printf("mcnaf-E- M out of range 16,24\n");
769 *ps = ' ';
770 }
771 if (ok)
773 if ((cmd = strpbrk(p, "QE")))
776}