Compare commits

..

No commits in common. "20a6f94a8e0c42ff56deaf8ec67ec0293c4dfcf0" and "48a0b477eeb2fbd80f07070c976b1ff35b7ef5c8" have entirely different histories.

3 changed files with 4 additions and 84 deletions

View File

@ -1,21 +1,11 @@
PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin
MANDIR ?= ${PREFIX}/share/man
all: mycfetch
mycfetch: config.h defs.h
install: mycfetch
install -m 555 mycfetch $(PREFIX)/bin/
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
.PHONY: all install clean

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, one 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
.

View File

@ -1,11 +1,8 @@
#define _POSIX_C_SOURCE 200112L
#include <stdio.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>
#include "config.h"
#include "defs.h"
@ -32,15 +29,10 @@ 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;
}
{ art = arts[i].art; break; }
struct utsname uname_buf;
char hostname[max_hostname_length];
@ -62,5 +54,5 @@ int main(int argc, char **argv)
art[2], uname_buf.sysname, uname_buf.release,
art[3], uptime
);
return ret;
return 0;
}