summaryrefslogtreecommitdiff
path: root/usr.bin/sectok
diff options
context:
space:
mode:
authorJim Rees <rees@cvs.openbsd.org>2001-08-24 17:27:58 +0000
committerJim Rees <rees@cvs.openbsd.org>2001-08-24 17:27:58 +0000
commit1bbaf366388699c5804d4ed51407011204b0d8ec (patch)
tree0f8b5239b53957e487e6de148bc9e759b200057b /usr.bin/sectok
parentf6451b91af8454c1e571f8ac560a1581a5f08be4 (diff)
junload: Derive progID and contID from filename
Diffstat (limited to 'usr.bin/sectok')
-rw-r--r--usr.bin/sectok/cyberflex.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/usr.bin/sectok/cyberflex.c b/usr.bin/sectok/cyberflex.c
index 1c1bc25f379..23071ab5d75 100644
--- a/usr.bin/sectok/cyberflex.c
+++ b/usr.bin/sectok/cyberflex.c
@@ -1,4 +1,4 @@
-/* $Id: cyberflex.c,v 1.19 2001/08/15 21:11:29 rees Exp $ */
+/* $Id: cyberflex.c,v 1.20 2001/08/24 17:27:57 rees Exp $ */
/*
copyright 1999, 2000
@@ -813,13 +813,7 @@ int jload(int ac, char *av[])
int junload(int ac, char *av[])
{
char progname[5], contname[5];
- int i, vflag = 0, sw;
-
- /* Use old defaults */
- if (progID[0] == 0)
- memcpy(progID, "ww", 2);
- if (contID[0] == 0)
- memcpy(contID, "wx", 2);
+ int i, vflag = 0, gotprog = 0, gotcont = 0, sw;
optind = optreset = 1;
@@ -827,9 +821,11 @@ int junload(int ac, char *av[])
switch (i) {
case 'p':
sectok_parse_input(optarg, progID, 2);
+ gotprog = 1;
break;
case 'c':
sectok_parse_input(optarg, contID, 2);
+ gotcont = 1;
break;
case 'v':
vflag = 1;
@@ -840,6 +836,26 @@ int junload(int ac, char *av[])
}
}
+ if (ac - optind >= 1) {
+ /* Derive progID and contID from filename */
+ if (!gotprog) {
+ progID[0] = av[optind][0];
+ progID[1] = 'p';
+ gotprog = 1;
+ }
+ if (!gotcont) {
+ contID[0] = av[optind][0];
+ contID[1] = 'c';
+ gotcont = 1;
+ }
+ }
+
+ /* Use old defaults */
+ if (!gotprog)
+ memcpy(progID, "ww", 2);
+ if (!gotcont)
+ memcpy(contID, "wx", 2);
+
if (fd < 0 && reset(0, NULL) < 0)
return -1;
if (!aut0_vfyd)