-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathunnecessary.c
105 lines (86 loc) · 1.39 KB
/
unnecessary.c
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include "simishell.h"
/**
* strcomp - a function to compare two strings
* @str: the first string to compare
* @equ: the secodn string to comapre too
*
* Return: returns an integer indicater of the boolean
*/
int strcomp(char *str, char *equ)
{
int i = 0;
int result = 0;
if (str == NULL || equ == NULL)
{
return (0);
}
while (equ[i] != '\0' || str[i] != '\0')
{
if (str[i] == equ[i])
{
result = 1;
}
else
{
result = 0;
}
i++;
}
return (result);
}
/**
* description - a function to discription about the program
*
* Return: void
*/
void description(void)
{
printstar();
printstar();
printstr("~- H.E.L.L.O _ W.A.R.M _ W.E.L.C.O.M.E -~");
printstr("");
printstr("This is a simple bash shell project.");
printstr("Designed by sertse and faj for ALX SE ");
printstr("https://github.com/sertsev");
printstar();
printstar();
}
/**
* printstar - prints a star line
*
* Return: void
*/
void printstar(void)
{
int i = 0;
write(1, "\n\t\t\t", 5);
while (i < 75)
{
write(1, "*", 2);
i++;
}
}
/**
* printstr - a function to print a given string between a stars
* @s: a string location pointer
*
* Return: void
*/
void printstr(char *s)
{
int len = strleng(s), spc, m = 0;
write(1, "\n\t\t\t***\t", strleng("\n\t\t\t***\t"));
spc = (60 - len) / 2;
while (m < spc)
{
write(1, " ", 2);
m++;
}
write(1, s, strleng(s));
while (m > 0)
{
write(1, " ", 2);
m--;
}
write(1, "\t***", strleng("\t***"));
}