File: main.c

package info (click to toggle)
grass 6.0.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 38,764 kB
  • ctags: 31,167
  • sloc: ansic: 320,650; tcl: 25,669; cpp: 10,098; sh: 9,695; makefile: 4,714; fortran: 1,846; yacc: 493; lex: 462; perl: 133; sed: 1
file content (72 lines) | stat: -rw-r--r-- 2,016 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/* *****************************************************************
 * *
 * * MODULE:       v.convert
 * * 
 * * AUTHOR(S):    Radim Blazek - Radim.Blazek@dhv.cz
 * *               
 * * PURPOSE:      Convert GRASS vector files versions:
 * *               from 3 or 4 to 5.0
 * *               
 * * COPYRIGHT:    (C) 2001 by the GRASS Development Team
 * *
 * *               This program is free software under the 
 * *               GNU General Public License (>=v2). 
 * *               Read the file COPYING that comes with GRASS
 * *               for details.
 * *
 * ****************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include "gis.h"
#include "Vect.h"
#include "conv.h"
#include "local_proto.h"

int 
main (int argc, char *argv[])
{
    struct Option *opt_in, *opt_out, *opt_end;
    int    endian;
    struct GModule *module;

    module = G_define_module();
    module->description = "Imports older versions of GRASS vectors.";

    /* input vector map */
    opt_in = G_define_option();
    opt_in->key         = "input";
    opt_in->type        = TYPE_STRING ;
    opt_in->required    = YES ;
    opt_in->multiple    = NO ;
    opt_in->gisprompt   = "old,dig,vector" ;
    opt_in->description = "input vector map";

    /* output vector map */
    opt_out = G_define_standard_option(G_OPT_V_OUTPUT);

    /* endian of input vector map */
    opt_end = G_define_option();
    opt_end->key         = "endian";
    opt_end->type        = TYPE_STRING ;
    opt_end->required    = NO;
    opt_end->multiple    = NO;
    opt_end->options     = "big,little";
    opt_end->description = "endian of input vector map";
    opt_end->answer = "big";

    G_gisinit(argv[0]);

    if (G_parser(argc,argv))
        exit(-1);

    /* Numbers in portable format files are saved as big endians */
    if ( opt_end->answer[0] == 'l' )
	endian = ENDIAN_LITTLE;
    else
	endian = ENDIAN_BIG;

    old2new (opt_in->answer, opt_out->answer, endian);

    exit(0);
}