|
k-dot-p 0.1
|
#include <glib.h>#include <gio/gio.h>
Include dependency graph for makestruct_argprocess.h++:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Classes | |
| struct | makestruct_args |
Functions | |
| int | parse_makestruct_args (int argc, char **argv, struct makestruct_args *args) |
| int parse_makestruct_args | ( | int | argc, |
| char ** | argv, | ||
| struct makestruct_args * | args | ||
| ) |
Definition at line 42 of file makestruct_argprocess.c++.
References makestruct_args::files, makestruct_args::matdb, print_version(), and print_version_info().
Referenced by main().
{
int errored = 0;
gchar **file_names = NULL;
gboolean print_version = FALSE;
args->matdb = (char*)"/home/solarion/dist/share/materials-databases/matdb.txt";
GOptionEntry options[] = {
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &file_names,},
{ "version", 'v', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &print_version, "Print version information about this program", NULL },
{ "matdb", 'm', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING, &(args->matdb), "Use an alternate materials database file.", NULL },
{NULL, 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING, NULL, "", ""},
};
GOptionContext *ctx;
ctx = g_option_context_new("- sets up a structure for k-dot-p calculations");
g_option_context_add_main_entries(ctx, options, "Options");
g_option_context_parse(ctx, &argc, &argv, NULL);
gchar* htext = g_option_context_get_help(ctx, FALSE, NULL);
g_option_context_free(ctx);
args->files = NULL;
if(file_names != NULL) {
for(int i = 0; file_names[i] != NULL; i++) {
args->files = g_list_append(args->files, g_file_new_for_commandline_arg(file_names[i]));
}
}
if(args->files == NULL) {
fprintf(stderr, "ERROR: you MUST give at least one file to process!\n");
errored=1;
}
if(print_version){
print_version_info();
return 1;
}
if(errored){
printf("%s", htext);
printf("\n\n**For version and compilation information, run with --version***\n");
return 3;
}
return 0;
}
Here is the call graph for this function:
Here is the caller graph for this function: