minor cleanup and usability improvement
This commit is contained in:
parent
bcc61365e1
commit
2960c47176
3 changed files with 14 additions and 17 deletions
2
basic.c
2
basic.c
|
@ -1,7 +1,5 @@
|
|||
#include "basic.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "draw.h"
|
||||
|
||||
void rainbow_8() {
|
||||
|
|
2
full.c
2
full.c
|
@ -1,7 +1,5 @@
|
|||
#include "full.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "draw.h"
|
||||
|
||||
void rainbow_256() {
|
||||
|
|
27
main.c
27
main.c
|
@ -2,11 +2,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "draw.h"
|
||||
#include "basic.h"
|
||||
#include "full.h"
|
||||
|
||||
#define VERSION "0.0.3"
|
||||
#define VERSION "0.0.4"
|
||||
|
||||
#define RESET "\x1b[0m"
|
||||
|
||||
|
@ -34,11 +33,11 @@ void help() {
|
|||
);
|
||||
}
|
||||
|
||||
unsigned long djb_hash(unsigned char *string) {
|
||||
unsigned long djb_hash(char *string) {
|
||||
unsigned long output = 5381;
|
||||
int c;
|
||||
|
||||
while(c = *string++)
|
||||
while((c = *string++))
|
||||
output = ((output << 5) + output) + c;
|
||||
|
||||
return output;
|
||||
|
@ -55,15 +54,6 @@ int main(int argc, char **argv) {
|
|||
if(colorterm != NULL && strcmp(colorterm, ""))
|
||||
color_mode = 1;
|
||||
|
||||
// handle flags
|
||||
if(strcmp(flag, "--version") == 0) {
|
||||
version();
|
||||
return 0;
|
||||
} else if(strcmp(flag, "--help") == 0) {
|
||||
help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long flag_hash = djb_hash(flag);
|
||||
|
||||
char *output;
|
||||
|
@ -124,6 +114,17 @@ int main(int argc, char **argv) {
|
|||
else transgender_8();
|
||||
break;
|
||||
|
||||
|
||||
// handle flags, but in the command-line sense
|
||||
case 6951207451432lu: // --help
|
||||
case 5861498lu: // -h
|
||||
help();
|
||||
break;
|
||||
case 249805560270004805lu: // --version
|
||||
case 5861512lu: // -v
|
||||
version();
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("pride-c: no flag '%s' found.", flag);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in a new issue