eval.c (95095) | eval.c (95887) |
---|---|
1/* $OpenBSD: eval.c,v 1.43 2002/02/16 21:27:48 millert Exp $ */ | 1/* $OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $ */ |
2/* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ 3 4/* 5 * Copyright (c) 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Ozan Yigit at York University. --- 23 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 */ 39 40#include <sys/cdefs.h> | 2/* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ 3 4/* 5 * Copyright (c) 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This code is derived from software contributed to Berkeley by 9 * Ozan Yigit at York University. --- 23 unchanged lines hidden (view full) --- 33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 * SUCH DAMAGE. 38 */ 39 40#include <sys/cdefs.h> |
41__SCCSID("@(#)eval.c 8.2 (Berkeley) 4/27/95"); 42__RCSID_SOURCE("$OpenBSD: eval.c,v 1.43 2002/02/16 21:27:48 millert Exp $"); 43__FBSDID("$FreeBSD: head/usr.bin/m4/eval.c 95095 2002-04-20 01:49:10Z jmallett $"); | 41__SCCSID("@(#)eval.c 8.2 (Berkeley) 4/27/95"); 42__RCSID_SOURCE("$OpenBSD: eval.c,v 1.44 2002/04/26 16:15:16 espie Exp $"); 43__FBSDID("$FreeBSD: head/usr.bin/m4/eval.c 95887 2002-05-01 21:37:29Z jmallett $"); |
44 45/* 46 * eval.c 47 * Facility: m4 macro processor 48 * by: oz 49 */ 50 51#include <sys/types.h> --- 49 unchanged lines hidden (view full) --- 101 * A call in the form of macro-or-builtin() will result in: 102 * argv[0] = nullstr 103 * argv[1] = macro-or-builtin 104 * argv[2] = nullstr 105 * 106 * argc is 3 for macro-or-builtin() and 2 for macro-or-builtin 107 */ 108void | 44 45/* 46 * eval.c 47 * Facility: m4 macro processor 48 * by: oz 49 */ 50 51#include <sys/types.h> --- 49 unchanged lines hidden (view full) --- 101 * A call in the form of macro-or-builtin() will result in: 102 * argv[0] = nullstr 103 * argv[1] = macro-or-builtin 104 * argv[2] = nullstr 105 * 106 * argc is 3 for macro-or-builtin() and 2 for macro-or-builtin 107 */ 108void |
109eval(argv, argc, td) 110 const char *argv[]; 111 int argc; 112 int td; | 109eval(const char *argv[], int argc, int td) |
113{ 114 ssize_t mark = -1; 115 116 expansion_id++; 117 if (td & RECDEF) 118 errx(1, "%s at line %lu: expanding recursive definition for %s", 119 CURRENT_NAME, CURRENT_LINE, argv[1]); 120 if (traced_macros && is_traced(argv[1])) --- 5 unchanged lines hidden (view full) --- 126 if (mark != -1) 127 finish_trace(mark); 128} 129 130/* 131 * expand_builtin - evaluate built-in macros. 132 */ 133void | 110{ 111 ssize_t mark = -1; 112 113 expansion_id++; 114 if (td & RECDEF) 115 errx(1, "%s at line %lu: expanding recursive definition for %s", 116 CURRENT_NAME, CURRENT_LINE, argv[1]); 117 if (traced_macros && is_traced(argv[1])) --- 5 unchanged lines hidden (view full) --- 123 if (mark != -1) 124 finish_trace(mark); 125} 126 127/* 128 * expand_builtin - evaluate built-in macros. 129 */ 130void |
134expand_builtin(argv, argc, td) 135 const char *argv[]; 136 int argc; 137 int td; | 131expand_builtin(const char *argv[], int argc, int td) |
138{ 139 int c, n; 140 int ac; 141 static int sysval = 0; 142 143#ifdef DEBUG 144 printf("argc = %d\n", argc); 145 for (n = 0; n < argc; n++) --- 347 unchanged lines hidden (view full) --- 493 break; 494 } 495} 496 497/* 498 * expand_macro - user-defined macro expansion 499 */ 500void | 132{ 133 int c, n; 134 int ac; 135 static int sysval = 0; 136 137#ifdef DEBUG 138 printf("argc = %d\n", argc); 139 for (n = 0; n < argc; n++) --- 347 unchanged lines hidden (view full) --- 487 break; 488 } 489} 490 491/* 492 * expand_macro - user-defined macro expansion 493 */ 494void |
501expand_macro(argv, argc) 502 const char *argv[]; 503 int argc; | 495expand_macro(const char *argv[], int argc) |
504{ 505 const char *t; 506 const char *p; 507 int n; 508 int argno; 509 510 t = argv[0]; /* defn string as a whole */ 511 p = t; --- 56 unchanged lines hidden (view full) --- 568 if (p == t) /* do last character */ 569 PUTBACK(*p); 570} 571 572/* 573 * dodefine - install definition in the table 574 */ 575void | 496{ 497 const char *t; 498 const char *p; 499 int n; 500 int argno; 501 502 t = argv[0]; /* defn string as a whole */ 503 p = t; --- 56 unchanged lines hidden (view full) --- 560 if (p == t) /* do last character */ 561 PUTBACK(*p); 562} 563 564/* 565 * dodefine - install definition in the table 566 */ 567void |
576dodefine(name, defn) 577 const char *name; 578 const char *defn; | 568dodefine(const char *name, const char *defn) |
579{ 580 ndptr p; 581 int n; 582 583 if (!*name) 584 errx(1, "%s at line %lu: null definition.", CURRENT_NAME, 585 CURRENT_LINE); 586 if ((p = lookup(name)) == nil) --- 19 unchanged lines hidden (view full) --- 606 p->type |= RECDEF; 607} 608 609/* 610 * dodefn - push back a quoted definition of 611 * the given name. 612 */ 613static void | 569{ 570 ndptr p; 571 int n; 572 573 if (!*name) 574 errx(1, "%s at line %lu: null definition.", CURRENT_NAME, 575 CURRENT_LINE); 576 if ((p = lookup(name)) == nil) --- 19 unchanged lines hidden (view full) --- 596 p->type |= RECDEF; 597} 598 599/* 600 * dodefn - push back a quoted definition of 601 * the given name. 602 */ 603static void |
614dodefn(name) 615 const char *name; | 604dodefn(const char *name) |
616{ 617 ndptr p; 618 const char *real; 619 620 if ((p = lookup(name)) != nil) { 621 if (p->defn != null) { 622 pbstr(rquote); 623 pbstr(p->defn); --- 8 unchanged lines hidden (view full) --- 632/* 633 * dopushdef - install a definition in the hash table 634 * without removing a previous definition. Since 635 * each new entry is entered in *front* of the 636 * hash bucket, it hides a previous definition from 637 * lookup. 638 */ 639static void | 605{ 606 ndptr p; 607 const char *real; 608 609 if ((p = lookup(name)) != nil) { 610 if (p->defn != null) { 611 pbstr(rquote); 612 pbstr(p->defn); --- 8 unchanged lines hidden (view full) --- 621/* 622 * dopushdef - install a definition in the hash table 623 * without removing a previous definition. Since 624 * each new entry is entered in *front* of the 625 * hash bucket, it hides a previous definition from 626 * lookup. 627 */ 628static void |
640dopushdef(name, defn) 641 const char *name; 642 const char *defn; | 629dopushdef(const char *name, const char *defn) |
643{ 644 ndptr p; 645 646 if (!*name) 647 errx(1, "%s at line %lu: null definition", CURRENT_NAME, 648 CURRENT_LINE); 649 p = addent(name); 650 if (!*defn) --- 4 unchanged lines hidden (view full) --- 655 if (STREQ(name, defn)) 656 p->type |= RECDEF; 657} 658 659/* 660 * dump_one_def - dump the specified definition. 661 */ 662static void | 630{ 631 ndptr p; 632 633 if (!*name) 634 errx(1, "%s at line %lu: null definition", CURRENT_NAME, 635 CURRENT_LINE); 636 p = addent(name); 637 if (!*defn) --- 4 unchanged lines hidden (view full) --- 642 if (STREQ(name, defn)) 643 p->type |= RECDEF; 644} 645 646/* 647 * dump_one_def - dump the specified definition. 648 */ 649static void |
663dump_one_def(p) 664 ndptr p; | 650dump_one_def(ndptr p) |
665{ 666 const char *real; 667 668 if (mimic_gnu) { 669 if ((p->type & TYPEMASK) == MACRTYPE) 670 fprintf(traceout, "%s:\t%s\n", p->name, p->defn); 671 else { 672 real = builtin_realname(p->type); --- 6 unchanged lines hidden (view full) --- 679} 680 681/* 682 * dodumpdef - dump the specified definitions in the hash 683 * table to stderr. If nothing is specified, the entire 684 * hash table is dumped. 685 */ 686static void | 651{ 652 const char *real; 653 654 if (mimic_gnu) { 655 if ((p->type & TYPEMASK) == MACRTYPE) 656 fprintf(traceout, "%s:\t%s\n", p->name, p->defn); 657 else { 658 real = builtin_realname(p->type); --- 6 unchanged lines hidden (view full) --- 665} 666 667/* 668 * dodumpdef - dump the specified definitions in the hash 669 * table to stderr. If nothing is specified, the entire 670 * hash table is dumped. 671 */ 672static void |
687dodump(argv, argc) 688 const char *argv[]; 689 int argc; | 673dodump(const char *argv[], int argc) |
690{ 691 int n; 692 ndptr p; 693 694 if (argc > 2) { 695 for (n = 2; n < argc; n++) 696 if ((p = lookup(argv[n])) != nil) 697 dump_one_def(p); 698 } else { 699 for (n = 0; n < HASHSIZE; n++) 700 for (p = hashtab[n]; p != nil; p = p->nxtptr) 701 dump_one_def(p); 702 } 703} 704 705/* 706 * dotrace - mark some macros as traced/untraced depending upon on. 707 */ 708static void | 674{ 675 int n; 676 ndptr p; 677 678 if (argc > 2) { 679 for (n = 2; n < argc; n++) 680 if ((p = lookup(argv[n])) != nil) 681 dump_one_def(p); 682 } else { 683 for (n = 0; n < HASHSIZE; n++) 684 for (p = hashtab[n]; p != nil; p = p->nxtptr) 685 dump_one_def(p); 686 } 687} 688 689/* 690 * dotrace - mark some macros as traced/untraced depending upon on. 691 */ 692static void |
709dotrace(argv, argc, on) 710 const char *argv[]; 711 int argc; 712 int on; | 693dotrace(const char *argv[], int argc, int on) |
713{ 714 int n; 715 716 if (argc > 2) { 717 for (n = 2; n < argc; n++) 718 mark_traced(argv[n], on); 719 } else 720 mark_traced(NULL, on); 721} 722 723/* 724 * doifelse - select one of two alternatives - loop. 725 */ 726static void | 694{ 695 int n; 696 697 if (argc > 2) { 698 for (n = 2; n < argc; n++) 699 mark_traced(argv[n], on); 700 } else 701 mark_traced(NULL, on); 702} 703 704/* 705 * doifelse - select one of two alternatives - loop. 706 */ 707static void |
727doifelse(argv, argc) 728 const char *argv[]; 729 int argc; | 708doifelse(const char *argv[], int argc) |
730{ 731 cycle { 732 if (STREQ(argv[2], argv[3])) 733 pbstr(argv[4]); 734 else if (argc == 6) 735 pbstr(argv[5]); 736 else if (argc > 6) { 737 argv += 3; 738 argc -= 3; 739 continue; 740 } 741 break; 742 } 743} 744 745/* 746 * doinclude - include a given file. 747 */ 748static int | 709{ 710 cycle { 711 if (STREQ(argv[2], argv[3])) 712 pbstr(argv[4]); 713 else if (argc == 6) 714 pbstr(argv[5]); 715 else if (argc > 6) { 716 argv += 3; 717 argc -= 3; 718 continue; 719 } 720 break; 721 } 722} 723 724/* 725 * doinclude - include a given file. 726 */ 727static int |
749doincl(ifile) 750 const char *ifile; | 728doincl(const char *ifile) |
751{ 752 if (ilevel + 1 == MAXINP) 753 errx(1, "%s at line %lu: too many include files.", 754 CURRENT_NAME, CURRENT_LINE); 755 if (fopen_trypath(infile+ilevel+1, ifile) != NULL) { 756 ilevel++; 757 if ((inname[ilevel] = strdup(ifile)) == NULL) 758 err(1, NULL); --- 6 unchanged lines hidden (view full) --- 765} 766 767#ifdef EXTENDED 768/* 769 * dopaste - include a given file without any 770 * macro processing. 771 */ 772static int | 729{ 730 if (ilevel + 1 == MAXINP) 731 errx(1, "%s at line %lu: too many include files.", 732 CURRENT_NAME, CURRENT_LINE); 733 if (fopen_trypath(infile+ilevel+1, ifile) != NULL) { 734 ilevel++; 735 if ((inname[ilevel] = strdup(ifile)) == NULL) 736 err(1, NULL); --- 6 unchanged lines hidden (view full) --- 743} 744 745#ifdef EXTENDED 746/* 747 * dopaste - include a given file without any 748 * macro processing. 749 */ 750static int |
773dopaste(pfile) 774 const char *pfile; | 751dopaste(const char *pfile) |
775{ 776 FILE *pf; 777 int c; 778 779 if ((pf = fopen(pfile, "r")) != NULL) { 780 fprintf(active, "#line 1 \"%s\"\n", pfile); 781 while ((c = getc(pf)) != EOF) 782 putc(c, active); 783 (void) fclose(pf); 784 emitline(); 785 return (1); 786 } else 787 return (0); 788} 789#endif 790 791static void | 752{ 753 FILE *pf; 754 int c; 755 756 if ((pf = fopen(pfile, "r")) != NULL) { 757 fprintf(active, "#line 1 \"%s\"\n", pfile); 758 while ((c = getc(pf)) != EOF) 759 putc(c, active); 760 (void) fclose(pf); 761 emitline(); 762 return (1); 763 } else 764 return (0); 765} 766#endif 767 768static void |
792gnu_dochq(argv, ac) 793 const char *argv[]; 794 int ac; | 769gnu_dochq(const char *argv[], int ac) |
795{ 796 /* In gnu-m4 mode, the only way to restore quotes is to have no 797 * arguments at all. */ 798 if (ac == 2) { 799 lquote[0] = LQUOTE, lquote[1] = EOS; 800 rquote[0] = RQUOTE, rquote[1] = EOS; 801 } else { 802 strlcpy(lquote, argv[2], sizeof(lquote)); 803 if(ac > 3) 804 strlcpy(rquote, argv[3], sizeof(rquote)); 805 else 806 rquote[0] = EOS; 807 } 808} 809 810/* 811 * dochq - change quote characters 812 */ 813static void | 770{ 771 /* In gnu-m4 mode, the only way to restore quotes is to have no 772 * arguments at all. */ 773 if (ac == 2) { 774 lquote[0] = LQUOTE, lquote[1] = EOS; 775 rquote[0] = RQUOTE, rquote[1] = EOS; 776 } else { 777 strlcpy(lquote, argv[2], sizeof(lquote)); 778 if(ac > 3) 779 strlcpy(rquote, argv[3], sizeof(rquote)); 780 else 781 rquote[0] = EOS; 782 } 783} 784 785/* 786 * dochq - change quote characters 787 */ 788static void |
814dochq(argv, argc) 815 const char *argv[]; 816 int argc; | 789dochq(const char *argv[], int argc) |
817{ 818 if (argc > 2) { 819 if (*argv[2]) 820 strlcpy(lquote, argv[2], sizeof(lquote)); 821 else { 822 lquote[0] = LQUOTE; 823 lquote[1] = EOS; 824 } --- 4 unchanged lines hidden (view full) --- 829 strcpy(rquote, lquote); 830 } else { 831 lquote[0] = LQUOTE, lquote[1] = EOS; 832 rquote[0] = RQUOTE, rquote[1] = EOS; 833 } 834} 835 836static void | 790{ 791 if (argc > 2) { 792 if (*argv[2]) 793 strlcpy(lquote, argv[2], sizeof(lquote)); 794 else { 795 lquote[0] = LQUOTE; 796 lquote[1] = EOS; 797 } --- 4 unchanged lines hidden (view full) --- 802 strcpy(rquote, lquote); 803 } else { 804 lquote[0] = LQUOTE, lquote[1] = EOS; 805 rquote[0] = RQUOTE, rquote[1] = EOS; 806 } 807} 808 809static void |
837gnu_dochc(argv, ac) 838 const char *argv[]; 839 int ac; | 810gnu_dochc(const char *argv[], int ac) |
840{ 841 /* In gnu-m4 mode, no arguments mean no comment 842 * arguments at all. */ 843 if (ac == 2) { 844 scommt[0] = EOS; 845 ecommt[0] = EOS; 846 } else { 847 if (*argv[2]) --- 5 unchanged lines hidden (view full) --- 853 else 854 ecommt[0] = ECOMMT, ecommt[1] = EOS; 855 } 856} 857/* 858 * dochc - change comment characters 859 */ 860static void | 811{ 812 /* In gnu-m4 mode, no arguments mean no comment 813 * arguments at all. */ 814 if (ac == 2) { 815 scommt[0] = EOS; 816 ecommt[0] = EOS; 817 } else { 818 if (*argv[2]) --- 5 unchanged lines hidden (view full) --- 824 else 825 ecommt[0] = ECOMMT, ecommt[1] = EOS; 826 } 827} 828/* 829 * dochc - change comment characters 830 */ 831static void |
861dochc(argv, argc) 862 const char *argv[]; 863 int argc; | 832dochc(const char *argv[], int argc) |
864{ 865 if (argc > 2) { 866 if (*argv[2]) 867 strlcpy(scommt, argv[2], sizeof(scommt)); 868 if (argc > 3) { 869 if (*argv[3]) 870 strlcpy(ecommt, argv[3], sizeof(ecommt)); 871 } --- 5 unchanged lines hidden (view full) --- 877 ecommt[0] = ECOMMT, ecommt[1] = EOS; 878 } 879} 880 881/* 882 * dodivert - divert the output to a temporary file 883 */ 884static void | 833{ 834 if (argc > 2) { 835 if (*argv[2]) 836 strlcpy(scommt, argv[2], sizeof(scommt)); 837 if (argc > 3) { 838 if (*argv[3]) 839 strlcpy(ecommt, argv[3], sizeof(ecommt)); 840 } --- 5 unchanged lines hidden (view full) --- 846 ecommt[0] = ECOMMT, ecommt[1] = EOS; 847 } 848} 849 850/* 851 * dodivert - divert the output to a temporary file 852 */ 853static void |
885dodiv(n) 886 int n; | 854dodiv(int n) |
887{ 888 int fd; 889 890 oindex = n; 891 if (n >= maxout) { 892 if (mimic_gnu) 893 resizedivs(n + 10); 894 else --- 14 unchanged lines hidden (view full) --- 909 active = outfile[n]; 910} 911 912/* 913 * doundivert - undivert a specified output, or all 914 * other outputs, in numerical order. 915 */ 916static void | 855{ 856 int fd; 857 858 oindex = n; 859 if (n >= maxout) { 860 if (mimic_gnu) 861 resizedivs(n + 10); 862 else --- 14 unchanged lines hidden (view full) --- 877 active = outfile[n]; 878} 879 880/* 881 * doundivert - undivert a specified output, or all 882 * other outputs, in numerical order. 883 */ 884static void |
917doundiv(argv, argc) 918 const char *argv[]; 919 int argc; | 885doundiv(const char *argv[], int argc) |
920{ 921 int ind; 922 int n; 923 924 if (argc > 2) { 925 for (ind = 2; ind < argc; ind++) { 926 n = atoi(argv[ind]); 927 if (n > 0 && n < maxout && outfile[n] != NULL) --- 6 unchanged lines hidden (view full) --- 934 if (outfile[n] != NULL) 935 getdiv(n); 936} 937 938/* 939 * dosub - select substring 940 */ 941static void | 886{ 887 int ind; 888 int n; 889 890 if (argc > 2) { 891 for (ind = 2; ind < argc; ind++) { 892 n = atoi(argv[ind]); 893 if (n > 0 && n < maxout && outfile[n] != NULL) --- 6 unchanged lines hidden (view full) --- 900 if (outfile[n] != NULL) 901 getdiv(n); 902} 903 904/* 905 * dosub - select substring 906 */ 907static void |
942dosub(argv, argc) 943 const char *argv[]; 944 int argc; | 908dosub(const char *argv[], int argc) |
945{ 946 const char *ap, *fc, *k; 947 int nc; 948 949 ap = argv[2]; /* target string */ 950#ifdef EXPR 951 fc = ap + expr(argv[3]); /* first char */ 952#else --- 32 unchanged lines hidden (view full) --- 985 * mapvec[n] == n). Even if the entry in the mapvec is null for an ordinary 986 * character, it will stabilize, since mapvec[0] == 0 at all times. At the 987 * end, we restore mapvec* back to normal where mapvec[n] == n for 988 * 0 <= n <= 127. This strategy, along with the restoration of mapvec, is 989 * about 5 times faster than any algorithm that makes multiple passes over 990 * destination string. 991 */ 992static void | 909{ 910 const char *ap, *fc, *k; 911 int nc; 912 913 ap = argv[2]; /* target string */ 914#ifdef EXPR 915 fc = ap + expr(argv[3]); /* first char */ 916#else --- 32 unchanged lines hidden (view full) --- 949 * mapvec[n] == n). Even if the entry in the mapvec is null for an ordinary 950 * character, it will stabilize, since mapvec[0] == 0 at all times. At the 951 * end, we restore mapvec* back to normal where mapvec[n] == n for 952 * 0 <= n <= 127. This strategy, along with the restoration of mapvec, is 953 * about 5 times faster than any algorithm that makes multiple passes over 954 * destination string. 955 */ 956static void |
993map(dest, src, from, to) 994 char *dest; 995 const char *src; 996 const char *from; 997 const char *to; | 957map(char *dest, const char *src, const char *from, const char *to) |
998{ 999 const char *tmp; 1000 unsigned char sch, dch; 1001 static char frombis[257]; 1002 static char tobis[257]; 1003 static unsigned char mapvec[256] = { 1004 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1005 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, --- 55 unchanged lines hidden (view full) --- 1061 1062 1063/* 1064 * handledash: 1065 * use buffer to copy the src string, expanding character ranges 1066 * on the way. 1067 */ 1068static const char * | 958{ 959 const char *tmp; 960 unsigned char sch, dch; 961 static char frombis[257]; 962 static char tobis[257]; 963 static unsigned char mapvec[256] = { 964 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 965 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, --- 55 unchanged lines hidden (view full) --- 1021 1022 1023/* 1024 * handledash: 1025 * use buffer to copy the src string, expanding character ranges 1026 * on the way. 1027 */ 1028static const char * |
1069handledash(buffer, end, src) 1070 char *buffer; 1071 char *end; 1072 const char *src; | 1029handledash(char *buffer, char *end, const char *src) |
1073{ 1074 char *p; 1075 1076 p = buffer; 1077 while(*src) { 1078 if (src[1] == '-' && src[2]) { 1079 unsigned char i; 1080 for (i = (unsigned char)src[0]; --- 8 unchanged lines hidden (view full) --- 1089 } else 1090 *p++ = *src++; 1091 if (p == end) 1092 break; 1093 } 1094 *p = '\0'; 1095 return buffer; 1096} | 1030{ 1031 char *p; 1032 1033 p = buffer; 1034 while(*src) { 1035 if (src[1] == '-' && src[2]) { 1036 unsigned char i; 1037 for (i = (unsigned char)src[0]; --- 8 unchanged lines hidden (view full) --- 1046 } else 1047 *p++ = *src++; 1048 if (p == end) 1049 break; 1050 } 1051 *p = '\0'; 1052 return buffer; 1053} |
1097 | |