Skip to content

Commit

Permalink
Separate test client
Browse files Browse the repository at this point in the history
  • Loading branch information
uoo723 committed Jun 22, 2017
1 parent 5c7e412 commit f26a3cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion include/client.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#ifndef CLIENT_H
#define CLIENT_H

void client();
#ifndef CLIENT_TEST
#define client() client_non_test()
#else
#define client() client_test()
#endif

void req_put(unsigned int, char *);
void req_get(unsigned int);
Expand Down
2 changes: 1 addition & 1 deletion src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static void snd_msg();
static key_t key_id;
static msgbuf_t msg;

void client() {
void client_non_test() {
if ((key_id = msgget(KEYID, IPC_CREAT|0666)) < 0) {
perror("msgget error ");
exit(0);
Expand Down
3 changes: 1 addition & 2 deletions src/client_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ void client_view() {
}

void show_get_result(unsigned int key, char *value) {
printf("%u\n", key);
if (strcmp(value, NODATA) == 0) {
printf("no data\n");
printf("value: no data\n");
} else {
printf("value: %s\n", value);
}
Expand Down

0 comments on commit f26a3cb

Please sign in to comment.