[GRASS-dev] db.connect exit codes

currently if no DB/driver is defined (new mapset), "db.connect -p" returns
with an error code of 0.

G61> db.connect -p
driver:(null)
database:(null)
schema:(null)
group:(null)
G61> echo $?
0

This makes it hard to test in a script... (v.db.addtable fails)

I assume the (null) comes from printf("%s",..);

Is there anything wrong with setting it to something >0 and ideas on how
to do that?

Hamish

On 5/8/06, Hamish <hamish_nospam@yahoo.com> wrote:

currently if no DB/driver is defined (new mapset), "db.connect -p" returns
with an error code of 0.

G61> db.connect -p
driver:(null)
database:(null)
schema:(null)
group:(null)
G61> echo $?
0

This makes it hard to test in a script... (v.db.addtable fails)

I assume the (null) comes from printf("%s",..);

Is there anything wrong with setting it to something >0 and ideas on how
to do that?

But return code 0 is correct, it means that module successfully finished
and that is true. Module's return code cannot depend on defined driver.

Radim

Hamish

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

> currently if no DB/driver is defined (new mapset), "db.connect -p"
> returns with an error code of 0.
>
> G61> db.connect -p
> driver:(null)
> database:(null)
> schema:(null)
> group:(null)
> G61> echo $?
> 0
>
> This makes it hard to test in a script... (v.db.addtable fails)
>
> I assume the (null) comes from printf("%s",..);
>
> Is there anything wrong with setting it to something >0 and ideas on
> how to do that?

But return code 0 is correct, it means that module successfully
finished and that is true. Module's return code cannot depend on
defined driver.

Ok, we asked it a question and it answered us accurately & without
encountering any problems. test for "(null)" added to v.db.addtable.

Hamish