use common setup

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3308 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-08-31 16:55:39 +00:00
parent f196148b04
commit 81f41fc3d6
4 changed files with 10 additions and 190 deletions

View File

@@ -40,12 +40,6 @@
#include <gssapi.h>
RCSID("$Id$");
static void
usage (void)
{
errx (1, "Usage: %s [-p port] [-s service] host", __progname);
}
static int
proto (int sock, const char *hostname, const char *service)
{
@@ -198,45 +192,7 @@ doit (const char *hostname, int port, const char *service)
int
main(int argc, char **argv)
{
int c;
int port = 0;
char *service = SERVICE;
set_progname (argv[0]);
while ((c = getopt (argc, argv, "p:s:")) != EOF) {
switch (c) {
case 'p': {
struct servent *s = getservbyname (optarg, "tcp");
if (s)
port = s->s_port;
else {
char *ptr;
port = strtol (optarg, &ptr, 10);
if (port == 0 && ptr == optarg)
errx (1, "Bad port `%s'", optarg);
port = htons(port);
}
break;
}
case 's':
service = optarg;
break;
default:
usage ();
break;
}
}
argc -= optind;
argv += optind;
if (argc != 1)
usage ();
if (port == 0)
port = krb5_getportbyname (PORT, "tcp", htons(4711));
return doit (*argv, port, service);
krb5_context context; /* XXX */
int port = client_setup(&context, &argc, argv);
return doit (argv[argc], port, service);
}