Compare commits

..

No commits in common. "main" and "256-color" have entirely different histories.

4 changed files with 18 additions and 61 deletions

View file

@ -1,5 +1,7 @@
#include "basic.h" #include "basic.h"
#include <stdio.h>
#include "draw.h" #include "draw.h"
void rainbow_8() { void rainbow_8() {

2
full.c
View file

@ -1,5 +1,7 @@
#include "full.h" #include "full.h"
#include <stdio.h>
#include "draw.h" #include "draw.h"
void rainbow_256() { void rainbow_256() {

29
main.c
View file

@ -2,10 +2,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "draw.h"
#include "basic.h" #include "basic.h"
#include "full.h" #include "full.h"
#define VERSION "0.0.4" #define VERSION "0.0.1"
#define RESET "\x1b[0m" #define RESET "\x1b[0m"
@ -33,11 +34,11 @@ void help() {
); );
} }
unsigned long djb_hash(char *string) { unsigned long djb_hash(unsigned char *string) {
unsigned long output = 5381; unsigned long output = 5381;
int c; int c;
while((c = *string++)) while(c = *string++)
output = ((output << 5) + output) + c; output = ((output << 5) + output) + c;
return output; return output;
@ -51,9 +52,18 @@ int main(int argc, char **argv) {
int color_mode = 0; int color_mode = 0;
char * colorterm = getenv("COLORTERM"); char * colorterm = getenv("COLORTERM");
if(colorterm != NULL && strcmp(colorterm, "")) if(strcmp(colorterm, ""))
color_mode = 1; 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); unsigned long flag_hash = djb_hash(flag);
char *output; char *output;
@ -114,17 +124,6 @@ int main(int argc, char **argv) {
else transgender_8(); else transgender_8();
break; 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: default:
printf("pride-c: no flag '%s' found.", flag); printf("pride-c: no flag '%s' found.", flag);
return 1; return 1;

View file

@ -1,46 +0,0 @@
.Dd $Mdocdate$
.Dt PRIDE-C 6
.Os
.Sh NAME
.Nm pride-c
.Nd shows pride flags in the terminal using ANSI color sequences.
.Sh SYNOPSIS
.Nm
.Op Ar flag
.Nm
.Op Fl -help | Fl -version
.Sh DESCRIPTION
.Nm
displays pride flags for reduced color terminals. Outputs 8- or 256-color flags depending on if
.Ev COLORTERM
is set. If no
.Ar flag
is provided,
.Nm
defaults to 'rainbow'. The following flags are implemented:
.Pp
.Bl -tag -compact
.It aroace, aro-ace
.It bisexual, bi
.It gay, mlm
.It lesbian, wlw
.It nonbinary, nb
.It pansexual, pan
.It transgender, trans
.El
.Sh ENVIRONMENT
.Bl -tag -width Ds
.It COLORTERM
Should be set by your terminal if it supports colors. If set,
.Nm
will use 256-color mode.
.Sh SEE ALSO
.Xr pride 6
.Sh HISTORY
.Nm
is a C port of
.Xr pride 6
made for reduced color terminals and embedded systems.
.Sh AUTHORS
.An -nosplit
.An Valerie Wolfe Aq Mt sleeplessval@gmail.com