フォーク元 suwako/farfetch
.
このコミットが含まれているのは:
コミット
79285280a5
12
Makefile
12
Makefile
@ -16,9 +16,9 @@ OS = linux
|
||||
UNAME_M = amd64
|
||||
.endif
|
||||
|
||||
NAME != cat main.c | grep "const char \*sofname" | awk '{print $$5}' | \
|
||||
NAME != cat main.c | grep "const char \*sofname" | awk '{print $$5}' |\
|
||||
sed "s/\"//g" | sed "s/;//"
|
||||
VERSION != cat main.c | grep "const char \*version" | awk '{print $$5}' | \
|
||||
VERSION != cat main.c | grep "const char \*version" | awk '{print $$5}' |\
|
||||
sed "s/\"//g" | sed "s/;//"
|
||||
PREFIX = /usr/local
|
||||
.if ${UNAME_S} == "Linux"
|
||||
@ -37,7 +37,7 @@ CFLAGS = -Wall -Wextra -O3 -I${PREFIX}/include -L${PREFIX}/lib
|
||||
.if ${UNAME_S} == "NetBSD"
|
||||
CFLAGS += -I/usr/pkg/include -L/usr/pkg/lib -I/usr/include -L/usr/lib
|
||||
.endif
|
||||
LDFLAGS =
|
||||
LDFLAGS = -lc
|
||||
|
||||
all:
|
||||
${CC} ${CFLAGS} -o ${NAME} ${FILES} ${LDFLAGS}
|
||||
@ -48,7 +48,7 @@ clean:
|
||||
|
||||
dist:
|
||||
mkdir -p ${NAME}-${VERSION} release/src
|
||||
cp -R LICENSE.txt Makefile README.md CHANGELOG.md \
|
||||
cp -R LICENSE.txt Makefile README.md CHANGELOG.md\
|
||||
${NAME}-completion.zsh ${NAME}.1 main.c src ${NAME}-${VERSION}
|
||||
tar zcfv release/src/${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION}
|
||||
rm -rf ${NAME}-${VERSION}
|
||||
@ -62,8 +62,8 @@ depend:
|
||||
|
||||
release:
|
||||
mkdir -p release/bin
|
||||
${CC} ${CFLAGS} -o release/bin/${NAME}-${VERSION}-${OS}-${UNAME_M} ${FILES} \
|
||||
-static ${LDFLAGS} -lc
|
||||
${CC} ${CFLAGS} -o release/bin/${NAME}-${VERSION}-${OS}-${UNAME_M} ${FILES}\
|
||||
-static ${LDFLAGS}
|
||||
strip release/bin/${NAME}-${VERSION}-${OS}-${UNAME_M}
|
||||
|
||||
install: all
|
||||
|
2
main.c
2
main.c
@ -96,10 +96,8 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
printf("%s ", LOGO[lc]);
|
||||
printf(COLOR"%s%s"RESET, "Uptime", ": ");
|
||||
#ifndef __NetBSD__
|
||||
display_days();
|
||||
printf(", ");
|
||||
#endif
|
||||
display_time();
|
||||
printf("\n");
|
||||
lc++;
|
||||
|
@ -21,18 +21,13 @@ void run_uptime_command(const char *command) {
|
||||
pclose(p);
|
||||
}
|
||||
|
||||
#ifndef __NetBSD__
|
||||
void display_days() {
|
||||
run_uptime_command("uptime | awk '{print $3}' && echo \" days\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void display_time() {
|
||||
#if defined(__NetBSD__)
|
||||
run_uptime_command("uptime | awk '{print $3}' | sed 's/,//' | "
|
||||
"sed 's/:/ hours, /' && echo \" mins\"");
|
||||
#else
|
||||
/* run_uptime_command("uptime | awk '{print $3}' | sed 's/,//' | " */
|
||||
/* "sed 's/:/ hours, /' && echo \" mins\""); */
|
||||
run_uptime_command("uptime | awk '{print $5}' | sed 's/,//' | "
|
||||
"sed 's/:/ hours, /' && echo \" mins\"");
|
||||
#endif
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
#ifndef UPTIME_H
|
||||
#define UPTIME_H
|
||||
|
||||
#ifndef __NetBSD__
|
||||
void display_days();
|
||||
#endif
|
||||
void display_time();
|
||||
|
||||
#endif
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする