with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-#include "system.h"
-#include "rmt.h"
+#include <system.h>
+#include <rmt.h>
#include "common.h"
#include <quotearg.h>
#include <save-cwd.h>
source++;
break;
- case 'n':
- *destination++ = '\n';
+ case 'a':
+ *destination++ = '\a';
source++;
break;
-
- case 't':
- *destination++ = '\t';
+
+ case 'b':
+ *destination++ = '\b';
source++;
break;
source++;
break;
- case 'b':
- *destination++ = '\b';
+ case 'n':
+ *destination++ = '\n';
source++;
break;
source++;
break;
+ case 't':
+ *destination++ = '\t';
+ source++;
+ break;
+
+ case 'v':
+ *destination++ = '\v';
+ source++;
+ break;
+
case '?':
*destination++ = 0177;
source++;
static bool
must_be_dot_or_slash (char const *file_name)
{
- file_name += FILESYSTEM_PREFIX_LEN (file_name);
+ file_name += FILE_SYSTEM_PREFIX_LEN (file_name);
if (ISSLASH (file_name[0]))
{
entry += entrylen + 1)
{
char *file_name_buffer = new_name (file_name, entry);
- int r = remove_any_file (file_name_buffer, 1);
+ int r = remove_any_file (file_name_buffer,
+ RECURSIVE_REMOVE_OPTION);
int e = errno;
free (file_name_buffer);
call_arg_error (char const *call, char const *name)
{
int e = errno;
+ /* TRANSLATORS: %s after `Cannot' is a function name, e.g. `Cannot open'.
+ Directly translating this to another language will not work, first because
+ %s itself is not translated.
+ Translate it as `%s: Function %s failed'. */
ERROR ((0, e, _("%s: Cannot %s"), quotearg_colon (name), call));
}
call_arg_fatal (char const *call, char const *name)
{
int e = errno;
+ /* TRANSLATORS: %s after `Cannot' is a function name, e.g. `Cannot open'.
+ Directly translating this to another language will not work, first because
+ %s itself is not translated.
+ Translate it as `%s: Function %s failed'. */
FATAL_ERROR ((0, e, _("%s: Cannot %s"), quotearg_colon (name), call));
}
call_arg_warn (char const *call, char const *name)
{
int e = errno;
+ /* TRANSLATORS: %s after `Cannot' is a function name, e.g. `Cannot open'.
+ Directly translating this to another language will not work, first because
+ %s itself is not translated.
+ Translate it as `%s: Function %s failed'. */
WARN ((0, e, _("%s: Warning: Cannot %s"), quotearg_colon (name), call));
}
call_arg_error ("mknod", name);
}
+void
+exec_error (char const *name)
+{
+ call_arg_error ("exec", name);
+}
+
+void
+fork_error (char const *name)
+{
+ call_arg_error ("fork", name);
+}
+
+void
+dup2_error (char const *name)
+{
+ call_arg_error ("dup2", name);
+}
+
+void
+pipe_error (char const *name)
+{
+ call_arg_error ("pipe", name);
+}
+
void
open_error (char const *name)
{
char buf[UINTMAX_STRSIZE_BOUND];
int e = errno;
ERROR ((0, e,
- ngettext ("%s: Read error at byte %s, reading %lu byte",
- "%s: Read error at byte %s, reading %lu bytes",
+ ngettext ("%s: Read error at byte %s, while reading %lu byte",
+ "%s: Read error at byte %s, while reading %lu bytes",
size),
quotearg_colon (name), STRINGIFY_BIGINT (offset, buf),
(unsigned long) size));
char buf[UINTMAX_STRSIZE_BOUND];
int e = errno;
WARN ((0, e,
- ngettext ("%s: Warning: Read error at byte %s, reading %lu byte",
- "%s: Warning: Read error at byte %s, reading %lu bytes",
+ ngettext ("%s: Warning: Read error at byte %s, while reading %lu byte",
+ "%s: Warning: Read error at byte %s, while reading %lu bytes",
size),
quotearg_colon (name), STRINGIFY_BIGINT (offset, buf),
(unsigned long) size));
quotearg_colon (name), quote_n (1, contents)));
}
+void
+stat_fatal (char const *name)
+{
+ call_arg_fatal ("stat", name);
+}
+
void
stat_error (char const *name)
{
call_arg_fatal ("pipe", _("interprocess channel"));
}
-/* Return an unambiguous printable representation, allocated in slot N,
- for NAME, suitable for diagnostics. */
-char const *
-quote_n (int n, char const *name)
+/* Return PTR, aligned upward to the next multiple of ALIGNMENT.
+ ALIGNMENT must be nonzero. The caller must arrange for ((char *)
+ PTR) through ((char *) PTR + ALIGNMENT - 1) to be addressable
+ locations. */
+
+static inline void *
+ptr_align (void *ptr, size_t alignment)
{
- return quotearg_n_style (n, locale_quoting_style, name);
+ char *p0 = ptr;
+ char *p1 = p0 + alignment - 1;
+ return p1 - (size_t) p1 % alignment;
}
-/* Return an unambiguous printable representation of NAME, suitable
- for diagnostics. */
-char const *
-quote (char const *name)
+/* Return the address of a page-aligned buffer of at least SIZE bytes.
+ The caller should free *PTR when done with the buffer. */
+
+void *
+page_aligned_alloc (void **ptr, size_t size)
{
- return quote_n (0, name);
+ size_t alignment = getpagesize ();
+ size_t size1 = size + alignment;
+ if (size1 < size)
+ xalloc_die ();
+ *ptr = xmalloc (size1);
+ return ptr_align (*ptr, alignment);
}