Print perror before unlinking files.

Join common parts of fatal errors.
Update copyright notices.
Small improvement to visual output.
This commit is contained in:
Con Kolivas 2011-02-21 16:11:59 +11:00
parent a7b4708bd2
commit 88e3df6af1
4 changed files with 16 additions and 10 deletions

7
main.c
View file

@ -1,5 +1,6 @@
/*
Copyright (C) 2006-2011 Con Kolivas
Copyright (C) 2011 Peter Hyman
Copyright (C) 1998-2003 Andrew Tridgell
This program is free software; you can redistribute it and/or modify
@ -23,10 +24,10 @@ struct rzip_control control;
static void usage(void)
{
print_output("lrzip version %d.%d%d\n", LRZIP_MAJOR_VERSION, LRZIP_MINOR_VERSION, LRZIP_MINOR_SUBVERSION);
print_output("Copyright (C) Con Kolivas 2006-2011\n\n");
print_output("Copyright (C) Con Kolivas 2006-2011\n");
print_output("Based on rzip ");
print_output("Copyright (C) Andrew Tridgell 1998-2003\n");
print_output("usage: lrzip [options] <file...>\n");
print_output("Copyright (C) Andrew Tridgell 1998-2003\n\n");
print_output("Usage: lrzip [options] <file...>\n");
print_output("General options:\n");
print_output(" -c check integrity of file written on decompression\n");
print_output(" -d decompress\n");

1
rzip.h
View file

@ -1,5 +1,6 @@
/*
Copyright (C) 2006-2011 Con Kolivas
Copyright (C) 2011 Peter Hyman
Copyright (C) 1998 Andrew Tridgell
This program is free software; you can redistribute it and/or modify

View file

@ -1,5 +1,6 @@
/*
Copyright (C) 2006-2011 Con Kolivas
Copyright (C) 2011 Peter Hyman
Copyright (C) 1998 Andrew Tridgell
This program is free software; you can redistribute it and/or modify

17
util.c
View file

@ -1,6 +1,6 @@
/*
Copyright (C) 2006-2011 Con Kolivas
Copyright (C) 2008 Peter Hyman
Copyright (C) 2008, 2011 Peter Hyman
Copyright (C) 1998 Andrew Tridgell
This program is free software; you can redistribute it and/or modify
@ -42,6 +42,13 @@ static void unlink_files(void)
unlink(control.infile);
}
static void fatal_exit(void)
{
unlink_files();
print_output("Fatal error - exiting\n");
exit(1);
}
/* Failure when there is likely to be a meaningful error in perror */
void fatal(const char *format, ...)
{
@ -53,10 +60,8 @@ void fatal(const char *format, ...)
va_end(ap);
}
unlink_files();
perror(NULL);
print_output("Fatal error - exiting\n");
exit(1);
fatal_exit();
}
void failure(const char *format, ...)
@ -69,9 +74,7 @@ void failure(const char *format, ...)
va_end(ap);
}
unlink_files();
print_output("Fatal error - exiting\n");
exit(1);
fatal_exit();
}
void sighandler()