Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /trunk/src/filedumper.c
Parent Directory
|
Revision Log
Revision 107 -
(show annotations)
(download)
(as text)
Sat Feb 7 11:50:37 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-csrc
File size: 2581 byte(s)
Sat Feb 7 11:50:37 2009 UTC (16 years, 1 month ago) by amb
File MIME type: text/x-csrc
File size: 2581 byte(s)
Add new command line options.
1 | /*************************************** |
2 | $Header: /home/amb/CVS/routino/src/filedumper.c,v 1.17 2009-02-07 11:50:37 amb Exp $ |
3 | |
4 | Memory file dumper. |
5 | ******************/ /****************** |
6 | Written by Andrew M. Bishop |
7 | |
8 | This file Copyright 2008,2009 Andrew M. Bishop |
9 | It may be distributed under the GNU Public License, version 2, or |
10 | any higher version. See section COPYING of the GNU Public license |
11 | for conditions under which this file may be redistributed. |
12 | ***************************************/ |
13 | |
14 | |
15 | #include <stdio.h> |
16 | #include <stdlib.h> |
17 | #include <string.h> |
18 | |
19 | #include "types.h" |
20 | #include "nodes.h" |
21 | #include "segments.h" |
22 | #include "ways.h" |
23 | #include "functions.h" |
24 | |
25 | |
26 | int main(int argc,char** argv) |
27 | { |
28 | Nodes *OSMNodes; |
29 | Segments *OSMSegments; |
30 | Ways *OSMWays; |
31 | char *dirname=NULL,*prefix=NULL,*filename; |
32 | |
33 | /* Parse the command line arguments */ |
34 | |
35 | while(--argc>=1) |
36 | { |
37 | if(!strcmp(argv[argc],"--help")) |
38 | goto usage; |
39 | else if(!strncmp(argv[argc],"--dir=",6)) |
40 | dirname=&argv[argc][6]; |
41 | else if(!strncmp(argv[argc],"--prefix=",9)) |
42 | prefix=&argv[argc][9]; |
43 | else |
44 | { |
45 | usage: |
46 | |
47 | fprintf(stderr,"Usage: filedumper\n" |
48 | " [--help]\n" |
49 | " [--dir=<name>] [--prefix=<name>]\n"); |
50 | |
51 | return(1); |
52 | } |
53 | } |
54 | |
55 | filename=(char*)malloc((dirname?strlen(dirname):0)+(prefix?strlen(prefix):0)+16); |
56 | |
57 | /* Examine the nodes */ |
58 | |
59 | sprintf(filename,"%s%s%s%snodes.mem",dirname?dirname:"",dirname?"/":"",prefix?prefix:"",prefix?"-":""); |
60 | OSMNodes=LoadNodeList(filename); |
61 | |
62 | printf("Nodes\n"); |
63 | printf("-----\n"); |
64 | |
65 | printf("sizeof(Node)=%9d Bytes\n",sizeof(Node)); |
66 | printf("number =%9d\n",OSMNodes->number); |
67 | |
68 | printf("Lat bins=%3d\n",OSMNodes->latbins); |
69 | printf("Lon bins=%3d\n",OSMNodes->lonbins); |
70 | |
71 | printf("Lat zero=%4.6f\n",OSMNodes->latzero); |
72 | printf("Lon zero=%4.6f\n",OSMNodes->lonzero); |
73 | |
74 | /* Examine the segments */ |
75 | |
76 | sprintf(filename,"%s%s%s%ssegments.mem",dirname?dirname:"",dirname?"/":"",prefix?prefix:"",prefix?"-":""); |
77 | OSMSegments=LoadSegmentList(filename); |
78 | |
79 | printf("\n"); |
80 | printf("Segments\n"); |
81 | printf("--------\n"); |
82 | |
83 | printf("sizeof(Segment)=%9d Bytes\n",sizeof(Segment)); |
84 | printf("number =%9d\n",OSMSegments->number); |
85 | |
86 | /* Examine the ways */ |
87 | |
88 | sprintf(filename,"%s%s%s%sways.mem",dirname?dirname:"",dirname?"/":"",prefix?prefix:"",prefix?"-":""); |
89 | OSMWays=LoadWayList(filename); |
90 | |
91 | printf("\n"); |
92 | printf("Ways\n"); |
93 | printf("----\n"); |
94 | |
95 | printf("sizeof(Way) =%9d Bytes\n",sizeof(Way)); |
96 | printf("number =%9d\n",OSMWays->number); |
97 | |
98 | return(0); |
99 | } |
Properties
Name | Value |
---|---|
cvs:description | Test program for mmap files. |