Skip to content

Commit

Permalink
client_sc script added & some extra debugging to the client.c
Browse files Browse the repository at this point in the history
-details on how to use script includes inside the file
  • Loading branch information
PGryllos committed Nov 11, 2012
1 parent 898789f commit 2a19cc7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ int main(int argc, char **argv) {

/* confirmation of the order */
for(;;) {

if (confirm=='y')
break;

/* print out the order */
print_order(order);

if (confirm=='y')
break;

do {
printf("\n confirm? [y/n] :");
Expand Down
38 changes: 38 additions & 0 deletions client_sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# this is a script that enables the user to make
# multiple client requests to the server
# argument 1 specifies how many times the client program
# is going to execute
# argument 2 is specifies the name of the executable
# if no arguments are giver default values are :
# executable = client
# number of repetitions : 100

if [ $1 ]; then
n=$1;
else
n=100;
fi
if [[ -x $2 ]]; then

for ((i=1;i<=n;i++))
do
./$2 rand # call the client as specified by second argument
sleep 0.2 # just a little delay in order
# to have the rand function generate
# different orders
done
else
if [[ -x client ]]; then

for ((i=1;i<=n;i++))
do
./client rand # call the client as default
sleep 0.2 # just a little delay in order
# to have the rand function generate
# different orders
done
else
echo "specify the name of the executable";
fi

fi

0 comments on commit 2a19cc7

Please sign in to comment.