#!/bin/sh

#-----[ usage ]---------------------------------------------
function usage ()
{
    echo "Usage   : ${0} file";
    echo "lock file, you can see the lock at \"~/.$(basename file).lock\""
    exit;
}

#-----[ lock ]----------------------------------------------
function lock ()
{
    lockfile -1 ${1};
}

#-----[ main ]----------------------------------------------
function main ()
{
    if test ${#} -ne 1 -o ! -f ${1}; then
	usage ${*};
    fi;

    lock "${HOME}/.$(basename ${1}).lock"
}

#-----[ Corps ]---------------------------------------------
main ${*}
