aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-12-18 15:22:49 +0100
committerThomas White <taw@physics.org>2018-12-18 15:38:13 +0100
commitb78860efdda0d5963b75b84925840c947e48609e (patch)
tree457d3590a26529544d2b14db3b82c9bf55db49ca /src
parent33d20aa3ea505e214fdcfc2c532b6bda28df7979 (diff)
make_pixelmap: Use <input>.h5 as default output filename
Diffstat (limited to 'src')
-rw-r--r--src/dw-hdfsee.c13
-rw-r--r--src/make_pixelmap.c8
2 files changed, 6 insertions, 15 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 7545e4ab..76caaefd 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -1703,19 +1703,6 @@ static gint displaywindow_save_response(GtkWidget *d, gint response,
}
-static void strip_extension(char *bfn)
-{
- size_t r = strlen(bfn)-1;
- while ( r > 0 ) {
- if ( bfn[r] == '.') {
- bfn[r] = '\0';
- return;
- }
- r--;
- }
-}
-
-
static void move_back_one(char *a)
{
int i;
diff --git a/src/make_pixelmap.c b/src/make_pixelmap.c
index b6e174b5..b2e95a60 100644
--- a/src/make_pixelmap.c
+++ b/src/make_pixelmap.c
@@ -53,7 +53,7 @@ static void show_help(const char *s)
"\n"
" -h, --help Display this help message.\n"
"\n"
-" -o, --output=<filename> Output filename. Default: pixelmap.h5.\n"
+" -o, --output=<filename> Output filename. Default: <input>.h5.\n"
" --badmap Generate bad pixel map instead of geometry\n"
" --good-pixel=<n> Value for good pixels in bad map. Default 1.\n"
" --bad-pixel=<n> Value for bad pixels in bad map. Default 0.\n"
@@ -240,7 +240,11 @@ int main(int argc, char *argv[])
input_file = strdup(argv[optind++]);
if ( output_file == NULL ) {
- output_file = strdup("pixelmap.h5");
+ size_t len = strlen(input_file);
+ output_file = malloc(len+4);
+ strncpy(output_file, input_file, len-1);
+ strip_extension(output_file);
+ strcat(output_file, ".h5");
}
/* Load geometry */