-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: hackvr
action: commit
revision:
path_from:
revision_from: 848a823b1287d8804e8d6170c3ca30ccf7689784:
path_to:
revision_to:

git.thebackupbox.net

hackvr

git://git.thebackupbox.net/hackvr

commit 848a823b1287d8804e8d6170c3ca30ccf7689784
Author: epoch <epoch@hacking.allowed.org>
Date:   Tue Feb 5 21:46:21 2019 -0600

    added --version/-v/version flag/command. changed mouse coords from shrot to int

diff --git a/src/Makefile b/src/Makefile

index 7bc082ba00ef5ad9b6be8454897688fe1b3924e0..

index ..81f81f7e3f675250d2bd565c9209bc61daaa9f92 100644

--- a/src/Makefile
+++ b/src/Makefile
@@ -22,13 +22,20 @@ hackvr_freeglut: LDLIBS=-lm -lGL -lGLU -lglut
 hackvr_freeglut: hackvr_freeglut.o graphics_c3_freeglut.o math.o physics.o keyboard.o mouse_die.o keyboard_die.o

 hackvr_freeglut.o: LDLIBS=-lm -lGL -lGLU -lglut
+hackvr_freeglut.o: CFLAGS+='-DHVR_VERSION="freeglut"'
+
+hackvr_fb.o: CFLAGS+='-DHVR_VERSION="framebuffer"'

 graphics_c3_freeglut.o: LDLIBS=-lm -lGL -lGLU -lglut

 hackvr_opengl.o: LDLIBS=-lm -lGL -lGLU -lglut
+hackvr_opengl.o: CFLAGS+='-DHVR_VERSION="opengl"'
+
 hackvr_x11.o: LDLIBS=-lm -lX11
+hackvr_x11.o: CFLAGS+='-DHVR_VERSION="x11"'

 hackvr_headless.o: CFLAGS=-Wall -pedantic -std=c99 -ffast-math
+hackvr_headless.o: CFLAGS+='-DHVR_VERSION="headless"'
 hackvr_headless.o: LDLIBS=-lm

 graphics_c3.o: LDLIBS=-lm
diff --git a/src/common.h b/src/common.h

index 93e8d27712c747d42cb3ffbd9f76ee2190e7f72c..

index ..9b7dd6d9fe5062497070d251a04cdd29338867fe 100644

--- a/src/common.h
+++ b/src/common.h
@@ -35,9 +35,9 @@ typedef struct {
  real y;
 } c2_t;

-typedef struct {//no screens will ever be bigger than 32k x 32k, right?
- short x;
- short y;
+typedef struct {//x11 wants coords to be integers. let's make this that.
+ int x;
+ int y;
 } cs_t;

 typedef struct {
diff --git a/src/hackvr.c b/src/hackvr.c

index a6b31b47ac9f10f6c443f3d084daa65621762f4b..

index ..88ce2f9aa6e0e60e0e802c75e17e6afea73c1873 100644

--- a/src/hackvr.c
+++ b/src/hackvr.c
@@ -111,6 +111,10 @@ int glob_match(char *a,char *b) {
   return strcmp(a,b);
 }

+void hvr_version() {
+  printf("# hackvr version: %s\n",HVR_VERSION);
+}
+
 int load_stdin() {//this function returns -1 to quit, 0 to not ask for a redraw, and 1 to ask for redraw
 // struct c3_shape s;
 // struct c3_line l;
@@ -172,12 +176,17 @@ int load_stdin() {//this function returns -1 to quit, 0 to not ask for a redraw,
    command=a[1];
   }
   if(len < 2) {
+   if(!strcmp(id,"version")) {
+    hvr_version();
+    continue;
+   }
    if(!strcmp(id,"help")) {
 #ifdef GRAPHICAL
     fprintf(stderr,"# NOT built headless.\n");
 #else
     fprintf(stderr,"# built headless.\n");
 #endif
+    fprintf(stderr,"# commands that don't get prepended with groupname: help, version\n");
     fprintf(stderr,"# command format:\n");
     fprintf(stderr,"# group names can be globbed in some cases to operate on multiple groups\n");
     fprintf(stderr,"# groupnam* command arguments\n");
@@ -556,6 +565,10 @@ int main(int argc,char *argv[]) {
   c3_t old_p;
   c3_rot_t old_r;
   if(argc == 2) {
+   if(!strcmp(argv[1],"-v") || !strcmp(argv[1],"--version")) {
+    hvr_version();
+    return 0;
+   }
    if(!strcmp(argv[1],"-h") || !strcmp(argv[1],"--help")) {
     printf("usage: hackvr file1 file2 file3 ... fileN < from_others > to_others\n");
     return 0;

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 15:44:50 2024