-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
60 lines (52 loc) · 1.61 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*********************************FILE__HEADER*********************************\
* File: utils.h
* Author: Daniel Brodsky & Lior Katav
* Date: August-2023
* Description: This header file provides the declarations for utility functions
* and type definitions for boolean and function return status.
\******************************************************************************/
#ifndef MAMAN14_UTILS_H
#define MAMAN14_UTILS_H
/**
* An enum representing function return statuses.
*/
typedef enum {
SUCCESS, /**< Represents a successful function execution */
FAILURE /**< Represents a failed function execution */
} Status;
/**
* An enum representing boolean values.
*/
typedef enum {
FALSE, /**< Represents a boolean False value */
TRUE /**< Represents a boolean True value */
} Boolean;
/**
* Duplicates a string.
*
* @param s - The string to be duplicated.
* @return - A pointer to the duplicated string.
*/
char *my_strdup(const char *s);
/**
* Filters a line to determine if it is a comment or blank line.
*
* @param line - The line to be filtered.
* @return - 1 if the line is a comment or blank line, 0 otherwise.
*/
int filter_line(const char *line);
/**
* Converts all characters in a string to lowercase.
*
* @param str - The string to be converted.
*/
void to_lowercase(char *str);
/**
* Checks if a string starts with a specific prefix.
*
* @param str - The string to be checked.
* @param prefix - The prefix to be searched.
* @return - 1 if the string starts with the prefix, 0 otherwise.
*/
int startsWith(const char *str, const char *prefix);
#endif