1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-22 12:39:42 +00:00

Applied patch from GWater + other minor fixes

This commit is contained in:
Nicolay Korslund 2010-05-18 10:08:12 +02:00
parent 8c21616ce5
commit 3e157ff2b8
10 changed files with 84 additions and 97 deletions

View file

@ -1,5 +1,5 @@
/* /*
File autogenerated by gengetopt version 2.22.1 File autogenerated by gengetopt version 2.22.2
generated with the following command: generated with the following command:
gengetopt --unamed-opts=BSA-FILE -F bsatool_cmd -G gengetopt --unamed-opts=BSA-FILE -F bsatool_cmd -G
@ -17,6 +17,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef FIX_UNUSED
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
#endif
#include "bsatool_cmd.h" #include "bsatool_cmd.h"
@ -64,6 +68,7 @@ void clear_given (struct gengetopt_args_info *args_info)
static static
void clear_args (struct gengetopt_args_info *args_info) void clear_args (struct gengetopt_args_info *args_info)
{ {
FIX_UNUSED (args_info);
args_info->extract_arg = NULL; args_info->extract_arg = NULL;
args_info->extract_orig = NULL; args_info->extract_orig = NULL;
@ -84,7 +89,9 @@ void init_args_info(struct gengetopt_args_info *args_info)
void void
cmdline_parser_print_version (void) cmdline_parser_print_version (void)
{ {
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); printf ("%s %s\n",
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
CMDLINE_PARSER_VERSION);
} }
static void print_help_common(void) { static void print_help_common(void) {
@ -118,7 +125,7 @@ cmdline_parser_init (struct gengetopt_args_info *args_info)
clear_args (args_info); clear_args (args_info);
init_args_info (args_info); init_args_info (args_info);
args_info->inputs = NULL; args_info->inputs = 0;
args_info->inputs_num = 0; args_info->inputs_num = 0;
} }
@ -174,8 +181,9 @@ cmdline_parser_release (struct gengetopt_args_info *args_info)
static void static void
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
{ {
FIX_UNUSED (values);
if (arg) { if (arg) {
fprintf(outfile, "%s=\"%s\"\n", opt, arg); fprintf(outfile, "%s=\"%s\"\n", opt, arg);
} else { } else {
@ -239,7 +247,7 @@ cmdline_parser_free (struct gengetopt_args_info *args_info)
char * char *
gengetopt_strdup (const char *s) gengetopt_strdup (const char *s)
{ {
char *result = NULL; char *result = 0;
if (!s) if (!s)
return result; return result;
@ -261,7 +269,7 @@ cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *ar
struct cmdline_parser_params *params) struct cmdline_parser_params *params)
{ {
int result; int result;
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); result = cmdline_parser_internal (argc, argv, args_info, params, 0);
if (result == EXIT_FAILURE) if (result == EXIT_FAILURE)
{ {
@ -284,7 +292,7 @@ cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_
params.check_ambiguity = 0; params.check_ambiguity = 0;
params.print_errors = 1; params.print_errors = 1;
result = cmdline_parser_internal (argc, argv, args_info, &params, NULL); result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
if (result == EXIT_FAILURE) if (result == EXIT_FAILURE)
{ {
@ -298,6 +306,8 @@ cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_
int int
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
{ {
FIX_UNUSED (args_info);
FIX_UNUSED (prog_name);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -331,37 +341,6 @@ struct option
int val; int val;
}; };
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
static char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
static int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
static int opterr;
/* Set to an option character which was unrecognized. */
static int optopt;
/* This version of `getopt' appears to the caller like standard Unix `getopt' /* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments. to intersperse the options with the other arguments.
@ -948,13 +927,15 @@ static char *package_name = 0;
static static
int update_arg(void *field, char **orig_field, int update_arg(void *field, char **orig_field,
unsigned int *field_given, unsigned int *prev_given, unsigned int *field_given, unsigned int *prev_given,
char *value, char *possible_values[], const char *default_value, char *value, const char *possible_values[],
const char *default_value,
cmdline_parser_arg_type arg_type, cmdline_parser_arg_type arg_type,
int check_ambiguity, int override, int check_ambiguity, int override,
int no_free, int multiple_option, int no_free, int multiple_option,
const char *long_opt, char short_opt, const char *long_opt, char short_opt,
const char *additional_error) const char *additional_error)
{ {
FIX_UNUSED (field);
char *stop_char = 0; char *stop_char = 0;
const char *val = value; const char *val = value;
int found; int found;
@ -976,6 +957,7 @@ int update_arg(void *field, char **orig_field,
return 1; /* failure */ return 1; /* failure */
} }
FIX_UNUSED (default_value);
if (field_given && *field_given && ! override) if (field_given && *field_given && ! override)
return 0; return 0;
@ -1021,7 +1003,8 @@ int update_arg(void *field, char **orig_field,
int int
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, cmdline_parser_internal (
int argc, char * const *argv, struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params, const char *additional_error) struct cmdline_parser_params *params, const char *additional_error)
{ {
int c; /* Character of the parsed option. */ int c; /* Character of the parsed option. */
@ -1034,6 +1017,11 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
int check_required; int check_required;
int check_ambiguity; int check_ambiguity;
char *optarg;
int optind;
int opterr;
int optopt;
package_name = argv[0]; package_name = argv[0];
override = params->override; override = params->override;
@ -1060,7 +1048,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
{ "version", 0, NULL, 'V' }, { "version", 0, NULL, 'V' },
{ "extract", 1, NULL, 'x' }, { "extract", 1, NULL, 'x' },
{ "long", 0, NULL, 'l' }, { "long", 0, NULL, 'l' },
{ NULL, 0, NULL, 0 } { 0, 0, 0, 0 }
}; };
custom_optarg = optarg; custom_optarg = optarg;

