all: add universal version

instead of having a placeholder version command, it is now read from a #define in `lib/version.h`
master
Drake 3 years ago
parent 6b6742dc21
commit f3f2e772df
No known key found for this signature in database
GPG Key ID: 9B83455BD94F12A3

@ -0,0 +1 @@
#define DRAKECU_VERSION "0.0.1"

@ -5,6 +5,8 @@
#include <pwd.h>
#include <sys/utsname.h>
#include "version.h"
/*
arch - prints the current machine's architecture
Available arguments:
@ -25,7 +27,9 @@ int main(int argc, char** argv) {
printf(" ");*/
if (!strcmp(arg, "--help")) {
char* help =
"Drake's Epic Coreutils (working title)\n"
"Drake's Epic Coreutils (working title) "
DRAKECU_VERSION
"\n"
"arch - prints the current machine's architecture\n"
"Available arguments:\n"
" --help: show this help message\n"
@ -33,7 +37,7 @@ int main(int argc, char** argv) {
printf("%s\n", help);
return 0;
} else if (!strcmp(arg, "--version")) {
printf("6.9.69\n");
printf(DRAKECU_VERSION);
return 0;
}
}

@ -10,6 +10,7 @@
#include <sys/types.h>
#include "ansi-colour.h"
#include "version.h"
/*
ls - print all files and directories in working directory
@ -57,7 +58,9 @@ int main(int argc, char** argv) {
printf(" ");*/
if (!strcmp(arg, "--help")) {
char* help =
"Drake's Epic Coreutils (working title)\n"
"Drake's Epic Coreutils (working title) "
DRAKECU_VERSION
"\n"
"ls - print all files and directories in working directory\n"
"Available arguments:\n"
" --help: show this help message\n"
@ -68,7 +71,7 @@ int main(int argc, char** argv) {
printf("%s\n", help);
return 0;
} else if (!strcmp(arg, "--version")) {
printf("6.9.69\n");
printf(DRAKECU_VERSION);
return 0;
} else if (!strcmp(arg, "--color") || !strcmp(arg, "--colour")) {
colour = true;

@ -4,6 +4,8 @@
#include <sys/types.h>
#include <pwd.h>
#include "version.h"
/*
whoami - prints the working user's username (unless --uid is specified)
Available arguments:
@ -25,7 +27,9 @@ int main(int argc, char** argv) {
printf(" ");*/
if (!strcmp(arg, "--help")) {
char* help =
"Drake's Epic Coreutils (working title)\n"
"Drake's Epic Coreutils (working title) "
DRAKECU_VERSION
"\n"
"whoami - prints the working user's username (unless --uid is specified)\n"
"Available arguments:\n"
" --help: show this help message\n"
@ -34,7 +38,7 @@ int main(int argc, char** argv) {
printf("%s\n", help);
return 0;
} else if (!strcmp(arg, "--version")) {
printf("6.9.69\n");
printf(DRAKECU_VERSION);
return 0;
} else if (!strcmp(arg, "--uid")) {
printf("%lu\n", (unsigned long int)userid);

Loading…
Cancel
Save