blob: ffb269e415be48c940733f40d8b4367f2d991f25 (
plain)
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
|
/*
* main.c
*
* "Main"
*
* (c) 2006-2009 Thomas White <thomas.white@desy.de>
*
* template_index - Indexing diffraction patterns by template matching
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static void main_show_help(const char *s)
{
printf("Syntax: %s <file1.h5> <file2.h5> [...]\n\n", s);
printf("Index diffraction patterns\n\n");
printf(" -h Display this help message\n");
}
int main(int argc, char *argv[])
{
int c;
char **in_files;
size_t nin;
size_t i;
while ((c = getopt(argc, argv, "h")) != -1) {
switch ( c ) {
case 'h' : {
main_show_help(argv[0]);
return 0;
}
}
}
if ( optind < argc ) {
nin = argc-optind;
in_files = malloc(nin*sizeof(char *));
for ( i=0; i<nin; i++ ) {
in_files[i] = strdup(argv[optind+i]);
}
} else {
fprintf(stderr, "No input files!\n");
return 1;
}
printf("Input files (%i):\n", nin);
for ( i=0; i<nin; i++ ) {
printf("%6i: %s\n", i+1, in_files[i]);
}
return 0;
}
|