From 4182874b764ea3d6ec6224e1b4d0f1b38ff78c05 Mon Sep 17 00:00:00 2001
From: Yuqian Yang
Date: Tue, 1 Apr 2025 23:44:50 +0800
Subject: feat(www): update.
---
www/assets/res/css/todos.css | 20 +++-
www/content/notes/_index.md | 5 +
www/content/notes/cheat-sheet/_index.md | 11 --
www/content/notes/cheat-sheet/index.md | 14 +++
www/content/notes/hurd/_index.md | 178 --------------------------------
www/content/notes/hurd/index.md | 119 +++++++++++++++++++++
www/content/notes/hurd/todos.md | 14 ++-
www/content/posts/_index.html | 3 -
www/content/posts/_index.md | 3 +
www/content/posts/c-func-ext.md | 64 +++++++-----
www/layouts/_default/list.html | 11 +-
www/layouts/index.html | 2 +-
www/layouts/shortcodes/todo.html | 6 +-
13 files changed, 220 insertions(+), 230 deletions(-)
create mode 100644 www/content/notes/_index.md
create mode 100644 www/content/notes/cheat-sheet/index.md
create mode 100644 www/content/notes/hurd/index.md
delete mode 100644 www/content/posts/_index.html
create mode 100644 www/content/posts/_index.md
(limited to 'www')
diff --git a/www/assets/res/css/todos.css b/www/assets/res/css/todos.css
index e9a595d..7802812 100644
--- a/www/assets/res/css/todos.css
+++ b/www/assets/res/css/todos.css
@@ -1,14 +1,24 @@
.todo {
-
- &::before {
+ h3::before {
font-family: monospace;
}
- &.working::before {
+ &.working h3::before {
content: "* ";
}
- &.done::before {
+ &.done h3::before {
content: "✓ ";
}
-}
\ No newline at end of file
+
+ &.give-up {
+ &, a:link, a:visited {
+ color: grey;
+ }
+
+ h3:before {
+ content: "orz ✖ ";
+ }
+ }
+}
+
diff --git a/www/content/notes/_index.md b/www/content/notes/_index.md
new file mode 100644
index 0000000..3c736ed
--- /dev/null
+++ b/www/content/notes/_index.md
@@ -0,0 +1,5 @@
+---
+title: "Notes"
+params:
+ recursive: true
+---
diff --git a/www/content/notes/cheat-sheet/_index.md b/www/content/notes/cheat-sheet/_index.md
index f379f0b..ff72c3d 100644
--- a/www/content/notes/cheat-sheet/_index.md
+++ b/www/content/notes/cheat-sheet/_index.md
@@ -1,15 +1,4 @@
---
title: "Cheat Sheet"
-date: 2025-04-01T23:09:53+08:00
-lastmod: 2025-04-01T23:09:53+08:00
-layout: single
---
-Update GRUB after `grub` package is updated. Replace `/boot` with your mount
-point of the EFI partition in `--efi-directory=/boot`. Replace `GRUB` with your
-bootloader id in `--bootloader-id=GRUB`.
-
-```bash-session
-grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
-grub-mkconfig -o /boot/grub/grub.cfg
-```
diff --git a/www/content/notes/cheat-sheet/index.md b/www/content/notes/cheat-sheet/index.md
new file mode 100644
index 0000000..efb3b35
--- /dev/null
+++ b/www/content/notes/cheat-sheet/index.md
@@ -0,0 +1,14 @@
+---
+title: "Cheat Sheet"
+date: 2025-04-01T23:09:53+08:00
+lastmod: 2025-04-01T23:09:53+08:00
+---
+
+Update GRUB after `grub` package is updated. Replace `/boot` with your mount
+point of the EFI partition in `--efi-directory=/boot`. Replace `GRUB` with your
+bootloader id in `--bootloader-id=GRUB`.
+
+```bash-session
+grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
+grub-mkconfig -o /boot/grub/grub.cfg
+```
diff --git a/www/content/notes/hurd/_index.md b/www/content/notes/hurd/_index.md
index 86b062a..3c031e1 100644
--- a/www/content/notes/hurd/_index.md
+++ b/www/content/notes/hurd/_index.md
@@ -1,182 +1,4 @@
---
title: "Hurd"
-date: 2025-03-03T15:34:41+08:00
-lastmod: 2025-03-03T23:28:46+08:00
-layout: single
---
-{{< mono >}}
-
-[TODOS](/notes/hurd/todos)
-
-{{< /mono >}}
-
-## links
-
-{{< mono >}}
-
-| name | link |
-| --- | --- |
-| kernel-list-archive | |
-| debian-list-archive | |
-| irc-archive | |
-| kernel-home | |
-| debian-home | |
-
-{{< /mono >}}
-
-refs:
-
-{{< mono >}}
-
-| name | link |
-| --- | --- |
-| c | |
-| posix latest | |
-| posix 2013 | |
-| posix 2008 | |
-| glibc | |
-
-{{< /mono >}}
-
-## *_MAX patch
-
-TODO: Move to separate page.
-
-```c
-#include
-#include
-#include
-
-static inline char *xreadlink(const char *restrict path) {
- char *buffer;
- size_t allocated = 128;
- ssize_t len;
-
- while (1) {
- buffer = (char *)malloc(allocated);
- if (!buffer) {
- return NULL;
- }
- len = readlink(path, buffer, allocated);
- if (len < (ssize_t)allocated) {
- return buffer;
- }
- free(buffer);
- if (len >= (ssize_t)allocated) {
- allocated *= 2;
- continue;
- }
- return NULL;
- }
-}
-
-static inline char *xgethostname() {
- long max_host_name;
- char *buffer;
-
- max_host_name = sysconf(_SC_HOST_NAME_MAX);
- buffer = malloc(max_host_name + 1);
-
- if (gethostname(buffer, max_host_name + 1)) {
- free(buffer);
- return NULL;
- }
-
- buffer[max_host_name] = '\0';
- return buffer;
-}
-
-static inline char *xgetcwd() {
- char *buffer;
- size_t allocated = 128;
-
- while (1) {
- buffer = (char *)malloc(allocated);
- if (!buffer) {
- return NULL;
- }
- getcwd(buffer, allocated);
- if (buffer)
- return buffer;
- free(buffer);
- if (errno == ERANGE) {
- allocated *= 2;
- continue;
- }
- return NULL;
- }
-}
-```
-
-## git repos
-
-{{< link-group >}}
-hurd
-cru:
-upstream:
-debian:
-{{< /link-group >}}
-
-{{< link-group >}}
-gnumach
-cru:
-upstream:
-debian:
-{{< /link-group >}}
-
-{{< link-group >}}
-mig
-cru:
-upstream:
-debian:
-{{< /link-group >}}
-
-{{< link-group >}}
-glibc
-cru:
-upstream:
-debian:
-mirror:
-{{< /link-group >}}
-
-{{< link-group >}}
-web
-cru:
-upstream:
-{{< /link-group >}}
-
-## cheatsheet
-
-Start qemu
-
-```sh
-qemu-system-x86_64 -enable-kvm -m 4G -net nic -net user,hostfwd=tcp::3222-:22 -vga vmware -drive cache=writeback,file=[...]
-```
-
-Configure/Setup network
-
-```sh
-settrans -fgap /servers/socket/2 /hurd/pfinet -i /dev/eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
-fsysopts /servers/socket/2 /hurd/pfinet -i /dev/eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
-fsysopts /server/socket/2 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
-```
-
-Setup apt
-
-```sh
-apt-get --allow-unauthenticated --allow-insecure-repositories update
-apt-get --allow-unauthenticated upgrade
-```
-
-## mailing lists / irc
-
-{{< mono >}}
-
-| name | address |
-| --- | --- |
-| hurd | |
-| debian | |
-| irc | librechat #hurd |
-
-{{< /mono >}}
diff --git a/www/content/notes/hurd/index.md b/www/content/notes/hurd/index.md
new file mode 100644
index 0000000..c48ed86
--- /dev/null
+++ b/www/content/notes/hurd/index.md
@@ -0,0 +1,119 @@
+---
+title: "Hurd"
+date: 2025-03-03T15:34:41+08:00
+lastmod: 2025-03-03T23:28:46+08:00
+---
+
+{{< mono >}}
+
+[TODOS](/notes/hurd/todos)
+
+{{< /mono >}}
+
+## links
+
+{{< mono >}}
+
+| name | link |
+| --- | --- |
+| kernel-list-archive | |
+| debian-list-archive | |
+| irc-archive | |
+| kernel-home | |
+| debian-home | |
+
+{{< /mono >}}
+
+refs:
+
+{{< mono >}}
+
+| name | link |
+| --- | --- |
+| c | |
+| posix latest | |
+| posix 2013 | |
+| posix 2008 | |
+| glibc | |
+
+{{< /mono >}}
+
+## *_MAX patch
+
+See [this](posts/c-func-ext.md)
+
+## git repos
+
+{{< link-group >}}
+hurd
+cru:
+upstream:
+debian:
+{{< /link-group >}}
+
+{{< link-group >}}
+gnumach
+cru:
+upstream:
+debian:
+{{< /link-group >}}
+
+{{< link-group >}}
+mig
+cru:
+upstream:
+debian:
+{{< /link-group >}}
+
+{{< link-group >}}
+glibc
+cru:
+upstream:
+debian:
+mirror:
+{{< /link-group >}}
+
+{{< link-group >}}
+web
+cru:
+upstream:
+{{< /link-group >}}
+
+## cheatsheet
+
+Start qemu
+
+```sh
+qemu-system-x86_64 -enable-kvm -m 4G \
+ -net nic -net user,hostfwd=tcp::3222-:22 \
+ -vga vmware -drive cache=writeback,file=[...]
+```
+
+Configure/Setup network
+
+```sh
+settrans -fgap /servers/socket/2 /hurd/pfinet \
+ -i /dev/eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
+fsysopts /servers/socket/2 /hurd/pfinet \
+ -i /dev/eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
+fsysopts /server/socket/2 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0
+```
+
+Setup apt
+
+```sh
+apt-get --allow-unauthenticated --allow-insecure-repositories update
+apt-get --allow-unauthenticated upgrade
+```
+
+## mailing lists / irc
+
+{{< mono >}}
+
+| name | address |
+| --- | --- |
+| hurd | |
+| debian | |
+| irc | librechat #hurd |
+
+{{< /mono >}}
diff --git a/www/content/notes/hurd/todos.md b/www/content/notes/hurd/todos.md
index f8273fb..cd93f01 100644
--- a/www/content/notes/hurd/todos.md
+++ b/www/content/notes/hurd/todos.md
@@ -9,7 +9,7 @@ params:
## Porting
-### {{< todo name=pam state=working >}}
+{{< todo name=pam state=give-up >}}
{{< link-group >}}
git
@@ -23,7 +23,9 @@ mail
{{< /link-group >}}
-### {{< todo name=abseil state=working >}}
+{{< /todo >}}
+
+{{< todo name=abseil state=working >}}
{{< link-group >}}
git
@@ -38,7 +40,9 @@ mail
{{< /link-group >}}
-### {{< todo name=libgav1 state=done >}}
+{{< /todo >}}
+
+{{< todo name=libgav1 state=done >}}
{{< link-group >}}
git
@@ -52,3 +56,7 @@ misc
mail:
gerrit:
{{< /link-group >}}
+
+{{< /todo >}}
+
+
diff --git a/www/content/posts/_index.html b/www/content/posts/_index.html
deleted file mode 100644
index 76fa783..0000000
--- a/www/content/posts/_index.html
+++ /dev/null
@@ -1,3 +0,0 @@
----
-title: Posts
----
diff --git a/www/content/posts/_index.md b/www/content/posts/_index.md
new file mode 100644
index 0000000..76fa783
--- /dev/null
+++ b/www/content/posts/_index.md
@@ -0,0 +1,3 @@
+---
+title: Posts
+---
diff --git a/www/content/posts/c-func-ext.md b/www/content/posts/c-func-ext.md
index f0fce10..7106fad 100644
--- a/www/content/posts/c-func-ext.md
+++ b/www/content/posts/c-func-ext.md
@@ -19,9 +19,11 @@ reusable code snippets here to help *fix `*_MAX` bugs*.
```c
-#include
#include
+#include
#include
+#include
+#include
static inline char *xreadlink(const char *restrict path) {
char *buffer;
@@ -29,24 +31,18 @@ static inline char *xreadlink(const char *restrict path) {
ssize_t len;
while (1) {
- buffer = (char *)malloc(allocated);
- if (!buffer) {
- return NULL;
- }
+ buffer = (char*) malloc(allocated);
+ if (!buffer) { return NULL; }
len = readlink(path, buffer, allocated);
- if (len < (ssize_t)allocated) {
- return buffer;
- }
+ if (len < (ssize_t) allocated) { return buffer; }
free(buffer);
- if (len >= (ssize_t)allocated) {
- allocated *= 2;
- continue;
- }
+ if (len >= (ssize_t) allocated) { allocated *= 2; continue; }
return NULL;
}
-}
+ }
+
-static inline char *xgethostname() {
+static inline char *xgethostname(void) {
long max_host_name;
char *buffer;
@@ -62,24 +58,42 @@ static inline char *xgethostname() {
return buffer;
}
-static inline char *xgetcwd() {
+static inline char *xgetcwd(void) {
char *buffer;
size_t allocated = 128;
while (1) {
- buffer = (char *)malloc(allocated);
- if (!buffer) {
- return NULL;
- }
+ buffer = (char*) malloc(allocated);
+ if (!buffer) { return NULL; }
getcwd(buffer, allocated);
- if (buffer)
- return buffer;
+ if (buffer) return buffer;
free(buffer);
- if (errno == ERANGE) {
- allocated *= 2;
- continue;
- }
+ if (errno == ERANGE) { allocated *= 2; continue; }
return NULL;
}
}
+
+static inline __attribute__((__format__(__printf__, 2, 3))) int
+xsprintf(char **buf_ptr, const char *restrict format, ...) {
+ char *buffer;
+ int ret;
+
+ va_list args;
+ va_start(args, format);
+
+ ret = snprintf(NULL, 0, format, args);
+ if (ret < 0) { goto out; }
+
+ buffer = malloc(ret + 1);
+ if (!buffer) { ret = -1; goto out; }
+
+ ret = snprintf(NULL, 0, format, args);
+ if (ret < 0) { free(buffer); goto out; }
+
+ *buf_ptr = buffer;
+
+out:
+ va_end(args);
+ return ret;
+}
```
diff --git a/www/layouts/_default/list.html b/www/layouts/_default/list.html
index c7c6cce..5bb0b5e 100644
--- a/www/layouts/_default/list.html
+++ b/www/layouts/_default/list.html
@@ -4,9 +4,14 @@
{{ define "content" }}
{{ partial "nav.html" . }}
- Posts
+ {{ .Title }}
+ {{ $pages := .RegularPages }}
+ {{ if .Param "recursive" }}
+ {{ $pages = .RegularPagesRecursive }}
+ {{ end }}
{{ partial "preview/posts.html" (dict
- "h" "h3"
- "pages" (.RegularPages.ByDate.Reverse.Limit 3))
+ "h" "h3"
+ "pages" $pages
+ )
}}
{{ end }}
diff --git a/www/layouts/index.html b/www/layouts/index.html
index f456e71..e05af03 100644
--- a/www/layouts/index.html
+++ b/www/layouts/index.html
@@ -33,7 +33,7 @@
anything to me.
- jump-to:
+ goto:
- git
{{ with .GetPage "/notes/hurd" }}
diff --git a/www/layouts/shortcodes/todo.html b/www/layouts/shortcodes/todo.html
index 1327b31..b4fc680 100644
--- a/www/layouts/shortcodes/todo.html
+++ b/www/layouts/shortcodes/todo.html
@@ -1 +1,5 @@
-{{ .Get "name" }}
\ No newline at end of file
+
+ {{ .Get "name" }}
+ {{ .Inner }}
+
+
--
cgit v1.2.3