printInfo

This commit is contained in:
elvis
2022-04-21 20:08:22 +02:00
parent fdb98cec53
commit cf93e53ade
3 changed files with 12 additions and 5 deletions

View File

@ -23,6 +23,8 @@ typedef struct openfiles_s {
files_t *f;
char *wDir; // for files sent from the server after openFile
char *rDir; // for files read from the server
int print; // whether to print
FILE *out; // where to print
} openfiles_t;
// -----------------------------------------------------------------------------
@ -62,6 +64,8 @@ int openConnection(const char* sockname, int msec, const struct timespec abstime
openedFiles->numOfFiles = 0;
openedFiles->rDir = NULL;
openedFiles->wDir = NULL;
openedFiles->print = 0;
openedFiles->out = NULL;
}
struct sockaddr_un sa;
@ -178,7 +182,10 @@ int setDirectory(char* Dir, int rw) {
return 1;
}
void printInfo(int p) {
void printInfo(int p, FILE *stream) {
// 1 prints, 0 does not print
openedFiles->print = (p)? 1: 0;
openedFiles->out = stream;
return;
}