libite 2.6.1
chomp.c File Reference
#include <errno.h>
#include <string.h>

Go to the source code of this file.

Functions

char * chomp (char *str)
 

Detailed Description

Author
Joachim Wiberg
Date
2014-2021

Definition in file chomp.c.

Function Documentation

◆ chomp()

char * chomp ( char * str)

Perl like chomp function, chop off last char(s) if newline.

Parameters
strString to chomp

This function is like Perl chomp, but it's set to chop of all trailing newlines. Useful in combination with fgets().

Returns
str, or NULL with errno set, if str is not a valid pointer.
Exceptions
EINVALif the input argument is not a valid pointer.

Definition at line 38 of file chomp.c.