Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

(25 points) Consider the following scenario: You are programming a Raspberry Pi com puter running a Linux kernel. You have a compiled program (i.e., an

image text in transcribed
(25 points) Consider the following scenario: You are programming a Raspberry Pi com puter running a Linux kernel. You have a compiled program (i.e., an executable, e-g, called utility) that performs some task once (e.g. flashes an LED), and may take some command-line arguments (e.g, the number of times you want the LED to fash) What you want to do is write another program, named repeat.c, that accepts that other program (e.g., utility) as a command-line argument and continually executes it, from start to completion, as its own process (i.e., not as part of the repeat process). The repeat process never terminates (i.e., it runs forever, like a daemon). Write the complete repeat.c C program below. Do not use system in your program, and keep your program to less than 12 lines of code. Hint: the repeat process than one child at a time and never terminates before it. never has more Examples: 1 gcc echohello.c -o utility 2 s/utility 1 3 hello 4 sJutility 1 -nonewline 5 hellos/utility 2 6 hellohello 7 S /utility 3 -nonevline 8 hellohellohellos./utility 3 9 hellohellohello 10 $ 11 $ gec repeat.c-o repeat 12 /repeat /utility 2 13 hellohello 14 hellohello 15 hellohello 16 hellohello 17 hellohello 18 19 continues forever 20 21 $/repeat /utility 1-nonewline 22 hellohellohellohellohellohello....continues forever 23 $ ./repeat echo hello world 24 hello world 25 hello vorld 26 hello world 27 hello vorld 28 hello world 29 30 continues forever 31 32/repeat echo -n hello world Page 9 of 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions