-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmy_misc.c
More file actions
35 lines (31 loc) · 849 Bytes
/
my_misc.c
File metadata and controls
35 lines (31 loc) · 849 Bytes
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
/*******************************************************************************
*
* File Name : misc.c
* Created By : Thomas Aurel
* Creation Date : March 10th, 2015
* Last Change : April 22th, 2015 at 23:10:55
* Last Changed By : Thomas Aurel
* Purpose :
*
*******************************************************************************/
#include <unistd.h>
#include "my_misc.h"
#include "my_string.h"
#include "my_math.h"
int my_ls(char *dir){
if ((execlp("ls", dir, (char *)NULL))==-1)
return 0;
return 1;
}
int my_wc(void){
if ((execlp("wc", "wc", (char *)NULL))==-1)
return 0;
return 1;
}
int my_stoi(char *str){
int result = 0;
for(int i = 0; i < my_strlen(str); i++){
result += my_pow((int) str[i], my_strlen(str) - i);
}
return result;
}