Skip to content

Commit 64ebd61

Browse files
committed
bar_mkfifo: move to bar.c
1 parent 37095b5 commit 64ebd61

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

bar.c

+20
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,26 @@ bar_time_left(void)
9999
return left.it_value.tv_sec > 0;
100100
}
101101

102+
int
103+
bar_mkfifo(void)
104+
{
105+
char *config_dir;
106+
107+
config_dir = get_config_dir();
108+
rp_glob_screen.bar_fifo_path = xsprintf("%s/bar", config_dir);
109+
free(config_dir);
110+
111+
unlink(rp_glob_screen.bar_fifo_path);
112+
113+
if (mkfifo(rp_glob_screen.bar_fifo_path, S_IRUSR|S_IWUSR) == -1) {
114+
warn("failed creating bar FIFO at %s",
115+
rp_glob_screen.bar_fifo_path);
116+
return 0;
117+
}
118+
119+
return bar_open_fifo();
120+
}
121+
102122
void
103123
init_bar(void)
104124
{

bar.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#ifndef _SDORFEHS_BAR_H
2121
#define _SDORFEHS_BAR_H 1
2222

23+
int bar_mkfifo(void);
2324
void init_bar(void);
2425
void redraw_sticky_bar_text(rp_screen *s, int force);
2526
void update_window_names(rp_screen *s, char *fmt);

sdorfehs.c

-20
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,6 @@ read_startup_files(const char *alt_rcfile)
121121
return 0;
122122
}
123123

124-
static int
125-
bar_mkfifo(void)
126-
{
127-
char *config_dir;
128-
129-
config_dir = get_config_dir();
130-
rp_glob_screen.bar_fifo_path = xsprintf("%s/bar", config_dir);
131-
free(config_dir);
132-
133-
unlink(rp_glob_screen.bar_fifo_path);
134-
135-
if (mkfifo(rp_glob_screen.bar_fifo_path, S_IRUSR|S_IWUSR) == -1) {
136-
warn("failed creating bar FIFO at %s",
137-
rp_glob_screen.bar_fifo_path);
138-
return 0;
139-
}
140-
141-
return bar_open_fifo();
142-
}
143-
144124
/*
145125
* Odd that we spend so much code on making sure the silly welcome message is
146126
* correct. Oh well...

0 commit comments

Comments
 (0)