Ignore:
Timestamp:
Sep 3, 2008, 3:40:13 AM (17 years ago)
Author:
bird
Message:

kmk: Added a new function $(defined var) which check whether var is defined and returns a make boolean result ("1" or "").

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/function.c

    r1699 r1716  
    20882088
    20892089
     2090#ifdef CONFIG_WITH_DEFINED
     2091/* Similar to ifdef. */
     2092static char *
     2093func_defined (char *o, char **argv, const char *funcname)
     2094{
     2095  struct variable *v = lookup_variable (argv[0], strlen (argv[0]));
     2096  int result = v != NULL && *v->value != '\0';
     2097  o = variable_buffer_output (o,  result ? "1" : "", result);
     2098  return o;
     2099}
     2100#endif /* CONFIG_WITH_DEFINED*/
     2101
     2102
     2103
    20902104/* Return the absolute name of file NAME which does not contain any `.',
    20912105   `..' components nor any repeated path separators ('/').   */
     
    39173931  { STRING_SIZE_TUPLE("not"),           0,  1,  1,  func_not},
    39183932#endif
     3933#ifdef CONFIG_WITH_DEFINED
     3934  { STRING_SIZE_TUPLE("defined"),       1,  1,  1,  func_defined},
     3935#endif
    39193936#ifdef CONFIG_WITH_TOUPPER_TOLOWER
    39203937  { STRING_SIZE_TUPLE("toupper"),       0,  1,  1,  func_toupper_tolower},
Note: See TracChangeset for help on using the changeset viewer.