"Fossies" - the Fresh Open Source Software Archive

Member "shake-1.0/msg.c" (15 Nov 2014, 4085 Bytes) of package /linux/privat/shake-1.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "msg.c" see the Fossies "Dox" file reference documentation.

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