2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2015 Toomas Soome <tsoome@me.com>
19 ficlMalloc(size_t size
)
21 return (malloc(size
));
25 ficlRealloc(void *p
, size_t size
)
27 return (realloc(p
, size
));
37 ficlCallbackDefaultTextOut(ficlCallback
*callback
, char *message
)
39 FICL_IGNORE(callback
);
41 if (message
!= NULL
) {
44 putchar((unsigned char)*(message
++));
46 (void) fputs(message
, stdout
);
47 (void) fflush(stdout
);
54 ficlFileTruncate(ficlFile
*ff
, ficlUnsigned size
)
56 return (ftruncate(fileno(ff
->f
), size
));
60 ficlFileStatus(char *filename
, int *status
)
64 if (stat(filename
, &statbuf
) == 0) {
65 *status
= statbuf
.st_mode
;
73 ficlFileSize(ficlFile
*ff
)
81 if (fstat(fileno(ff
->f
), &statbuf
) != 0)
84 return (statbuf
.st_size
);