Changeset 30 for trunk/src/kmk/var.c
- Timestamp:
- Nov 30, 2002, 7:53:42 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/var.c
r27 r30 183 183 static Boolean VarSuffix __P((char *, Boolean, Buffer, ClientData)); 184 184 static Boolean VarRoot __P((char *, Boolean, Buffer, ClientData)); 185 #ifdef NMAKE 186 static Boolean VarBase __P((char *, Boolean, Buffer, ClientData)); 187 #endif 185 188 static Boolean VarMatch __P((char *, Boolean, Buffer, ClientData)); 186 189 #ifdef SYSVVARSUB … … 795 798 return (dummy ? TRUE : TRUE); 796 799 } 800 801 #ifdef NMAKE 802 /*- 803 *----------------------------------------------------------------------- 804 * VarBase -- 805 * Remove the head and suffix of the given word and place the result 806 * in the given buffer. 807 * 808 * Results: 809 * TRUE if characters were added to the buffer (a space needs to be 810 * added to the buffer before the next word). 811 * 812 * Side Effects: 813 * The trimmed word is added to the buffer. 814 * 815 *----------------------------------------------------------------------- 816 */ 817 static Boolean 818 VarBase (word, addSpace, buf, dummy) 819 char *word; /* Word to trim */ 820 Boolean addSpace; /* TRUE if need to stick a space in the 821 * buffer before adding the tail */ 822 Buffer buf; /* Buffer in which to store it */ 823 ClientData dummy; 824 { 825 register char *slash; 826 827 if (addSpace) { 828 Buf_AddByte (buf, (Byte)' '); 829 } 830 831 slash = strrchr (word, '/'); 832 if (slash != (char *)NULL) { 833 register char *dot; 834 *slash++ = '\0'; 835 dot = strrchr (slash, '.'); 836 if (dot) 837 { 838 *dot = '\0'; 839 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 840 *dot = '.'; 841 } 842 else 843 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 844 slash[-1] = '/'; 845 } else { 846 register char *dot; 847 dot = strrchr (slash, '.'); 848 if (dot) 849 { 850 *dot = '\0'; 851 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 852 *dot = '.'; 853 } 854 else 855 Buf_AddBytes (buf, strlen(slash), (Byte *)slash); 856 } 857 return (dummy ? TRUE : TRUE); 858 } 859 860 #endif 797 861 798 862 /*- … … 1496 1560 dynamic = FALSE; 1497 1561 start = str; 1562 //debugkso: fprintf(stderr, "var: str=%s\n", str); 1498 1563 1499 1564 if (str[1] != '(' && str[1] != '{') { … … 1590 1655 v = VarFind (str, ctxt, FIND_ENV | FIND_GLOBAL | FIND_CMD); 1591 1656 if ((v == (Var *)NIL) && (ctxt != VAR_CMD) && (ctxt != VAR_GLOBAL) && 1657 #ifdef NMAKE 1658 (vlen == 2) && (str[1] == 'F' || str[1] == 'D' || str[1] == 'B' || str[1] == 'R')) 1659 #else 1592 1660 (vlen == 2) && (str[1] == 'F' || str[1] == 'D')) 1661 #endif 1593 1662 { 1594 1663 /* … … 1622 1691 val = (char *)Buf_GetAll(v->val, (int *)NULL); 1623 1692 1693 #ifdef NMAKE 1694 switch (str[1]) 1695 { 1696 case 'D': val = VarModify(val, VarHead, (ClientData)0); break; 1697 case 'B': val = VarModify(val, VarBase, (ClientData)0); break; 1698 case 'R': val = VarModify(val, VarRoot, (ClientData)0); break; 1699 default: val = VarModify(val, VarTail, (ClientData)0); break; 1700 } 1701 #else 1624 1702 if (str[1] == 'D') { 1625 1703 val = VarModify(val, VarHead, (ClientData)0); … … 1627 1705 val = VarModify(val, VarTail, (ClientData)0); 1628 1706 } 1707 #endif 1629 1708 /* 1630 1709 * Resulting string is dynamically allocated, so … … 1643 1722 1644 1723 if (v == (Var *)NIL) { 1724 //debugkso: fprintf(stderr, "\tv == (Var *)NIL vlen=%d str=%s\n", vlen, str); 1725 1645 1726 if (((vlen == 1) || 1646 1727 (((vlen == 2) && (str[1] == 'F' || 1728 #ifdef NMAKE 1729 str[1] == 'D' || str[1] == 'B' || str[1] == 'R')))) && 1730 #else 1647 1731 str[1] == 'D')))) && 1732 #endif 1648 1733 ((ctxt == VAR_CMD) || (ctxt == VAR_GLOBAL))) 1649 1734 {
Note:
See TracChangeset
for help on using the changeset viewer.