Deleted Added
full compact
parse.c (100792) parse.c (102178)
1/*
2 * Copyright (c) 1988, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1989 by Berkeley Softworks
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.

--- 25 unchanged lines hidden (view full) ---

34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)parse.c 8.3 (Berkeley) 3/19/94
39 */
40
41#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1988, 1989, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1989 by Berkeley Softworks
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Adam de Boor.

--- 25 unchanged lines hidden (view full) ---

34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)parse.c 8.3 (Berkeley) 3/19/94
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/usr.bin/make/parse.c 100792 2002-07-28 03:52:41Z jmallett $");
42__FBSDID("$FreeBSD: head/usr.bin/make/parse.c 102178 2002-08-20 12:50:32Z ru $");
43
44/*-
45 * parse.c --
46 * Functions to parse a makefile.
47 *
48 * One function, Parse_Init, must be called before any functions
49 * in this module are used. After that, the function Parse_File is the
50 * main entry point and controls most of the other functions in this

--- 667 unchanged lines hidden (view full) ---

718 waiting = 0;
719 paths = (Lst)NULL;
720
721 curTargs = Lst_Init(FALSE);
722 curSrcs = Lst_Init(FALSE);
723
724 do {
725 for (cp = line;
43
44/*-
45 * parse.c --
46 * Functions to parse a makefile.
47 *
48 * One function, Parse_Init, must be called before any functions
49 * in this module are used. After that, the function Parse_File is the
50 * main entry point and controls most of the other functions in this

--- 667 unchanged lines hidden (view full) ---

718 waiting = 0;
719 paths = (Lst)NULL;
720
721 curTargs = Lst_Init(FALSE);
722 curSrcs = Lst_Init(FALSE);
723
724 do {
725 for (cp = line;
726 *cp && !isspace ((unsigned char) *cp) &&
727 (*cp != '!') && (*cp != ':') && (*cp != '(');
726 *cp && !isspace ((unsigned char) *cp) && *cp != '(';
728 cp++)
729 {
730 if (*cp == '$') {
731 /*
732 * Must be a dynamic source (would have been expanded
733 * otherwise), so call the Var module to parse the puppy
734 * so we can safely advance beyond it...There should be
735 * no errors in this, as they would have been discovered

--- 4 unchanged lines hidden (view full) ---

740 char *result;
741
742 result=Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt);
743
744 if (freeIt) {
745 free(result);
746 }
747 cp += length-1;
727 cp++)
728 {
729 if (*cp == '$') {
730 /*
731 * Must be a dynamic source (would have been expanded
732 * otherwise), so call the Var module to parse the puppy
733 * so we can safely advance beyond it...There should be
734 * no errors in this, as they would have been discovered

--- 4 unchanged lines hidden (view full) ---

739 char *result;
740
741 result=Var_Parse(cp, VAR_CMD, TRUE, &length, &freeIt);
742
743 if (freeIt) {
744 free(result);
745 }
746 cp += length-1;
747 } else if (*cp == '!' || *cp == ':') {
748 /*
749 * We don't want to end a word on ':' or '!' if there is a
750 * better match later on in the string. By "better" I mean
751 * one that is followed by whitespace. This allows the user
752 * to have targets like:
753 * fie::fi:fo: fum
754 * where "fie::fi:fo" is the target. In real life this is used
755 * for perl5 library man pages where "::" separates an object
756 * from its class. Ie: "File::Spec::Unix". This behaviour
757 * is also consistent with other versions of make.
758 */
759 char *p = cp + 1;
760
761 if (*cp == ':' && *p == ':');
762 p++;
763
764 /* Found the best match already. */
765 if (*p == '\0' || isspace(*p))
766 break;
767
768 do {
769 p += strcspn(p, "!:");
770 if (*p == '\0')
771 break;
772 } while (!isspace(*++p));
773
774 /* No better match later on... */
775 if (*p == '\0')
776 break;
748 }
749 continue;
750 }
751 if (*cp == '(') {
752 /*
753 * Archives must be handled specially to make sure the OP_ARCHV
754 * flag is set in their 'type' field, for one thing, and because
755 * things like "archive(file1.o file2.o file3.o)" are permissible.

--- 1875 unchanged lines hidden ---
777 }
778 continue;
779 }
780 if (*cp == '(') {
781 /*
782 * Archives must be handled specially to make sure the OP_ARCHV
783 * flag is set in their 'type' field, for one thing, and because
784 * things like "archive(file1.o file2.o file3.o)" are permissible.

--- 1875 unchanged lines hidden ---