New MBR which supports logical partitions.
[profile/ivi/syslinux.git] / mbr / checksize.pl
1 ## -----------------------------------------------------------------------
2 ##   
3 ##   Copyright 2007 H. Peter Anvin - All Rights Reserved
4 ##
5 ##   This program is free software; you can redistribute it and/or modify
6 ##   it under the terms of the GNU General Public License as published by
7 ##   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ##   Boston MA 02111-1307, USA; either version 2 of the License, or
9 ##   (at your option) any later version; incorporated herein by reference.
10 ##
11 ## -----------------------------------------------------------------------
12
13 ##
14 ## checksize.pl
15 ##
16 ## Check the size of a binary file
17 ##
18
19 ($file, $maxsize) = @ARGV;
20
21 @st = stat($file);
22 if (!defined($size = $st[7])) {
23     die "$0: $file: $!\n";
24 }
25 if ($size > $maxsize) {
26     print STDERR "$file: too big ($size > $maxsize)\n";
27     exit 1;
28 } else {
29     exit 0;
30 }
31