Find Jobs
Hire Freelancers

C program, simulate pipes | and count bytes of command in a file

$10-30 CAD

In Progress
Posted over 2 years ago

$10-30 CAD

Paid on delivery
./tally cat [login to view URL] : grep left : grep ha ....... tally executes a sequence of commands in parallel. The commands are separated by a colon: which acts as a redirect. The redirects made by: are implemented by UNIX sockets with local communication. So, just like | in a shell pipeline, tally with: connect the commands to each other. The standard output of one command is therefore redirected to the standard input of the next command. The standard input of the first command corresponds to the standard input of tally, and the standard output of the last command corresponds to the standard output of tally (usually the terminal in both cases). The standard output for error messages is not changed. The number of bytes that go through each redirect: is counted and written to a count file that will be in the directory where tally will run. For each redirection: the count file will contain a line with the following information, - the order of the redirection in the pipe (the account starts at 1), - followed by the characters: (a space,: and a space), - then the number of bytes that have passed through the redirection, - a line break \ n to end the line. 70% of the work is done (pipes, forks, execs) I just need to know how to count the bytes of each command and write in a file. Example ./tally cat [login to view URL] : grep left will output the result in the terminal as if it is cat [login to view URL] | grep left and create a file with bytes of each command (cat [login to view URL]) and (grep left of cat [login to view URL]) Output file example: 1 : 122 2 : 4 compile with make and run tests with make check
Project ID: 32313009

About the project

Remote project
Active 2 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs

About the client

Flag of CANADA
Montreal, Canada
0.0
0
Payment method verified
Member since Sep 22, 2014

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.