-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathlibuwrite.c
More file actions
35 lines (30 loc) · 770 Bytes
/
libuwrite.c
File metadata and controls
35 lines (30 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* FUNET-NJE/HUJI-NJE Client utilities
*
* Common set of client used utility routines.
* These are collected to here from various modules for eased
* maintance.
*
* Matti Aarnio <mea@nic.funet.fi> 12-Feb-1991, 26-Sep-1993
*/
#include "prototypes.h"
#include "clientutils.h"
/*
| Write the given string into the file.
*/
int
Uwrite(outfil, string, size)
FILE *outfil;
const void *string; /* Line descption */
const int size;
{
unsigned short Size = htons(size);
if(fwrite(&Size, 1, sizeof(Size), outfil) != sizeof(Size)) {
logger(1, "UWRITE: Can't fwrite, error: %s\n", PRINT_ERRNO);
return 0;
}
if(fwrite(string, 1, size, outfil) != size) {
logger(1, "UWRITE: Can't fwrite, error: %s\n", PRINT_ERRNO);
return 0;
}
return 1; /* Done ok */
}