aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/make_pixelmap.12
-rw-r--r--libcrystfel/src/utils.c13
-rw-r--r--libcrystfel/src/utils.h1
-rw-r--r--src/dw-hdfsee.c13
-rw-r--r--src/make_pixelmap.c8
5 files changed, 21 insertions, 16 deletions
diff --git a/doc/man/make_pixelmap.1 b/doc/man/make_pixelmap.1
index 22fba821..b2e34d4a 100644
--- a/doc/man/make_pixelmap.1
+++ b/doc/man/make_pixelmap.1
@@ -39,7 +39,7 @@ Specify the values to use in the mask for good and bad pixels, respectively. Th
.IP "\fB-o \fIoutput.h5\fR"
.IP \fB--output=\fIoutput.h5\fR
.PD
-Set the output filename. The default is \fB--output=pixelmap.h5\fR.
+Set the output filename. The default output filename is \fIinput\fR.h5, i.e. the input filename with its extension changed to .h5.
.SH AUTHOR
This page was written by Thomas White.
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c
index 90d81a71..1b2ebad3 100644
--- a/libcrystfel/src/utils.c
+++ b/libcrystfel/src/utils.c
@@ -548,6 +548,19 @@ char *safe_basename(const char *in)
}
+void strip_extension(char *bfn)
+{
+ size_t r = strlen(bfn)-1;
+ while ( r > 0 ) {
+ if ( bfn[r] == '.') {
+ bfn[r] = '\0';
+ return;
+ }
+ r--;
+ }
+}
+
+
/* Force the linker to bring in CBLAS to make GSL happy */
void utils_fudge_gslcblas()
{
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h
index 2c756ad7..65ab9b00 100644
--- a/libcrystfel/src/utils.h
+++ b/libcrystfel/src/utils.h
@@ -218,6 +218,7 @@ extern pthread_mutex_t stderr_lock;
extern char *check_prefix(char *prefix);
extern char *safe_basename(const char *in);
+extern void strip_extension(char *bfn);
/* ------------------------------ Useful stuff ------------------------------ */
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 */