View file

@ -1,6 +1,6 @@
/** @file bsatool_cmd.h /** @file bsatool_cmd.h
* @brief The header file for the command line option parser * @brief The header file for the command line option parser
* generated by GNU Gengetopt version 2.22.1 * generated by GNU Gengetopt version 2.22.2
* http://www.gnu.org/software/gengetopt. * http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten * DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */ * @author GNU Gengetopt by Lorenzo Bettini */
@ -20,10 +20,15 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifndef CMDLINE_PARSER_PACKAGE #ifndef CMDLINE_PARSER_PACKAGE
/** @brief the program name */ /** @brief the program name (used for printing errors) */
#define CMDLINE_PARSER_PACKAGE "bsatool" #define CMDLINE_PARSER_PACKAGE "bsatool"
#endif #endif
#ifndef CMDLINE_PARSER_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
#define CMDLINE_PARSER_PACKAGE_NAME "bsatool"
#endif
#ifndef CMDLINE_PARSER_VERSION #ifndef CMDLINE_PARSER_VERSION
/** @brief the program version */ /** @brief the program version */
#define CMDLINE_PARSER_VERSION "1.0" #define CMDLINE_PARSER_VERSION "1.0"

View file

@ -9,10 +9,10 @@ PROGS=*_test
for a in $PROGS; do for a in $PROGS; do
if [ -f "output/$a.out" ]; then if [ -f "output/$a.out" ]; then
echo "Running $a:" echo "Running $a:"
$a | diff output/$a.out - ./$a | diff output/$a.out -
else else
echo "Creating $a.out" echo "Creating $a.out"
$a > "output/$a.out" ./$a > "output/$a.out"
git add "output/$a.out" git add "output/$a.out"
fi fi
done done

View file

