سلام دوستان یه سورس سوکت به زبان سی دارم هرکاری میکنم با visual studio 2010کامپایل نمیشه 2006 رو هم ندارم امتØان کنم.
خواهشن یکی کامپایلش کنه خیلی ضروریه!!!!!!!!
اصلن نمیدونم چرا اروری مزخر٠میده؟
==============================
سورس مربوط به سرویس دهنده smtp هست
و سورس دومی برای pop3
=============================
============================================
خواهشن یکی کامپایلش کنه خیلی ضروریه!!!!!!!!
اصلن نمیدونم چرا اروری مزخر٠میده؟
==============================
سورس مربوط به سرویس دهنده smtp هست
و سورس دومی برای pop3
=============================
#include <rpc/rpc.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#ifndef _MAILBOX_H
#define _MAILBOX_H
/*the port mail clients will be connecting to */
#define MSERVERPORT 3476
/* server hold 20 mails at most*/
#define MAILMAX 20
/*all message are of fixed length: MSGLEN*/
#define MSGLEN 80
#define START 1
#define QUIT 2
#define RETRIEVE_MESSAGE 3
#define INSERT_MESSAGE 4
#define LIST_ALL_MESSAGES 5
#define DELETE_MESSAGE 6
typedef char mess[MSGLEN];
struct argument {
int cmdType;
mess user;
int messageID;
mess message;
};
typedef struct argument argument;
struct srvResponse {
int respondID; /* 0: successful, otherwise error*/
mess message;
};
typedef struct srvResponse srvResponse;
struct mails {
int mailNum;
mess mails[MAILMAX];
};
typedef struct mails mails;
#endif
#define MAXUSER 100
static char* INTERNALERR = "System internal error";
struct mailbox {
char user[80];
struct timeval lastAccessTime;
mails mails;
};
typedef struct mailbox mailbox;
static mailbox * mailSpool[MAXUSER];
static char* errMessage;
void debug(char * msg) {errMessage = msg;}
int getEmptyMailSpool() {
int i;
for (i=0; i<MAXUSER;i++) {
if (mailSpool[i] == NULL) return i;
}
debug("MailSpool is full");
return -1;
}
mailbox * getMailBox(char* user) {
int i;
i = getMailBoxIndex(user);
if (i< 0) return NULL;
else return mailSpool[i];
}
int getMailBoxIndex(char * user) {
int i;
struct timeval curTime;
char buffer[100];
for (i=0; i<MAXUSER;i++) {
if ((mailSpool[i] != NULL) &&
(strcmp(user,mailSpool[i]->user) == 0)) {
gettimeofday(&curTime,NULL);
if ((curTime.tv_sec - mailSpool[i]->
lastAccessTime.tv_sec) >300) {
debug("session expired");
return -1;
}
gettimeofday(&mailSpool[i]->lastAccessTime,NULL);
return i;
}
}
sprintf(buffer,"mailbox for %s not found",user);
debug(buffer);
return -1;
}
/*
1. read "user.mbx" from local file system
2. if file not exist, then create one
3. initialize the necessary fields
4. add it to the mailSpool
status: test
*/
mailbox* loadMailBox(char* user) {
FILE * fp;
char filename[MSGMAX+5];
char msg[MSGMAX+1];
mailbox* mbox;
int i;
strcpy(filename,user);
strcat(filename,".mbx");
fp = fopen(filename,"a+");
if (fp == NULL) {
debug("open file failed");
return NULL;
}
mbox = (mailbox *) malloc(sizeof(mailbox));
if (mbox == NULL) {
debug("allocate memory for mbox failed");
fclose(fp);
return NULL;
}
//initialize the mailbox
mbox->mails.mailNum = 0;
gettimeofday(&mbox->lastAccessTime,NULL);
strcpy(mbox->user,user);
while ((mbox->mails.mailNum < MAILMAX) &&
(fgets(msg,MSGMAX+1,fp) !==
strcpy(mbox->mails.mails[mbox->mails.mailNum],msg); NULL)){
mbox->mails.mailNum ++;
}
i = getEmptyMailSpool();
if (i == -1) {
free(mbox);
fclose(fp);
return NULL;
}
mailSpool[i] = mbox;
fclose(fp);
return mbox;
}
/*
save line by line
*/
void saveMailBox(mailbox * mbox) {
FILE * fp;
char filename[MSGMAX+5];
char msg[MSGMAX+1];
int i;
strcpy(filename,mbox->user);
strcat(filename,".mbx");
fp = fopen(filename,"w");
if (fp == NULL) {
debug("open file failed");
return NULL;
}
for (i=0; i<mbox->mails.mailNum; i++) {
fputs(mbox->mails.mails[i],fp);
}
fclose(fp);
}
/*
getMailBox, if success, do nothing
else loadMailBox, and insert it to the mailspool
*/
char ** start_2(char ** user,struct svc_req * req){
mailbox* myMbox = getMailBox(*user);
if (myMbox == NULL) { //not logged in
myMbox = loadMailBox(*user);
}
if (myMbox == NULL) {
return & errMessage; //what's the matter?
}
strcat(*user," log in successful");
return(user);
}
/*
remove the user from the spool
save the mailbox
*/
char ** quit_2(char ** user,struct svc_req * req){
int i = getMailBoxIndex(*user);
mailbox* myMbox;
if (i < 0) {
return & errMessage; //what's the matter?
}
myMbox = mailSpool[i];
saveMailBox(myMbox);
return(user);
}
/*
locate the mail box
*/
char ** insert_message_2(insert_argument * arg,struct svc_req * req){
mailbox* myMailBox;
myMailBox = getMailBox(arg->user);
if (myMailBox == NULL) {
return &errMessage;
}
if (myMailBox->mails.mailNum >= MAILMAX) {
debug("mailbox reached it's max size\n");
return &errMessage;
}
strcpy(myMailBox->mails.mails[myMailBox->mails.mailNum],arg->mesg);
myMailBox->mails.mailNum ++;
debug("mail insert successful");
return(&errMessage);
}
/*
design:
1. get mailbox, if error, return mails with mailNum = -1, put the error meg in mails[0]
2. return all the mails
status: design
*/
mails* list_all_messages_2(char** user,struct svc_req * req){
mailbox* myMailBox;
static mails allMails;
myMailBox = getMailBox(*user);
if (myMailBox == NULL) {
allMails.mailNum = -1;
strcpy(allMails.mails[0],errMessage);
return &allMails;
}
return &(myMailBox->mails);
}
char** retrieve_message_2(argument * arg,struct svc_req * req){
mailbox* myMailBox;
int i;
myMailBox = getMailBox(arg->user);
if (myMailBox == NULL) {
return &errMessage;
}
if (arg->number >= myMailBox->mails.mailNum) {
debug("No such mail\n");
return &errMessage;
}
debug(myMailBox->mails.mails[arg->number]);
return(&errMessage);
}
char ** delete_message_2(argument * arg,struct svc_req * req){
mailbox* myMailBox;
int i;
myMailBox = getMailBox(arg->user);
if (myMailBox == NULL) {
return &errMessage;
}
if (arg->number >= myMailBox->mails.mailNum) {
debug("No such mail\n");
return &errMessage;
}
for (i=arg->number; i<myMailBox->mails.mailNum-1;i++) {
strcpy(myMailBox->mails.mails[i],myMailBox->mails.mails[i+1]);
}
myMailBox->mails.mailNum --;
debug("mail delete successful");
return(&errMessage);
}
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#ifndef _MAILBOX_H
#define _MAILBOX_H
/*the port mail clients will be connecting to */
#define MSERVERPORT 3476
/* server hold 20 mails at most*/
#define MAILMAX 20
/*all message are of fixed length: MSGLEN*/
#define MSGLEN 80
#define START 1
#define QUIT 2
#define RETRIEVE_MESSAGE 3
#define INSERT_MESSAGE 4
#define LIST_ALL_MESSAGES 5
#define DELETE_MESSAGE 6
typedef char mess[MSGLEN];
struct argument {
int cmdType;
mess user;
int messageID;
mess message;
};
typedef struct argument argument;
struct srvResponse {
int respondID; /* 0: successful, otherwise error*/
mess message;
};
typedef struct srvResponse srvResponse;
struct mails {
int mailNum;
mess mails[MAILMAX];
};
typedef struct mails mails;
#endif
#define MAXUSER 100
static char* INTERNALERR = "System internal error";
struct mailbox {
char user[80];
struct timeval lastAccessTime;
mails mails;
};
typedef struct mailbox mailbox;
static mailbox * mailSpool[MAXUSER];
static char* errMessage;
void debug(char * msg) {errMessage = msg;}
int getEmptyMailSpool() {
int i;
for (i=0; i<MAXUSER;i++) {
if (mailSpool[i] == NULL) return i;
}
debug("MailSpool is full");
return -1;
}
mailbox * getMailBox(char* user) {
int i;
i = getMailBoxIndex(user);
if (i< 0) return NULL;
else return mailSpool[i];
}
int getMailBoxIndex(char * user) {
int i;
struct timeval curTime;
char buffer[100];
for (i=0; i<MAXUSER;i++) {
if ((mailSpool[i] != NULL) &&
(strcmp(user,mailSpool[i]->user) == 0)) {
gettimeofday(&curTime,NULL);
if ((curTime.tv_sec - mailSpool[i]->
lastAccessTime.tv_sec) >300) {
debug("session expired");
return -1;
}
gettimeofday(&mailSpool[i]->lastAccessTime,NULL);
return i;
}
}
sprintf(buffer,"mailbox for %s not found",user);
debug(buffer);
return -1;
}
/*
1. read "user.mbx" from local file system
2. if file not exist, then create one
3. initialize the necessary fields
4. add it to the mailSpool
status: test
*/
mailbox* loadMailBox(char* user) {
FILE * fp;
char filename[MSGMAX+5];
char msg[MSGMAX+1];
mailbox* mbox;
int i;
strcpy(filename,user);
strcat(filename,".mbx");
fp = fopen(filename,"a+");
if (fp == NULL) {
debug("open file failed");
return NULL;
}
mbox = (mailbox *) malloc(sizeof(mailbox));
if (mbox == NULL) {
debug("allocate memory for mbox failed");
fclose(fp);
return NULL;
}
//initialize the mailbox
mbox->mails.mailNum = 0;
gettimeofday(&mbox->lastAccessTime,NULL);
strcpy(mbox->user,user);
while ((mbox->mails.mailNum < MAILMAX) &&
(fgets(msg,MSGMAX+1,fp) !==
strcpy(mbox->mails.mails[mbox->mails.mailNum],msg); NULL)){
mbox->mails.mailNum ++;
}
i = getEmptyMailSpool();
if (i == -1) {
free(mbox);
fclose(fp);
return NULL;
}
mailSpool[i] = mbox;
fclose(fp);
return mbox;
}
/*
save line by line
*/
void saveMailBox(mailbox * mbox) {
FILE * fp;
char filename[MSGMAX+5];
char msg[MSGMAX+1];
int i;
strcpy(filename,mbox->user);
strcat(filename,".mbx");
fp = fopen(filename,"w");
if (fp == NULL) {
debug("open file failed");
return NULL;
}
for (i=0; i<mbox->mails.mailNum; i++) {
fputs(mbox->mails.mails[i],fp);
}
fclose(fp);
}
/*
getMailBox, if success, do nothing
else loadMailBox, and insert it to the mailspool
*/
char ** start_2(char ** user,struct svc_req * req){
mailbox* myMbox = getMailBox(*user);
if (myMbox == NULL) { //not logged in
myMbox = loadMailBox(*user);
}
if (myMbox == NULL) {
return & errMessage; //what's the matter?
}
strcat(*user," log in successful");
return(user);
}
/*
remove the user from the spool
save the mailbox
*/
char ** quit_2(char ** user,struct svc_req * req){
int i = getMailBoxIndex(*user);
mailbox* myMbox;
if (i < 0) {
return & errMessage; //what's the matter?
}
myMbox = mailSpool[i];
saveMailBox(myMbox);
return(user);
}
/*
locate the mail box
*/
char ** insert_message_2(insert_argument * arg,struct svc_req * req){
mailbox* myMailBox;
myMailBox = getMailBox(arg->user);
if (myMailBox == NULL) {
return &errMessage;
}
if (myMailBox->mails.mailNum >= MAILMAX) {
debug("mailbox reached it's max size\n");
return &errMessage;
}
strcpy(myMailBox->mails.mails[myMailBox->mails.mailNum],arg->mesg);
myMailBox->mails.mailNum ++;
debug("mail insert successful");
return(&errMessage);
}
/*
design:
1. get mailbox, if error, return mails with mailNum = -1, put the error meg in mails[0]
2. return all the mails
status: design
*/
mails* list_all_messages_2(char** user,struct svc_req * req){
mailbox* myMailBox;
static mails allMails;
myMailBox = getMailBox(*user);
if (myMailBox == NULL) {
allMails.mailNum = -1;
strcpy(allMails.mails[0],errMessage);
return &allMails;
}
return &(myMailBox->mails);
}
char** retrieve_message_2(argument * arg,struct svc_req * req){
mailbox* myMailBox;
int i;
myMailBox = getMailBox(arg->user);
if (myMailBox == NULL) {
return &errMessage;
}
if (arg->number >= myMailBox->mails.mailNum) {
debug("No such mail\n");
return &errMessage;
}
debug(myMailBox->mails.mails[arg->number]);
return(&errMessage);
}
char ** delete_message_2(argument * arg,struct svc_req * req){
mailbox* myMailBox;
int i;
myMailBox = getMailBox(arg->user);
if (myMailBox == NULL) {
return &errMessage;
}
if (arg->number >= myMailBox->mails.mailNum) {
debug("No such mail\n");
return &errMessage;
}
for (i=arg->number; i<myMailBox->mails.mailNum-1;i++) {
strcpy(myMailBox->mails.mails[i],myMailBox->mails.mails[i+1]);
}
myMailBox->mails.mailNum --;
debug("mail delete successful");
return(&errMessage);
}
#include <rpc/rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#ifndef _MAILBOX_H
#define _MAILBOX_H
/*the port mail clients will be connecting to */
#define MSERVERPORT 3476
/* server hold 20 mails at most*/
#define MAILMAX 20
/*all message are of fixed length: MSGLEN*/
#define MSGLEN 80
#define START 1
#define QUIT 2
#define RETRIEVE_MESSAGE 3
#define INSERT_MESSAGE 4
#define LIST_ALL_MESSAGES 5
#define DELETE_MESSAGE 6
typedef char mess[MSGLEN];
struct argument {
int cmdType;
mess user;
int messageID;
mess message;
};
typedef struct argument argument;
/*
server to client message
*/
struct srvResponse {
int respondID; /* 0: successful, otherwise error*/
mess message;
};
typedef struct srvResponse srvResponse;
struct mails {
int mailNum;
mess mails[MAILMAX];
};
typedef struct mails mails;
#endif /* !_MAILBOX_H */
#define CMDQUIT 0
#define CMDLIST 1
#define CMDREAD 2
#define CMDINSERT 3
#define CMDDELETE 4
void main(int argc, char* argv[]){
CLIENT *cl;
char hname[70];
char* user;
char cmd[80];
int cmdType;
char* tokens[10];
char* token;
int tokenNum;
char** p;
int quit = 0;
mails * myMails;
int i;
argument arg;
insert_argument insert_arg;
int messageID;
char message[80+1];
if (argc != 3) {
printf("Usage: rpcclient hostname userID\n");
exit(1);
}
cl = clnt_create(argv[1],MAILBOX_PROG, MAILBOX_VERS, "udp");
if (cl == NULL) {
clnt_pcreateerror(argv[1]);
exit(1);
}
printf("Getting ready to call start\n");
// strcpy(host,"ClientA");
i = gethostname(hname,69);
printf("hostname = %s i= %d\n",hname,i);
user = strcat(hname,argv[2]);
printf("user = %s i= %d\n",user,i);
p = start_2(&user,cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s\n",*p);
printf("press any key to continue"); getchar();
/*
command interpreter
*/
while (quit == 0) {
system("clear");
printf("******* Available Commands *******\n");
printf(" quit --> quit the system\n");
printf(" list --> list all mails\n");
printf(" read [msgNO] -->read a certain mail\n");
printf(" delete [msgNO] --> delete the mail\n");
printf(" insert --> insert a message\n");
printf("***********************************\n");
printf("cmd>");
gets(cmd);
for((token=strtok(cmd,""));token&&(tokenNum < 9);token=
strtok(NULL,â€")) {
tokens[tokenNum] = token;
tokenNum ++;
}
if (tokenNum < 1) {
printf("command error, press any key to continue");
getchar();
continue;
}
cmdType = -1;
if (strcmp(tokens[0],"quit") == 0) cmdType = CMDQUIT;
if (strcmp(tokens[0],"list") == 0) cmdType = CMDLIST;
if (strcmp(tokens[0],"read") == 0) {
printf(" messageID:");
gets(message);
messageID = atoi(message);
if (messageID != 0) {
messageID --;
cmdType = CMDREAD;
}
}
if (strcmp(tokens[0],"delete") == 0) {
printf(" messageID:");
gets(message);
messageID = atoi(message);
if (messageID != 0) {
messageID --;
cmdType = CMDDELETE;
}
}
if (strcmp(tokens[0],"insert") == 0) {
printf(" message:");
gets(message);
cmdType = CMDINSERT;
}
switch (cmdType) {
case -1:
printf("command error, press any key to continue");
getchar();
break;
case CMDQUIT:
p= quit_2(&user, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
quit= 1;
printf("Thanks for using Zheng Run's Mail System\n");
printf("Bye! Bye %s!\n",*p);
break;
case CMDLIST:
myMails = list_all_messages_2(&user, cl);
if (myMails == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
if (myMails->mailNum < 0) { //error
printf("%s\n",myMails->mails[0]);
} else {
printf("you have %d mails totally\n",myMails->mailNum);
for (i=0; i< myMails->mailNum;i++) {
printf("%d: %s",i+1,myMails->mails[i]);
}
}
printf("retrived mail list finished, press any key to continue");
getchar();
break;
case CMDREAD:
strcpy(arg.user,user);
arg.number = messageID;
p= retrieve_message_2(&arg, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s press any key to continue",*p); getchar();
break;
break;
case CMDDELETE:
strcpy(arg.user,user);
arg.number = messageID;
p= delete_message_2(&arg, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s press any key to continue",*p); getchar();
break;
case CMDINSERT:
strcpy(insert_arg.user,user);
strcpy(insert_arg.mesg,message);
strcat(insert_arg.mesg,"\n");
p= insert_message_2(&insert_arg, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s press any key to continue",*p); getchar();
break;
}
}
clnt_destroy(cl);
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#ifndef _MAILBOX_H
#define _MAILBOX_H
/*the port mail clients will be connecting to */
#define MSERVERPORT 3476
/* server hold 20 mails at most*/
#define MAILMAX 20
/*all message are of fixed length: MSGLEN*/
#define MSGLEN 80
#define START 1
#define QUIT 2
#define RETRIEVE_MESSAGE 3
#define INSERT_MESSAGE 4
#define LIST_ALL_MESSAGES 5
#define DELETE_MESSAGE 6
typedef char mess[MSGLEN];
struct argument {
int cmdType;
mess user;
int messageID;
mess message;
};
typedef struct argument argument;
/*
server to client message
*/
struct srvResponse {
int respondID; /* 0: successful, otherwise error*/
mess message;
};
typedef struct srvResponse srvResponse;
struct mails {
int mailNum;
mess mails[MAILMAX];
};
typedef struct mails mails;
#endif /* !_MAILBOX_H */
#define CMDQUIT 0
#define CMDLIST 1
#define CMDREAD 2
#define CMDINSERT 3
#define CMDDELETE 4
void main(int argc, char* argv[]){
CLIENT *cl;
char hname[70];
char* user;
char cmd[80];
int cmdType;
char* tokens[10];
char* token;
int tokenNum;
char** p;
int quit = 0;
mails * myMails;
int i;
argument arg;
insert_argument insert_arg;
int messageID;
char message[80+1];
if (argc != 3) {
printf("Usage: rpcclient hostname userID\n");
exit(1);
}
cl = clnt_create(argv[1],MAILBOX_PROG, MAILBOX_VERS, "udp");
if (cl == NULL) {
clnt_pcreateerror(argv[1]);
exit(1);
}
printf("Getting ready to call start\n");
// strcpy(host,"ClientA");
i = gethostname(hname,69);
printf("hostname = %s i= %d\n",hname,i);
user = strcat(hname,argv[2]);
printf("user = %s i= %d\n",user,i);
p = start_2(&user,cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s\n",*p);
printf("press any key to continue"); getchar();
/*
command interpreter
*/
while (quit == 0) {
system("clear");
printf("******* Available Commands *******\n");
printf(" quit --> quit the system\n");
printf(" list --> list all mails\n");
printf(" read [msgNO] -->read a certain mail\n");
printf(" delete [msgNO] --> delete the mail\n");
printf(" insert --> insert a message\n");
printf("***********************************\n");
printf("cmd>");
gets(cmd);
for((token=strtok(cmd,""));token&&(tokenNum < 9);token=
strtok(NULL,â€")) {
tokens[tokenNum] = token;
tokenNum ++;
}
if (tokenNum < 1) {
printf("command error, press any key to continue");
getchar();
continue;
}
cmdType = -1;
if (strcmp(tokens[0],"quit") == 0) cmdType = CMDQUIT;
if (strcmp(tokens[0],"list") == 0) cmdType = CMDLIST;
if (strcmp(tokens[0],"read") == 0) {
printf(" messageID:");
gets(message);
messageID = atoi(message);
if (messageID != 0) {
messageID --;
cmdType = CMDREAD;
}
}
if (strcmp(tokens[0],"delete") == 0) {
printf(" messageID:");
gets(message);
messageID = atoi(message);
if (messageID != 0) {
messageID --;
cmdType = CMDDELETE;
}
}
if (strcmp(tokens[0],"insert") == 0) {
printf(" message:");
gets(message);
cmdType = CMDINSERT;
}
switch (cmdType) {
case -1:
printf("command error, press any key to continue");
getchar();
break;
case CMDQUIT:
p= quit_2(&user, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
quit= 1;
printf("Thanks for using Zheng Run's Mail System\n");
printf("Bye! Bye %s!\n",*p);
break;
case CMDLIST:
myMails = list_all_messages_2(&user, cl);
if (myMails == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
if (myMails->mailNum < 0) { //error
printf("%s\n",myMails->mails[0]);
} else {
printf("you have %d mails totally\n",myMails->mailNum);
for (i=0; i< myMails->mailNum;i++) {
printf("%d: %s",i+1,myMails->mails[i]);
}
}
printf("retrived mail list finished, press any key to continue");
getchar();
break;
case CMDREAD:
strcpy(arg.user,user);
arg.number = messageID;
p= retrieve_message_2(&arg, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s press any key to continue",*p); getchar();
break;
break;
case CMDDELETE:
strcpy(arg.user,user);
arg.number = messageID;
p= delete_message_2(&arg, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s press any key to continue",*p); getchar();
break;
case CMDINSERT:
strcpy(insert_arg.user,user);
strcpy(insert_arg.mesg,message);
strcat(insert_arg.mesg,"\n");
p= insert_message_2(&insert_arg, cl);
if (p == NULL) {
clnt_perror(cl,argv[1]);
exit(1);
}
printf("%s press any key to continue",*p); getchar();
break;
}
}
clnt_destroy(cl);
}
Comment