Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jun 2, 2014
1 parent a7cfb07 commit 01c9d16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ EXE= # AUTOGEN
LDLIBS= # AUTOGEN
CFLAGS=$(COMPILER_FLAGS) $(COMPILER_WARN) # AUTOGEN
LDLIBS=
COMPILER_FLAGS+=-DVERSION=\"0.1.2\"
COMPILER_FLAGS+=-DVERSION=\"1.0.0-beta\"

#
# Useful if on MacOS to do performance analysis with instruments
Expand Down
19 changes: 3 additions & 16 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ uint32_t opt_sectors_per_cluster;
/*
* Die and print usage message.
*/
static boolean die_with_usage;
boolean die_with_usage;

/*
* Tool usage.
*/
static void usage (void)
void usage (void)
{
fprintf(stderr,
"fatdisk, version " VERSION "\n\n"
Expand Down Expand Up @@ -198,16 +198,7 @@ static void usage (void)
fprintf(stderr, "\n");
fprintf(stderr, "Written by Neil McGill, [email protected], with special thanks\n");
fprintf(stderr, "to Donald Sharp, Andy Dalton and Mike Woods\n");
}

/*
* usage_short
*
* Short help
*/
static void usage_short (void)
{
fprintf(stderr, "Enter \"fatdisk --help\" for usage\n");
fprintf(stderr, "\nfatdisk, version " VERSION "\n\n");
}

/*
Expand Down Expand Up @@ -240,10 +231,6 @@ void die (void)
{
quit();

if (die_with_usage) {
usage_short();
}

exit(1);
}

Expand Down
6 changes: 6 additions & 0 deletions main.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ typedef unsigned long int uint64_t;
* log.c
*/
#define DIE(args...) \
if (die_with_usage) { \
usage(); \
} \
\
DYING("Died at %s:%s():%u", __FILE__, __FUNCTION__, __LINE__); \
CROAK(args); \
exit(1);
Expand Down Expand Up @@ -243,6 +247,7 @@ char *duplstr_(const char *in, const char *what, const char *func,
*/
void quit(void);
void die(void);
void usage(void);

extern boolean opt_verbose;
extern boolean opt_quiet;
Expand All @@ -253,3 +258,4 @@ extern boolean opt_debug;
extern boolean croaked;
extern uint32_t opt_sector_size;
extern uint32_t opt_sectors_per_cluster;
extern boolean die_with_usage;

0 comments on commit 01c9d16

Please sign in to comment.