// DIE's signature file

init("format","plain text");

function detect(bShowType,bShowVersion,bShowOptions)
{
    var sText=Text.getString(0,Math.min(Text.getSize(),3));
    // UTF-8 BOM.
    if(/^\xef\xbb\xbf/.test(sText))
    {
        sName="UTF-8 text";
    }
    if(bShowOptions)
    {
        var size=Text.getSize()<4096?Text.getSize():4096;
        var pos=Text.findByte(0,size,10);
        if(pos!=-1)
        {
            sOptions=(pos!=0&&Text.readByte(pos-1)==13)||(pos+1<Text.getSize()&&Text.readByte(pos+1)==13)?"CRLF":"LF";
        }
        else if(Text.findByte(0,size,13)!=-1)
        {
            sOptions="CR";
        }
    }
    bDetected=1;

    return result(bShowType,bShowVersion,bShowOptions);
}
