aboutsummaryrefslogtreecommitdiff
path: root/src/indexamajig.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-05-22 16:42:33 +0200
committerThomas White <taw@physics.org>2014-05-22 16:42:33 +0200
commit30ddb045dfaaf867bda7122d76ceb12d24d248e7 (patch)
tree2e956fc678aee387d152a337749a53b4ca9b29b2 /src/indexamajig.c
parent8c76ffc087dc1f900125b8669d3460b7ea52f14c (diff)
Rationalise and document stream "open for write" functions
A nice side-effect is that streams now only have one set of headers
Diffstat (limited to 'src/indexamajig.c')
-rw-r--r--src/indexamajig.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 9102ccc5..607e8b0c 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
char *filename = NULL;
char *outfile = NULL;
FILE *fh;
- int ofd;
+ Stream *st;
int config_checkprefix = 1;
int config_basename = 0;
int integrate_saturated = 0;
@@ -627,14 +627,15 @@ int main(int argc, char *argv[])
}
- ofd = open(outfile, O_CREAT | O_TRUNC | O_WRONLY,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
- if ( ofd == -1 ) {
+ st = open_stream_for_write(outfile);
+ if ( st == NULL ) {
ERROR("Failed to open stream '%s'\n", outfile);
return 1;
}
free(outfile);
+ write_command(st, argc, argv);
+
/* Prepare the indexer */
if ( indm != NULL ) {
ipriv = prepare_indexing(indm, iargs.cell, iargs.det,
@@ -653,7 +654,7 @@ int main(int argc, char *argv[])
iargs.ipriv = ipriv;
create_sandbox(&iargs, n_proc, prefix, config_basename, fh,
- ofd, argc, argv, tempdir);
+ st, tempdir);
free(prefix);
free(tempdir);