Skip to content

Commit

Permalink
v.what: Fix script outputs (space after = or : instead of =) (OSGeo#1584
Browse files Browse the repository at this point in the history
)
  • Loading branch information
a0x8o committed May 18, 2021
1 parent 7c10386 commit e4a5d77
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions vector/v.what/what.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,31 +461,32 @@ void what(struct Map_info *Map, int nvects, char **vect, double east,
fprintf(stdout,
"Id=%d\nType=%s\nLeft=%d\nRight=%d\n",
line, buf, left, right);
if (type & GV_LINES)
fprintf(stdout, "Length=%f\n", l);
break;
case OUTPUT_JSON:
fprintf(stdout, "%s\"Feature_max_distance\": %f",
multiple ? "" : ",\n", maxdist);
fprintf(stdout,
",\n\"Id\": %d,\n\"Type\": \"%s\",\n\"Left\": %d,\n\"Right\": %d",
line, buf, left, right);
if (type & GV_LINES)
fprintf(stdout, ",\n\"Length\": %f", l);
break;
default:
fprintf(stdout, "Looking for features within: %f\n",
maxdist);
fprintf(stdout,
_("Id: %d\nType: %s\nLeft: %d\nRight: %d\n"),
line, buf, left, right);
if (type & GV_LINES)
fprintf(stdout, _("Length: %f\n"), l);
break;
}
if (type & GV_LINES) {
if (type & GV_LINES)
nnodes = 2;
fprintf(stdout, _("Length: %f\n"), l);
}
else { /* points */
else /* points */
nnodes = 0;
if (output != OUTPUT_SCRIPT)
fprintf(stdout, "\n");
}

if (nnodes > 0)
Vect_get_line_nodes(&(Map[i]), line, &node[0], &node[1]);
Expand Down Expand Up @@ -521,15 +522,15 @@ void what(struct Map_info *Map, int nvects, char **vect, double east,
Vect_get_node_line_angle(&(Map[i]), node[n], nli);
switch (output) {
case OUTPUT_SCRIPT:
fprintf(stdout, "Id=%5d\nAngle=%.8f\n",
fprintf(stdout, "Id=%d\nAngle=%.8f\n",
nodeline, angle);
break;
case OUTPUT_JSON:
fprintf(stdout, ",\n\"Id\": %5d,\n\"Angle\": %.8f",
fprintf(stdout, ",\n\"Id\": %d,\n\"Angle\": %.8f",
nodeline, angle);
break;
default:
fprintf(stdout, _("Id: %5d\nAngle: %.8f\n"),
fprintf(stdout, _("Id: %d\nAngle: %.8f\n"),
nodeline, angle);
break;
}
Expand Down

0 comments on commit e4a5d77

Please sign in to comment.