51 lines
1 KiB
Markdown
51 lines
1 KiB
Markdown
# utils.h
|
|
|
|
## Include Guard
|
|
```c
|
|
#ifndef UTILS_H
|
|
# define UTILS_H
|
|
|
|
# include <stdint.h>
|
|
# include <stdio.h>
|
|
```
|
|
## Functions
|
|
|
|
### [`read_line`](/srcs/utils/io/read_line.c.md#read_line)
|
|
Get a line from a file.
|
|
```c
|
|
char *
|
|
read_line(FILE *f);
|
|
```
|
|
|
|
### [`starts_with`](/srcs/utils/string/starts_with.c.md#starts_with)
|
|
Check if a string starts with a given prefix.
|
|
```c
|
|
int8_t
|
|
starts_with(const char *str, const char *prefix);
|
|
```
|
|
|
|
### [`extract_fence_ext`](/srcs/utils/string/extract_fence_ext.c.md#extract_fence_ext)
|
|
Extract the extension from a fence string.
|
|
```c
|
|
char *
|
|
extract_fence_ext(const char *fence);
|
|
```
|
|
|
|
### [`extract_file_ext`](/srcs/utils/string/extract_file_ext.c.md#extract_file_ext)
|
|
Extract the file extension from a file path.
|
|
```c
|
|
const char *
|
|
extract_file_ext(const char *path);
|
|
```
|
|
|
|
### [`infer_ext_from_filename`](/srcs/utils/string/infer_ext_from_filename.c.md#infer_ext_from_filename)
|
|
Infer the file extension from a filename.
|
|
```c
|
|
const char *
|
|
infer_ext_from_filename(const char *path);
|
|
```
|
|
|
|
## End Guard
|
|
```c
|
|
#endif
|
|
```
|