22
  7  ˆl–ßi~” ”Ð?Je@‚ãn\ªbÑ¿�þE,`Y¹G$}¢·)üÿÍ„„¿ÌÂÊ /°   #!/usr/bin/perl
# Debian required shebang above
# Original shebang below
# #!/usr/bin/env perl
#
# Copyright (C) 2006-2022 Boris Veytsman & Leila Akhmadeeva
#
# 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
# (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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
#
=pod

=head1 NAME

pedigree - create a TeX file for pedigree from a csv file

=head1 SYNOPSIS

B<pedigree> [-c I<configuration_file>] [-d] [-o I<output_file>] [-s I<start_id>] I<input_file>

B<pedigree> -v

=head1 DESCRIPTION

The program converts a comma separated I<input_file> into a TeX file
with pst-pdgr macros.  

=head1 OPTIONS

=over 4

=item B<-c> I<configuration_file>

The configuration file to read along with the system-wide and user's
configuration files

=item B<-d>

Debug mode on

=item B<-o> -I<output_file> 

The ouput file instead of I<input_file.tex>

=item B<-s> -I<start_id> 

If this option is selected, the pedigree is constructed starting from
the node with the Id i<start_id>. Otherwise it is started from the 
proband node.

This option allows to create pedigrees with multiple probands or absent
probands, or show people who are not proband's relatives.

=item B<-v>

Print version information

=back

=head1 FILES

=over 4

=item B</etc/pedigree.cfg>

Global configuration file

=item B<$HOME/.pedigreerc>

User configuration file

=back 

=head1 SEE ALSO

The manual distributed with this program describes the format of the
configuration file and the input file.

The library functions are described in Pedigree::Language(3),
Pedigree::Parser(3), Pedigree::Node(3), Pedigree::PersonNode(3),
Pedigree::MarriageNode(3), Pedigree::Area(3).

=head1  AUTHOR

Boris Veytsman, Leila Akhmadeeva, 2006-2022


=cut


#########################################################
#   Packages and Options                                #
#########################################################

use strict;
use vars qw($opt_c $opt_d $opt_o $opt_s $opt_v);

##############################
# TeXLive compatibility stuff
##############################
my $TLMaster;      # Where TeXlive is
my $TLCONF;        # TL config file
my $TLCONFLOCAL;   # TL local config file
BEGIN {
    chomp($TLMaster = `kpsewhich -var-value=TEXMFROOT`);
    if (length($TLMaster)) {
	unshift @INC, "$TLMaster/texmf-dist/scripts/pedigree-perl";
	$TLCONF = "$TLMaster/texmf-config/pedigree/pedigree.cfg";
	chomp($TLCONFLOCAL = `kpsewhich -var-value=TEXMFLOCAL`);
	$TLCONFLOCAL .= "/pedigree/pedigree.cfg";
    }
}

use Getopt::Std;
use FileHandle;
use Pedigree;

#########################################################
#   Options Reading and Global Variables                #
#########################################################

my $USAGE="Usage: $0 [-c configuration_file] [-d] [-o output_file] [-s start_id] input_file\n";
my $COPYRIGHT=<<END;
$0 Version 2.1, August 2022

Copyright (C) 2006-2022 Boris Veytsman & Leila Akhmadeeva

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
(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 GN