Skip to content

Instantly share code, notes, and snippets.

@ravelll
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save ravelll/cdc0b0c9b2584ffa5692 to your computer and use it in GitHub Desktop.

Select an option

Save ravelll/cdc0b0c9b2584ffa5692 to your computer and use it in GitHub Desktop.
Part of test.c in Bash source codes.
case 't': /* File fd is a terminal? */
if (legal_number (arg, &r) == 0)
return (FALSE);
return ((r == (int)r) && isatty ((int)r));
case 'n': /* True if arg has some length. */
return (arg[0] != '\0');
case 'z': /* True if arg has no length. */
return (arg[0] == '\0');
case 'o': /* True if option `arg' is set. */
return (minus_o_option_value (arg) == 1);
case 'v':
v = find_variable (arg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment