From cefc2cb0a936febbccc4fe111968eb219e8a849e Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 3 Dec 2011 08:44:40 +0100 Subject: [PATCH] vquota(8): style(9)/whitespace fixes. --- sbin/vquota/vquota.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/sbin/vquota/vquota.c b/sbin/vquota/vquota.c index 2099cf6c26..f63d28b5b1 100644 --- a/sbin/vquota/vquota.c +++ b/sbin/vquota/vquota.c @@ -40,25 +40,29 @@ #include static void usage(int); -static int get_dirsize( char* ); +static int get_dirsize(char *); -static void usage(int retcode) { - fprintf( stderr, "usage: vquota check directory\n" ); +static void +usage(int retcode) +{ + fprintf(stderr, "usage: vquota check directory\n"); exit(retcode); } -static int get_dirsize( char* dirname ) { - FTS *fts; +static int +get_dirsize(char* dirname) +{ + FTS *fts; FTSENT *p; char* fts_args[2]; uint64_t size_of_files = 0; - int retval = 0; + int retval = 0; /* TODO: check directory name sanity */ fts_args[0] = dirname; fts_args[1] = NULL; - if ((fts = fts_open( fts_args, FTS_PHYSICAL, NULL)) == NULL) + if ((fts = fts_open(fts_args, FTS_PHYSICAL, NULL)) == NULL) err(1, "fts_open() failed"); while ((p = fts_read(fts)) != NULL) { @@ -79,23 +83,25 @@ static int get_dirsize( char* dirname ) { /* files with more than one link, undecided */ // if (p->fts_statp->st_nlink > 1 && linkchk(p)) if (p->fts_statp->st_nlink > 1) - fprintf( stderr, "%s has more than one link\n", p->fts_name ); - + fprintf(stderr, "%s has more than one link\n", + p->fts_name ); + size_of_files += p->fts_statp->st_size; } } - printf( "%"PRIu64"\n", size_of_files ); + printf("%"PRIu64"\n", size_of_files); return retval; } -int main( int argc, char **argv ) { - +int +main(int argc, char **argv) +{ if (argc < 3) usage(1); if (strcmp(argv[1], "check") == 0) { - return get_dirsize( argv[2] ); + return get_dirsize(argv[2]); } return 0; -- 2.41.0