wip
This commit is contained in:
3
config.mak
Normal file
3
config.mak
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
PREFIX=/usr/local
|
||||||
|
CFLAGS=-pedantic -O0 -ggdb -Wall -Wextra -Wpedantic -fno-omit-frame-pointer -DDEBUG
|
||||||
|
CC=gcc
|
||||||
44
config.status
Executable file
44
config.status
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# DO NOT MODIFY. THIS IS A AUTOGENERATED SCRIPT FROM 'configure'
|
||||||
|
#
|
||||||
|
# COMPILATION (Linux - POSIX):
|
||||||
|
# ./config.status
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# LICENSE: BSD-3-Clause
|
||||||
|
#
|
||||||
|
# Copyright (c) 2025 GCK
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
# list of conditions and the following disclaimer.
|
||||||
|
#
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
# this list of conditions and the following disclaimer in the documentation
|
||||||
|
# and/or other materials provided with the distribution.
|
||||||
|
#
|
||||||
|
# 3. Neither the name of the copyright holder nor the names of its
|
||||||
|
# contributors may be used to endorse or promote products derived from
|
||||||
|
# this software without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
printf "config.status: recreating config.mak... "
|
||||||
|
{
|
||||||
|
printf "PREFIX=%s\n" "/usr/local"
|
||||||
|
printf "CFLAGS=%s\n" "-pedantic -O0 -ggdb -Wall -Wextra -Wpedantic -fno-omit-frame-pointer -DDEBUG"
|
||||||
|
printf "CC=%s\n" "gcc"
|
||||||
|
} > config.status
|
||||||
|
printf "done\n"
|
||||||
157
src/yait.c
157
src/yait.c
@@ -62,6 +62,7 @@
|
|||||||
#include "../lib/proginfo.h"
|
#include "../lib/proginfo.h"
|
||||||
#include "../lib/say.h"
|
#include "../lib/say.h"
|
||||||
#include "../lib/textc.h"
|
#include "../lib/textc.h"
|
||||||
|
#include "../lib/xmem.h"
|
||||||
#include "licence.h"
|
#include "licence.h"
|
||||||
|
|
||||||
typedef enum { MIT, GPL, BSD, UNL } licence_t;
|
typedef enum { MIT, GPL, BSD, UNL } licence_t;
|
||||||
@@ -77,6 +78,22 @@ static int exit_status;
|
|||||||
static void print_help();
|
static void print_help();
|
||||||
static void print_version();
|
static void print_version();
|
||||||
|
|
||||||
|
static char *source_replace(const char *restrict template,
|
||||||
|
const char *restrict package,
|
||||||
|
const char *restrict author) {
|
||||||
|
/*
|
||||||
|
* XXX(vx-clutch):
|
||||||
|
* - package token : {{PACKAGE}}
|
||||||
|
* - author token : {{AUTHOR}}
|
||||||
|
*
|
||||||
|
* - allocate buffer
|
||||||
|
* - replace all packages with package and authors with author
|
||||||
|
* - return
|
||||||
|
*/
|
||||||
|
char *buffer = xmalloc(99999999999);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static char *get_name() {
|
static char *get_name() {
|
||||||
int fds[2];
|
int fds[2];
|
||||||
if (pipe(fds) == -1)
|
if (pipe(fds) == -1)
|
||||||
@@ -124,8 +141,6 @@ static int get_year() {
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
struct tm *t = localtime(&now);
|
struct tm *t = localtime(&now);
|
||||||
|
|
||||||
// The tm_year member stores years since 1900, so add 1900 to get the actual
|
|
||||||
// year
|
|
||||||
return t->tm_year + 1900;
|
return t->tm_year + 1900;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,11 +278,6 @@ done\n\
|
|||||||
return exit_status;
|
return exit_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// size_t len = strlen(package);
|
|
||||||
// char *pdir = xmalloc(len + 2);
|
|
||||||
// memcpy(pdir, package, len);
|
|
||||||
// pdir[len] = '/';
|
|
||||||
// pdir[len + 1] = '\0';
|
|
||||||
char *pdir;
|
char *pdir;
|
||||||
asprintf(&pdir, "%s/", package);
|
asprintf(&pdir, "%s/", package);
|
||||||
|
|
||||||
@@ -275,6 +285,11 @@ done\n\
|
|||||||
if (chdir(pdir))
|
if (chdir(pdir))
|
||||||
fatalfa(errno);
|
fatalfa(errno);
|
||||||
|
|
||||||
|
fs_new("doc/");
|
||||||
|
fs_new("src/");
|
||||||
|
fs_new("tools/");
|
||||||
|
fs_new("lib/");
|
||||||
|
|
||||||
fs_write("doc/version.texi", "\
|
fs_write("doc/version.texi", "\
|
||||||
@set UPDATED %s\
|
@set UPDATED %s\
|
||||||
@set UPDATED-MONTH %s\
|
@set UPDATED-MONTH %s\
|
||||||
@@ -284,7 +299,6 @@ done\n\
|
|||||||
"1 January 1970", "January 2025");
|
"1 January 1970", "January 2025");
|
||||||
|
|
||||||
char *texi_buffer;
|
char *texi_buffer;
|
||||||
// snprintf(path_buffer, sizeof(path_buffer), "doc/%s.texi", package);
|
|
||||||
asprintf(&texi_buffer, "doc/%s.texi", package);
|
asprintf(&texi_buffer, "doc/%s.texi", package);
|
||||||
fs_write(texi_buffer, "\
|
fs_write(texi_buffer, "\
|
||||||
\\input texinfo @c -*-texinfo-*-\n\
|
\\input texinfo @c -*-texinfo-*-\n\
|
||||||
@@ -459,72 +473,71 @@ a @file{ChangeLog} entry.\n\
|
|||||||
author, author, author, author, author, author);
|
author, author, author, author, author, author);
|
||||||
free(texi_buffer);
|
free(texi_buffer);
|
||||||
|
|
||||||
// TODO(vx-clutch): Why dosn't this write the source?
|
|
||||||
// snprintf(path_buffer, sizeof(path_buffer), "src/%s.c", package);
|
|
||||||
char *src_path;
|
char *src_path;
|
||||||
asprintf(&src_path, "src/%s.c", package);
|
asprintf(&src_path, "src/%s.c", package);
|
||||||
fs_write(src_path, "\
|
fs_write(src_path, "typedef int x;");
|
||||||
/* Copyright (C) %s\n\
|
// fs_write(src_path, "\
|
||||||
*\n\
|
// /* Copyright (C) %s\n\
|
||||||
* This file is part of %s\n\
|
// *\n\
|
||||||
*\n\
|
// * This file is part of %s\n\
|
||||||
* This project and file is licenced under the BSD-3-Clause licence.\n\
|
// *\n\
|
||||||
* <https://opensource.org/licence/bsd-3-clause>\n\
|
// * This project and file is licenced under the BSD-3-Clause licence.\n\
|
||||||
*/\n\
|
// * <https://opensource.org/licence/bsd-3-clause>\n\
|
||||||
\n\
|
// */\n\
|
||||||
// Usage: %s [OPTION]...\n\
|
// \n\
|
||||||
\n\
|
// // Usage: %s [OPTION]...\n\
|
||||||
#include <stdlib.h>\n\
|
// \n\
|
||||||
#include <stdio.h>\n\
|
// #include <stdlib.h>\n\
|
||||||
\n\
|
// #include <stdio.h>\n\
|
||||||
#include <config.h>\n\
|
// \n\
|
||||||
\n\
|
// #include <config.h>\n\
|
||||||
#include \"../lib/proginfo.h\"\n\
|
// \n\
|
||||||
\n\
|
// #include \"../lib/proginfo.h\"\n\
|
||||||
static int exit_status;\n\
|
// \n\
|
||||||
\n\
|
// static int exit_status;\n\
|
||||||
static void print_help();\n\
|
// \n\
|
||||||
static void print_version();\n\
|
// static void print_help();\n\
|
||||||
\n\
|
// static void print_version();\n\
|
||||||
int main(int argc, char **argv)\n\
|
// \n\
|
||||||
{\n\
|
// int main(int argc, char **argv)\n\
|
||||||
set_prog_name(argv[0]);\n\
|
// {\n\
|
||||||
\n\
|
// set_prog_name(argv[0]);\n\
|
||||||
exit_status = EXIT_SUCCESS;\n\
|
// \n\
|
||||||
\n\
|
// exit_status = EXIT_SUCCESS;\n\
|
||||||
return exit_status;\n\
|
// \n\
|
||||||
}\n\
|
// return exit_status;\n\
|
||||||
\n\
|
// }\n\
|
||||||
void print_help()\n\
|
// \n\
|
||||||
{\n\
|
// void print_help()\n\
|
||||||
printf(\"Usage: %%s [OPTION]...\\n\", PROGRAM);\n\
|
// {\n\
|
||||||
fputs(\"\\
|
// printf(\"Usage: %%s [OPTION]...\\n\", PROGRAM);\n\
|
||||||
%s does a thing.\\n\",\n\
|
// fputs(\"\\
|
||||||
stdout);\n\
|
// %s does a thing.\\n\",\n\
|
||||||
\n puts(\"\");\n\
|
// stdout);\n\
|
||||||
fputs(\"\\
|
// \n puts(\"\");\n\
|
||||||
--help display this help and exit\\n\\
|
// fputs(\"\\
|
||||||
--version display version information and exit\\n\",\n\
|
// --help display this help and exit\\n\\
|
||||||
stdout);\n\
|
// --version display version information and exit\\n\",\n\
|
||||||
puts(\"\");\n\
|
// stdout);\n\
|
||||||
fputs(\"\\
|
// puts(\"\");\n\
|
||||||
--option Does an awesome thing\\n\\\",\n\
|
// fputs(\"\\
|
||||||
stdout);\n\
|
// --option Does an awesome thing\\n\\\",\n\
|
||||||
exit(exit_status);\n\
|
// stdout);\n\
|
||||||
}\n\
|
// exit(exit_status);\n\
|
||||||
\n\
|
// }\n\
|
||||||
void print_version()\n\
|
// \n\
|
||||||
{\n\
|
// void print_version()\n\
|
||||||
printf(\"%%s %%s %%d\\n\", prog_name, VERSION, COMMIT);\n\
|
// {\n\
|
||||||
\n\
|
// printf(\"%%s %%s %%d\\n\", prog_name, VERSION, COMMIT);\n\
|
||||||
printf(\"Copyright (C) %%d %s.\\n\", YEAR);\n\
|
// \n\
|
||||||
\n\
|
// printf(\"Copyright (C) %%d %s.\\n\", YEAR);\n\
|
||||||
puts(\"This is free software: you are free to change and redistribute it.\");\n\
|
// \n\
|
||||||
puts(\"There is NO WARRANTY, to the extent permitted by law.\");\n\
|
// puts(\"This is free software: you are free to change and redistribute it.\");\n\
|
||||||
exit(exit_status);\n\
|
// puts(\"There is NO WARRANTY, to the extent permitted by law.\");\n\
|
||||||
}\
|
// exit(exit_status);\n\
|
||||||
",
|
// }\
|
||||||
author, package, package, package, author);
|
// ",
|
||||||
|
// author, package, package, package, author);
|
||||||
free(src_path);
|
free(src_path);
|
||||||
|
|
||||||
fs_write("tools/Cleanup", "\
|
fs_write("tools/Cleanup", "\
|
||||||
|
|||||||
Reference in New Issue
Block a user