sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 1424a5afe815328daef2f69966617b9abce67a44
parent 695961cdd8a9003e3dd77a5cdc30e41092d8a058
Author: Madison Lynch <madi@mxdi.xyz>
Date:   Wed,  7 Dec 2022 19:08:51 -0800

[slstatus][kanji]: removed c file and updated patch

Diffstat:
Mtools.suckless.org/slstatus/patches/kanji/index.md | 3---
Dtools.suckless.org/slstatus/patches/kanji/kanji.c | 27---------------------------
Mtools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff | 19++++++++++++++++++-
3 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/tools.suckless.org/slstatus/patches/kanji/index.md b/tools.suckless.org/slstatus/patches/kanji/index.md @@ -5,12 +5,9 @@ Description ----------- This patch implements functionality to display the Japanese Kanji character corresponding with the current day of the week. -Move `kanji.c` into the `components/` directory. Give make the `clean` argument when compiling. - Download -------- * [slstatus-kanji.diff](slstatus-kanji.diff) -* [kanji.c](kanji.c) Author ------ diff --git a/tools.suckless.org/slstatus/patches/kanji/kanji.c b/tools.suckless.org/slstatus/patches/kanji/kanji.c @@ -1,27 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include <time.h> - -const char * -kanji() { - time_t t=time(NULL); - struct tm tm=*localtime(&t); - static int map[]={0,3,2,5,0,3,5,1,4,6,2,4}; - int m=tm.tm_mon+1,y=tm.tm_year+1900; - y-=m<3; - int weekDay=(y+y/4-y/100+y/400+map[m-1]+tm.tm_mday)%7; - if(weekDay==1) { - return "月"; - } else if(weekDay==2) { - return "火"; - } else if(weekDay==3) { - return "水"; - } else if(weekDay==4) { - return "木"; - } else if(weekDay==5) { - return "金"; - } else if(weekDay ==6) { - return "土"; - } else { - return "日"; - } -} diff --git a/tools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff b/tools.suckless.org/slstatus/patches/kanji/slstatus-kanji.diff @@ -1,6 +1,6 @@ --- b/config.def.h +++ a/config.def.h -@@ -30,6 +30,7 @@ +@@ -31,6 +31,7 @@ * hostname hostname NULL * ipv4 IPv4 address interface name (eth0) * ipv6 IPv6 address interface name (eth0) @@ -8,6 +8,23 @@ * kernel_release `uname -r` NULL * keyboard_indicators caps/num lock indicators format string (c?n?) * see keyboard_indicators.c +--- a/components/kanji.c ++++ b/components/kanji.c +@@ -0,0 +1,14 @@ ++/* See LICENSE file for copyright and license details. */ ++#include <time.h> ++ ++const char * ++kanji(const char *unused) { ++ char *kanji[]={"月","火","水","木","金","土","日"}; ++ int map[]={0,3,2,5,0,3,5,1,4,6,2,4}; ++ time_t t=time(NULL); ++ struct tm tm=*localtime(&t); ++ int m=tm.tm_mon+1,y=tm.tm_year+1900; ++ y-=m<3; ++ int wd=(y+y/4-y/100+y/400+map[m-1]+tm.tm_mday)%7; ++ return kanji[wd-1]; ++} --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@