MCPcopy Create free account
hub / github.com/coreutils/coreutils / posixtest

Function posixtest

src/test.c:615–656  ·  view source on GitHub ↗

This is an implementation of a Posix.2 proposal by David Korn. */

Source from the content-addressed store, hash-verified

613
614/* This is an implementation of a Posix.2 proposal by David Korn. */
615static bool
616posixtest (int nargs)
617{
618 bool value;
619
620 switch (nargs)
621 {
622 case 1:
623 value = one_argument ();
624 break;
625
626 case 2:
627 value = two_arguments ();
628 break;
629
630 case 3:
631 value = three_arguments ();
632 break;
633
634 case 4:
635 if (streq (argv[pos], "!"))
636 {
637 advance (true);
638 value = !three_arguments ();
639 break;
640 }
641 if (streq (argv[pos], "(") && streq (argv[pos + 3], ")"))
642 {
643 advance (false);
644 value = two_arguments ();
645 advance (false);
646 break;
647 }
648 FALLTHROUGH;
649 case 5:
650 default:
651 affirm (0 < nargs);
652 value = expr ();
653 }
654
655 return (value);
656}
657
658#if defined TEST_STANDALONE
659

Callers 2

termFunction · 0.85
mainFunction · 0.85

Calls 5

one_argumentFunction · 0.85
two_argumentsFunction · 0.85
three_argumentsFunction · 0.85
advanceFunction · 0.85
exprFunction · 0.85

Tested by

no test coverage detected