-
Notifications
You must be signed in to change notification settings - Fork 5
/
msg.c
96 lines (90 loc) · 3.95 KB
/
msg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/***************************************************************************/
/* Copyright (C) 2006-2009 Brice Arnould. */
/* */
/* This file is part of ShaKe. */
/* */
/* ShaKe is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/***************************************************************************/
#include <stdio.h> // puts(), printf(), putchar()
#include "config.h"
#include "msg.h"
void
show_help (void)
{
puts ("\
Usage: shake [OPTION]... [FILE|DIRECTORY]...\n\
Rewrite fragmented or misplaced files, maybe improving performance.\n\
Reads file list from standard input if there is no files in the arguments.\n\
You have to mount your partition with the user_xattr option.\n\
\n\
-c, --max-crumbc max number of crumbs\n\
-C, --max-fragc max number of fragments\n\
-d, --max-deviance max distance between file start and it's ideal position\n\
-h, --help you're looking at me !\n\
-L, --no-locks don't put a lock on written files\n\
-m, --many-fs shake subdirectories that are on different filesystems\n\
-n, --new age of \"new\" files, which will be shak()ed\n\
-o, --old age of \"old\" files, which won't be shak()ed\n\
-p, --pretend don't alter files\n\
-r, --crumbratio ratio of the file under which a fragment is a crumb\n\
-s, --smallsize the size under which a file is considered small\n\
-S, --bigsize the size under which a file is considered big\n\
-t, --small-tolerance multiply crumbratio and divide maxfnumber of small files\n\
-T, --big-tolerance multiply crumbratio and divide maxfnumber of big files\n\
-v, --verbose increase the verbosity level\n\
-V, --version show version number and copyright\n\
-X, --no-xattr disable usage of xattr\n\
Report bugs at https://github.com/unbrice/shake/issues\
");
}
void
show_version (void)
{
puts ("\
Shake " VERSION "\n\
Copyright (C) 2006-2011 Brice Arnould.\n\
Shake comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of Shake\n\
under the terms of the GNU General Public License version or greater.\n\
For more information about these matters, see the file named GPL.txt.\
");
}
void
show_header (struct law *l)
{
if (l->verbosity)
printf ("IDEAL\tSTART\tEND\tFRAGC\tCRUMBC\tAGE\tSHOCKED\tNAME");
if (l->verbosity >= 3)
puts ("\tFRAGS");
else if (l->verbosity)
putchar ('\n');
}
void
show_reg (struct accused *a, struct law *l)
{
/* Show file status */
printf ("%lli\t%lli\t%lli\t%i\t%i\t%i\t%i\t%s",
a->ideal, a->start / 1024, a->end / 1024, a->fragc, a->crumbc,
(int) (a->age / 3600 / 24), a->guilty, a->name);
/* And, eventualy, list of frags and crumbs */
if (l->verbosity > 2 && a->poslog && a->poslog[0] != -1)
{
uint n;
putchar ('\t');
for (n = 0; a->sizelog[n + 1] != -1; n++)
printf ("%lli:%lli,", a->poslog[n] / 1024, a->sizelog[n] / 1024);
printf ("%lli:%lli\n", a->poslog[n] / 1024, a->sizelog[n] / 1024);
}
else
putchar ('\n');
}