[Project Assignment]
Your project is to implement a shell-alike application, which acts like the Terminal / Konsole application in Ubuntu. Upon startup, it should show a command line asking the user to enter a command, for instance:
>_
[Milestone 1] - Due Week 11
For your first milestone, you need to implement the basic functionality in your shell application. It should only respond to the exit command and it should terminate upon entering that command. Additionally, you need to add history support (using a key of your choice) - e.g. if the user presses the Up or DOwnarrow key, it should show the previous or next command in the terminal just like the real terminal does and auto-complete them in the terminal. Example:
>_ (pressing Up)
>ls_ (pressing Up)
>cat test.txt_ (pressing Down)
>ls_ (pressing Down)
>_
[Milestone 2] - Due Week 12
For your second milestone, you need to implement support for executing external commands. Your application should be able to execute commands just like the real terminal does. Example:
>cat test.txt
This is the contents of test.txt
>_
[Lab 4] Homework - due on week 11
1. Write a program that creates N child processes, where N is taken from the command line, and makes each child process with index I compute the total number of divisors of the number I*10 and return them. The parent process will read each result returned by the children and show them on screen.
* Example:
N=5, child 0 will compute the number of divisors of 0, child 1 will compute the number of divisors of 10, child 2 the number of divisors of 20 and so on. Parent returns: "for child 0, I found 4 divisors", "for child 1, I found 6 divisors", etc.
* Desired input:
./app N
* Example:
./app 5
2. Write a program that creates N child processes, where N is taken from the command line, and also receives a filename. The program takes the input file and splits it so that each child process with the index I will show the exact Ith part of the file.
* Example:
Input file is 100 bytes in size and N=5. Child 0 will display bytes from 0 to 19, child 1 from 20 to 39, child 2 from 40 to 59 and so on.
* Desired input:
./app N input_file
* Example call:
./app 5 input.txt
[Lab 5] Homework - due on week 11
1. Write a program that creates a child process and waits for an input command (it reads it from the standard input). a) If the command is "show filename.txt" (no quotes), then the parent process will read the file filename.txt entirely and send it to the child process; the child process will send back to the parent the number of total words in that file, and the parent will show that number on screen. b) If the command is "trim filename.txt" (no quotes), the parent will no longer read the file, instead the child process will send to the parent the last 10 lines from the file filename.txt and the parent will show those lines on screen.
2. Write a program that creates N child processes, where N is taken from the command line, and also receives a filename and an input string. The program takes the input file and splits it so that each child process with the index I will process exactly the Ith part of the file, as follows: each child will determine if its allocated data chunk contains the input string or not, and all positions where matches occur. If matches are found, it will write to a pipe the locations of all occurrences.
Requirements:
a) Use a SINGLE PIPE for communication between the parent and all children.
b) BONUS points will be awarded if you can figure out a way to avoid misses if a string has a partial match in two different child processes (e.g. for "testing this", "testing " is partially matched by the first process and "this" by the second).
c) You can use strstr() to determine occurrences in a child process if you'd like, although that's not the optimal approach.
* Example call:
./app 5 input.txt "Something to search for"
Found occurrence at position 123
Found occurrence at position 567
MILESTONES 3 & 4
ANDONIE ALEX-MIHAI
ANDRONACHE DAN-ALEXANDRU
BACANU ALEXANDRU
BOBEI PAULA-ALEXANDRA
BOGDAN ROBERT-ANDREI
BORDINC FELICIA
BRANDIBURIU ROXANA-ANDRADA
BUDA ADRIAN-DANIEL
BULARKA SZILARD
BUTA CRISTINA-ANDREEA
BUTUNOI BOGDAN-PETRU
CAUACIU LUCIAN
CHEROIU COZMA STEFAN
CHISALITA GHEORGHITA-ADRIAN
CIOCOIU IULIAN-TIBERIU
CIUCIU DANIEL-MIHAITA
COTRAU MARIA-ALINA
CROITORU SANDU
DRAGULEASA MIHAI-IONUT
DUMITRASCU DANIEL-MIHAI
FILIP CRISTIAN
GLIGOR LAURA-ANA
GRECEA SIMONA
GRIDAN GABRIEL
GROZAVESCU ANA
HODUT ALEXANDRU-LAURENTIU
HOLLO DAVID-STEFAN
IENEA MARIO-NICOLA
ILINCA GEORGIANA-AURORA
ILIESI ALEXANDRU
IONESCU EDUARD-NICOLAE CEZAR
IOVA CLAUDIU-CRISTIAN
IURCA ADRIAN-VIOREL
JICHICI MANUELA
JURCUL MARIAN-DANIEL
LUDAIE AMBRA-CARINA
MACEC ALEXANDRU-MILAN
MAN MIHAI HOREA
MILICA IONUT-CATALIN
MOLNAR ERIKA
MUNTEAN ALEXANDRU
NEGRI DANIEL-ANGELO
NICULA CATALIN-ALIN
ONESCU ROBERT-CRISTIAN
OPREA SERGIU-IOSIF
PETEAN ANDREEA-ELISABETA
POP TUDOR-MARIAN
POPA SILVIU-CRISTIAN
PUTA DAN
ROS DENISA-CLAUDIA
RUS ANDREI
RUSU MIHAI-ION
SFERA KRISTINA
SICHITIU ROXANA-ELENA
STOENESCU CRISTINA-ALEXANDRA
STOIAN ALICE-RAMONA
STOICA ANGHEL-CATALIN
STRAULEA ANDREEA
STEFANESCU NATALIA-MARIA
STEFANITA RAZVAN-PETRISOR
TARPIAN GABRIEL-LUCIAN
TELCIAN LAURA-ANDRADA
TRAISTA EUGEN-MIHAI
TUDORASCU KARIN ANNE-MARIE
UNGUREANU ALEX-DANIEL
VLADUTU MARIAN-EDUARD
VOICU RAMONA-CRISTINA