chiark / gitweb /
remove binaries and ~-files
authorian <ian>
Wed, 2 Jul 2003 18:55:22 +0000 (18:55 +0000)
committerian <ian>
Wed, 2 Jul 2003 18:55:22 +0000 (18:55 +0000)
www-cgi/ucgi [deleted file]
www-cgi/ucgi.c~ [deleted file]
www-cgi/ucgi.h~ [deleted file]
www-cgi/ucgicommon.c~ [deleted file]
www-cgi/ucgitarget [deleted file]
www-cgi/ucgitarget.c~ [deleted file]

diff --git a/www-cgi/ucgi b/www-cgi/ucgi
deleted file mode 100755 (executable)
index e6ceca7..0000000
Binary files a/www-cgi/ucgi and /dev/null differ
diff --git a/www-cgi/ucgi.c~ b/www-cgi/ucgi.c~
deleted file mode 100644 (file)
index b336f96..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Usage: as CGI script
- */
-
-#include "ucgi.h"
-
-int main(int argc, const char **argv) {
-  char *defarg;
-  const char *slash2, *pathi, *ev, *en, *av;
-  const char *const *ep;
-  const char **arguments;
-  size_t usernamelen;
-
-  pathi= getenv("PATH_INFO");
-  if (pathi[0] != '/' || pathi[1] != '~') error("PATH_INFO must start with /~");
-  slash2= strchr(pathi,'/'); if (!slash2) error("PATH_INFO must have more than one /");
-  usernamelen= slash2-(pathi+2);
-  if (usernamelen > MAX_USERNAME_LEN) error("PATH_INFO username too long");
-  username= xmalloc(usernamelen+1); memcpy(username,pathi+2); username[usernamelen]= 0;
-  if (!isalpha(username[0])) error("username 1st character is not alphabetic");
-  if (setenv("PATH_INFO",slash2,1)) syserror("setenv PATH_INFO");
-  
-  arguments= xmalloc(sizeof(const char*)*(nenvok+argc+10));
-  nargs= 0;
-  arguments[0]= "userv";
-  for (ep= envok; (en= *ep); ep++) {
-    ev= getenv(en); if (!ev) continue;
-    l= strlen(ev); if (l > MAX_ENVVAR_VALUE) error("environment variable too long");
-    defarg= xmalloc(strlen(en)+l+5);
-    sprintf(defarg,"-D%s=%s",en,ev);
-    arguments[nargs++]= defarg;
-  }
-  arguments[nargs++]= username;
-  arguments[nargs++]= "www-cgi";
-  while ((av= (*++argv))) arguments[nargs++]= av;
-  arguments[nargs++]= 0;
-}
diff --git a/www-cgi/ucgi.h~ b/www-cgi/ucgi.h~
deleted file mode 100644 (file)
index f5bda11..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/**/
-
-#ifndef UCGI_H
-#define UCGI_H
-
-#include "ucgicommon.h"
-
-void syserror(const char *m);
-void error(const char *m);
-void *xmalloc(size_t sz);
-
-extern const char *const envok[];
-extern const int nenvok;
-
-#endif
diff --git a/www-cgi/ucgicommon.c~ b/www-cgi/ucgicommon.c~
deleted file mode 100644 (file)
index 327beae..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/**/
-
-#include "ucgicommon.h"
-
-const char *const envok[]= {
-  "CONTENT_LENGTH",
-  "CONTENT_TYPE",
-  "DOCUMENT_ROOT",
-  "GATEWAY_INTERFACE",
-  "HTTP_ACCEPT",
-  "HTTP_ACCEPT_ENCODING",
-  "HTTP_ACCEPT_LANGUAGE",
-  "HTTP_CACHE_CONTROL",
-  "HTTP_HOST",
-  "HTTP_NEGOTIATE",
-  "HTTP_PRAGMA",
-  "HTTP_USER_AGENT",
-  "PATH_INFO",
-  "PATH_TRANSLATED",
-  "QUERY_STRING",
-  "REMOTE_ADDR",
-  "REMOTE_HOST",
-  "REMOTE_USER",
-  "REMOTE_IDENT",
-  "REQUEST_METHOD",
-  "SCRIPT_FILENAME",
-  "SCRIPT_NAME",
-  "SCRIPT_URI",
-  "SCRIPT_URL",
-  "SERVER_ADMIN",
-  "SERVER_NAME",
-  "SERVER_PORT",
-  "SERVER_PROTOCOL",
-  "SERVER_SOFTWARE",
-  0
-};
-const int nenvok= sizeof(envok)/sizeof(envok[0]);
-
-void syserror(const char *m) {
-  if (printf("Content-Type: text/plain\n\n"
-            "ucgi: system call error:\n"
-            "%s: %s\n",
-            m,strerror(errno))==EOF || fflush(stdout)) outerror();
-  exit(0);
-}
-
-void error(const char *m) {
-  if (printf("Content-Type: text/plain\n\n"
-            "ucgi: error:\n"
-            "%s\n",
-            m)==EOF || fflush(stdout)) outerror();
-  exit(0);
-}
-
-void *xmalloc(size_t sz) {
-  void *r;
-
-  r= malloc(sz);
-  if (!r) syserror("malloc failed");
-  return r;
-}
diff --git a/www-cgi/ucgitarget b/www-cgi/ucgitarget
deleted file mode 100755 (executable)
index d845646..0000000
Binary files a/www-cgi/ucgitarget and /dev/null differ
diff --git a/www-cgi/ucgitarget.c~ b/www-cgi/ucgitarget.c~
deleted file mode 100644 (file)
index 5299b6a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Usage: as CGI script, but called by userv
- * environment variables are USERV_U_E_...
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <stat.h>
-
-#include "ucgi.h"
-
-void *xrealloc(void *ptr, size_t sz) {
-  void *r;
-
-  r= realloc(ptr,sz);
-  if (!r) syserror("realloc failed");
-  return r;
-}
-
-int main(int argc, const char **argv) {
-  char *uservar, *scriptpath;
-  const char *nextslash, *lastslash, *pathi, *ev, *en, *scriptdir;
-  const char *const *ep;
-  const char **arguments;
-  size_t scriptdirlen, scriptpathlen, l, uservarnl;
-  struct stat stab;
-
-  ev= getenv("USERV_U_DEBUG");
-  if (ev && *ev) debugmode= 1;
-  
-  if (argc > MAX_ARGS) error("too many arguments");
-
-  scriptdir= *++argv;
-  if (!scriptdir) error("no argv[1] (script directory)");
-  scriptdirlen= strlen(scriptdir);
-
-  for (ep= envok; (en= *ep); ep++) {
-    l= strlen(en)+11;
-    if (uservarnl<l) { uservarn= xrealloc(uservarn,l); uservarnl= l; }
-    sprintf(uservarn,"USERV_U_E_%s",en);
-    ev= getenv(uservarn); if (!ev) continue;
-    if (strlen(ev) > MAX_ENVVAR_VALUE) error("environment variable too long");
-    if (setenv(en,ev,1)) syserror("setenv");
-    if (unsetenv(uservarn)) syserror("unsetenv");
-  }
-
-  pathi= getenv("PATH_INFO");
-  if (!pathi) error("PATH_INFO not found");
-  if (pathi[0] != '/') error("PATH_INFO must start with /");
-  lastslash= pathi;
-  for (;;) {
-    nextslash= strchr(lastslash+1,'/');
-    if (!nextslash) error("insufficient slashes in PATH_INFO beyond directory");
-    if (nextslash[1]=='.' || nextslash[1]=='#' || !nextslash[1]) error("bad char begin");
-    if (nextslash-pathi > MAX_SCRIPTPATH_LEN) error("PATH_INFO script dir too long");
-    scriptpathlen= scriptdirlen+(nextslash-pathi);
-    scriptpath= xrealloc(scriptpath,scriptpathlen);
-    memcpy(scriptpath,pathi,scriptpathlen); scriptpath[scriptpathlen]= 0;
-    if (scriptpath[scriptpathlen-1]=='~') error("bad char end");
-    r= stat(scriptpath,&stab); if (r) syserror("stat script");
-    if (S_ISREG(stab.st_mode)) break;
-    if (!S_ISDIR(stab.st_mode)) syserror("script not directory or file");
-    lastlash= nextslash;
-  }
-  if (setenv("PATH_INFO",nextslash,1)) syserror("setenv PATH_INFO");
-
-  arguments= xmalloc(sizeof(const char*)*(argc+5));
-  nargs= 0;
-  
-  arguments[nargs++]= scriptpath;
-  while ((av= (*++argv))) arguments[nargs++]= av;
-  arguments[nargs++]= 0;
-
-  execvp(scriptpath,(char*const*)arguments);
-  syserror("exec script");
-  return -1;
-}