Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Vend 0.2
  • Loading branch information
Andrew M. Wilcox authored and jonjensen committed Jan 2, 2009
1 parent 4f62847 commit 376d651
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 61 deletions.
6 changes: 6 additions & 0 deletions Changes
@@ -0,0 +1,6 @@
Version 0.2
svend.c cleaned up
configuration directives now get correct default values

Version 0.1
initial release
File renamed without changes.
16 changes: 8 additions & 8 deletions doc/vend.html
Expand Up @@ -6,15 +6,15 @@
<body>
<h1>Vend Documentation</h1>

Vend version 0.1 (alpha). This documentation is preliminary.<p>
Vend version 0.2 (alpha). This documentation is preliminary.<p>

Vend allows customers to select items to buy from catalog pages. The
program tracks which products they have selected and the quantity
desired. From the ordering page they may complete the ordering
process by entering their name and address, or return to browsing and
select more items.<p>

Vend 0.1 does not support secure transmission of credit card numbers.
Vend 0.2 does not support secure transmission of credit card numbers.
Vendors should contact customers separately for payment.<p>

<ul>
Expand Down Expand Up @@ -99,8 +99,8 @@ <h2><a name="download">Where to Download Vend</a></h2>

Vend is available from:<p>

<a href="ftp://gray.maine.com/pub/awilcox/vend-0.1.tar.gz">ftp://gray.maine.com/pub/awilcox/vend-0.1.tar.gz</a><br>
<a href="ftp://ftp.biddeford.com/pub/awilcox/vend-0.1.tar.gz">ftp://ftp.biddeford.com/pub/awilcox/vend-0.1.tar.gz</a>
<a href="ftp://gray.maine.com/pub/awilcox/vend-0.2.tar.gz">ftp://gray.maine.com/pub/awilcox/vend-0.2.tar.gz</a><br>
<a href="ftp://ftp.biddeford.com/pub/awilcox/vend-0.2.tar.gz">ftp://ftp.biddeford.com/pub/awilcox/vend-0.2.tar.gz</a>

<h2><a name="perl">Perl version 5</a></h2>

Expand Down Expand Up @@ -207,14 +207,14 @@ <h2><a name="unpacking">Unpacking the Vend Distribution</a></h2>
Decompress and untar the distribution:

<pre>
gzip -d vend-0.1.tar.gz
tar xfv vend-0.1.tar
gzip -d vend-0.2.tar.gz
tar xfv vend-0.2.tar
</pre>

If you have GNU tar, you can combine these steps:

<pre>
tar xfvz vend-0.1.tar.gz
tar xfvz vend-0.2.tar.gz
</pre>

The <code>samples</code> directory contains a sample product file and
Expand Down Expand Up @@ -693,7 +693,7 @@ <h2><a name="expire">Expiring Sessions</a></h2>

<hr>
<address>
Febuary 1, 1995.
Febuary 22, 1995.
<a href="http://www.maine.com/awilcox/">Andrew Wilcox</a>,
<a href="mailto:awilcox@world.std.com">awilcox@world.std.com</a></address>
</body></html>
26 changes: 15 additions & 11 deletions doc/vend.text
@@ -1,15 +1,15 @@

VEND DOCUMENTATION

Vend version 0.1 (alpha). This documentation is preliminary.
Vend version 0.2 (alpha). This documentation is preliminary.

Vend allows customers to select items to buy from catalog pages. The
program tracks which products they have selected and the quantity
desired. From the ordering page they may complete the ordering process
by entering their name and address, or return to browsing and select
more items.

Vend 0.1 does not support secure transmission of credit card numbers.
Vend 0.2 does not support secure transmission of credit card numbers.
Vendors should contact customers separately for payment.

* Overview
Expand Down Expand Up @@ -57,7 +57,8 @@ Overview
Informs server that the requested page will be generated by a
program.

vend Name of the program to run
vend
Name of the program to run

shirts
Page of the catalog to display
Expand Down Expand Up @@ -86,8 +87,8 @@ Where to Download Vend

Vend is available from:

ftp://gray.maine.com/pub/awilcox/vend-0.1.tar.gz
ftp://ftp.biddeford.com/pub/awilcox/vend-0.1.tar.gz
ftp://gray.maine.com/pub/awilcox/vend-0.2.tar.gz
ftp://ftp.biddeford.com/pub/awilcox/vend-0.2.tar.gz

Perl version 5

Expand Down Expand Up @@ -179,12 +180,12 @@ Unpacking the Vend Distribution

Decompress and untar the distribution:

gzip -d vend-0.1.tar.gz
tar xfv vend-0.1.tar
gzip -d vend-0.2.tar.gz
tar xfv vend-0.2.tar

If you have GNU tar, you can combine these steps:

tar xfvz vend-0.1.tar.gz
tar xfvz vend-0.2.tar.gz

The samples directory contains a sample product file and order report,
and sample catalog pages. If you would like to use them as a starting
Expand Down Expand Up @@ -234,10 +235,12 @@ Setting up SVEND
Set this to the numeric uid (user id) which HTTPD runs cgi-bin
programs under. Typically this will be 'nobody' or 'guest'.

