dir()
{
	return( (mode & IFMT) == IFDIR );
}
file()
{
	return( (mode & IFMT) == IFREG );
}

/*
 * months - This function can be used like a constant.
 *	It evaluates to the number of seconds in a month (average).
 *	Expressions like the following are now possible:
 *		(mtime > NOW-2*months)
 *	Would find files that have been modified in the last 2
 *	months.
 *
 */

months
{
	return days*30;
}

/*
 * This defines a useful "alias" for the 'nlink' variable,
 * which may be easier to remember.
 *
 */

nlinks { return nlink; }

/*
 * This function returns the number of seconds passed as its argument
 * minus NOW. Used to make some time comparisons "cleaner".
 *
 */

ago(d)
{
	return( NOW - d );
}

/*
 * returns true if a file is writable by others (and group).
 *
 */

writable()
{
	return mode & 022;
}

MINE
{
	return( uid == $$ );
}

/*
 * Find C related files.
 *
 */

csrc()
{
	return("*.[chs]" || "[Mm]akefile" );
}

/*
 * Find files that have been modified in the last
 * 1 hour.
 *
 */

changed()
{
	return( mtime > NOW-1*hours );

	/* ALTERNATELY:
	 * (using the ago() function)
	 *
	 * 	return( mtime > ago(1*hours) );
	 *
	 */
}

/*
 * This function can be used as a constant.
 *
 */

K()
{
	return 1024;
}

/* megs { return K*K; }  or ...*/
megs { return K<<10; }
