[GRASS-SVN] r54904 - grass/trunk/imagery/i.landsat.toar
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Feb 4 08:02:54 PST 2013
Author: ychemin
Date: 2013-02-04 08:02:54 -0800 (Mon, 04 Feb 2013)
New Revision: 54904
Modified:
grass/trunk/imagery/i.landsat.toar/main.c
Log:
fail gracefully if -p does not have any lsatmet= arguments
Modified: grass/trunk/imagery/i.landsat.toar/main.c
===================================================================
--- grass/trunk/imagery/i.landsat.toar/main.c 2013-02-04 16:02:17 UTC (rev 54903)
+++ grass/trunk/imagery/i.landsat.toar/main.c 2013-02-04 16:02:54 UTC (rev 54904)
@@ -261,33 +261,33 @@
lsat.flag = METADATAFILE;
lsat_metadata( met, &lsat );
if(print_meta) {
+ if (lsatmet->answer == NULL) {
+ G_fatal_error(_("Please use a metadata keyword with -p"));
+ }
if (strcmp(lsatmet->answer, "number") == 0) {
fprintf(stdout,"%d\n",lsat.number);
}
- else if (strcmp(lsatmet->answer, "creation") == 0) {
+ if (strcmp(lsatmet->answer, "creation") == 0) {
fprintf(stdout,"%s\n",lsat.creation);
}
- else if (strcmp(lsatmet->answer, "date") == 0) {
+ if (strcmp(lsatmet->answer, "date") == 0) {
fprintf(stdout,"%s\n",lsat.date);
}
- else if (strcmp(lsatmet->answer, "sun_elev") == 0) {
+ if (strcmp(lsatmet->answer, "sun_elev") == 0) {
fprintf(stdout,"%f\n",lsat.sun_elev);
}
- else if (strcmp(lsatmet->answer, "sensor") == 0) {
+ if (strcmp(lsatmet->answer, "sensor") == 0) {
fprintf(stdout,"%s\n",lsat.sensor);
}
- else if (strcmp(lsatmet->answer, "bands") == 0) {
+ if (strcmp(lsatmet->answer, "bands") == 0) {
fprintf(stdout,"%d\n",lsat.bands);
}
- else if (strcmp(lsatmet->answer, "sunza") == 0) {
+ if (strcmp(lsatmet->answer, "sunza") == 0) {
fprintf(stdout,"%f\n",lsat.sunza);
}
- else if (strcmp(lsatmet->answer, "time") == 0) {
+ if (strcmp(lsatmet->answer, "time") == 0) {
fprintf(stdout,"%f\n",lsat.time);
}
- else {
- G_fatal_error(_("Please use a metadata keyword with -p"));
- }
exit(EXIT_SUCCESS);
}
G_debug(1, "lsat.number = %d, lsat.sensor = [%s]", lsat.number, lsat.sensor);
More information about the grass-commit
mailing list