#!/usr/bin/perl
# $Id: ShowUndocumented,v 1.5 2000/08/04 15:05:31 macgyver Exp $
#
# ShowUndocumented: Obtain a list of all undocumented ProFTPD configuration
#                   directives.
# Author: MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
# Copyright(C) 1999, 2000, MacGyver.  All Rights Reserved.
#

use strict;

my %doc;

open(DOC,"grep -i '<li><a href=\"#' Configuration.html | cut -d'\"' -f2 | cut -d'#' -f2 | sort|");

while(<DOC>) {
    chomp;
    $doc{$_} = 1;
}

open(UNDOC,"./GetConf ../*/*.c|");

my $count = 0;
my $module = undef;
my $newmod = 0;

while(<UNDOC>) {
    chomp;

    s/^\s+//;
    s/\s+$//;
    s/^<//;
    s/^\///;
    s/>$//;
    
    next unless length($_) > 0;
    
    if(/^Module ([^\s]*):$/) {
	$module = $1;
	$newmod = 1;
	next;
    }
    
    if(!$doc{$_}) {
	if($newmod) {
	    print "\nModule: $module\n";
	    $newmod = 0;
	}
	
	print "  $_\n";
	$count++;
    }
}

if($count == 0) {
    print "No undocumented directives found.\n";
}
