@@ -108,7 +108,7 @@ GMT_LOCAL GDALDatasetH gdal_vector (struct GMT_CTRL *GMT, char *fname) {
108
108
109
109
/* ------------------------------------------------------------------------------------------------------------ */
110
110
GMT_LOCAL char * * breakMe (struct GMT_CTRL * GMT , char * in ) {
111
- /* Breake a string "-aa -bb -cc dd " into tokens "-aa" "-bb" "-cc" "dd" */
111
+ /* Break a string "-mo TIFFTAG_XRESOLUTION=300 -a_srs '+proj=stere +lat_0=90' " into tokens */
112
112
/* Based on GMT_Create_Options() */
113
113
unsigned int pos = 0 , k , n_args = 0 ;
114
114
bool quoted ;
@@ -122,11 +122,11 @@ GMT_LOCAL char ** breakMe(struct GMT_CTRL *GMT, char *in) {
122
122
txt_in = strdup (in );
123
123
args = gmt_M_memory (GMT , NULL , n_alloc , char * );
124
124
125
- /* txt_in can contain options that take multi-word text strings, e.g., -B+t"My title" . We avoid the problem of splitting
126
- * these items by temporarily replacing spaces inside quoted strings with ASCII 31 US (Unit Separator), do the strtok on
125
+ /* txt_in can contain options that take multi-word text strings, e.g., '+proj=stere +lat_0=90' . We avoid the problem of splitting
126
+ * these items by temporarily replacing spaces inside single quoted strings with ASCII 31 US (Unit Separator), do the strtok on
127
127
* space, and then replace all ASCII 31 with space at the end (we do the same for tab using ASCII 29 GS (group separator) */
128
128
for (k = 0 , quoted = false; txt_in [k ]; k ++ ) {
129
- if (txt_in [k ] == '\" ' ) quoted = !quoted ; /* Initially false, becomes true at start of quote, then false when exit quote */
129
+ if (txt_in [k ] == '\' ' ) quoted = !quoted ; /* Initially false, becomes true at start of quote, then false when exit quote */
130
130
else if (quoted && txt_in [k ] == '\t' ) txt_in [k ] = GMT_ASCII_GS ;
131
131
else if (quoted && txt_in [k ] == ' ' ) txt_in [k ] = GMT_ASCII_US ;
132
132
}
@@ -139,7 +139,7 @@ GMT_LOCAL char ** breakMe(struct GMT_CTRL *GMT, char *in) {
139
139
p [k ] = ' ' ; /* Replace spaces and tabs masked above */
140
140
}
141
141
for (i = o = 0 ; p [i ]; i ++ )
142
- if (p [i ] != '\"' ) p [o ++ ] = p [i ]; /* Ignore double quotes */
142
+ if (p [i ] != '\"' ) p [o ++ ] = p [i ]; /* Ignore any double quotes */
143
143
p [o ] = '\0' ;
144
144
args [n_args ++ ] = strdup (p );
145
145
@@ -148,7 +148,7 @@ GMT_LOCAL char ** breakMe(struct GMT_CTRL *GMT, char *in) {
148
148
args = gmt_M_memory (GMT , args , n_alloc , char * );
149
149
}
150
150
}
151
- for (k = 0 ; txt_in [k ]; k ++ ) /* Restore input string to prestine condition */
151
+ for (k = 0 ; txt_in [k ]; k ++ ) /* Restore input string to pristine condition */
152
152
if (txt_in [k ] == GMT_ASCII_GS ) txt_in [k ] = '\t' ;
153
153
else if (txt_in [k ] == GMT_ASCII_US ) txt_in [k ] = ' ' ; /* Replace spaces and tabs masked above */
154
154
0 commit comments