PERL Set this to the location of the perl (version 5 or higher)
PERL
Set this to the location of the perl (version 5 or higher)
executable.

VEND Set to the location of vend.pl, typically in the vend
VEND
Set to the location of vend.pl, typically in the vend
directory.

Compile svend.c with your C compiler:
Expand Down Expand Up @@ -591,4 +594,5 @@ Expiring Sessions

_________________________________________________________________

Febuary 1, 1995. Andrew Wilcox, awilcox@world.std.com

Febuary 22, 1995. Andrew Wilcox, awilcox@world.std.com
12 changes: 2 additions & 10 deletions sample/pages/catalog.html
@@ -1,9 +1,9 @@
<html><head>
<title>Vend 0.1 Demo Catalog</title>
<title>Vend 0.2 Demo Catalog</title>
</head>

<body>
<h1>Vend 0.1 Demo Catalog</h1>
<h1>Vend 0.2 Demo Catalog</h1>

Welcome to this demonstration of the Vend version 0.1 World Wide Web
catalog ordering system. This is an alpha version, which means that
Expand All @@ -15,18 +15,10 @@ <h1>Vend 0.1 Demo Catalog</h1>
entering their name and address, or return to browsing and select more
items.<p>

Vend 0.1 does not support secure transmission of credit card numbers.
Vendors should contact customers separately via phone, fax, or regular
mail for payment.<p>

<em>Special Today!</em> Buy the [order bridge]Brookline Bridge[/order]
for only $[price bridge]!<p>

<h2>Demo Catalog Pages</h2>
[page planets]Planets[/page]<p>

[page page2]Second Category[/page]<p>

[page page3]Third Category[/page]<p>

</body> </html>
59 changes: 31 additions & 28 deletions svend.c
@@ -1,11 +1,30 @@
#define CGIUSER 999
#define PERL "/usr/bin/perl"
#define VEND "/home/vend/vend.pl"

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define CGIUSER 503
#define PERL "/usr/bin/perl"
#define VEND "/home/vend/vend.pl"
#ifdef sun
int sys_nerr;
char* sys_errlist[];
#define NEED_STRERROR
#endif

#ifdef NEED_STRERROR
static char* strerror(e)
int e;
{
if (e == 0)
return "System call failed but errno not set";
else if (e < 1 || e >= sys_nerr)
return "No description available for this error";
else
return sys_errlist[e];
}
#endif

int main(argc, argv)
int argc;
Expand All @@ -16,45 +35,29 @@ int main(argc, argv)
int r;

if (getuid() != CGIUSER) {
printf(
"Content-type: text/plain

SVEND must be run from HTTPD. (Check CGIUSER in svend.c)
");
printf("Content-type: text/plain\n\n");
printf("SVEND must be run from HTTPD. (Check CGIUSER in svend.c)\n");
exit(1);
}

euid = geteuid();
r = setreuid( euid, euid );
if (r == -1) {
printf(
"Content-type: text/plain
Could not set uid: %s
",
strerror(errno));
printf("Content-type: text/plain\n\n");
printf("Could not set uid: %s\n", strerror(errno));
exit(1);
}

egid = getegid();
r = setregid( egid, egid );
if (r == -1) {
printf(
"Content-type: text/plain
Could not set gid: %s
",
strerror(errno));
printf("Content-type: text/plain\n\n");
printf("Could not set gid: %s\n", strerror(errno));
exit(1);
}

execl(PERL, PERL, VEND);
printf("
Content-type: text/plain

Could not exec %s: %s
",
PERL,
strerror(errno));
execl(PERL, PERL, VEND, 0);
printf("Content-type: text/plain\n\n");
printf("Could not exec %s: %s", PERL, strerror(errno));
exit(1);
}
17 changes: 13 additions & 4 deletions vend.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# Vend version 0.1 (alpha)
# Vend version 0.2 (alpha)
# Copyright 1995 by Andrew M. Wilcox <awilcox@world.std.com>
#
# This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -244,8 +244,17 @@ sub config {
foreach $d (@$directives) {
($directive = $d->[0]) =~ tr/A-Z/a-z/;
$name{$directive} = $d->[0];
$parse{$directive} = 'parse_' . $d->[1] if defined $d->[1];
${'Config::' . $name{$directive}} = $d->[2];
if (defined $d->[1]) {
$parse = 'parse_' . $d->[1];
} else {
$parse = undef;
}
$parse{$directive} = $parse;
$value = $d->[2];
if (defined $parse and defined $value) {
$value = &$parse($d->[0], $value);
}
${'Config::' . $name{$directive}} = $value;
}

open(Vend::CONFIG, $Config::ConfigFile)
Expand Down Expand Up @@ -1391,7 +1400,7 @@ sub parse_options {
}

sub version {
print "Vend version 0.1 Copyright 1995 Andrew M. Wilcox\n";
print "Vend version 0.2 Copyright 1995 Andrew M. Wilcox\n";
}

sub usage {
Expand Down

0 comments on commit 376d651

Please sign in to comment.