#!/bin/bash

# fslint - FSlint command line utilites wrapper
# Copyright © 2000-2007 by Pádraig Brady <P@draigBrady.com>.
#
# This program 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 2 of the License, or
# 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,
# which is available at www.gnu.org


# Notes:
#
# This is just a simple wrapper for the various commands.
# This assumes all commands are in same dir.


. /usr/share/fslint/supprt/fslver

Usage() {
	ProgName=$(basename "$0")
	echo "File system lint.
A collection of utilities to find lint on a filesystem.
To get more info on each utility run 'util --help'.

findup -- find DUPlicate files
findnl -- find Name Lint (problems with filenames)
findu8 -- find filenames with invalid utf8 encoding
findbl -- find Bad Links (various problems with symlinks)
findsn -- find Same Name (problems with clashing names)
finded -- find Empty Directories
findid -- find files with dead user IDs
findns -- find Non Stripped executables
findrs -- find Redundant Whitespace in files
findtf -- find Temporary Files
findul -- find possibly Unused Libraries
zipdir -- Reclaim wasted space in ext2 directory entries"
	exit
}

for arg
do
	case "$arg" in
	-h|--help|-help)
		Usage ;;
	-v|--version)
		Version ;;
	esac
done

echo "-----------------------------------file name lint"
findnl "$@"
echo "-------------------------------Invalid utf8 names"
findu8 "$@"
echo "-----------------------------------file case lint"
findsn -c "$@"
echo "----------------------------------DUPlicate files"
findup "$@"
echo "-----------------------------------Dangling links"
findbl "$@"
echo "--------------------redundant characters in links"
findbl -n "$@"
echo "------------------------------------suspect links"
findbl -s "$@"
echo "--------------------------------Empty Directories"
finded "$@"
echo "----------------------------------Temporary Files"
findtf "$@"
echo "----------------------duplicate/conflicting Names"
if [ "$1" = "/" ]; then
    findsn
else
    findsn "$@"
fi
echo "------------------------------------------Bad ids"
findid "$@"
echo "-------------------------Non Stripped executables"
if [ "$1" = "/" ]; then
    findns
else
    findns "$@"
fi
