! . */
| 4588 | |
| 4589 | /*! . */ |
| 4590 | void gmtlib_write_tableheader (struct GMT_CTRL *GMT, FILE *fp, char *txt) { |
| 4591 | /* Output ASCII segment header; skip if mode is binary. |
| 4592 | * We append a newline (\n) if not is present */ |
| 4593 | |
| 4594 | if (!GMT->current.setting.io_header[GMT_OUT]) return; /* No output headers requested */ |
| 4595 | if (gmt_M_binary_header (GMT, GMT_OUT)) /* Must write a binary header */ |
| 4596 | gmtlib_io_binary_header (GMT, fp, GMT_OUT); |
| 4597 | else if (!txt || !txt[0]) /* Blank header */ |
| 4598 | fprintf (fp, "%c\n", GMT->current.setting.io_head_marker_out); |
| 4599 | else if (txt[0] == GMT->current.setting.io_seg_marker[GMT_OUT]) |
| 4600 | fprintf (fp, "%s\n", txt); |
| 4601 | else { |
| 4602 | size_t L = strlen (txt), k = 0; |
| 4603 | fputc (GMT->current.setting.io_head_marker_out, fp); /* Make sure we have # at start */ |
| 4604 | while (k < L && strchr ("#\t ", txt[k])) k++; /* Skip header record indicator and leading whitespace */ |
| 4605 | if (k < L) fprintf (fp, " %s", &txt[k]); |
| 4606 | if (txt[L-1] != '\n') fputc ('\n', fp); /* Make sure we have \n at end */ |
| 4607 | } |
| 4608 | } |
| 4609 | |
| 4610 | void gmt_insert_tableheader (struct GMT_CTRL *GMT, struct GMT_DATATABLE *T, char *txt) { |
| 4611 | /* Add one more header record to the table */ |
no test coverage detected