+// vim:ts=8:expandtab
#include <sys/types.h>
#include <string.h>
#include <stdarg.h>
* Reads size bytes into the destination buffer from filename.
*
*/
-void slurp(char *filename, char *destination, int size) {
- int fd;
+bool slurp(char *filename, char *destination, int size) {
+ int fd;
- if ((fd = open(filename, O_RDONLY)) == -1)
- die("Could not open \"%s\"\n", filename);
+ if ((fd = open(filename, O_RDONLY)) == -1)
+ return false;
- (void)read(fd, destination, size);
- (void)close(fd);
+ (void)read(fd, destination, size);
+ (void)close(fd);
+
+ return true;
}
/*
* Otherwise, the buffer size would have to be increased.
*
*/
-char *concat(const char *str1, const char *str2) {
- static char concatbuf[32];
- (void)snprintf(concatbuf, sizeof(concatbuf), "%s%s", str1, str2);
- return concatbuf;
+char *order_to_str(int number, char *name) {
+ static char buf[32];
+ (void)snprintf(buf, sizeof(buf), "%d%s", number, name);
+ return buf;
}