www.delorie.com/djgpp/doc/libc/libc_109.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

confstr

Syntax

 
#include <unistd.h>

size_t confstr(int name, char *buf, size_t len);

Description

This function stores various system-dependent configuration values in buf. name is one of the following:

_CS_PATH

Returns a path to the standard POSIX utilities.

_CS_POSIX_V6_ILP32_OFF32_CFLAGS

Returns the compile-time flags required to build an application using 32-bit int, long, pointer, and off_t types.

_CS_POSIX_V6_ILP32_OFF32_LDFLAGS

Returns the link-time flags required to build an application using 32-bit int, long, pointer, and off_t types.

_CS_POSIX_V6_ILP32_OFF32_LIBS

Returns the set of libraries required to build an application using 32-bit int, long, pointer, and off_t types.

If len is not zero and name has a defined value, that value is copied into buf and null terminated. If the length of the string to be copied plus the null terminator is greater than len bytes, the string is truncated to len-1 bytes and the result is null terminated.

If len is zero, nothing is copied into buf and the size of the buffer required to store the string is returned.

Return Value

If name has a defined value, the minimum size of the buffer required to hold the string including the terminating null is returned. If this value is greater than len, then buf is truncated.

If name is valid but does not have a defined value, zero is returned.

If name is invalid, zero is returned and errno is set to EINVAL.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
char *path;
size_t path_len;

path_len = confstr (_CS_PATH, NULL, 0);
path = malloc(path_len);
confstr(_CS_PATH, path, path_len);


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004