#!/usr/bin/perl
use strict;
use OurNet::BBS;
use OurNet::BBS::PlClient;
use Getopt::Std;
use Carp;

my %opt;
getopts(':ps', \%opt);

my $port = $opt{p} || 7978;
die "Usage: $0 <backend> <args>\n" unless @ARGV;
my $BBS = OurNet::BBS->new(@ARGV) or die "Cannot connect to BBS: @ARGV\n";


if ($opt{s} or !fork()) {
    print "\nBBSCOM Daemon starting at port $port.\n";
    $BBS->daemonize($port) or die "Failed to daemonize: $!\n";
}
