Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

isencrypt(3gen) [opensolaris man page]

isencrypt(3GEN) 				     String Pattern-Matching Library Functions					   isencrypt(3GEN)

NAME
isencrypt - determine whether a buffer of characters is encrypted SYNOPSIS
cc [flag]... [file]... -lgen [library]... #include<libgen.h> int isencrypt(const char *fbuf, size_t ninbuf); DESCRIPTION
isencrypt() uses heuristics to determine whether a buffer of characters is encrypted. It requires two arguments: a pointer to an array of characters and the number of characters in the buffer. isencrypt() assumes that the file is not encrypted if all the characters in the first block are ASCII characters. If there are non-ASCII characters in the first ninbuf characters, and if the setlocale() LC_CTYPE category is set to C or ascii, isencrypt() assumes that the buf- fer is encrypted If the LC_CTYPE category is set to a value other than C or ascii, then isencrypt() uses a combination of heuristics to determine if the buffer is encrypted. If ninbuf has at least 64 characters, a chi-square test is used to determine if the bytes in the buffer have a uniform distribution; if it does, then isencrypt() assumes the buffer is encrypted. If the buffer has less than 64 characters, a check is made for null characters and a terminating new-line to determine whether the buffer is encrypted. RETURN VALUES
If the buffer is encrypted, 1 is returned; otherwise, zero is returned. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
setlocale(3C), attributes(5) NOTES
When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in mul- tithreaded applications. SunOS 5.11 29 Dec 1996 isencrypt(3GEN)

Check Out this Related Man Page

bgets(3GEN)					     String Pattern-Matching Library Functions					       bgets(3GEN)

NAME
bgets - read stream up to next delimiter SYNOPSIS
cc [ flag ... ] file ... -lgen [ library ... ] #include <libgen.h> char *bgets(char *buffer, size_t count, FILE *stream, const char *breakstring); DESCRIPTION
The bgets() function reads characters from stream into buffer until either count is exhausted or one of the characters in breakstring is encountered in the stream. The read data is terminated with a null byte ('') and a pointer to the trailing null is returned. If a break- string character is encountered, the last non-null is the delimiter character that terminated the scan. Note that, except for the fact that the returned value points to the end of the read string rather than to the beginning, the call bgets(buffer, sizeof buffer, stream, " "); is identical to fgets (buffer, sizeof buffer, stream); There is always enough room reserved in the buffer for the trailing null character. If breakstring is a null pointer, the value of breakstring from the previous call is used. If breakstring is null at the first call, no characters will be used to delimit the string. RETURN VALUES
NULL is returned on error or end-of-file. Reporting the condition is delayed to the next call if any characters were read but not yet returned. EXAMPLES
Example 1 Example of the bgets() function. The following example prints the name of the first user encountered in /etc/passswd, including a trailing ":" #include <stdio.h> #include<libgen.h> int main() { char buffer[8]; FILE *fp; if ((fp = fopen("/etc/passwd","r")) == NULL) { perror("/etc/passwd"); return 1; } if (bgets(buffer, 8, fp, ":") == NULL) { perror("bgets"); return 1; } (void) puts(buffer); return 0; } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
gets(3C), attributes(5) NOTES
When compiling multithread applications, the _REENTRANT flag must be defined on the compile line. This flag should only be used in multi- threaded applications. SunOS 5.11 9 May 2001 bgets(3GEN)
Man Page