This is a simple example of how to read the number of extended attributes with GetEAInfo()
#include <errno.h>
#include <nwerrno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nit\nwextatt.h>
static void displayEAs( char* filename) {
int handle;
int ccode;
unsigned long totalEAs;
unsigned long totalDataSizeOfEAs;
unsigned long totalKeySizeOfEAs;
if (( handle = OpenEA( filename, 0)) == EFAILURE) {
printf( "OpenEA failed, errno = %x (%s), NetWareErrno = %x\n",
errno, strerror( errno), NetWareErrno);
return;
}
if (( ccode = GetEAInfo( handle,
&totalEAs,
&totalDataSizeOfEAs,
&totalKeySizeOfEAs)) != 0) {
printf( "GetEAInfo failed, ccode = %x, errno = %x (%s), NetWareErrno = %x\n",
ccode, errno, strerror( errno), NetWareErrno);
CloseEA( handle);
return;
}
printf( "totalEAs = %u\n", totalEAs);
CloseEA( handle);
}
int main( int argc, char* argv[]) {
if ( argc != 2) {
puts( "Usage: GetEAInf <filename>");
return EXIT_FAILURE;
}
displayEAs( strupr( argv[ 1]));
return EXIT_SUCCESS;
}
© 2008 Novell, Inc. All Rights Reserved.