Kaynağa Gözat

g.ppmtopng: update options
update manual page


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54648 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 12 yıl önce
ebeveyn
işleme
62b39a76ab
2 değiştirilmiş dosya ile 17 ekleme ve 25 silme
  1. 5 2
      general/g.ppmtopng/g.ppmtopng.html
  2. 12 23
      general/g.ppmtopng/main.c

+ 5 - 2
general/g.ppmtopng/g.ppmtopng.html

@@ -1,8 +1,11 @@
 <h2>DESCRIPTION</h2>
 
-<p>A utility to convert between PPM/PGM and PNG image formats.
+<p><em>g.ppmtopng</em> isn't meant for end users. It's a utility to
+convert between PPM/PGM and PNG image formats.
 
 <h2>AUTHOR</h2>
+
 Glynn Clements
 
-<p><i>Last changed: $Date$</i>
+<p>
+<i>Last changed: $Date$</i>

+ 12 - 23
general/g.ppmtopng/main.c

@@ -31,10 +31,10 @@ static void read_ppm(const char *filename)
 
     input = fopen(filename, "rb");
     if (!input)
-	G_fatal_error(_("unable to open input file %s"), filename);
+	G_fatal_error(_("Unable to open input file %s"), filename);
 
     if (fscanf(input, "P6 %d %d %d", &width, &height, &maxval) != 3)
-	G_fatal_error(_("invalid input file %s"), filename);
+	G_fatal_error(_("Invalid input file %s"), filename);
 
     fgetc(input);
 
@@ -67,18 +67,18 @@ static void write_png(const char *filename)
 
     png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, &jbuf, NULL, NULL);
     if (!png_ptr)
-	G_fatal_error(_("unable to allocate PNG structure"));
+	G_fatal_error(_("Unable to allocate PNG structure"));
 
     info_ptr = png_create_info_struct(png_ptr);
     if (!info_ptr)
-	G_fatal_error(_("unable to allocate PNG structure"));
+	G_fatal_error(_("Unable to allocate PNG structure"));
 
     if (setjmp(png_jmpbuf(png_ptr)))
-	G_fatal_error(_("error writing PNG file"));
+	G_fatal_error(_("Error writing PNG file"));
 
     output = fopen(filename, "wb");
     if (!output)
-	G_fatal_error(_("unable to open output file %s"), filename);
+	G_fatal_error(_("Unable to open output file %s"), filename);
 
     png_init_io(png_ptr, output);
 
@@ -115,23 +115,12 @@ int main(int argc, char *argv[])
 
     module = G_define_module();
     G_add_keyword(_("general"));
-    G_add_keyword(_("gui"));
-    module->description = "Converts between PPM/PGM and PNG image formats";
-
-    opt.in = G_define_option();
-    opt.in->key = "input";
-    opt.in->type = TYPE_STRING;
-    opt.in->required = YES;
-    opt.in->multiple = YES;
-    opt.in->description = _("Name of input file");
-    opt.in->gisprompt = "old_file,file,input";
-
-    opt.out = G_define_option();
-    opt.out->key = "output";
-    opt.out->type = TYPE_STRING;
-    opt.out->required = YES;
-    opt.out->description = _("Name of output file");
-    opt.out->gisprompt = "new_file,file,output";
+    G_add_keyword(_("display"));
+    module->description = _("Converts between PPM/PGM and PNG image formats.");
+
+    opt.in = G_define_standard_option(G_OPT_F_INPUT);
+
+    opt.out = G_define_standard_option(G_OPT_F_OUTPUT);
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);