VirtualBox

Changeset 311 in kBuild for trunk


Ignore:
Timestamp:
Aug 11, 2005 9:29:40 PM (19 years ago)
Author:
bird
Message:

Must strip trailing slashes in abspath. added tolower and toupper.

Location:
trunk/src/gmake
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/Makefile.kmk

    r302 r311  
    2020        CONFIG_NO_DEFAULT_SUFFIX_RULES \
    2121        CONFIG_NO_DEFAULT_VARIABLES \
     22        KMK
    2223       
    2324kmk_SOURCES         = \
  • trunk/src/gmake/function.c

    r303 r311  
    17841784  if (!dest)
    17851785      return NULL;
     1786  {
     1787  size_t len = strlen(dest);
     1788  memcpy(apath, dest, len);
     1789  dest = apath + len;
     1790  }
     1791
    17861792  (void)end; (void)start; (void)apath_limit;
    1787   return strcpy(apath, dest);
    17881793
    17891794#elif defined __OS2__
    17901795  if (!_fullpath(apath, name, GET_PATH_MAX))
    17911796      return NULL;
     1797  dest = strchr(apath, '\0');
     1798
    17921799  (void)end; (void)start; (void)apath_limit; (void)dest;
    1793   return apath;
    17941800
    17951801#else /* !WINDOWS32 && !__OS2__ */
     
    18601866        }
    18611867    }
     1868#endif /* !WINDOWS32 && !__OS2__ */
    18621869
    18631870  /* Unless it is root strip trailing separator.  */
     1871#ifdef HAVE_DOS_PATHS
     1872  if (dest > apath + 1 + (apath[0] != '/') && dest[-1] == '/')
     1873#else
    18641874  if (dest > apath + 1 && dest[-1] == '/')
     1875#endif
    18651876    --dest;
    18661877
     
    18681879
    18691880  return apath;
    1870 #endif /* !WINDOWS32 */
    18711881}
    18721882
     
    19461956 return o;
    19471957}
     1958
     1959#ifdef KMK
     1960static char *
     1961func_toupper_tolower (char *o, char **argv, const char *funcname)
     1962{
     1963  /* Expand the argument.  */
     1964  char *p = argv[0];
     1965  while (*p)
     1966    {
     1967      /* convert to temporary buffer */
     1968      char tmp[256];
     1969      unsigned int i;
     1970      if (!strcmp(funcname, "toupper"))
     1971        for (i = 0; i < sizeof(tmp) && tmp[i]; i++, p++)
     1972          tmp[i] = toupper(*p);
     1973      else
     1974        for (i = 0; i < sizeof(tmp) && tmp[i]; i++, p++)
     1975          tmp[i] = tolower(*p);
     1976      o = variable_buffer_output (o, tmp, i);
     1977    }
     1978
     1979  return o;
     1980}
     1981#endif
    19481982
    19491983/* Lookup table for builtin functions.
     
    20012035  { STRING_SIZE_TUPLE("not"),           0,  1,  1,  func_not},
    20022036#endif
     2037#ifdef KMK
     2038  { STRING_SIZE_TUPLE("toupper"),       0,  1,  1,  func_toupper_tolower},
     2039  { STRING_SIZE_TUPLE("tolower"),       0,  1,  1,  func_toupper_tolower},
     2040#endif
    20032041};
    20042042
  • trunk/src/gmake/variable.c

    r303 r311  
    681681
    682682  /* Define KMK_FEATURES to indicate various working KMK features. */
    683   (void) define_variable ("KMK_FEATURES", 12, "abspath", o_default, 0);
     683  (void) define_variable ("KMK_FEATURES", 12, "abspath toupper tolower", o_default, 0);
    684684
    685685#ifdef CONFIG_WITH_KMK_BUILTIN
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette