openFile, readFile

This commit is contained in:
elvis
2022-04-22 21:59:40 +02:00
parent cf93e53ade
commit 8e9cc3de13
2 changed files with 670 additions and 12 deletions

View File

@ -12,7 +12,7 @@
#define LOGBUFSIZE 2048
#define MEOK "20" //OK
#define MEHE "21" // help message
// #define ME "21" // not used
// #define ME "22" // not used
#define MEFP "25" // file purged
@ -131,6 +131,12 @@ void sendMessageFile(char *m, fileT *f, long fd_c, taglia_t *taglia, char *mlog)
goto _sendMF_cleanup;
}
int n = 1;
if(writen(fd_c, &n, sizeof(n)) < 0) {
perror("writen");
goto _sendMF_cleanup;
}
if(sendFile(f, fd_c, taglia) < 0) {
perror("sendFile");
goto _sendMF_cleanup;
@ -165,6 +171,11 @@ void sendMessageFileN(char *m, fileT **f, int n, long fd_c, taglia_t *taglia, ch
goto _sendMFN_cleanup;
}
if(write(fd_c, &n, sizeof(n)) < 0) {
perror("writen");
goto _sendMFN_cleanup;
}
for(int i=0; i<n && (f[i]!=NULL); ++i) {
if(sendFile(f[i], fd_c, taglia) < 0) {
perror("sendFile");