Skip to content
common.h 1.28 KiB
Newer Older
Seblu's avatar
Seblu committed
/*
** common.h for 42sh
**
** Made by Seblu
** Login   <seblu@epita.fr>
**
** Started on  Sun Jul 30 03:59:48 2006 Seblu
** Last update Fri Aug 25 03:31:29 2006 Seblu
Seblu's avatar
Seblu committed
*/

#ifndef COMMON_H_
# define COMMON_H_

Seblu's avatar
Seblu committed
/*!
** Merge strings
**
** @param n number of string to merge
** @param s1 First string to merge
**
** @return malloced string merged
** @warning the returned string must be freed by the caller
*/
Seblu's avatar
Seblu committed
char            *strmerge(int n, const char *s1, ...);
Seblu's avatar
Seblu committed

/*!
** Merge a vector of string
**
** @param vtable strings to merge
**
** @return a string merged from @arg vtable
*/
Seblu's avatar
Seblu committed
char            *strvmerge(const char * const *vtable);

Seblu's avatar
Seblu committed
/*!
** Return a malloc copy of the given, conserving only the basename
**
** @param path path where basename will be extracted
**
** @return malloced basename
** @warning Not use the standard function for reason of vicious
** definition in manuel.
*/
char		*basename(const char *path);

/*!
** Duplicate a string for @arg n characteres
**
** @param str string to duplicate
** @param n number of caractere to duplicate
**
** @return a new malloced string
*/
char            *strndup(const char *str, size_t n);

Seblu's avatar
Seblu committed
/*!
** Compute if string is composed only by digit
**
** @param str string to test
**
** @return boolean result
*/
int		isdigitstr(const char *str);

Seblu's avatar
Seblu committed
#endif