Compare commits

..

26 Commits

Author SHA1 Message Date
n8 6ca09415e5 Загрузить файлы в «/» 2023-11-17 19:03:08 +03:00
n8 a90a7543f6 Загрузить файлы в «/» 2023-11-17 18:56:58 +03:00
n8 fd095008ff Загрузить файлы в «/» 2023-11-16 19:41:13 +03:00
n8 e3b5e72581 Загрузить файлы в «/» 2023-11-16 19:34:35 +03:00
n8 cde1cdf5d6 Загрузить файлы в «/» 2023-11-16 19:25:51 +03:00
n8 0027faa083 Загрузить файлы в «/» 2023-11-16 19:13:29 +03:00
n8 c10ecbf1c9 Загрузить файлы в «/» 2023-11-16 18:51:29 +03:00
n8 01e2ecc37d Загрузить файлы в «/» 2023-11-16 18:51:18 +03:00
n8 e733aa1a32 Загрузить файлы в «/» 2023-11-16 17:26:21 +03:00
n8 5e8108f02f Загрузить файлы в «/» 2023-11-16 17:26:13 +03:00
n8 a537ea3c07 Загрузить файлы в «/» 2023-11-16 17:26:01 +03:00
n8 cb97ac700f Удалить gitignore 2023-11-16 08:39:01 +03:00
n8 5759737f2d Загрузить файлы в «/» 2023-11-16 08:38:45 +03:00
n8 9ffe709d5f Загрузить файлы в «/» 2023-11-16 08:37:34 +03:00
n8 837333531a Загрузить файлы в «/» 2023-11-16 08:36:48 +03:00
n8 8b5832d87f Загрузить файлы в «/» 2023-11-16 08:33:49 +03:00
n8 acf9796bef Загрузить файлы в «/» 2023-11-16 08:33:07 +03:00
n8 c44dda514c Удалить hiscfetch 2023-11-15 18:12:41 +03:00
n8 537665363f Загрузить файлы в «/» 2023-11-15 17:51:03 +03:00
n8 851cfbb553 Загрузить файлы в «/» 2023-11-15 17:42:08 +03:00
n8 5b90120d2a Загрузить файлы в «/» 2023-11-15 17:28:07 +03:00
n8 a7046df03e Загрузить файлы в «/» 2023-11-15 17:27:33 +03:00
n8 33cc9b9872 Загрузить файлы в «/» 2023-11-15 13:48:15 +03:00
n8 c47959aecb Загрузить файлы в «/» 2023-11-15 13:30:51 +03:00
n8 ef8b229e2f Загрузить файлы в «/» 2023-11-15 08:39:46 +03:00
n8 589d1820df Загрузить файлы в «/» 2023-11-15 08:37:59 +03:00
7 changed files with 279 additions and 139 deletions

4
.gitignore vendored
View File

@ -1,3 +1 @@
mycfetch hiscfetch
compile_commands.json
.cache/

View File

@ -1,21 +1,15 @@
PREFIX ?= /usr/local CC := cc
BINDIR ?= ${PREFIX}/bin CFLAGS :=
MANDIR ?= ${PREFIX}/share/man
all: mycfetch all: hiscfetch
mycfetch: config.h defs.h hiscfetch: main.c config.h
$(CC) main.c -o hiscfetch $(CFLAGS)
install: hiscfetch
cp hiscfetch /usr/bin/hiscfetch
clean: clean:
rm -f mycfetch rm hiscfetch
install: mycfetch mycfetch.1
install -d ${DESTDIR}${BINDIR} ${DESTDIR}${MANDIR}/man1
install mycfetch ${DESTDIR}${BINDIR}
install -m 644 mycfetch.1 ${DESTDIR}${MANDIR}/man1
uninstall:
rm -f ${DESTDIR}${BINDIR}/mycfetch
rm -f ${DESTDIR}${MANDIR}/man1/mycfetch.1
.PHONY: all install clean .PHONY: all install clean

View File

