Skip to content

Commit b95a5ff

Browse files
authored
Let gmtread (externals only) also respect the -R option. (#9148)
It has to resort to the trick to call gmtselect -R.
1 parent 45da506 commit b95a5ff

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/gmtread.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ EXTERN_MSC int GMT_gmtread (void *V_API, int mode, void *args) {
189189

190190
/*---------------------------- This is the gmtread main code ----------------------------*/
191191

192-
error = gmt_copy (API, Ctrl->T.mode, GMT_IN, Ctrl->IO.file[GMT_IN], Ctrl->IO.file[GMT_OUT]);
192+
if (Ctrl->T.mode == GMT_IS_DATASET && GMT->common.R.active[RSET]) {
193+
struct GMT_OPTION *opt_T = GMT_Find_Option (API, 'T', options);
194+
if (GMT_Delete_Option (API, opt_T, &options)) Return (API->error);
195+
error = GMT_Call_Module (API, "gmtselect", GMT_MODULE_OPT, options);
196+
}
197+
else
198+
error = gmt_copy (API, Ctrl->T.mode, GMT_IN, Ctrl->IO.file[GMT_IN], Ctrl->IO.file[GMT_OUT]);
193199
Return (error);
194200
}

0 commit comments

Comments
 (0)