diff --git a/c/httphead/httphead.c b/c/httphead/httphead.c index 0c869f1..8491e4b 100644 --- a/c/httphead/httphead.c +++ b/c/httphead/httphead.c @@ -36,8 +36,6 @@ #include #include -#include "httphead.h" - const char usagemsg[] = "usage: httphead [-r] [-q] [-p port] [-s host-] [-d path] [-s host] URL\n" "\n" @@ -52,7 +50,42 @@ " -l display (BSD) license\n" ; +const char licensemsg[] = + "httphead is copyright (c) 2006 Andreas Jaggi \n" + "All rights reserved.\n" + "\n" + "Redistribution and use in source and binary forms, with or without\n" + "modification, are permitted provided that the following conditions\n" + "are met:\n" + "1. Redistributions of source code must retain the above copyright\n" + " notice, this list of conditions and the following disclaimer.\n" + "2. Redistributions in binary form must reproduce the above copyright\n" + " notice, this list of conditions and the following disclaimer in the\n" + " documentation and/or other materials provided with the distribution.\n" + "3. The name of the author may not be used to endorse or promote products\n" + " derived from this software without specific prior written permission.\n" + "\n" + "THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" + "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" + "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" + "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" + "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" + "NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" + "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" + "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" + "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" + "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + ; + +const char versionmsg[] = "httphead 0.2\n"; + +#define HH_BUFFSIZE 512 + void usage ( ); +void license ( ); +void version ( ); + +void showerror ( char* type ); void crlf ( int s ); @@ -311,3 +344,19 @@ void usage ( ) { write(1, usagemsg, strlen(usagemsg)); } + +void license ( ) { + write(1, licensemsg, strlen(licensemsg)); +} + +void version ( ) { + write(1, versionmsg, strlen(versionmsg)); +} + +void showerror ( char* type ) { + char* errstr = strerror(errno); + write(2, type, strlen(type)); + write(2, ": ", 2); + write(2, errstr, strlen(errstr)); + write(2, "\n", 1); +} diff --git a/c/httphead/httphead.h b/c/httphead/httphead.h deleted file mode 100644 index f01cacc..0000000 --- a/c/httphead/httphead.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _HTTPHEAD_H -#define _HTTPHEAD_H - -#define HH_BUFFSIZE 512 - -#include -#include -#include - -const char licensemsg[] = - "httphead is copyright (c) 2006 Andreas Jaggi \n" - "All rights reserved.\n" - "\n" - "Redistribution and use in source and binary forms, with or without\n" - "modification, are permitted provided that the following conditions\n" - "are met:\n" - "1. Redistributions of source code must retain the above copyright\n" - " notice, this list of conditions and the following disclaimer.\n" - "2. Redistributions in binary form must reproduce the above copyright\n" - " notice, this list of conditions and the following disclaimer in the\n" - " documentation and/or other materials provided with the distribution.\n" - "3. The name of the author may not be used to endorse or promote products\n" - " derived from this software without specific prior written permission.\n" - "\n" - "THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" - "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" - "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" - "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" - "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" - "NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" - "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" - "THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" - "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" - "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" - ; - -const char versionmsg[] = "httphead 0.2\n"; - -void license ( ) { - write(1, licensemsg, strlen(licensemsg)); -} - -void version ( ) { - write(1, versionmsg, strlen(versionmsg)); -} - -void showerror ( char* type ) { - char* errstr = strerror(errno); - write(2, type, strlen(type)); - write(2, ": ", 2); - write(2, errstr, strlen(errstr)); - write(2, "\n", 1); -} - -#endif