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

Function add_file_name

src/join.c:982–1026  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

980 OPERAND_STATUS; currently there are NFILES names in the list. */
981
982static void
983add_file_name (char *name, char *names[2],
984 int operand_status[2], int joption_count[2], int *nfiles,
985 int *prev_optc_status, int *optc_status)
986{
987 int n = *nfiles;
988
989 if (n == 2)
990 {
991 bool op0 = (operand_status[0] == MUST_BE_OPERAND);
992 char *arg = names[op0];
993 switch (operand_status[op0])
994 {
995 case MUST_BE_OPERAND:
996 error (0, 0, _("extra operand %s"), quoteaf (name));
997 usage (EXIT_FAILURE);
998
999 case MIGHT_BE_J1_ARG:
1000 joption_count[0]--;
1001 set_join_field (&join_field_1, string_to_join_field (arg));
1002 break;
1003
1004 case MIGHT_BE_J2_ARG:
1005 joption_count[1]--;
1006 set_join_field (&join_field_2, string_to_join_field (arg));
1007 break;
1008
1009 case MIGHT_BE_O_ARG:
1010 add_field_list (arg);
1011 break;
1012 }
1013 if (!op0)
1014 {
1015 operand_status[0] = operand_status[1];
1016 names[0] = names[1];
1017 }
1018 n = 1;
1019 }
1020
1021 operand_status[n] = *prev_optc_status;
1022 names[n] = name;
1023 *nfiles = n + 1;
1024 if (*prev_optc_status == MIGHT_BE_O_ARG)
1025 *optc_status = MIGHT_BE_O_ARG;
1026}
1027
1028int
1029main (int argc, char **argv)

Callers 1

mainFunction · 0.85

Calls 4

set_join_fieldFunction · 0.85
string_to_join_fieldFunction · 0.85
add_field_listFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected