From 974ab3dd887985e3aa347f3c6521f819296396a0 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sat, 16 Feb 2013 14:42:43 +0000 Subject: Imported Upstream version 8.21 --- src/system.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/system.h') 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 before including this file #include +/* 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 @@ -535,6 +538,14 @@ is_nul (const char *buf, size_t bufsize) ? false : (((Accum) = (Accum) * 10 + (Digit_val)), true)) \ ) +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) { @@ -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 -- cgit v1.2.3