package xm::tabs;
use strict;
use xm::o;

sub DESC {"
 expand tabulator ascii characters to their respective width.

 (this snippet is taken from code2html, although no important part of it).
"}

sub expand # checkTabulator
{
    my ($line, $TABSTOP) = @_;
    $TABSTOP = 8 if not defined $TABSTOP;
    
    while ((my $at = index($line, "\t")) != -1)
      {
          my $cnt = ($TABSTOP - ($at % $TABSTOP));
          my $replace_with = ' ' x $cnt if ($cnt);
          $line =~ s/\t/$replace_with/;
      };

    return $line;
}

sub DO
{
    my $x = shift;

    return &checkTabulator ($x,8);
}

sub ARGS { return    xm::o::args_stdin(@_, DESC); }
sub main { return DO(xm::o::args_stdin(@_, DESC)); }

1;