@@ -3832,7 +3832,7 @@ GMT_LOCAL int gmtinit_parse4_B_option (struct GMT_CTRL *GMT, char *in) {
3832
3832
}
3833
3833
3834
3834
if (out3[0] == '\0') continue; /* No intervals */
3835
- GMT->current.map.frame.set = true; /* Got here so we are setting intervals */
3835
+ if (i < GMT_Z) GMT->current.map.frame.set = true; /* Got here so we are setting x/y intervals */
3836
3836
3837
3837
/* Parse the annotation/tick info string */
3838
3838
if (out3[0] == 'c')
@@ -4318,7 +4318,7 @@ GMT_LOCAL int gmtinit_parse5_B_option (struct GMT_CTRL *GMT, char *in) {
4318
4318
/* Now parse the annotation/tick info string */
4319
4319
4320
4320
if (orig_string[0] == '\0') continue; /* Got nothing */
4321
- GMT->current.map.frame.set = true; /* Got here so we are setting intervals */
4321
+ if (no < GMT_Z) GMT->current.map.frame.set = true; /* Got here so we are setting intervals */
4322
4322
if (strstr (orig_string, "pi")) GMT->current.map.frame.axis[no].substitute_pi = true; /* Use pi in formatting labels */
4323
4323
4324
4324
gmt_M_memset (string, GMT_BUFSIZ, char);
@@ -15815,7 +15815,7 @@ GMT_LOCAL int gmtinit_parse_proj4 (struct GMT_CTRL *GMT, char *item, char *dest)
15815
15815
*/
15816
15816
int gmt_parse_common_options (struct GMT_CTRL *GMT, char *list, char option, char *item) {
15817
15817
15818
- int error = 0, i = 0; /* The i and i+= GMT_more_than_once are there to avoid compiler warnings... */
15818
+ int error = 0, i = 0, q = 0 ; /* The i and i+= GMT_more_than_once are there to avoid compiler warnings... */
15819
15819
15820
15820
if (!list || !strchr (list, option)) return (0); /* Not a common option we accept */
15821
15821
@@ -15831,28 +15831,29 @@ int gmt_parse_common_options (struct GMT_CTRL *GMT, char *list, char option, cha
15831
15831
switch (option) { /* Handle parsing of this option, if allowed here */
15832
15832
case 'B':
15833
15833
switch (item[0]) { /* Check for -B[p] and -Bs */
15834
- case 's': GMT->common.B.active[GMT_SECONDARY] = true; break;
15834
+ case 'p': GMT->common.B.active[GMT_PRIMARY] = true; q = 1; break;
15835
+ case 's': GMT->common.B.active[GMT_SECONDARY] = true; q = 1; break;
15835
15836
default: GMT->common.B.active[GMT_PRIMARY] = true; break;
15836
15837
}
15837
15838
if (!error) {
15838
- if (GMT->current.setting.run_mode == GMT_MODERN && !GMT->current.map.frame.set) {
15839
+ if (GMT->current.setting.run_mode == GMT_MODERN && ( !GMT->current.map.frame.set || item[q] == 'z') ) {
15839
15840
char code[2], args[GMT_LEN256] = {""}, *c = strchr (item, '+'); /* Start of modifiers, if any */
15840
- if (item[0 ] && strstr (item, "+f")) GMT->current.plot.calclock.geo.wesn = 1; /* Got +f, so enable W|E|S|N suffices */
15841
+ if (item[q ] && strstr (item, "+f")) GMT->current.plot.calclock.geo.wesn = 1; /* Got +f, so enable W|E|S|N suffices */
15841
15842
if (c && strchr ("aflLsSu", c[1])) /* We got the ones suitable for axes that we can chop off */
15842
15843
c[0] = '\0'; /* Temporarily chop off these modifiers only */
15843
- code[0] = item[0 ]; code[1] = (item[0 ]) ? item[1] : '\0';
15844
+ code[0] = item[q ]; code[1] = (item[q ]) ? item[q+ 1] : '\0';
15844
15845
if (c) c[0] = '+'; /* Restore modifiers */
15845
15846
if (code[0] == '\0') { /* Default is -Baf if nothing given */
15846
- strcpy (args, "af"); if (c) strcat (args, c);
15847
+ if (q) args[0] = item[0]; strcat (args, "af"); if (c) strcat (args, c);
15847
15848
}
15848
15849
else if (code[0] == 'x' && code[1] == '\0') { /* If indicating x we do -Bxaf */
15849
- strcpy (args, "xaf"); if (c) strcat (args, c);
15850
+ if (q) args[0] = item[0]; strcat (args, "xaf"); if (c) strcat (args, c);
15850
15851
}
15851
15852
else if (code[0] == 'y' && code[1] == '\0') { /* If indicating y we do -Byaf */
15852
- strcpy (args, "yaf"); if (c) strcat (args, c);
15853
+ if (q) args[0] = item[0]; strcat (args, "yaf"); if (c) strcat (args, c);
15853
15854
}
15854
15855
else if (code[0] == 'z' && code[1] == '\0') { /* If indicating z we do -Bzaf */
15855
- strcpy (args, "zaf"); if (c) strcat (args, c);
15856
+ if (q) args[0] = item[0]; strcat (args, "zaf"); if (c) strcat (args, c);
15856
15857
}
15857
15858
else /* Keep what we got */
15858
15859
strcpy (args, item);
0 commit comments