Add tagline.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-04-25 23:39:21 +02:00
parent d166e58dc8
commit fe87b61a33
5 changed files with 14 additions and 1 deletions

View File

@ -34,6 +34,7 @@ static const char* KernelInfo(const char* req)
{
if ( strcmp(req, "name") == 0 ) { return BRAND_KERNEL_NAME; }
if ( strcmp(req, "version") == 0 ) { return VERSIONSTR; }
if ( strcmp(req, "tagline") == 0 ) { return BRAND_RELEASE_TAGLINE; }
if ( strcmp(req, "builddate") == 0 ) { return __DATE__; }
if ( strcmp(req, "buildtime") == 0 ) { return __TIME__; }
#if defined(__i386__) || defined(__x86_64__)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014 Jonas 'Sortie' Termansen.
* Copyright (c) 2013, 2014, 2015 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -32,6 +32,9 @@
/* The name of the kernel. */
#define BRAND_KERNEL_NAME "Sortix"
/* The tagline of this release. */
#define BRAND_RELEASE_TAGLINE "\"Self-Hosting & Installable\""
/* Ascii version of the maxsi logo. */
#define BRAND_MAXSI \
" _ \n" \

View File

@ -34,6 +34,7 @@ struct utsname
char nodename[_UTSNAME_LENGTH];
char release[_UTSNAME_LENGTH];
char version[_UTSNAME_LENGTH];
char tagline[_UTSNAME_LENGTH];
char machine[_UTSNAME_LENGTH];
char processor[_UTSNAME_LENGTH];
char hwplatform[_UTSNAME_LENGTH];

View File

@ -55,6 +55,8 @@ int uname(struct utsname* name)
strlcpy(name->nodename, "unknown", sizeof(name->nodename));
if ( kernelinfo("version", name->release, sizeof(name->release)) != 0 )
strlcpy(name->release, "unknown", sizeof(name->release));
if ( kernelinfo("tagline", name->tagline, sizeof(name->tagline)) != 0 )
strlcpy(name->tagline, "unknown", sizeof(name->tagline));
if ( kernelinfo("builddate", name->version, sizeof(name->version)) != 0 )
strlcpy(name->version, "unknown", sizeof(name->version));
strlcpy(name->machine, machine, sizeof(name->machine));

View File

@ -32,6 +32,7 @@ static const int PRINT_KERNELNAME = 1 << 0;
static const int PRINT_NODENAME = 1 << 1;
static const int PRINT_KERNELREL = 1 << 2;
static const int PRINT_KERNELVER = 1 << 3;
static const int PRINT_TAGLINE = 1 << 4;
static const int PRINT_MACHINE = 1 << 5;
static const int PRINT_PROCESSOR = 1 << 6;
static const int PRINT_HWPLATFORM = 1 << 7;
@ -92,6 +93,7 @@ int main(int argc, char* argv[])
case 's': flags |= PRINT_KERNELNAME; break;
case 'n': flags |= PRINT_NODENAME; break;
case 'r': flags |= PRINT_KERNELREL; break;
case 't': flags |= PRINT_TAGLINE; break;
case 'v': flags |= PRINT_KERNELVER; break;
case 'm': flags |= PRINT_MACHINE; break;
case 'p': flags |= PRINT_PROCESSOR; break;
@ -111,6 +113,8 @@ int main(int argc, char* argv[])
flags |= PRINT_KERNELREL;
else if ( !strcmp(arg, "--kernel-version") )
flags |= PRINT_KERNELVER;
else if ( !strcmp(arg, "--tagline") )
flags |= PRINT_TAGLINE;
else if ( !strcmp(arg, "--machine") )
flags |= PRINT_MACHINE;
else if ( !strcmp(arg, "--processor") )
@ -148,6 +152,8 @@ int main(int argc, char* argv[])
DoPrint(utsname.nodename);
if ( flags & PRINT_KERNELREL )
DoPrint(utsname.release);
if ( flags & PRINT_TAGLINE )
DoPrint(utsname.tagline);
if ( flags & PRINT_KERNELVER )
DoPrint(utsname.version);
if ( flags & PRINT_MACHINE )