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

Function get_format_flags

src/csplit.c:1175–1201  ·  view source on GitHub ↗

Scan the printf format flags in FORMAT, storing info about the flags into *FLAGS_PTR. Return the number of flags found. */

Source from the content-addressed store, hash-verified

1173/* Scan the printf format flags in FORMAT, storing info about the
1174 flags into *FLAGS_PTR. Return the number of flags found. */
1175static idx_t
1176get_format_flags (char const *format, int *flags_ptr)
1177{
1178 int flags = 0;
1179
1180 for (idx_t count = 0; ; count++)
1181 {
1182 switch (format[count])
1183 {
1184 case '-':
1185 case '0':
1186 break;
1187
1188 case '\'':
1189 flags |= FLAG_THOUSANDS;
1190 break;
1191
1192 case '#':
1193 flags |= FLAG_ALTERNATIVE;
1194 break;
1195
1196 default:
1197 *flags_ptr = flags;
1198 return count;
1199 }
1200 }
1201}
1202
1203/* Check that the printf format conversion specifier *FORMAT is valid
1204 and compatible with FLAGS. Change it to 'd' if it is 'u',

Callers 1

max_outFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected