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
compile_commands.json
.cache/
hiscfetch

View File

@ -1,21 +1,15 @@
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
MANDIR ?= ${PREFIX}/share/man
CC := cc
CFLAGS :=
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:
rm -f mycfetch
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
rm hiscfetch
.PHONY: all install clean

View File

@ -1,29 +1,39 @@
# mycfetch
# hiscfetch
Simple fetch
```
$ mycfetch cat
|、 naki@nakidai
(˚ˎ。7 --
| 、˜〵 Linux 6.10.0-rc3-ga3e18a540541
じしˍ,) Up 2 hours, 20 minutes
```
fork of mycfetch by nakidai with new arts
Usage
--
Use first argument as art name. If no arguments given or name is invalid,
mycfetch will use first one from the `arts`
For convenience, you can set alias for needed art
Install
--
mycfetch is available on [AUR](https://aur.archlinux.org/packages/mycfetch)
Use argument to select art. If not argument provided, mycfetch uses first entry in arts list.
For convenience, you can set alias for needed art.
List of arts
--
- `cat`
- `freebsd`
- `gentoo`
- `arch`
- `cat` - Just cat
- `freebsd` - FreeBSD logo
- `gentoo` - Gentoo logo
- `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"
static const int max_username_length = 128;
static const int max_hostname_length = 128;
static const int max_uptime_length = 40;
const int max_username_length = 128;
const int max_hostname_length = 128;
const int max_uptime_length = 40;
static struct art_entry arts[] = {
struct art_entry arts[] = {
{
"cat",
{
@ -26,19 +26,213 @@ static struct art_entry arts[] = {
{
"gentoo",
{
"\033[35m /‾\\ \033[0m",
"\033[35m( \033[37mo \033[35m\\\033[0m",
"\033[35m/ /\033[0m",
"\033[35m\\__/ \033[0m"
"\e[0;35m /‾\\ \033[0m",
"\e[0;35m( \033[0mo \e[0;35m\\\033[0m",
"\e[0;35m/ /\033[0m",
"\e[0;35m\\__/ \033[0m"
}
},
{
"arch",
{
"\033[34m /\\ \033[0m",
"\033[34m /\\ \\ \033[0m",
"\033[34m / \\ \033[0m",
"\033[34m/__/\\__\\\033[0m"
"\e[0;34m /\\ \033[0m",
"\e[0;34m /\\ \\ \033[0m",
"\e[0;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 <stdlib.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <time.h>
#include <stdarg.h>
#include <string.h>
#include <stdbool.h>
#include "config.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)
{
struct timespec uptime;
@ -31,36 +39,34 @@ void getuptime(char *buffer, int max_length)
int main(int argc, char **argv)
{
char **art = arts[0].art, *name = argv[1];
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;
}
if (argc > 2) die(1, "usage: %s [artname]\n", argv[0]);
struct utsname uname_buf;
char hostname[max_hostname_length];
char username[max_username_length];
char uptime[max_uptime_length];
int i;
char **art = NULL;
gethostname(hostname, max_hostname_length);
getlogin_r(username, max_username_length);
getuptime(uptime, max_uptime_length);
uname(&uname_buf);
printf(
"%s %s@%s\n"
"%s --\n"
"%s %s %s\n"
"%s %s\n",
art[0], username, hostname,
art[1],
art[2], uname_buf.sysname, uname_buf.release,
art[3], uptime
);
return ret;
if (argc == 2)
{
for (i = 0; i < sizeof(arts)/sizeof(struct art_entry); ++i)
if (!strcmp(arts[i].name, argv[1])) { art = arts[i].art; break; }
if (!art) die(1, "Art %s not found\n", argv[1]);
} else
{
art = arts[0].art;
}
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
.