From 0079202d8b783ecf2408775c30b82ccb13d2825e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Thu, 18 Jul 2024 03:12:54 +0900 Subject: [PATCH] =?UTF-8?q?Linux:=20=E3=80=8Chostname=E3=80=8D=E3=82=B3?= =?UTF-8?q?=E3=83=9E=E3=83=B3=E3=83=89=E3=81=8C=E3=81=AA=E3=81=91=E3=82=8C?= =?UTF-8?q?=E3=81=B0=E3=80=81=E3=80=8Ccat=20/etc/hostname=E3=80=8D?= =?UTF-8?q?=E3=82=92=E5=AE=9F=E5=8A=B9=E3=81=99=E3=82=8B=E6=A7=98=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/user.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 925cc45..c9dcc15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Linux: 「/proc/cpuinfo」で使ってCPU速さの受け取る様に * Kubuntu、Xubuntu、Lubuntuロゴの追加 * Arcoロゴの追加 +* Linux: 「hostname」コマンドがなければ、「cat /etc/hostname」を実効する様に # 0.2.0 * Manjaroのロゴの追加 diff --git a/src/user.c b/src/user.c index d90c28d..1779394 100644 --- a/src/user.c +++ b/src/user.c @@ -6,5 +6,6 @@ const char *display_user_name() { } const char *display_user_host() { - return run_command_s("hostname"); + return run_command_s("command -v hostname >/dev/null 2>&1 && hostname || " + "cat /etc/hostname"); }