lib: rename strmode() and setmode()

On BSD they are part of the standard C library.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2016-02-07 12:59:57 +01:00
parent 4303124ad5
commit b0b24b11f8
7 changed files with 13 additions and 13 deletions

View File

@ -78,7 +78,7 @@ static inline char *strdup_to_offset(void *stru, size_t offset, const char *str)
#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

View File

@ -425,7 +425,7 @@ void strtotimeval_or_err(const char *str, struct timeval *tv, const char *errmes
* 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;

View File

@ -59,7 +59,7 @@ static int add_line_from_stat(struct libscols_table *tb,
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;

View File

@ -911,7 +911,7 @@ static void set_scols_data(struct blkdev_cxt *cxt, int col, int id, struct libsc
char md[11];
if (!st_rc) {
strmode(cxt->st.st_mode, md);
xstrmode(cxt->st.st_mode, md);
str = xstrdup(md);
}
break;

View File

@ -288,7 +288,7 @@ print_namei(struct namei *nm, char *path)
return -1;
}
strmode(nm->st.st_mode, md);
xstrmode(nm->st.st_mode, md);
if (nm->mountpoint)
md[0] = 'D';

View File

@ -579,7 +579,7 @@ static void do_sem(int id, struct lsipc_control *ctl, struct libscols_table *tb)
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;
@ -776,7 +776,7 @@ static void do_msg(int id, struct lsipc_control *ctl, struct libscols_table *tb)
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;
@ -928,7 +928,7 @@ static void do_shm(int id, struct lsipc_control *ctl, struct libscols_table *tb)
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;

View File

@ -81,7 +81,7 @@ static void fwd(void);
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);
@ -368,7 +368,7 @@ static void flushln(void)
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') {
@ -382,7 +382,7 @@ static void flushln(void)
i += obuf[i].c_width - 1;
}
if (lastmode != NORMAL) {
setmode(0);
xsetmode(0);
}
if (must_overstrike && hadmodes)
overstrike();
@ -560,11 +560,11 @@ static void outc(wint_t c, int width) {
}
}
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) {