Compare commits

..

5 commits

Author SHA1 Message Date
2960c47176 minor cleanup and usability improvement 2024-07-09 14:00:38 -04:00
bcc61365e1 version bump 2024-07-08 13:49:02 -04:00
01573867eb covered null case for COLORTERM variable 2024-07-08 13:48:40 -04:00
3c9623040f created manual 2024-07-02 09:59:13 -04:00
8d80b1bedc version bump 2024-07-02 09:52:36 -04:00
4 changed files with 61 additions and 18 deletions

View file

@ -1,7 +1,5 @@
#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,7 +1,5 @@
#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,11 +2,10 @@
#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.1" #define VERSION "0.0.4"
#define RESET "\x1b[0m" #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; 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;
@ -52,18 +51,9 @@ int main(int argc, char **argv) {
int color_mode = 0; int color_mode = 0;
char * colorterm = getenv("COLORTERM"); char * colorterm = getenv("COLORTERM");
if(strcmp(colorterm, "")) if(colorterm != NULL && 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;
@ -124,6 +114,17 @@ 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;

46
man/pride-c.6 Normal file
View file

@ -0,0 +1,46 @@
.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