4.104.114.84.95
Last change
on this file since d7aecdc was
9c49db4,
checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44
|
2001-01-08 Ralf Corsepius <corsepiu@…>
- configure.in: Add libc/config.h
- libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
- libc/.cvsignore: Add config.h and stamp-h
- libc/*.c: Add config.h support.
|
-
Property mode set to
100644
|
File size:
831 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.OARcorp.com/rtems/license.html. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #if HAVE_CONFIG_H |
---|
19 | #include "config.h" |
---|
20 | #endif |
---|
21 | |
---|
22 | #include <unistd.h> |
---|
23 | #include <errno.h> |
---|
24 | #include <fcntl.h> |
---|
25 | |
---|
26 | int truncate( |
---|
27 | const char *path, |
---|
28 | off_t length |
---|
29 | ) |
---|
30 | { |
---|
31 | int status; |
---|
32 | int fd; |
---|
33 | |
---|
34 | fd = open( path, O_WRONLY ); |
---|
35 | if ( fd == -1 ) |
---|
36 | return -1; |
---|
37 | |
---|
38 | status = ftruncate( fd, length ); |
---|
39 | |
---|
40 | (void) close( fd ); |
---|
41 | |
---|
42 | return status; |
---|
43 | } |
---|
44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.