-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject1-README
44 lines (30 loc) · 2.32 KB
/
Project1-README
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
## SYSTEM ENVIRONMENT
OS: Ubuntu22.04 x86_64
Processor Model name: Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Stepping: 2
BogoMIPS: 4800.03
Memory(RAM): 989.388 MB(approx 1GB)
## NO SPECIAL STEPS TO INSTALL xv6
## IMPLEMENTATION OF ls
1. To automatically hide hidden files and directories I have used an 'if statement' to check in the name of the file/directory starts with a '.' (dot).
2. To add '/' at the end of the directory name I find the first occurrence of ' '(blank space) in the name of the directory and replaced it with a '/'.
3. To show hidden files I have used a variable named 'showHidden' and if the value of 'showHidden' is 1 do not check the name for a '.' dot.
## IMPLEMENTATION of sleep
1. I have used the built-in systemcall "sleep" to pause the system for the time given by the user.
## IMPLEMENTATION of uniq
0. Two arrays (i). "output[][]" to store each unique line. (ii). "repeat[]" to store how many times a line is repeated.
1. While reading the input given by the user I compared the current line with the previous line and append the line to the "output" array if the.
2. To print all duplicate lines "-d", I have printed all the lines whose "repeat[index]"(i.e., value at the same "index" in "repeat[]" array) is greater than 1.
3. To print how many times a line is repeated "-c", I have printed the value in the "repeat[]" array along with the line.
4. To ignore the case when comparing "-i", I have made a string compare function "stringCmpi()" to compare the strings ignoring the case instead of using.
## IMPLEMENTATION of find
1. To search for a file or directory with the given name I used the function used in the "ls" command to list files in the given path and compare each f.
2. To implement the "-type" option I have used a variable named "type" that stores the input given by the user and an 'if statement' to print the name.
3. To implement the "-size" option I have used a variable named "size" if the size is not equal to "-1" only print files/directories with the given size)
## Extra files
1. "test.c" -> This command generate a file to test the "uniq" command
```Usage: test > test_file.txt```
this will create a file named "test_file.txt" which can be used to test the "uniq" command