Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
b32faa5a
Commit
b32faa5a
authored
Nov 06, 2010
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Set everything to 80-char limit.
parent
f0b0d329
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
os/ass3/fishbones.c
os/ass3/fishbones.c
+15
-9
No files found.
os/ass3/fishbones.c
View file @
b32faa5a
...
...
@@ -54,9 +54,12 @@ static void gup(FILE * log1, FILE * log2, int pipe_id[2], int myNumber)
{
if
(
!
antidote
)
{
fprintf
(
log1
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log2
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log3
,
"Child %d has no antidote for poison and will exit
\n
"
,
myNumber
);
fprintf
(
log1
,
"Child %d has no antidote for poison "
"and will exit
\n
"
,
myNumber
);
fprintf
(
log2
,
"Child %d has no antidote for poison "
"and will exit
\n
"
,
myNumber
);
fprintf
(
log3
,
"Child %d has no antidote for poison "
"and will exit
\n
"
,
myNumber
);
break
;
}
else
...
...
@@ -70,11 +73,11 @@ static void gup(FILE * log1, FILE * log2, int pipe_id[2], int myNumber)
else
if
(
c
==
'A'
)
{
antidote
++
;
fprintf
(
log1
,
"Child %d finds antidote (now has %d
andidote)
\n
"
,
fprintf
(
log1
,
"Child %d finds antidote (now has %d
)
\n
"
,
myNumber
,
antidote
);
fprintf
(
log2
,
"Child %d finds antidote (now has %d
andidote)
\n
"
,
fprintf
(
log2
,
"Child %d finds antidote (now has %d
)
\n
"
,
myNumber
,
antidote
);
fprintf
(
log3
,
"Child %d finds antidote (now has %d
andidote)
\n
"
,
fprintf
(
log3
,
"Child %d finds antidote (now has %d
)
\n
"
,
myNumber
,
antidote
);
}
}
while
(
c
!=
'\0'
);
...
...
@@ -126,7 +129,8 @@ main(int argc, char * argv[])
if
(
pipe
(
pipe_id
)
)
{
fprintf
(
stderr
,
"Error %d occured while creating the pipe
\n
"
,
errno
);
fprintf
(
stderr
,
"Error %d occured while creating the pipe
\n
"
,
errno
);
exit
(
1
);
}
...
...
@@ -192,8 +196,10 @@ main(int argc, char * argv[])
gup
(
log1
,
log2
,
pipe_id
,
kiddoCount
);
break
;
default:
fprintf
(
log1
,
"Started child process %d with id %d
\n
"
,
kiddoCount
,
child_id
);
fprintf
(
log2
,
"Started child process %d with id %d
\n
"
,
kiddoCount
,
child_id
);
fprintf
(
log1
,
"Started child process %d with id %d
\n
"
,
kiddoCount
,
child_id
);
fprintf
(
log2
,
"Started child process %d with id %d
\n
"
,
kiddoCount
,
child_id
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment