-- Leo's gemini proxy

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

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: shell-daemons
action: commit
revision:
path_from:
revision_from: b41d8148c1f127553b3d4e3d98aee3164d0271f1:
path_to:
revision_to:

git.thebackupbox.net

shell-daemons

git://git.thebackupbox.net/shell-daemons

commit b41d8148c1f127553b3d4e3d98aee3164d0271f1
Author: epoch <epoch@hack.thebackupbox.net>
Date:   Sun Sep 13 23:05:44 2020 +0000

    added includes and some other fixes that pedantic walls suggested. thank you, compiler

diff --git a/query_param.c b/query_param.c

index ac3cecd8e814afb4515ec6961163790a0c78aa8f..

index ..f47976c28306c354a2b6abf501dd280a1d2e5738 100644

--- a/query_param.c
+++ b/query_param.c
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <string.h> //strchr

 //this is to replace all of the:
 //   printf "%s\n" "$QUERY_STRING" | tr '&' '\n' | grep "^$1=" | cut -d= -f2-
@@ -9,7 +10,7 @@
 int main(int argc,char *argv[]) {
   char *p;
   if(argc != 2) return fprintf(stderr,"usage: query_param param_name\n"),1;
-  for(p=getenv("QUERY_STRING");p != 1;p=strchr(p,'&')+1) {
+  for(p=getenv("QUERY_STRING");p;p=strchr(p,'&')+1) {
     if(!strncmp(p,argv[1],strlen(argv[1]))) {
       if(strchr(p,'=')-p == strlen(argv[1])) {
         if(strchr(p,'&')) *strchr(p,'&')=0;
diff --git a/read_headers.c b/read_headers.c

index e87606b985f178b0a4c0a6da17c16cf77fa88ab2..

index ..efa71227f3fa46461b08dfdf5e227fca2b091abd 100644

--- a/read_headers.c
+++ b/read_headers.c
@@ -1,5 +1,8 @@
 #include <stdio.h>
 #include <ctype.h> //toupper
+#include <string.h> //strcpy, cat, etc
+#include <stdlib.h> //getenv
+#include <unistd.h> //execv

 // this program is to read in headers like the type in:
 // urn:ietf:rfc:3864
@@ -20,11 +23,11 @@ int main(int argc,char *argv[]) {
   char *value;
   strcpy(scheme,getenv("SERVER_PROTOCOL"));
   if(strchr(scheme,'/')) *strchr(scheme,'/')=0;
-  while(fgets(line,sizeof(line)-1,stdin) > 0) {
+  while(fgets(line,sizeof(line)-1,stdin)) {
     if(strchr(line,'\n')) *strchr(line,'\n')=0;
     if(strchr(line,'\r')) *strchr(line,'\r')=0;
     if(!strlen(line)) break;//got a blank line. abort.
-    if(value=strchr(line,':')) {
+    if((value=strchr(line,':'))) {
       *value=0;
       for(value++;*value==' ';value++);
     } else {

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

-- Response ended

-- Page fetched on Sun Jun 2 09:28:49 2024