This commit is contained in:
2025-07-24 22:00:11 -04:00
parent d6845e89d0
commit 444b22d2d5
2 changed files with 12 additions and 12 deletions

View File

@@ -12,8 +12,8 @@ typedef enum
BSD3, /* BSD 3-Clause License */ BSD3, /* BSD 3-Clause License */
GPLv3, /* GNU General Public License v3 */ GPLv3, /* GNU General Public License v3 */
MIT, /* MIT License */ MIT, /* MIT License */
UNLICENCE, /* Unlicense */ UNlicense, /* Unlicense */
} licence_t; } license_t;
/* Library type enumeration - using bit flags for multiple selection */ /* Library type enumeration - using bit flags for multiple selection */
typedef enum typedef enum
@@ -42,7 +42,7 @@ typedef struct
/* Project configuration structure */ /* Project configuration structure */
typedef struct typedef struct
{ {
licence_t licence; /* License type for the project */ license_t licence; /* License type for the project */
char *project; /* Project name */ char *project; /* Project name */
char *name; /* Author/creator name */ char *name; /* Author/creator name */
lib_flags_t libraries; /* Selected libraries (bit field) */ lib_flags_t libraries; /* Selected libraries (bit field) */

View File

@@ -126,7 +126,7 @@ main (int argc, char **argv)
conf.flag.git = DEFAULT_GIT_INIT; conf.flag.git = DEFAULT_GIT_INIT;
conf.flag.clang_format = DEFAULT_CLANG_FORMAT; conf.flag.clang_format = DEFAULT_CLANG_FORMAT;
conf.licence = DEFAULT_LICENSE; conf.license = DEFAULT_LICENSE;
err = create_project (conf); err = create_project (conf);
if (!err) if (!err)
@@ -201,8 +201,8 @@ sanitize (format_t *fmt)
fmt->project = DEFAULT_PROJECT_NAME; fmt->project = DEFAULT_PROJECT_NAME;
if (!fmt->name) if (!fmt->name)
fmt->name = DEFAULT_USER_NAME; fmt->name = DEFAULT_USER_NAME;
if (fmt->licence != BSD3 && fmt->licence != GPLv3 && fmt->licence != MIT) if (fmt->license != BSD3 && fmt->licence != GPLv3 && fmt->licence != MIT)
fmt->licence = DEFAULT_LICENSE; fmt->license = DEFAULT_LICENSE;
fmt->flag.git = fmt->flag.git ? true : DEFAULT_GIT_INIT; fmt->flag.git = fmt->flag.git ? true : DEFAULT_GIT_INIT;
fmt->flag.clang_format fmt->flag.clang_format
= fmt->flag.clang_format ? true : DEFAULT_CLANG_FORMAT; = fmt->flag.clang_format ? true : DEFAULT_CLANG_FORMAT;
@@ -212,13 +212,13 @@ sanitize (format_t *fmt)
} }
int int
create_license_and_set_license_line (format_t fmt, char **license_line_buffer) create_license_and_set_license_line (format_t fmt, char **licence_line_buffer)
{ {
if (fmt.licence == UNLICENCE) if (fmt.license == UNLICENCE)
return 0; return 0;
reset_path; reset_path;
/* TODO: Run better checks on licence_line_buffer to ensure we have enough space. /* TODO: Run better checks on license_line_buffer to ensure we have enough space.
This could be done through a multitude of ways; that is for you to figure out. */ This could be done through a multitude of ways; that is for you to figure out. */
assert (license_line_buffer != NULL); assert (license_line_buffer != NULL);
@@ -227,7 +227,7 @@ create_license_and_set_license_line (format_t fmt, char **license_line_buffer)
printfn ("Not impl"); \ printfn ("Not impl"); \
assert (1 == 2) assert (1 == 2)
switch (fmt.licence) switch (fmt.license)
{ {
case BSD3: case BSD3:
TODO (); TODO ();
@@ -239,9 +239,9 @@ create_license_and_set_license_line (format_t fmt, char **license_line_buffer)
TODO (); TODO ();
break; break;
// TODO: Replace fallthrough with unreachable macro for performace. // TODO: Replace fallthrough with unreachable macro for performace.
case UNLICENCE: case UNlicense:
default: default:
printfn ("bad logic in create_licence_and_set_licence_line()"); printfn ("bad logic in create_license_and_set_licence_line()");
return 1; return 1;
} }