キャッシュから削除の関数
このコミットが含まれているのは:
コミット
22062d76c6
|
@ -11,6 +11,7 @@
|
|||
* LinuxとBSD: 今から、静的リンクがデフォルトになりました(動的リンクには「make LDFLAGS=-lc」をご利用下さい)
|
||||
* 色コンフィグの追加
|
||||
* カスタムロゴコンフィグの追加
|
||||
* モジュールのキャッシングの追加(それでスピードアップする)
|
||||
|
||||
# 0.2.0
|
||||
* Manjaroのロゴの追加
|
||||
|
|
|
@ -8,6 +8,9 @@ farfetch - system info
|
|||
.PP
|
||||
システム情報
|
||||
.TP
|
||||
\fB\,r\fR
|
||||
キャッシュから削除(Haiku以外)
|
||||
.TP
|
||||
\fB\,s\fR
|
||||
小さいロゴの表示
|
||||
.TP
|
||||
|
@ -16,3 +19,4 @@ farfetch - system info
|
|||
.SH AUTHORS
|
||||
.PP
|
||||
テクニカル諏訪子(開発者)
|
||||
ハツラツ太郎(開発者)
|
||||
|
|
14
main.c
14
main.c
|
@ -25,13 +25,16 @@
|
|||
#include "src/storage.h"
|
||||
|
||||
#include "src/config.h"
|
||||
#include "src/common.h"
|
||||
|
||||
const char *sofname = "farfetch";
|
||||
const char *version = "0.3.0";
|
||||
#if defined(__linux__) || defined(__sun)
|
||||
const char *avalopt = "ls";
|
||||
#else
|
||||
const char *avalopt = "lrs";
|
||||
#elif defined(__HAIKU__)
|
||||
const char *avalopt = "s";
|
||||
#else
|
||||
const char *avalopt = "rs";
|
||||
#endif
|
||||
|
||||
int opt;
|
||||
|
@ -43,7 +46,7 @@ int iserr = 0;
|
|||
|
||||
void usage() {
|
||||
#if defined(__linux__) || defined(__sun)
|
||||
printf("%s-%s\nusage: %s [-s] [-l distro]\n", sofname, version, sofname);
|
||||
printf("%s-%s\nusage: %s [-rs] [-l distro]\n", sofname, version, sofname);
|
||||
#else
|
||||
printf("%s-%s\nusage: %s [-%s]\n", sofname, version, sofname, avalopt);
|
||||
#endif
|
||||
|
@ -55,6 +58,11 @@ void flags(int opt) {
|
|||
case 'l':
|
||||
islogo = 1;
|
||||
break;
|
||||
#endif
|
||||
#if !defined(__HAIKU__)
|
||||
case 'r':
|
||||
delete_cache();
|
||||
break;
|
||||
#endif
|
||||
case 's':
|
||||
issmall = 1;
|
||||
|
|
10
src/common.c
10
src/common.c
|
@ -111,4 +111,14 @@ int to_cache(const char *file, const char *res) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void delete_cache() {
|
||||
struct stat st;
|
||||
|
||||
if (stat("/tmp/farfetch/os", &st) == 0) remove("/tmp/farfetch/os");
|
||||
if (stat("/tmp/farfetch/host", &st) == 0) remove("/tmp/farfetch/host");
|
||||
if (stat("/tmp/farfetch/distro", &st) == 0) remove("/tmp/farfetch/distro");
|
||||
if (stat("/tmp/farfetch/cpu", &st) == 0) remove("/tmp/farfetch/cpu");
|
||||
if (stat("/tmp/farfetch/gpu", &st) == 0) remove("/tmp/farfetch/gpu");
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -6,6 +6,7 @@ const char *run_command_s(const char *command);
|
|||
#if !defined(__HAIKU__)
|
||||
const char *from_cache(const char *file);
|
||||
int to_cache(const char *file, const char *res);
|
||||
void delete_cache();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
読み込み中…
新しいイシューから参照