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

Function string_to_join_field

src/join.c:870–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868 diagnostic and exit. */
869
870static idx_t
871string_to_join_field (char const *str)
872{
873 intmax_t val;
874
875 strtol_error s_err = xstrtoimax (str, NULL, 10, &val, "");
876 if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && PTRDIFF_MAX < val))
877 val = PTRDIFF_MAX;
878 else if (s_err != LONGINT_OK || val <= 0)
879 error (EXIT_FAILURE, 0, _("invalid field number: %s"), quote (str));
880
881 return val - 1;
882}
883
884/* Convert a single field specifier string, S, to a *FILE_INDEX, *FIELD_INDEX
885 pair. In S, the field index string is 1-based; *FIELD_INDEX is zero-based.

Callers 3

decode_field_specFunction · 0.85
add_file_nameFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected