Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getln(3) [debian man page]

getln(3)						     Library Functions Manual							  getln(3)

NAME
getln - read one line of data SYNTAX
#include <getln.h> int getln(&ss,&sa,&match,sep); substdio ss; stralloc sa; int match; int sep; DESCRIPTION
getln reads a line of characters, terminated by a sep character, from ss. It returns the line in sa and sets match to 1. If getln sees end-of-input before it sees sep, it returns the partial line in sa and sets match to 0. getln normally returns 0. If it runs out of memory, or encounters an error from ss, it returns -1, setting errno appropriately. SEE ALSO
stralloc(3), substdio(3), getln2(3) getln(3)

Check Out this Related Man Page

stralloc(3)						     Library Functions Manual						       stralloc(3)

NAME
stralloc - dynamically allocated strings SYNTAX
#include <stralloc.h> int stralloc_ready(&sa,len); int stralloc_readyplus(&sa,len); int stralloc_copy(&sa,&sa2); int stralloc_copys(&sa,buf); int stralloc_copyb(&sa,buf,len); int stralloc_cat(&sa,&sa2); int stralloc_cats(&sa,buf); int stralloc_catb(&sa,buf,len); int stralloc_append(&sa,buf); int stralloc_0(&sa); int stralloc_starts(&sa,buf); stralloc sa = {0}; stralloc sa2 = {0}; unsigned int len; char *buf; DESCRIPTION
A stralloc variable holds a string in dynamically allocated space. String length is limited only by memory. String contents are unre- stricted. The stralloc structure has three components: sa.s is a pointer to the string, or 0 if it is not allocated; sa.len is the number of bytes in the string, if it is allocated; sa.a is the number of bytes allocated for the string, if it is allocated. A stralloc variable should be initialized to {0}, meaning unallocated. stralloc_ready makes sure that sa has enough space allocated for len characters. It allocates extra space if necessary. stralloc_readyplus makes sure that sa has enough space allocated for len characters more than its current length. If sa is unallocated, stralloc_readyplus is the same as stralloc_ready. stralloc_copy copies sa2 to sa, allocating space if necessary. Here sa2 is an allocated stralloc variable. stralloc_copys copies a 0-terminated string, buf, to sa, without the 0. stralloc_copyb copies len characters from buf to sa. stralloc_cat appends sa2 to sa, allocating space if necessary. If sa is unallocated, stralloc_cat is the same as stralloc_copy. stralloc_cats and stralloc_catb are analogous to stralloc_copys and stralloc_copyb. stralloc_append adds a single character, *buf, to sa, allocating space if necessary. stralloc_0 adds a single 0 character to sa. stralloc_starts returns 1 if the 0-terminated string buf, without the 0, is a prefix of sa. ERROR HANDLING
If a stralloc routine runs out of memory, it leaves sa alone and returns 0, setting errno appropriately. On success it returns 1; this guarantees that sa is allocated. SEE ALSO
alloc(3), error(3) stralloc(3)
Man Page

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk script for replacing 2 strings

Hi I have written a script for automating a program. There is a string in 2 lines that needs altering from input. The 2 lines are: prepare_flexreceptor4.py -r rec_rigid.pdbqt -s TYR119_TRP312 -x rec_flex.pdbqt and prepare_flexdocking4.py -l ind.pdbqt -r rec_flex.pdbqt -s TYR119_TRP312... (3 Replies)
Discussion started by: gav2251
3 Replies

2. Shell Programming and Scripting

Batch download

............. (9 Replies)
Discussion started by: hoo
9 Replies

3. Programming

Help with djbdns code

Hi, I need help to rewrite djbdns source code to accept 1024 bytes via UDP (limit is 512) #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include "uint16.h" #include "uint32.h" #include "str.h" #include "byte.h" #include "fmt.h" #include "ip4.h"... (0 Replies)
Discussion started by: cain82
0 Replies