Mercurial > hg > octave-lojdl > gnulib-hg
annotate lib/fileblocks.c @ 12518:b5e42ef33b49
update nearly all FSF copyright year lists to include 2009
The files named by the following are exempted:
grep -v '^#' config/srclist.txt|grep -v '^$' \
| while read src dst; do
test -f "$dst" && { echo "$dst"; continue; }
test -d "$dst" || continue
echo "$dst"/$(basename "$src")
done > exempt
git ls-files tests/unictype >> exempt
In the remaining files, convert to all-interval notation if
- there is already at least one year interval like 2000-2003
- the file is maintained by me
- the file is in lib/uni*/, where that style already prevails
Otherwise, use update-copyright's default.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Mon, 28 Dec 2009 10:50:36 +0100 |
parents | e8d2c6fc33ad |
children | c2cbabec01dd |
rev | line source |
---|---|
5 | 1 /* Convert file size to number of blocks on System V-like machines. |
5159 | 2 |
12518
b5e42ef33b49
update nearly all FSF copyright year lists to include 2009
Jim Meyering <meyering@redhat.com>
parents:
12421
diff
changeset
|
3 Copyright (C) 1990, 1997-1999, 2004-2006, 2009 Free Software Foundation, |
b5e42ef33b49
update nearly all FSF copyright year lists to include 2009
Jim Meyering <meyering@redhat.com>
parents:
12421
diff
changeset
|
4 Inc. |
5 | 5 |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
6 This program is free software: you can redistribute it and/or modify |
5 | 7 it under the terms of the GNU General Public License as published by |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
8 the Free Software Foundation; either version 3 of the License, or |
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
9 (at your option) any later version. |
5 | 10 |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
9309
bbbbbf4cd1c5
Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7302
diff
changeset
|
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
5 | 18 |
19 /* Written by Brian L. Matthews, blm@6sceng.UUCP. */ | |
7302
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
6600
diff
changeset
|
20 |
8a1a9361108c
* _fpending.c: Include <config.h> unconditionally, since we no
Paul Eggert <eggert@cs.ucla.edu>
parents:
6600
diff
changeset
|
21 #include <config.h> |
163
4aeea06507af
[!NINDIR]: Define BSIZE only if it's not already defined.
Jim Meyering <jim@meyering.net>
parents:
5
diff
changeset
|
22 |
1214
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
23 #include <sys/types.h> |
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
24 |
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
25 #if HAVE_SYS_PARAM_H |
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
26 # include <sys/param.h> |
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
27 #endif |
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
28 |
1997
d562a3cf9041
Use HAVE_STRUCT_STAT_ST_BLOCKS, not deprecated HAVE_ST_BLOCKS.
Jim Meyering <jim@meyering.net>
parents:
1557
diff
changeset
|
29 #if !HAVE_STRUCT_STAT_ST_BLOCKS && !defined _POSIX_SOURCE && defined BSIZE |
5 | 30 |
6275 | 31 # include <unistd.h> |
933
6c3fbfcdb059
[HAVE_UNISTD_H]: Include unistd.h.
Jim Meyering <jim@meyering.net>
parents:
650
diff
changeset
|
32 |
599 | 33 # ifndef NINDIR |
1240
92fcf946db19
[__DJGPP__]: Add missing typedef for daddr_t.
Jim Meyering <jim@meyering.net>
parents:
1214
diff
changeset
|
34 |
6600
67e1506d720e
Remove more useless parentheses.
Jim Meyering <jim@meyering.net>
parents:
6275
diff
changeset
|
35 # if defined __DJGPP__ |
1240
92fcf946db19
[__DJGPP__]: Add missing typedef for daddr_t.
Jim Meyering <jim@meyering.net>
parents:
1214
diff
changeset
|
36 typedef long daddr_t; /* for disk address */ |
92fcf946db19
[__DJGPP__]: Add missing typedef for daddr_t.
Jim Meyering <jim@meyering.net>
parents:
1214
diff
changeset
|
37 # endif |
92fcf946db19
[__DJGPP__]: Add missing typedef for daddr_t.
Jim Meyering <jim@meyering.net>
parents:
1214
diff
changeset
|
38 |
1134
b2ed35578119
(st_blocks): long -> off_t.
Jim Meyering <jim@meyering.net>
parents:
933
diff
changeset
|
39 /* Some SysV's, like Irix, seem to lack this. Hope it's correct. */ |
5 | 40 /* Number of inode pointers per indirect block. */ |
1214
a6150f7af1bd
Include sys/param.h only #if HAVE_SYS_PARAM_H.
Jim Meyering <jim@meyering.net>
parents:
1134
diff
changeset
|
41 # define NINDIR (BSIZE / sizeof (daddr_t)) |
599 | 42 # endif /* !NINDIR */ |
5 | 43 |
44 /* Number of direct block addresses in an inode. */ | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
45 # define NDIR 10 |
5 | 46 |
47 /* Return the number of 512-byte blocks in a file of SIZE bytes. */ | |
48 | |
1134
b2ed35578119
(st_blocks): long -> off_t.
Jim Meyering <jim@meyering.net>
parents:
933
diff
changeset
|
49 off_t |
1557 | 50 st_blocks (off_t size) |
5 | 51 { |
1134
b2ed35578119
(st_blocks): long -> off_t.
Jim Meyering <jim@meyering.net>
parents:
933
diff
changeset
|
52 off_t datablks = size / 512 + (size % 512 != 0); |
b2ed35578119
(st_blocks): long -> off_t.
Jim Meyering <jim@meyering.net>
parents:
933
diff
changeset
|
53 off_t indrblks = 0; |
5 | 54 |
55 if (datablks > NDIR) | |
56 { | |
57 indrblks = (datablks - NDIR - 1) / NINDIR + 1; | |
58 | |
59 if (datablks > NDIR + NINDIR) | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
60 { |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
61 indrblks += (datablks - NDIR - NINDIR - 1) / (NINDIR * NINDIR) + 1; |
5 | 62 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
63 if (datablks > NDIR + NINDIR + NINDIR * NINDIR) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
64 indrblks++; |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
9309
diff
changeset
|
65 } |
5 | 66 } |
67 | |
68 return datablks + indrblks; | |
69 } | |
598
e504ab9c8abf
[HAVE_ST_BLOCKS || _POSIX_VERSION]: Add extern dcl
Jim Meyering <jim@meyering.net>
parents:
498
diff
changeset
|
70 #else |
e504ab9c8abf
[HAVE_ST_BLOCKS || _POSIX_VERSION]: Add extern dcl
Jim Meyering <jim@meyering.net>
parents:
498
diff
changeset
|
71 /* This declaration is solely to ensure that after preprocessing |
e504ab9c8abf
[HAVE_ST_BLOCKS || _POSIX_VERSION]: Add extern dcl
Jim Meyering <jim@meyering.net>
parents:
498
diff
changeset
|
72 this file is never empty. */ |
5159 | 73 typedef int textutils_fileblocks_unused; |
5 | 74 #endif |