On BSD they are part of the standard C library.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
#define strdup_to_struct_member(_s, _m, _str) \
strdup_to_offset((void *) _s, offsetof(__typeof__(*(_s)), _m), _str)
-extern void strmode(mode_t mode, char *str);
+extern void xstrmode(mode_t mode, char *str);
/* Options for size_to_human_string() */
enum
* Converts stat->st_mode to ls(1)-like mode string. The size of "str" must
* be 11 bytes.
*/
-void strmode(mode_t mode, char *str)
+void xstrmode(mode_t mode, char *str)
{
unsigned short i = 0;
err(EXIT_FAILURE, "failed to create output line");
/* MODE; local buffer, use scols_line_set_data() that calls strdup() */
- strmode(mode, modbuf);
+ xstrmode(mode, modbuf);
if (scols_line_set_data(ln, COL_MODE, modbuf))
goto fail;
char md[11];
if (!st_rc) {
- strmode(cxt->st.st_mode, md);
+ xstrmode(cxt->st.st_mode, md);
str = xstrdup(md);
}
break;
return -1;
}
- strmode(nm->st.st_mode, md);
+ xstrmode(nm->st.st_mode, md);
if (nm->mountpoint)
md[0] = 'D';
xasprintf(&arg, "%#o", semdsp->sem_perm.mode & 0777);
else {
arg = xmalloc(11);
- strmode(semdsp->sem_perm.mode & 0777, arg);
+ xstrmode(semdsp->sem_perm.mode & 0777, arg);
}
rc = scols_line_refer_data(ln, n, arg);
break;
xasprintf(&arg, "%#o", msgdsp->msg_perm.mode & 0777);
else {
arg = xmalloc(11);
- strmode(msgdsp->msg_perm.mode & 0777, arg);
+ xstrmode(msgdsp->msg_perm.mode & 0777, arg);
rc = scols_line_refer_data(ln, n, arg);
}
break;
xasprintf(&arg, "%#o", shmdsp->shm_perm.mode & 0777);
else {
arg = xmalloc(11);
- strmode(shmdsp->shm_perm.mode & 0777, arg);
+ xstrmode(shmdsp->shm_perm.mode & 0777, arg);
}
rc = scols_line_refer_data(ln, n, arg);
break;
static void reverse(void);
static void initinfo(void);
static void outc(wint_t c, int width);
-static void setmode(int newmode);
+static void xsetmode(int newmode);
static void setcol(int newcol);
static void needcol(int col);
static void sig_handler(int signo);
for (i = 0; i < maxcol; i++) {
if (obuf[i].c_mode != lastmode) {
hadmodes++;
- setmode(obuf[i].c_mode);
+ xsetmode(obuf[i].c_mode);
lastmode = obuf[i].c_mode;
}
if (obuf[i].c_char == '\0') {
i += obuf[i].c_width - 1;
}
if (lastmode != NORMAL) {
- setmode(0);
+ xsetmode(0);
}
if (must_overstrike && hadmodes)
overstrike();
}
}
-static void setmode(int newmode)
+static void xsetmode(int newmode)
{
if (!iflag) {
if (curmode != NORMAL && newmode != NORMAL)
- setmode(NORMAL);
+ xsetmode(NORMAL);
switch (newmode) {
case NORMAL:
switch (curmode) {