X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Futil.h;h=cc52ae750387371ae2dbc0d74b02b613fa393f32;hb=98b2f766b24c84fc49a4df954717b1f96bbce00d;hp=c2bc9771b9f424c4bc5f6d5eb3725cfd184975aa;hpb=6db615c17ee7a434f9e0c40d67a1f833d8f3cc9d;p=elogind.git diff --git a/src/shared/util.h b/src/shared/util.h index c2bc9771b..cc52ae750 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -451,6 +451,8 @@ static inline const char *ansi_highlight_off(void) { return on_tty() ? ANSI_HIGHLIGHT_OFF : ""; } +int files_same(const char *filea, const char *fileb); + int running_in_chroot(void); char *ellipsize(const char *s, size_t length, unsigned percent); @@ -811,6 +813,19 @@ int unlink_noerrno(const char *path); _c_; \ }) +#define strappenda3(a, b, c) \ + ({ \ + const char *_a_ = (a), *_b_ = (b), *_c_ = (c); \ + char *_d_; \ + size_t _x_, _y_, _z_; \ + _x_ = strlen(_a_); \ + _y_ = strlen(_b_); \ + _z_ = strlen(_c_); \ + _d_ = alloca(_x_ + _y_ + _z_ + 1); \ + strcpy(stpcpy(stpcpy(_d_, _a_), _b_), _c_); \ + _d_; \ + }) + #define procfs_file_alloca(pid, field) \ ({ \ pid_t _pid_ = (pid); \