MCPcopy Index your code
hub / github.com/coreutils/coreutils / prjoin

Function prjoin

src/join.c:618–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

616/* Print the join of LINE1 and LINE2. */
617
618static void
619prjoin (struct line const *line1, struct line const *line2)
620{
621 const struct outlist *outlist;
622 idx_t field;
623 struct line const *line;
624
625 outlist = outlist_head.next;
626 if (outlist)
627 {
628 const struct outlist *o;
629
630 o = outlist;
631 while (true)
632 {
633 if (o->file == 0)
634 {
635 if (line1 == &uni_blank)
636 {
637 line = line2;
638 field = join_field_2;
639 }
640 else
641 {
642 line = line1;
643 field = join_field_1;
644 }
645 }
646 else
647 {
648 line = (o->file == 1 ? line1 : line2);
649 field = o->field;
650 }
651 prfield (field, line);
652 o = o->next;
653 if (o == NULL)
654 break;
655 fwrite (output_separator, 1, output_seplen, stdout);
656 }
657 putchar (eolchar);
658 }
659 else
660 {
661 if (line1 == &uni_blank)
662 {
663 line = line2;
664 field = join_field_2;
665 }
666 else
667 {
668 line = line1;
669 field = join_field_1;
670 }
671
672 /* Output the join field. */
673 prfield (field, line);
674
675 /* Output other fields. */

Callers 1

joinFunction · 0.85

Calls 3

prfieldFunction · 0.85
prfieldsFunction · 0.85
write_errorFunction · 0.85

Tested by

no test coverage detected