From 1bbaf366388699c5804d4ed51407011204b0d8ec Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Fri, 24 Aug 2001 17:27:58 +0000 Subject: junload: Derive progID and contID from filename --- usr.bin/sectok/cyberflex.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'usr.bin/sectok') 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) -- cgit v1.2.3