MCPcopy Create free account
hub / github.com/gwsw/less / mca_opt_first_char

Function mca_opt_first_char

command.c:332–376  ·  view source on GitHub ↗

* Handle the first char of an option (after the initial dash). */

(c)

Source from the content-addressed store, hash-verified

330 * Handle the first char of an option (after the initial dash).
331 */
332 static int
333mca_opt_first_char(c)
334 int c;
335{
336 int flag = (optflag & ~OPT_NO_PROMPT);
337 if (flag == OPT_NO_TOGGLE)
338 {
339 switch (c)
340 {
341 case '_':
342 /* "__" = long option name. */
343 optgetname = TRUE;
344 mca_opt_toggle();
345 return (MCA_MORE);
346 }
347 } else
348 {
349 switch (c)
350 {
351 case '+':
352 /* "-+" = UNSET. */
353 optflag = (flag == OPT_UNSET) ?
354 OPT_TOGGLE : OPT_UNSET;
355 mca_opt_toggle();
356 return (MCA_MORE);
357 case '!':
358 /* "-!" = SET */
359 optflag = (flag == OPT_SET) ?
360 OPT_TOGGLE : OPT_SET;
361 mca_opt_toggle();
362 return (MCA_MORE);
363 case CONTROL('P'):
364 optflag ^= OPT_NO_PROMPT;
365 mca_opt_toggle();
366 return (MCA_MORE);
367 case '-':
368 /* "--" = long option name. */
369 optgetname = TRUE;
370 mca_opt_toggle();
371 return (MCA_MORE);
372 }
373 }
374 /* Char was not handled here. */
375 return (NO_MCA);
376}
377
378/*
379 * Add a char to a long option name.

Callers 1

mca_opt_charFunction · 0.85

Calls 1

mca_opt_toggleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…