NAME DtDtsDataToDataType - get the data type for a set of data SYNOPSIS #include <Dt/Dts.h> char *DtDtsDataToDataType(const char *filepath, const void *buffer, const int size, const struct stat *stat_buff, const char *link_path, const struct stat *link_stat_buff, const char *opt_name); DESCRIPTION The DtDtsDataToDataType() function determines the data type of a set of data, based on the information given in the non-NULL pointer arguments to the function. The function gathers any additional information, if it is needed, to com- pensate for the NULL arguments. For example, if the filepath argument is given, but the stat_buff argument is NULL and a stat_buff value is required to determine the data type, DtDtsDataToDataType() calls the stat(2) function to obtain the information. The filepath argument is the pathname of a file. The buffer argument is a pointer to the buffer of the data to be typed. The size argument is the size of the buffer in bytes. The stat_buff argument is the buffer returned from a stat(2) or fstat(3) call for use in typing. The link_path argument is the pathname of the target file pointed to by a symbolic link. The link_stat_buff argument is the buffer returned from an lstat(2) call for use in typing. The opt_name argument can be used to specify a name to be associated with the buffer. If the opt_name argument is not NULL, it is used as a pseudo file name in typing; otherwise, certain attributes may be returned as NULL because the filename components could not be determined. RETURN VALUE Upon successful completion, the DtDtsDataToDataType() func- tion returns a pointer to a data type string, or NULL if no value could be determined. APPLICATION USAGE The DtDtsDataToDataType() function is generally used by applications such as file managers to improve performance. Typical applications should probably use DtDtsFileToData- Type(3) or DtDtsBufferToDataType(3) instead. The DtDtsBuffer* functions assume that the buffer is read- able and writable by the user, group and other file classes and select a type accordingly. An application requiring a type based on read-only permissions should use DtDtsDataTo- DataType() with a stat_buff value created for this purpose: all fields should NULL except for the st_mode field, which should be set to: S_IFREG | S_IROTH | S_IRGRP | S_IRUSR SEE ALSO DtDts(5), DtDtsLoadDataTypes(3), DtDtsFileToDataType(3), DtDtsBufferToDataType(3), fstat(3), lstat(2), stat(2).
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |