anomy-bugs

DOS format command lines

From: Peter Payne (11653@xyz.molar.is)
Date: Mon 14 Jan 2002 - 22:05:27 UTC

  • Next message: Bjarni R. Einarsson: "Re: DOS format command lines"

    Hi,

    I discovered that configuration files generated using a Win32 or DOS editor
    wouldn't work with:
      $Id: Sanitizer.pm,v 1.51 2002/01/04 19:55:10 bre Exp $

    To fix this I added a couple of lines to the "configure" subroutine:
    ---snip---
    sub configure
    {
        my $self = shift;
            my $conf = $self->{"conf"};

        while (my $line = shift)
        {
            # strip leading and trailing whitespace from line (works for DOS,
    unix)
            $line =~ s/(\s|[\n\r])+$//;
            $line =~ s/^(\s|[\n\r])+//;

            if ($line =~ /^\s*([a-z0-9_]+)\s*([\+\.]*=)\s*(.*)\s*$/si)
                    {
                # OK, this lookes like a variable configuration
                my ($var, $op, $val) = (lc($1), $2, $3);
    ---snip---

    The added lines are:
            # strip leading and trailing whitespace from line (works for DOS,
    unix)
            $line =~ s/(\s|[\n\r])+$//;
            $line =~ s/^(\s|[\n\r])+//;

    All the test cases pass with this modification.

    Your tool seems excellent and, after more testing, I may apply to a mail
    re-direction site I administer which processes 120 messages a day on average
    (many users aren't that wise at picking up a potentially virused mail).

    Cheers,
    Peter Payne
    11653@xyz.molar.is
    Auckland, New Zealand



    hosted by molar.is