[GRASS5] ps.map problem resolved

Radim's suggestion indeed resolved the problem. From the
cygwin command line, I ran

tr -d '\015' < oldmapinstructions > newmapinstructions

and newmapinstructions ran with a problem as the input to ps.map

Thank you very much.

(I remain puzzled why the "size 1" line did NOT cause a
problem, only the "color red" line.)

Best,

Michael Ash

> I am using GRASS 5.0pre3 on Cygwin/Windows
> I gave ps.map the following mapping instruction file
> sites censusbg
> color red
> size 1
> end
> raster onsitegridlogscore
> end
>
> ps.map rejects the file with the following message:
> PS-PAINT: using default configuration values.
> : illegal color request
>
> If I remove the color instruction from the mapping
> instruction file, then there is no complaint and the map is
> produced (without the desired color).
>
> If I give the instructions interactively, then there is no
> complaint and the map is produced (with the desired color)

It could be problem with line endings. If the file is written on
windows, try to remove <CR> by "tr -d '\015'"

Michael Ash, Assistant Professor
  of Economics and Public Policy
Department of Economics and CPPA
University of Massachusetts
Amherst, MA 01003
Tel 413-545-6329 Fax 413-545-2921
Email mash@econs.umass.edu
http://www-unix.oit.umass.edu/~maash

On Thursday 24 October 2002 08:04 pm, Michael Ash wrote:

Radim's suggestion indeed resolved the problem. From the
cygwin command line, I ran

tr -d '\015' < oldmapinstructions > newmapinstructions

and newmapinstructions ran with a problem as the input to ps.map

Thank you very much.

(I remain puzzled why the "size 1" line did NOT cause a
problem, only the "color red" line.)

Size as integer is converted to number by atoi() which handles <CR>,
color is string, compared to existing colors by strcmp().
We should use G_chop() before comparison which should remove both
'\n' and '\r'.

Radim

Michael Ash wrote:

(I remain puzzled why the "size 1" line did NOT cause a
problem, only the "color red" line.)

The code which processes "size" calls C's sscanf() operator, which
stops when it reaches an invalid character. OTOH, the code which
processes "color" strips any spaces and tabs, then uses strcmp() to
compare the string against each element of a table until it finds a
match.

We should probably change functions such as G_strip(), G_getl() etc to
strip any trailing CR characters.

--
Glynn Clements <glynn.clements@virgin.net>