Skip to content

Commit

Permalink
Day2
Browse files Browse the repository at this point in the history
  • Loading branch information
sameepkat committed Aug 1, 2024
1 parent b239030 commit eebb4d7
Show file tree
Hide file tree
Showing 39 changed files with 4,207 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.30)
project(Dash)
add_executable(${PROJECT_NAME} main.c main.h file_loc.c)
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Syscalls used

### 1. Getline()
```cpp
ssize_t getline(char **lineptr, size_t *n, FILE *stream);
```
Description: Reads a line of text from a stream. It can be a file, a pipe or standard input
### 2. Fork()
```cpp
pid_t fork(void);
```
Description: Creates a child process by duplicating the calling process.

### 3. Wait()
```cpp
pid_t wait(int *wstatus);
```
Description: Causes the current processes to wait until of its child process terminates.
### 4. Execve()
```cpp
int execve(const char *pathname, char *const argv[], char *const envp[]);
```
Description: Execute a new programmed referred to by the `pathname` variable. Here, `argv[]` is an array of strings, `envp[]` .......................

### 5. Strtok()
```cpp
char *stork(chat *str, const char *delim);
```
Description: Breaks a string into a sequence of tokens(a sequence of characters seperated by a delim)
### 6. Getenv()
```cpp
char *getenv(const char *name);
```
Description: Searches the environment list to find the environment variable name.

### 7. Stat()
```cpp
int stat(const char *pathname, struct stat *statbuf);
```
Description: Returns the information about the file in the buffer pointed to by the statbuf variable.
### 8. Access()
```cpp
int access(const char *pathname, int mode);
```
Description: Checks whether the file `pathname` can be accessed. Mode:
- F_OK: If file exits
- R_OK: If file exists and grants read permissions
- W_OK: If file exists and grants write permissions
- X_OK: If file exists and grants execute permissions

### 9. Strdup()
```cpp
char *strdup(const char *s);
```
Description: Returns a pointer to a new string which is a duplicate of the string s.
# Misc
#### 1. size_t, ssize_t
- Count of bytes. Result of `sizeof` operator.
- Included in `<string.h>`, `<sys/types.h>`, ..., etc.
#### 2. pid_t
- Process/User/Group identifier
- `<sys/types.h>`
#### 3. perror()
- print a system error message
- `<stdio.h>`
Loading

0 comments on commit eebb4d7

Please sign in to comment.