@ -1,5 +1,5 @@
/* /*
File autogenerated by gengetopt version 2.22 File autogenerated by gengetopt version 2.22.2
generated with the following command: generated with the following command:
gengetopt --unamed-opts=ES-FILE -F esmtool_cmd -G gengetopt --unamed-opts=ES-FILE -F esmtool_cmd -G
@ -17,6 +17,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef FIX_UNUSED
#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
#endif
#include "esmtool_cmd.h" #include "esmtool_cmd.h"
@ -65,6 +69,7 @@ void clear_given (struct gengetopt_args_info *args_info)
static static
void clear_args (struct gengetopt_args_info *args_info) void clear_args (struct gengetopt_args_info *args_info)
{ {
FIX_UNUSED (args_info);
} }
@ -84,7 +89,9 @@ void init_args_info(struct gengetopt_args_info *args_info)
void void
cmdline_parser_print_version (void) cmdline_parser_print_version (void)
{ {
printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION); printf ("%s %s\n",
(strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
CMDLINE_PARSER_VERSION);
} }
static void print_help_common(void) { static void print_help_common(void) {
@ -99,7 +106,7 @@ static void print_help_common(void) {
printf("\n"); printf("\n");
if (strlen(gengetopt_args_info_description) > 0) if (strlen(gengetopt_args_info_description) > 0)
printf("%s\n", gengetopt_args_info_description); printf("%s\n\n", gengetopt_args_info_description);
} }
void void
@ -118,7 +125,7 @@ cmdline_parser_init (struct gengetopt_args_info *args_info)
clear_args (args_info); clear_args (args_info);
init_args_info (args_info); init_args_info (args_info);
args_info->inputs = NULL; args_info->inputs = 0;
args_info->inputs_num = 0; args_info->inputs_num = 0;
} }
@ -163,8 +170,9 @@ cmdline_parser_release (struct gengetopt_args_info *args_info)
static void static void
write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[]) write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
{ {
FIX_UNUSED (values);
if (arg) { if (arg) {
fprintf(outfile, "%s=\"%s\"\n", opt, arg); fprintf(outfile, "%s=\"%s\"\n", opt, arg);
} else { } else {
@ -230,7 +238,7 @@ cmdline_parser_free (struct gengetopt_args_info *args_info)
char * char *
gengetopt_strdup (const char *s) gengetopt_strdup (const char *s)
{ {
char *result = NULL; char *result = 0;
if (!s) if (!s)
return result; return result;
@ -252,7 +260,7 @@ cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *ar
struct cmdline_parser_params *params) struct cmdline_parser_params *params)
{ {
int result; int result;
result = cmdline_parser_internal (argc, argv, args_info, params, NULL); result = cmdline_parser_internal (argc, argv, args_info, params, 0);
if (result == EXIT_FAILURE) if (result == EXIT_FAILURE)
{ {
@ -275,7 +283,7 @@ cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_
params.check_ambiguity = 0; params.check_ambiguity = 0;
params.print_errors = 1; params.print_errors = 1;
result = cmdline_parser_internal (argc, argv, args_info, &params, NULL); result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
if (result == EXIT_FAILURE) if (result == EXIT_FAILURE)
{ {
@ -289,6 +297,8 @@ cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_
int int
cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name) cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
{ {
FIX_UNUSED (args_info);
FIX_UNUSED (prog_name);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -322,37 +332,6 @@ struct option
int val; int val;
}; };
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
static char *optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
static int optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
static int opterr;
/* Set to an option character which was unrecognized. */
static int optopt;
/* This version of `getopt' appears to the caller like standard Unix `getopt' /* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments. to intersperse the options with the other arguments.
@ -734,7 +713,7 @@ static int check_short_opt(int argc, char *const *argv, const char *optstring,
int print_errors, struct custom_getopt_data *d) int print_errors, struct custom_getopt_data *d)
{ {
char c = *d->nextchar++; char c = *d->nextchar++;
char *temp = strchr(optstring, c); const char *temp = strchr(optstring, c);
/* Increment `custom_optind' when we start to process its last character. */ /* Increment `custom_optind' when we start to process its last character. */
if (*d->nextchar == '\0') if (*d->nextchar == '\0')
@ -939,13 +918,15 @@ static char *package_name = 0;
static static
int update_arg(void *field, char **orig_field, int update_arg(void *field, char **orig_field,
unsigned int *field_given, unsigned int *prev_given, unsigned int *field_given, unsigned int *prev_given,
char *value, char *possible_values[], const char *default_value, char *value, const char *possible_values[],
const char *default_value,
cmdline_parser_arg_type arg_type, cmdline_parser_arg_type arg_type,
int check_ambiguity, int override, int check_ambiguity, int override,
int no_free, int multiple_option, int no_free, int multiple_option,
const char *long_opt, char short_opt, const char *long_opt, char short_opt,
const char *additional_error) const char *additional_error)
{ {
FIX_UNUSED (field);
char *stop_char = 0; char *stop_char = 0;
const char *val = value; const char *val = value;
int found; int found;
@ -966,6 +947,7 @@ int update_arg(void *field, char **orig_field,
return 1; /* failure */ return 1; /* failure */
} }
FIX_UNUSED (default_value);
if (field_given && *field_given && ! override) if (field_given && *field_given && ! override)
return 0; return 0;
@ -1003,7 +985,8 @@ int update_arg(void *field, char **orig_field,
int int
cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info, cmdline_parser_internal (
int argc, char * const *argv, struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params, const char *additional_error) struct cmdline_parser_params *params, const char *additional_error)
{ {
int c; /* Character of the parsed option. */ int c; /* Character of the parsed option. */
@ -1016,6 +999,11 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
int check_required; int check_required;
int check_ambiguity; int check_ambiguity;
char *optarg;
int optind;
int opterr;
int optopt;
package_name = argv[0]; package_name = argv[0];
override = params->override; override = params->override;
@ -1043,7 +1031,7 @@ cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_inf
{ "raw", 0, NULL, 'r' }, { "raw", 0, NULL, 'r' },
{ "quiet", 0, NULL, 'q' }, { "quiet", 0, NULL, 'q' },
{ "loadcells", 0, NULL, 'C' }, { "loadcells", 0, NULL, 'C' },
{ NULL, 0, NULL, 0 } { 0, 0, 0, 0 }
}; };
custom_optarg = optarg; custom_optarg = optarg;

View file

@ -1,6 +1,6 @@
/** @file esmtool_cmd.h /** @file esmtool_cmd.h
* @brief The header file for the command line option parser * @brief The header file for the command line option parser
* generated by GNU Gengetopt version 2.22 * generated by GNU Gengetopt version 2.22.2
* http://www.gnu.org/software/gengetopt. * http://www.gnu.org/software/gengetopt.
* DO NOT modify this file, since it can be overwritten * DO NOT modify this file, since it can be overwritten
* @author GNU Gengetopt by Lorenzo Bettini */ * @author GNU Gengetopt by Lorenzo Bettini */
@ -20,10 +20,15 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifndef CMDLINE_PARSER_PACKAGE #ifndef CMDLINE_PARSER_PACKAGE
/** @brief the program name */ /** @brief the program name (used for printing errors) */
#define CMDLINE_PARSER_PACKAGE "esmtool" #define CMDLINE_PARSER_PACKAGE "esmtool"
#endif #endif
#ifndef CMDLINE_PARSER_PACKAGE_NAME
/** @brief the complete program name (used for help and version) */
#define CMDLINE_PARSER_PACKAGE_NAME "esmtool"
#endif
#ifndef CMDLINE_PARSER_VERSION #ifndef CMDLINE_PARSER_VERSION
/** @brief the program version */ /** @brief the program version */
#define CMDLINE_PARSER_VERSION "1.0" #define CMDLINE_PARSER_VERSION "1.0"

View file

@ -9,10 +9,10 @@ PROGS=*_test
for a in $PROGS; do for a in $PROGS; do
if [ -f "output/$a.out" ]; then if [ -f "output/$a.out" ]; then
echo "Running $a:" echo "Running $a:"
$a | diff output/$a.out - ./$a | diff output/$a.out -
else else
echo "Creating $a.out" echo "Creating $a.out"
$a > "output/$a.out" ./$a > "output/$a.out"
git add "output/$a.out" git add "output/$a.out"
fi fi
done done

View file

@ -1 +1 @@
Manually loading mesh mesh1 hello

View file

@ -9,10 +9,10 @@ PROGS=*_test
for a in $PROGS; do for a in $PROGS; do
if [ -f "output/$a.out" ]; then if [ -f "output/$a.out" ]; then
echo "Running $a:" echo "Running $a:"
$a | diff output/$a.out - ./$a | diff output/$a.out -
else else
echo "Creating $a.out" echo "Creating $a.out"
$a > "output/$a.out" ./$a > "output/$a.out"
git add "output/$a.out" git add "output/$a.out"
fi fi
done done

View file

@ -2,6 +2,7 @@
function run() function run()
{ {
echo "$1/tests/:"
cd "$1/tests/" cd "$1/tests/"
./test.sh ./test.sh
cd ../../ cd ../../

View file

@ -9,10 +9,10 @@ PROGS=*_test
for a in $PROGS; do for a in $PROGS; do
if [ -f "output/$a.out" ]; then if [ -f "output/$a.out" ]; then
echo "Running $a:" echo "Running $a:"
$a | diff output/$a.out - ./$a | diff output/$a.out -
else else
echo "Creating $a.out" echo "Creating $a.out"
$a > "output/$a.out" ./$a > "output/$a.out"
git add "output/$a.out" git add "output/$a.out"
fi fi
done done