Skip to content

Commit

Permalink
Add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Apr 19, 2024
1 parent 0fdc477 commit 24c8b59
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/ls/ls_main.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "ls.h"

#define NAME "ls (canoutils)"
#define VERSION "1.0.0"
#define AUTHOR "Yohann Boniface (Sigmanificient)"

#define print_version() \
do { \
printf("%s\nversion: %s\nby: %s\n", NAME, VERSION, AUTHOR); \
} while (0)

static const char FLAGLIST[] = "alRdrt";
static char DEFAULT_LOCATION[] = ".";

Expand Down Expand Up @@ -47,9 +58,13 @@ static bool list_dirs(dirbuff_t *db, int argc, char **argv, char flags) {

int main(int argc, char **argv) {
dirbuff_t db = {.size = MIN_ALLOCATED_ENTRY};
char flags = compose_flaglist(argc, argv);
char flags;
int err = 0;

for (int i = 0; argv[i] != NULL; i++)
if (!strcmp(argv[i], "--version"))
return printf(VERSION), EXIT_SUCCESS;
flags = compose_flaglist(argc, argv);
db.entries = malloc(db.size * sizeof(*db.entries));
if (db.entries == NULL)
return EXIT_FAILURE;
Expand Down

0 comments on commit 24c8b59

Please sign in to comment.