diff options
author | Denis Vlasenko | 2008-03-28 17:49:31 +0000 |
---|---|---|
committer | Denis Vlasenko | 2008-03-28 17:49:31 +0000 |
commit | b9ad75fa602dd72b042b2ea08ce86da50746ab30 (patch) | |
tree | 19445163e0f30e8015eeafbcad091309407ab050 /include/libbb.h | |
parent | a38ba59cc3e78db0234cf4c224de6749d8ce759d (diff) | |
download | busybox-b9ad75fa602dd72b042b2ea08ce86da50746ab30.zip busybox-b9ad75fa602dd72b042b2ea08ce86da50746ab30.tar.gz |
copy_file: handle "cp /dev/foo file" (almost) compatibly to coreutils.
(almost because we do not copy mode, which is probably wasn't intended).
+61 bytes.
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/include/libbb.h b/include/libbb.h index 3638b7e..afc053e 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -223,8 +223,27 @@ extern char *skip_non_whitespace(const char *); //TODO: supply a pointer to char[11] buffer (avoid statics)? extern const char *bb_mode_string(mode_t mode); extern int is_directory(const char *name, int followLinks, struct stat *statBuf); +enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ + FILEUTILS_PRESERVE_STATUS = 1, + FILEUTILS_DEREFERENCE = 2, + FILEUTILS_RECUR = 4, + FILEUTILS_FORCE = 8, + FILEUTILS_INTERACTIVE = 0x10, + FILEUTILS_MAKE_HARDLINK = 0x20, + FILEUTILS_MAKE_SOFTLINK = 0x40, +#if ENABLE_SELINUX + FILEUTILS_PRESERVE_SECURITY_CONTEXT = 0x80, + FILEUTILS_SET_SECURITY_CONTEXT = 0x100 +#endif +}; +#define FILEUTILS_CP_OPTSTR "pdRfils" USE_SELINUX("c") extern int remove_file(const char *path, int flags); +/* NB: without FILEUTILS_RECUR in flags, it will basically "cat" + * the source, not copy (unless "source" is a directory). + * This makes "cp /dev/null file" and "install /dev/null file" (!!!) + * work coreutils-compatibly. */ extern int copy_file(const char *source, const char *dest, int flags); + enum { ACTION_RECURSE = (1 << 0), ACTION_FOLLOWLINKS = (1 << 1), @@ -1170,21 +1189,6 @@ void *md5_end(void *resbuf, md5_ctx_t *ctx); uint32_t *crc32_filltable(uint32_t *tbl256, int endian); -enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ - FILEUTILS_PRESERVE_STATUS = 1, - FILEUTILS_DEREFERENCE = 2, - FILEUTILS_RECUR = 4, - FILEUTILS_FORCE = 8, - FILEUTILS_INTERACTIVE = 0x10, - FILEUTILS_MAKE_HARDLINK = 0x20, - FILEUTILS_MAKE_SOFTLINK = 0x40, -#if ENABLE_SELINUX - FILEUTILS_PRESERVE_SECURITY_CONTEXT = 0x80, - FILEUTILS_SET_SECURITY_CONTEXT = 0x100 -#endif -}; - -#define FILEUTILS_CP_OPTSTR "pdRfils" USE_SELINUX("c") extern const char *applet_name; /* "BusyBox vN.N.N (timestamp or extra_version)" */ extern const char bb_banner[]; |