summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/system.h b/src/system.h
index 06f09cba..1677999e 100644
--- a/src/system.h
+++ b/src/system.h
@@ -1,5 +1,5 @@
/* system-dependent definitions for coreutils
- Copyright (C) 1989-2012 Free Software Foundation, Inc.
+ Copyright (C) 1989-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,6 +30,9 @@ you must include <sys/types.h> before including this file
#include <sys/stat.h>
+/* Commonly used file permission combination. */
+#define MODE_RW_UGO (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
+
#if !defined HAVE_MKFIFO
# define mkfifo(name, mode) mknod (name, (mode) | S_IFIFO, 0)
#endif
@@ -536,6 +539,14 @@ is_nul (const char *buf, size_t bufsize)
)
static inline void
+emit_mandatory_arg_note (void)
+{
+ fputs (_("\n\
+Mandatory arguments to long options are mandatory for short options too.\n\
+"), stdout);
+}
+
+static inline void
emit_size_note (void)
{
fputs (_("\n\
@@ -623,6 +634,21 @@ The following directory is part of the cycle:\n %s\n"), \
} \
while (0)
+/* Like stpncpy, but do ensure that the result is NUL-terminated,
+ and do not NUL-pad out to LEN. I.e., when strnlen (src, len) == len,
+ this function writes a NUL byte into dest[len]. Thus, the length
+ of the destination buffer must be at least LEN + 1.
+ The DEST and SRC buffers must not overlap. */
+static inline char *
+stzncpy (char *restrict dest, char const *restrict src, size_t len)
+{
+ char const *src_end = src + len;
+ while (src < src_end && *src)
+ *dest++ = *src++;
+ *dest = 0;
+ return dest;
+}
+
#ifndef ARRAY_CARDINALITY
# define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#endif