Inital Commit
This commit is contained in:
16
.clang-format
Normal file
16
.clang-format
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
IndentWidth: 8
|
||||||
|
TabWidth: 8
|
||||||
|
UseTab: Always
|
||||||
|
BreakBeforeBraces: Linux
|
||||||
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: None
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
ColumnLimit: 80
|
||||||
|
IndentCaseLabels: false
|
||||||
|
PointerAlignment: Left
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
AlignTrailingComments: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
15
LICENSE
Normal file
15
LICENSE
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
ISC License
|
||||||
|
|
||||||
|
Copyright (c) 2026 fSD
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
PERFORMANCE OF THIS SOFTWARE.
|
||||||
23
Makefile
Normal file
23
Makefile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
-include make.conf
|
||||||
|
|
||||||
|
BIN = tcpl
|
||||||
|
|
||||||
|
SRC = $(wildcard src/*.c)
|
||||||
|
SRC_OBJ = $(SRC:.c=.o)
|
||||||
|
|
||||||
|
LIB_SRC = $(wildcard lib/*.c)
|
||||||
|
LIB_OBJ = $(LIB_SRC:.c=.o)
|
||||||
|
|
||||||
|
all: $(BIN)
|
||||||
|
|
||||||
|
$(BIN): $(SRC_OBJ) $(LIB_OBJ)
|
||||||
|
$(LD) $(LDFLAGS) -o $@ $(SRC_OBJ) $(LIB_OBJ)
|
||||||
|
|
||||||
|
src/%.o: src/%.c
|
||||||
|
$(CC) $(CFLAGS) -I. -Iinclude -c $< -o $@
|
||||||
|
|
||||||
|
lib/%.o: lib/%.c
|
||||||
|
$(CC) $(CFLAGS) -I. -Iinclude -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(SRC_OBJ) $(LIB_OBJ) $(BIN)
|
||||||
36
compile_commands.json
Normal file
36
compile_commands.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
"/usr/lib64/ccache/cc",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wall",
|
||||||
|
"-Os",
|
||||||
|
"-I.",
|
||||||
|
"-Iinclude",
|
||||||
|
"-c",
|
||||||
|
"-o",
|
||||||
|
"src/main.o",
|
||||||
|
"src/main.c"
|
||||||
|
],
|
||||||
|
"directory": "/home/owen/programming/tcpl",
|
||||||
|
"file": "/home/owen/programming/tcpl/src/main.c",
|
||||||
|
"output": "/home/owen/programming/tcpl/src/main.o"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
"/usr/lib64/ccache/cc",
|
||||||
|
"-Wextra",
|
||||||
|
"-Wall",
|
||||||
|
"-Os",
|
||||||
|
"-I.",
|
||||||
|
"-Iinclude",
|
||||||
|
"-c",
|
||||||
|
"-o",
|
||||||
|
"lib/print.o",
|
||||||
|
"lib/print.c"
|
||||||
|
],
|
||||||
|
"directory": "/home/owen/programming/tcpl",
|
||||||
|
"file": "/home/owen/programming/tcpl/lib/print.c",
|
||||||
|
"output": "/home/owen/programming/tcpl/lib/print.o"
|
||||||
|
}
|
||||||
|
]
|
||||||
4
doc/bugs
Normal file
4
doc/bugs
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Known bugs in tcpl(21 April 2026)
|
||||||
|
|
||||||
|
* Rare bug in x86_64 architecture prevents all users from
|
||||||
|
using this software.
|
||||||
11
include/tcpl/tcpl.h
Normal file
11
include/tcpl/tcpl.h
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef TCPL_TCPL_H
|
||||||
|
#define TCPL_TCPL_H
|
||||||
|
/*
|
||||||
|
* This is a header file to be included into every source file that comprises
|
||||||
|
* this project.
|
||||||
|
* Do #include <tcpl/tcpl.h>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <lib/print.h>
|
||||||
|
|
||||||
|
#endif
|
||||||
8
lib/print.c
Normal file
8
lib/print.c
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include "print.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tcpl/tcpl.h>
|
||||||
|
|
||||||
|
int tcpl_print(char* s)
|
||||||
|
{
|
||||||
|
return printf("%s: %s\n", arg0, s);
|
||||||
|
}
|
||||||
9
lib/print.h
Normal file
9
lib/print.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef TCPL_PRINT_H
|
||||||
|
#define TCPL_PRINT_H
|
||||||
|
/*
|
||||||
|
* Define the print functions for this project
|
||||||
|
*/
|
||||||
|
|
||||||
|
int tcpl_print(char* s);
|
||||||
|
|
||||||
|
#endif
|
||||||
11
make.conf
Normal file
11
make.conf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# tcpl version
|
||||||
|
VERSION = 0.1
|
||||||
|
|
||||||
|
# paths
|
||||||
|
PREFIX = /usr/local
|
||||||
|
MANPREFIX = $(PREFIX)/share/man
|
||||||
|
|
||||||
|
CC = cc
|
||||||
|
LD = $(CC)
|
||||||
|
CFLAGS = -Wextra -Wall -Os
|
||||||
|
LDFLAGS = -s
|
||||||
26
man/tcpl.1
Normal file
26
man/tcpl.1
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
.TH "TCPL" 1
|
||||||
|
.SH NAME
|
||||||
|
\fBtcpl\fR \- test c project layout.
|
||||||
|
.PP
|
||||||
|
.SH SYNOPSIS
|
||||||
|
tcpl [OPTION]...
|
||||||
|
.PP
|
||||||
|
.SH DESCRIPTION
|
||||||
|
`tcpl' greets you in various ways.
|
||||||
|
.PP
|
||||||
|
-n, --name=STRING
|
||||||
|
your name goes here
|
||||||
|
.PP
|
||||||
|
--help print this help, then exit
|
||||||
|
.PP
|
||||||
|
--version
|
||||||
|
print version number, then exit
|
||||||
|
.PP
|
||||||
|
.SH AUTHOR
|
||||||
|
Written by vxc <vxclutch@proton.me>
|
||||||
|
.PP
|
||||||
|
.SH COPYRIGHT
|
||||||
|
Copyright © 2026 vxc
|
||||||
|
This is free software; see the source for copying conditions. There is
|
||||||
|
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE.
|
||||||
25
man/tcpl.md
Normal file
25
man/tcpl.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# NAME
|
||||||
|
tcpl - test c project layout.
|
||||||
|
|
||||||
|
# SYNOPSIS
|
||||||
|
tcpl [OPTION]...
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
`tcpl' greets you in various ways.
|
||||||
|
|
||||||
|
-n, --name=STRING
|
||||||
|
your name goes here
|
||||||
|
|
||||||
|
--help print this help, then exit
|
||||||
|
|
||||||
|
--version
|
||||||
|
print version number, then exit
|
||||||
|
|
||||||
|
# AUTHOR
|
||||||
|
Written by vxc <vxclutch@proton.me>
|
||||||
|
|
||||||
|
# COPYRIGHT
|
||||||
|
Copyright © 2026 vxc
|
||||||
|
This is free software; see the source for copying conditions. There is
|
||||||
|
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE.
|
||||||
16
package/tcpl-0.1.ebuild
Normal file
16
package/tcpl-0.1.ebuild
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
EAPI = 8
|
||||||
|
|
||||||
|
DESCRIPTION = "Test C Project Layout" HOMEPAGE =
|
||||||
|
"https://fsdproject.org" SRC_URI =
|
||||||
|
"https://dl.fsdproject.org/tcpl-${PV}.tar.gz"
|
||||||
|
|
||||||
|
LICENSE = "BSD" SLOT = "0" KEYWORDS = "~amd64" IUSE = ""
|
||||||
|
|
||||||
|
DEPEND = "" RDEPEND = "${DEPEND}" BDEPEND = ""
|
||||||
|
|
||||||
|
src_compile(){emake}
|
||||||
|
|
||||||
|
src_install()
|
||||||
|
{
|
||||||
|
dobin tcpl dodoc README
|
||||||
|
}
|
||||||
11
src/main.c
Normal file
11
src/main.c
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#include <libgen.h>
|
||||||
|
#include <tcpl/tcpl.h>
|
||||||
|
|
||||||
|
extern char* arg0;
|
||||||
|
|
||||||
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
arg0 = basename(argv[0]);
|
||||||
|
tcpl_print("Hello, World!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
src/main.o
Normal file
BIN
src/main.o
Normal file
Binary file not shown.
78
tools/md2man
Executable file
78
tools/md2man
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
VERSION="v0.1"
|
||||||
|
|
||||||
|
file=$1
|
||||||
|
[ -f "$file" ] || exit 1
|
||||||
|
|
||||||
|
name=$(basename "$file" .md)
|
||||||
|
|
||||||
|
awk -v name="$name" '
|
||||||
|
BEGIN {
|
||||||
|
print ".TH \"" toupper(name) "\" 1"
|
||||||
|
in_name = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function esc(s) {
|
||||||
|
gsub(/\\/, "\\\\", s)
|
||||||
|
gsub(/^\./, "\\&.", s)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmt(s) {
|
||||||
|
while (match(s, /`[^`]+`/)) {
|
||||||
|
pre = substr(s, 1, RSTART-1)
|
||||||
|
mid = substr(s, RSTART+1, RLENGTH-2)
|
||||||
|
post = substr(s, RSTART+RLENGTH)
|
||||||
|
s = pre "\\fB" mid "\\fR" post
|
||||||
|
}
|
||||||
|
return esc(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
sub(/\r$/, "")
|
||||||
|
|
||||||
|
if ($0 ~ /^# /) {
|
||||||
|
section = substr($0, 3)
|
||||||
|
|
||||||
|
if (toupper(section) == "NAME") {
|
||||||
|
print ".SH NAME"
|
||||||
|
in_name = 1
|
||||||
|
} else {
|
||||||
|
print ".SH " toupper(esc(section))
|
||||||
|
in_name = 0
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($0 ~ /^$/) {
|
||||||
|
print ".PP"
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in_name) {
|
||||||
|
split($0, a, " - ")
|
||||||
|
if (length(a) > 1) {
|
||||||
|
print "\\fB" esc(a[1]) "\\fR \\- " esc(a[2])
|
||||||
|
} else {
|
||||||
|
print "\\fB" esc($0) "\\fR"
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($0 ~ /^- /) {
|
||||||
|
sub(/^- /, "")
|
||||||
|
split($0, a, " ")
|
||||||
|
print ".TP"
|
||||||
|
print "\\fB" esc(a[1]) "\\fR"
|
||||||
|
if (length(a) > 1) {
|
||||||
|
print fmt(substr($0, length(a[1]) + 3))
|
||||||
|
}
|
||||||
|
next
|
||||||
|
}
|
||||||
|
|
||||||
|
print fmt($0)
|
||||||
|
}
|
||||||
|
' "$file"
|
||||||
Reference in New Issue
Block a user