4.115
Last change
on this file since da154e14 was
9b4422a2,
checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24
|
Remove All CVS Id Strings Possible Using a Script
Script does what is expected and tries to do it as
smartly as possible.
+ remove occurrences of two blank comment lines
next to each other after Id string line removed.
+ remove entire comment blocks which only exited to
contain CVS Ids
+ If the processing left a blank line at the top of
a file, it was removed.
|
-
Property mode set to
100644
|
File size:
813 bytes
|
Line | |
---|
1 | /* |
---|
2 | * truncate() - Truncate a File to the Specified Length |
---|
3 | * |
---|
4 | * This routine is not defined in the POSIX 1003.1b standard but is |
---|
5 | * commonly supported on most UNIX and POSIX systems. It is provided |
---|
6 | * for compatibility. |
---|
7 | * |
---|
8 | * COPYRIGHT (c) 1989-1999. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <unistd.h> |
---|
21 | #include <errno.h> |
---|
22 | #include <fcntl.h> |
---|
23 | |
---|
24 | int truncate( |
---|
25 | const char *path, |
---|
26 | off_t length |
---|
27 | ) |
---|
28 | { |
---|
29 | int status; |
---|
30 | int fd; |
---|
31 | |
---|
32 | fd = open( path, O_WRONLY ); |
---|
33 | if ( fd == -1 ) |
---|
34 | return -1; |
---|
35 | |
---|
36 | status = ftruncate( fd, length ); |
---|
37 | |
---|
38 | (void) close( fd ); |
---|
39 | |
---|
40 | return status; |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.