#!/bin/bash

#Follow LG standard rule
STACK_SIZE_CRITIERION=512

checkstack()
{
    if [ -e $1 ]; then
        stackOverSize="FALSE";
        while read line
        do
            stacksize=$(echo $line |awk -F ':' '{print $2}')
            if [ $stacksize -gt $STACK_SIZE_CRITIERION ]; then
               echo "$line";
               stackOverSize="TRUE";
            fi
        done < $1

        if [ $stackOverSize == "TRUE" ]; then
            echo "stack over $STACK_SIZE_CRITIERION size";
            exit 1;
        else
            echo "stack size checking is safe!!!";
            exit 0;
        fi
    else
        echo "$1 file is not exist!!!";
        exit 1;
    fi
}

checkstack $1

