commit 4f64e923e703280ca4211c9e6919ee91bb328145
parent 698528a410e37fa3f23c4983b703128fc9dc2839
Author: noodle <noodle@pastanoggin.com>
Date: Mon, 9 Feb 2026 20:21:54 +0000
AWKification, README writeup, and refactor paths
Diffstat:
19 files changed, 372 insertions(+), 27 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,32 +1,22 @@
PREFIX = /var/www
-CGIBINDIR = cgi-bin
-HTDOCSDIR = htdocs/pastanoggin.com
-
-CGIDIR = ${PREFIX}/${CGIBINDIR}
-ROOTDIR = ${PREFIX}/${HTDOCSDIR}
+HTDOCSDIR = /htdocs/pastanoggin.com
install:
- # perl
- install -d ${DISTDIR}${PREFIX}/usr/bin
- install -g www -m 755 -o www /usr/bin/perl ${DESTDIR}${PREFIX}/usr/bin
- install -d ${DISTDIR}${PREFIX}/usr/lib
- install -g www -m 755 -o www /usr/lib/libperl.so.* \
- ${DESTDIR}${PREFIX}/usr/lib
- install -g www -m 755 -o www /usr/lib/libm.so.* ${DESTDIR}${PREFIX}/usr/lib
- install -g www -m 755 -o www /usr/lib/libc.so.* ${DESTDIR}${PREFIX}/usr/lib
- install -d ${DISTDIR}${PREFIX}/usr/libexec
- install -g www -m 755 -o www /usr/libexec/ld.so \
- ${DESTDIR}${PREFIX}/usr/libexec
- install -d ${DISTDIR}${PREFIX}/usr/libdata/perl5
- # cgi
- install -d ${DESTDIR}${CGIDIR}
- install -g www -m 0555 -o www perl.cgi ${DESTDIR}${CGIDIR}
- # documents
- install -d ${DESTDIR}${ROOTDIR}/docs
- install -g www -m 0555 -o www docs/* ${DESTDIR}${ROOTDIR}/docs
- # static files
- install -d ${DESTDIR}${ROOTDIR}/static
- install -g www -m 0555 -o www static/* ${DESTDIR}${ROOTDIR}/static
+ install -d -o root -g daemon ${DISTDIR}${PREFIX}/usr/bin
+ install -o root -g bin -m 555 /usr/bin/awk ${DESTDIR}${PREFIX}/usr/bin
+ install -d -o root -g daemon ${DISTDIR}${PREFIX}/usr/lib
+ install -o root -g bin -m 444 /usr/lib/libm.so.* ${DESTDIR}${PREFIX}/usr/lib
+ install -o root -g bin -m 444 /usr/lib/libc.so.* ${DESTDIR}${PREFIX}/usr/lib
+ install -d -o root -g daemon ${DISTDIR}${PREFIX}/usr/libexec
+ install -o root -g bin -m 555 /usr/libexec/ld.so ${DESTDIR}${PREFIX}/usr/libexec
+ install -d ${DESTDIR}${PREFIX}/cgi-bin
+ install -o root -g bin awk.cgi ${DESTDIR}${PREFIX}/cgi-bin
+ install -d ${DESTDIR}${PREFIX}${HTDOCSDIR}/docs
+ install docs/* ${DESTDIR}${PREFIX}${HTDOCSDIR}/docs
+ install -d ${DESTDIR}${PREFIX}${HTDOCSDIR}/img
+ install img/* ${DESTDIR}${PREFIX}${HTDOCSDIR}/img
+ install -d ${DESTDIR}${PREFIX}${HTDOCSDIR}/style
+ install style/* ${DESTDIR}${PREFIX}${HTDOCSDIR}/style
uninstall:
- rm -f ${DESTDIR}${PREFIX}/cgi-bin/perl.cgi
+ rm -f ${DESTDIR}${PREFIX}/cgi-bin/awk.cgi
diff --git a/README b/README
@@ -0,0 +1,7 @@
+A CGI script in AWK because why not.
+
+It uses the a template file like main.tmp as a base with jinja2-like
+placeholders like [%title%], [%content%], etc. the script matches
+endpoints to a pair of template file and page title and sends it
+to the renderer, which prints the appropriate HTTP header lines and
+the requested page.
diff --git a/awk.cgi b/awk.cgi
@@ -0,0 +1,63 @@
+#!/bin/awk -f
+
+function header(code){
+ printf "Status: %s\nContent-Type: text/html\n\n", code
+}
+
+function readfile(a, i, path){
+ while((ret = getline <path) > 0)
+ a[i++] = $0
+ if(ret == -1)
+ print "couldn't read from "path >"/dev/stderr"
+ return i
+}
+
+function cat(a, n, i){
+ for(i = 0; i < n; i++)
+ print a[i]
+}
+
+function error(code, a, len){
+ header(code)
+ len = readfile(a, 0, basedir"/docs/"code".html")
+ cat(a, len)
+}
+
+function render(docpath, doctitle){
+ template_path = basedir"/docs/main.tmp"
+
+ while((ret = getline <template_path) > 0){
+ if($0 ~ /\[%title%\]/)
+ lines[len++] = doctitle
+ else if($0 ~ /\[%content%\]/)
+ len = readfile(lines, len, basedir"/docs/"docpath)
+ else if($0 ~ /\[%status%\]/)
+ len = readfile(lines, len, basedir"/docs/status.html")
+ else
+ lines[len++] = $0
+ }
+ if(ret == -1)
+ print "couldn't read from "template_path >"/dev/stderr"
+ if(len > 0){
+ header(200)
+ cat(lines, len)
+ } else
+ error(404)
+}
+
+BEGIN{
+ basedir = "/htdocs/pastanoggin.com"
+ $0 = ENVIRON["PATH_INFO"] ? ENVIRON["PATH_INFO"] : "/"
+
+ if(/^\/?$/)
+ render("root.html", "pastanoggin!!");
+ else if(/^\/contact\/?$/)
+ render("contact.html", "hello, is it me you're looking for?");
+ else if(/^\/blog\/?$/)
+ render("blog.html", "yapyapyapyap :D");
+ else if(/^\/links\/?$/)
+ render("links.html", "the interwebs");
+ else
+ error(404)
+ exit
+}
diff --git a/docs/blog.html b/docs/blog.html
@@ -0,0 +1 @@
+No blogs here yet!!!
diff --git a/docs/contact.html b/docs/contact.html
@@ -0,0 +1,12 @@
+<h2>how 2 contact?</h2>
+
+<dl>
+ <dt>E-mail</dt>
+ <dd>[REDACTED] (working on it)</dd>
+ <dt>IRC</dt>
+ <dd>anelli (not registered everywhere though)</dd>
+ <dt>XMPP</dt>
+ <dd>anelli@pastanoggin.com</dd>
+</dl>
+
+<p>yay!</p>
diff --git a/docs/links.html b/docs/links.html
@@ -0,0 +1,33 @@
+<p><i>-because search engines suck :b</i></p>
+
+<h2>my button :3</h2>
+<section>
+ <a href="https://pastanoggin.com"><img class="buttonbadge" src="/img/badge.png" alt="button to https://pastanoggin.com"></a>
+ <pre class="codeblock"><code><a href="https://pastanoggin.com"><img src="https://pastanoggin.com/static/badge.png" alt="button to https://pastanoggin.com"></a></code></pre>
+</section>
+
+<h2>kin</h2>
+<ul class="links-list">
+ <li><a href="http://thedaemon.space">thedaemon - based 9fronter</a></li>
+ <li><a href="https://dataswamp.org/~solene">solene - OpenBSD OG</a></i>
+</ul>
+
+<h2>preddy</h2>
+<ul class="links-list">
+ <li><a href="https://cadence.moe"><img class="buttonbadge" src="https://cadence.moe/static/img/cadence_now.png" alt="The text "cadence now!" on a purple background. There is a moon-shaped logo on the left side and a tiny star in the bottom right."></a></li>
+ <li><a href="https://nonkiru.art"><img class="buttonbadge" src="https://nonkiru.art/assets/images/buttons/nonkiru_button_light.gif" alt="button to nonkiru(light)"></a></li>
+ <li><a href="https://goblin-heart.net/sadgrl"><img class="buttonbadge" src="https://goblin-heart.net/sadgrl/assets/images/buttons/sadgrlonline.gif" alt="button to https://goblin-heart.net/sadgrl"></a></li>
+</ul>
+
+<h2>tech</h2>
+<ul class="links-list">
+ <li><a href="https://openbsd.org">OpenBSD - secure os</a></li>
+ <li><a href="https://9front.org">9front - unix done right</a></li>
+ <li><a href="https://unixdigest.com">unix digest</a></li>
+</ul>
+
+<h2>other</h2>
+<ul class="links-list">
+ <li><a href="https://analognowhere.com">unix_surrealism</a></li>
+ <li><a href="https://www.fieggen.com/shoelace" title="Ian's Shoelace Site">Ian's Shoelace Site</a></li>
+</ul>
diff --git a/docs/main.tmp b/docs/main.tmp
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <link rel="icon" href="/img/blunt.png" type="image/png">
+ <link rel="stylesheet" type="text/css" href="/style/main.css">
+ <title>
+ [%title%]
+ </title>
+ </head>
+ <body>
+ <header class="box lighten">
+ <img id="banner" src="/img/banner.png">
+ <img id="construction" src="/img/under_construction.png">
+ </header>
+ <nav class="box lighten">
+ <ul class="nav-list">
+ <li class="nav-item"><a class="nav-link" href="/">home</a></li>
+ <li class="nav-item"><a class="nav-link" href="/contact">contact</a></li>
+ <li class="nav-item"><a class="nav-link" href="/blog">blog</a></li>
+ <li class="nav-item"><a class="nav-link" href="https://git.pastanoggin.com">code</a></li>
+ <li class="nav-item"><a class="nav-link" href="/links">links</a></li>
+ </ul>
+ </nav>
+ <main class="box lighten">
+ [%content%]
+ </main>
+ <dl id="status" class="lighten">
+ <dt id="status-header">status</dt>
+ <dd id="status-body">
+ [%status%]
+ </dd>
+ </dl>
+ <footer class="box lighten">
+ <a class="footer-link" href="https://openbsd.org" target="_blank">
+ <img class="buttonbadge" src="/img/obsd.jpg">
+ </a>
+ <a class="footer-link" href="http://plan9.stanleylieber.com/mothra" target="_blank">
+ <img class="buttonbadge" src="/img/mothracompat.gif">
+ </a>
+ <a class="footer-link" href="https://cadence.moe/blog/2024-10-05-created-by-a-human-badges" target="_blank">
+ <img class="buttonbadge" src="/img/created_by_a_human.png">
+ </a>
+ </footer>
+ </body>
+</html>
diff --git a/docs/root.html b/docs/root.html
@@ -0,0 +1,24 @@
+<blockquote>
+<p>"DO <b>YOU</b> HAVE A GRIMOIRE, SHITASS????"</p>
+<cite>- My friend</cite>
+</blockquote>
+<hr>
+
+<p>Hello, this is alex/anelli/noodle/etc,</p>
+<p>I think personal websites are way cooler than social media so hi. After surfing some neocities-like websites i was like "daym this is fun" (check out my favourites in the <i>links</i> page); so I'm trying to make a funny website too with blackjack and hookers as the cool kids say. I'll also blog and host code here for the lols.</p>
+
+<h2>Likes:</h2>
+<ul>
+<li>Birds</li>
+<li>Computers</li>
+<li>Self-hosting</li>
+<li>Xavier Renegade Angel</li>
+</ul>
+
+<h2>Dislikes:</h2>
+<ul>
+<li>Okara</li>
+<li>Spinach</li>
+<li>Consumerism</li>
+<li>Proprietary software/hardware</li>
+</ul>
diff --git a/docs/status.html b/docs/status.html
@@ -0,0 +1 @@
+openbsd vs freebsd rap battle
diff --git a/img/badge.png b/img/badge.png
Binary files differ.
diff --git a/img/banner.png b/img/banner.png
Binary files differ.
diff --git a/img/blunt.png b/img/blunt.png
Binary files differ.
diff --git a/img/created_by_a_human.png b/img/created_by_a_human.png
Binary files differ.
diff --git a/img/cursor.png b/img/cursor.png
Binary files differ.
diff --git a/img/mothracompat.gif b/img/mothracompat.gif
Binary files differ.
diff --git a/img/obsd.jpg b/img/obsd.jpg
Binary files differ.
diff --git a/img/tile.png b/img/tile.png
Binary files differ.
diff --git a/img/under_construction.png b/img/under_construction.png
Binary files differ.
diff --git a/style/main.css b/style/main.css
@@ -0,0 +1,167 @@
+:root {
+ --color-grey: #222222;
+ --text-color: #f9f9f9;
+ --color-purple: #8f60af;
+ --background-img: url(/img/tile.png);
+}
+
+* {
+ cursor: url("/img/cursor.png"), auto;
+}
+
+body {
+ min-width: 20rem;
+ max-width: 60rem;
+ margin: auto;
+ padding: 1em;
+ color: var(--text-color);
+ background-image: var(--background-img);
+ display: flex;
+ gap: 1em;
+ flex-wrap: wrap;
+ flex-direction: row-reverse;
+}
+
+header {
+ flex-basis: 100%;
+ display: flex;
+ position: relative;
+ justify-content: center;
+}
+
+nav {
+ flex-basis: 10%;
+ flex-grow: 1;
+ display: flex;
+ align-items: start;
+}
+
+main {
+ flex-basis: 70%;
+ flex-grow: 1;
+}
+
+footer {
+ flex-basis: 100%;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 0.5em;
+}
+
+a {
+ color: lightblue;
+}
+
+.nav-list {
+ width: 100%;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ display: flex;
+ gap: 1em;
+ flex-wrap: wrap;
+}
+
+.nav-item {
+ flex-grow: 1;
+ flex-shrink: 1;
+ flex-basis: 0;
+ display: flex;
+}
+
+.box {
+ padding: 1em;
+ border-style: groove;
+ border-width: 0.5em;
+ background-color: var(--color-grey);
+ border-color: var(--color-purple);
+}
+
+.lighten:hover {
+ filter: brightness(110%);
+}
+
+.nav-link {
+ width: 100%;
+ text-align: center;
+ align-content: center;
+ color: var(--color-grey);
+ text-decoration: none;
+ background: var(--color-purple);
+ border-style: outset;
+ border-color: var(--color-purple);
+ padding: 0.5em;
+ font-family: monospace;
+ font-weight: bold;
+ font-size: 1.5em;
+}
+
+.nav-link:hover {
+ filter: brightness(130%);
+}
+
+.buttonbadge {
+ width: 88px;
+ height: 31px;
+ vertical-align: middle;
+}
+
+.codeblock {
+ white-space: pre-wrap;
+ word-break: break-all;
+ background: black;
+ color: lightgreen;
+}
+
+#banner {
+ max-width: 100%;
+ object-fit: contain;
+ image-rendering: pixelated;
+}
+
+#construction {
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ height: auto;
+ width: 30%;
+ max-width: 125px;
+ max-height: 100%;
+}
+
+#status {
+ margin: 0;
+ background-color: #8f60af;
+ color: var(--color-grey);
+ border-radius: 1.5em;
+ padding: 0.5em;
+ display: flex;
+ align-items: center;
+ gap: 1em;
+ flex-basis: 100%;
+ border-color: var(--color-grey);
+ border-width: 0.1em;
+ border-style: solid;
+}
+
+#status-header {
+ padding: 0.1em 1em;
+ background: white;
+ height: 100%;
+ border-radius: 1em;
+ text-align: center;
+ align-content: center;
+}
+
+#status-body {
+ margin: 0;
+ font-size: 1.2em;
+ color: white;
+ word-break: break-word;
+}
+
+@media only screen and (min-width: 800px) {
+ ul {
+ flex-direction: column;
+ }
+}