@ -1,29 +1,39 @@
# mycfetch # hiscfetch
Simple fetch fork of mycfetch by nakidai with new arts
```
$ mycfetch cat
|、 naki@nakidai
(˚ˎ。7 --
| 、˜〵 Linux 6.10.0-rc3-ga3e18a540541
じしˍ,) Up 2 hours, 20 minutes
```
Usage Usage
-- --
Use first argument as art name. If no arguments given or name is invalid, Use argument to select art. If not argument provided, mycfetch uses first entry in arts list.
mycfetch will use first one from the `arts` For convenience, you can set alias for needed art.
For convenience, you can set alias for needed art
Install
--
mycfetch is available on [AUR](https://aur.archlinux.org/packages/mycfetch)
List of arts List of arts
-- --
- `cat` - `cat` - Just cat
- `freebsd` - `freebsd` - FreeBSD logo
- `gentoo` - `gentoo` - Gentoo logo
- `arch` - `arch` - Arch Linux logo
- `ubuntu` - Ubuntu logo
- `mint` - Linux Mint logo
- `debian` - Debian logo
- `manjaro` - Manjaro logo
- `slackware` - Slackware logo
- `triangle` - Triangle Linux logo
- `?` - Question Mark
- `fedora` - Fedora logo
- `elementary` - elementaryOS logo
- `kali` - Kali Linux logo
- `artix` - Artix logo
- `dafuckinstikman` - Stickman
- `templeos` - TempleOS logo
- `edubuntu` - Edubuntu logo
- `popos` - Pop!OS logo
- `opensuse` - openSUSE logo
- `steamos` - SteamOS logo
- `android` - Android logo
- `ios` - iOS logo
- `alt` Alt Linux logo
- `rammstein` - Rammstein logo
- `hellosystem` - helloSystem logo
- `phone` - Phone icon
- `youtube` - YouTube icon

218
config.h
View File

@ -1,10 +1,10 @@
#include "defs.h" #include "defs.h"
static const int max_username_length = 128; const int max_username_length = 128;
static const int max_hostname_length = 128; const int max_hostname_length = 128;
static const int max_uptime_length = 40; const int max_uptime_length = 40;
static struct art_entry arts[] = { struct art_entry arts[] = {
{ {
"cat", "cat",
{ {
@ -26,19 +26,213 @@ static struct art_entry arts[] = {
{ {
"gentoo", "gentoo",
{ {
"\033[35m /‾\\ \033[0m", "\e[0;35m /‾\\ \033[0m",
"\033[35m( \033[37mo \033[35m\\\033[0m", "\e[0;35m( \033[0mo \e[0;35m\\\033[0m",
"\033[35m/ /\033[0m", "\e[0;35m/ /\033[0m",
"\033[35m\\__/ \033[0m" "\e[0;35m\\__/ \033[0m"
} }
}, },
{ {
"arch", "arch",
{ {
"\033[34m /\\ \033[0m", "\e[0;34m /\\ \033[0m",
"\033[34m /\\ \\ \033[0m", "\e[0;34m /\\ \\ \033[0m",
"\033[34m / \\ \033[0m", "\e[0;34m / \\ \033[0m",
"\033[34m/__/\\__\\\033[0m" "\e[0;34m/__/\\__\\\033[0m"
}
},
{ "ubuntu",
{
"\033[31m /‾‾‾‾‾\\ \033[0m",
"\033[31m| o---o |\033[0m",
"\033[31m| \\o/ |\033[0m",
"\033[31m \\_____/ \033[0m"
}
},
{ "mint",
{
"\e[0;32m| ‾T‾T‾T‾\\ \033[0m",
"\e[0;32m| | | | | \033[0m",
"\e[0;32m| | | | | \033[0m",
"\e[0;32mL________J \033[0m"
}
},
{ "debian",
{
"\e[0;31m I‾‾‾‾‾\\ \033[0m",
"\e[0;31m | I‾‾‾ | \033[0m",
"\e[0;31m \\ L___/ \033[0m",
"\e[0;31m \\ \033[0m"
}
},
{ "manjaro",
{
"\e[0;32mMMMM MM \033[0m",
"\e[0;32mM MM \033[0m",
"\e[0;32mM M MM \033[0m",
"\e[0;32mM M MM\033[0m"
}
},
{ "slackware",
{
"\e[0;34m _____ \033[0m",
"\e[0;34m L___ \033[0m",
"\e[0;34m| ____J \033[0m",
"\e[0;34mL_______ \033[0m"
}
},
{ "triangle",
{
"\e[0;36m /\\ \033[0m",
"\e[0;36m /\\ \\ \033[0m",
"\e[0;36m/ \\ \\\033[0m",
"\e[0;36m‾‾‾‾‾‾\033[0m"
}
},
{ "?",
{
" /‾‾‾‾\\ ",
" | ",
" /‾ ",
" 0 "
}
},
{ "fedora",
{
"\e[0;34m /‾‾‾‾‾\\\033[0m",
"\e[0;34m | |‾‾‾ |\033[0m",
"\e[0;34m | J‾‾‾ |\033[0m",
"\e[0;34m L_____/ \033[0m"
}
},
{ "elementary",
{
" /‾‾‾‾‾‾\\",
"| /‾‾‾‾\\ |",
"|/|‾‾‾‾‾ |",
" \\🮀🮀🮀🮀__/"
}
},
{ "kali",
{
"\e[0;34m \\ \\ \033[0m",
"\e[0;34m --/‾‾‾‾\\\033[0m",
"\e[0;34m \\ o\033[0m",
"\e[0;34m \\ \033[0m",
}
},
{ "artix",
{
"\e[0;34m /\\ \033[0m",
"\e[0;34m /\\/\\ \033[0m",
"\e[0;34m / /\\ \\ \033[0m",
"\e[0;34m/_//\\__\\\033[0m"
}
},
{ "dafuckinstikman",
{
" 0 ",
" /|\\ ",
" | ",
" / \\ "
}
},
{ "templeos",
{
"\e[0;34m|‾‾‾‾/‾‾‾|\033[0m",
"\e[0;34m|\e[0;33mtempleOS\e[0;34m|\033[0m",
"\e[0;34m| -/- |\033[0m",
"\e[0;34mL_/______J\033[0m"
}
},
{ "edubuntu",
{
"\033[31m /‾‾‾|‾\\\033[0m ",
"\033[31m| o---o |\033[0m",
"\033[31m| \\o/ |\033[0m",
"\033[31m \\_____/\033[0m "
}
},
{ "popos",
{
"\e[0;34m|‾‾| |\033[0m ",
"\e[0;34m|__| |\033[0m ",
"\e[0;34m| o\033[0m ",
"\e[0;34m______\033[0m "
}
},
{ "opensuse",
{
"\e[0;32m ______|‾‾o)| \033[0m",
"\e[0;32m /MMMMMM‾‾‾‾ \033[0m",
"\e[0;32m |0 \\ \\ \033[0m",
"\e[0;32m \033[0m"
}
},
{ "steamos",
{
"\e[0;30m /‾‾‾‾‾‾\\ \033[0m",
"\e[0;30m| /0 |\033[0m",
"\e[0;30m|\\__0=/ |\033[0m",
"\e[0;30m \\______/ \033[0m"
}
},
{ "android",
{
"\e[0;32m\\/‾‾‾‾‾‾\\/\033[0m",
"\e[0;32m| 0 0 |\033[0m",
"\e[0;32m‾‾‾‾‾‾‾‾‾‾\033[0m",
"\e[0;32m Android. \033[0m"
// wtf man, why you use this on android?
}
},
{ "ios",
{
" /‾‾o/‾‾\\",
"| /‾",
"| \\_",
" \\______/"
// PIZDEEEEC BLYAT
}
},
{ "alt",
{
"\e[0;33m|‾‾‾‾‾‾‾|\033[0m",
"\e[0;33m| \e[0;30m o o\e[0;33m|\033[0m",
"\e[0;30mAlt 0 0\e[0;33m|\033[0m",
"\e[0;33m|_\e[0;30mLinux\e[0;33m_|\033[0m"
}
},
{ "rammstein",
{
"\e[0;30m |‾‾‾‾|\033[0m ",
"\e[0;30m|‾ ‾\\ ‾|\033[0m",
"\e[0;30m|_ _\\ _|\033[0m",
"\e[0;30m |____|\033[0m "
}
},
{ "hellosystem",
{
"\e[0;30m| | | ___\033[0m ",
"\e[0;30m|__ ____ | | / \\ \033[0m ",
"\e[0;30m| | |___| /| /| / |\\/\033[0m",
"\e[0;30m| |/\\____/ |__/ |__/ \\__/ \033[0m "
}
},
{ "phone",
{
" /‾‾/",
"| | ",
"| | ",
" \\__\\"
}
},
{ "youtube",
{
"\e[0;31m/‾‾‾‾‾‾‾‾‾\\\033[0m",
"\e[0;31m| \e[0;37m|‾\\ \e[0;31m|\033[0m",
"\e[0;31m| \e[0;37m|_/ \e[0;31m|\033[0m",
"\e[0;31m\\_________/\033[0m"
} }
} }
}; };

BIN
hiscfetch Normal file

Binary file not shown.

View File

@ -1,15 +1,23 @@
#define _POSIX_C_SOURCE 200112L
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
#include <time.h> #include <time.h>
#include <stdarg.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include "config.h" #include "config.h"
#include "defs.h" #include "defs.h"
void die(int code, char *fmt, ...)
{
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
exit(code);
}
void getuptime(char *buffer, int max_length) void getuptime(char *buffer, int max_length)
{ {
struct timespec uptime; struct timespec uptime;
@ -31,36 +39,34 @@ void getuptime(char *buffer, int max_length)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char **art = arts[0].art, *name = argv[1]; if (argc > 2) die(1, "usage: %s [artname]\n", argv[0]);
int ret = 0;
if (name)
{
bool found = false;
for (int i = 0; i < sizeof(arts) / sizeof(*arts); ++i)
if (!strcmp(arts[i].name, name))
{ art = arts[i].art; found = true; break; }
if (!found) ret = 69;
}
struct utsname uname_buf; struct utsname uname_buf;
char hostname[max_hostname_length]; char hostname[max_hostname_length];
char username[max_username_length]; char username[max_username_length];
char uptime[max_uptime_length]; char uptime[max_uptime_length];
int i;
char **art = NULL;
gethostname(hostname, max_hostname_length); gethostname(hostname, max_hostname_length);
getlogin_r(username, max_username_length); getlogin_r(username, max_username_length);
getuptime(uptime, max_uptime_length); getuptime(uptime, max_uptime_length);
uname(&uname_buf);
printf( if (argc == 2)
"%s %s@%s\n" {
"%s --\n" for (i = 0; i < sizeof(arts)/sizeof(struct art_entry); ++i)
"%s %s %s\n" if (!strcmp(arts[i].name, argv[1])) { art = arts[i].art; break; }
"%s %s\n", if (!art) die(1, "Art %s not found\n", argv[1]);
art[0], username, hostname, } else
art[1], {
art[2], uname_buf.sysname, uname_buf.release, art = arts[0].art;
art[3], uptime }
);
return ret; uname(&uname_buf);
printf("%s %s@%s\n", art[0], username, hostname);
printf("%s ----------\n", art[1]);
printf("%s %s %s\n", art[2], uname_buf.sysname, uname_buf.release);
printf("%s %s\n", art[3], uptime);
return 0;
} }

View File

@ -1,62 +0,0 @@
.Dd August 23, 2024
.Dt MYCFETCH 1
.Os
.
.Sh NAME
.Nm mycfetch
.Nd System info fetcher
.Sh SYNOPSIS
.Nm
.Op Ar artname
.
.Sh DESCRIPTION
.Nm
shows you some information about computer. On the left you will see some cute
ascii art, on the right -
.Ql user@host ,
kernel name and version, and current uptime.
.Pp
.
Arts are added to
.Nm
through
.Ql config.h
file.
.
.Bl -tag -width Ds
.It Ar artname
Name of the art to show on the left.
.
.Sh EXIT STATUS
.Nm
returns 0 if done without errors or 69 if art is not found.
.
.Sh EXAMPLES
For example,
.Bd -literal -offset indent
$ mycfetch cat
.Ed
Will show cat on the left with some system info.
.Ql cat
can be ommited because it's the first entry in the config.
.Bd -literal -offset indent
|、 naki@nakidai
(˚ˎ。7 --
| 、˜〵 Linux 6.10.4-arch2-1
じしˍ,) Up 1 days, 5 hours, 23 minutes
.Ed
.
.Sh STANDARDS
.Nm
is
.St -p1003.1-2004
compatible, while also uses
.Fn "int clock_gettime" "clockid_t" "struct timespec *"
from
.St -p1003.1b
.Sy TMR
extension.
.
.Sh AUTHORS
.An Nakidai Perumenei Aq Mt plaza521@inbox.ru
.