21 #include <lal/LALStdlib.h>
22 #include <lal/LALgetopt.h>
23 #include <lal/XLALError.h>
24 #include <lal/LALString.h>
25 #include <lal/FileIO.h>
28 "Usage: %s [options]\n\n"\
29 " --help (-h) display this message\n"\
30 " --file (-f) name of ascii text file to gzip/unzip\n"\
31 " --gzip (-g) gzip (compress) the text file\n"\
32 " --gunzip (-u) gunzip (decompress) the gzipped text file\n"\
35 int main(
int argc,
char **argv){
37 INT4 gzip = 0, gunzip = 0;
62 if ( long_options[option_index].
flag )
65 fprintf(stderr,
"Error parsing option %s with argument %s\n", long_options[option_index].
name,
LALoptarg );
80 fprintf(stderr,
"Unknown error while parsing options\n" );
83 fprintf(stderr,
"Unknown error while parsing options\n" );
89 fprintf(stderr,
"Must specify an input file\n");
94 if ( ( !gzip && !gunzip ) || ( gzip && gunzip ) ){
95 fprintf(stderr,
"Must specify whether you want to either gzip (-g) or gunzip (-u) the input file.\n");
int main(int argc, char **argv)
int LALgetopt_long(int argc, char *const *argv, const char *options, const struct LALoption *long_options, int *opt_index)
#define required_argument
int XLALGunzipTextFile(const char *filename)
Use gzip to uncompress a compressed text file.
int XLALGzipTextFile(const char *filename)
Use gzip to compress a text file This function will use the gzip compression routines in zlib to comp...
char CHAR
One-byte signed integer, see Headers LAL(Atomic)Datatypes.h for more details.
int32_t INT4
Four-byte signed integer.
char * XLALStringDuplicate(const char *s)
Like strdup but uses LAL allocation routines (free with LALFree).
@ XLAL_SUCCESS
Success return value (not an error number)