#include "ckcsym.h"
#define XFATAL fatal
-/* C K U U S Y -- "User Interface" for Unix Kermit, part Y */
+/* C K U U S Y -- "User Interface" for C-Kermit Kermit, part Y */
/* Command-Line Argument Parser */
Jeffrey E Altman <jaltman@secure-endpoints.com>
Secure Endpoints Inc., New York City
- Copyright (C) 1985, 2004,
+ Copyright (C) 1985, 2009,
Trustees of Columbia University in the City of New York.
All rights reserved. See the C-Kermit COPYING.TXT file or the
copyright text in the ckcmai.c module for disclaimer and permissions.
int haveftpuid = 0; /* Have FTP user ID */
static int have_cx = 0; /* Have connection */
+static char * failmsg = NULL; /* Failure message */
+
#ifdef NEWFTP
extern char * ftp_host;
#endif /* NEWFTP */
/*
Returns 0 if the candidate does not seem to be a URL.
Returns 1 if it might be a URL, with the above pointers set to its pieces:
- service : [ // ] [ user [ : password ] @ ] host [ : service ] [ / path ]
+ service : [ // ] [ user [ : password ] @ ] host [ : service ] [ / path ] -
+ [ ? name [ = value ]]
Example: ftp://ds.internic.net:21/rfc/rfc1234.txt
url.svc = [ftp]
free(url->pth);
url->pth = NULL;
}
+ if (url->nopts) {
+ int i;
+ for (i = 0; i < url->nopts && i < MAX_URL_OPTS; i++ ) {
+ if (url->opt[i].nam) {
+ free(url->opt[i].nam);
+ url->opt[i].nam = NULL;
+ }
+ if (url->opt[i].val) {
+ free(url->opt[i].val);
+ url->opt[i].val = NULL;
+ }
+ }
+ url->nopts = 0;
+ }
p = urlbuf; /* Was a service requested? */
while (*p && *p != ':') /* Look for colon */
p++;
p = q;
url->hos = p;
}
+#ifdef COMMENT
debug(F111,"urlparse url->usr",url->usr,url->usr);
debug(F111,"urlparse url->psw",url->usr,url->psw);
debug(F111,"urlparse url->hos",url->usr,url->hos);
+#endif /* COMMENT */
while (*p != NUL && *p != ':' && *p != '/') /* Port? */
p++;
char *hlp4[] = { /* ssh */
" [option-list] host[:port] [port]\n",
" The option-list consists of zero, one, or more of:\n",
+#ifdef OS2
+" -# flags Kermit 95 Startup Flags\n",
+" 1 turn off Win95 special fixes\n",
+" 2 do not load optional network dlls\n",
+" 4 do not load optional tapi dlls\n",
+" 8 do not load optional kerberos dlls\n",
+" 16 do not load optional zmodem dlls\n",
+" 32 use stdin for input instead of the console\n",
+" 64 use stdout for output instead of the console\n",
+" 128 do not terminate process in response to Session Logoff\n",
+#endif /* OS2 */
" -d Turn on debug mode\n",
+" -Y Disable init file processing\n",
" -l user Set username\n",
""
};
ftp_cmdlin++; /* 2 = same plus file transfer */
#ifndef NOURL
- debug(F111,"ftp xx_ftp g_url.usr",g_url.usr,g_url.usr);
+ /* debug(F111,"ftp xx_ftp g_url.usr",g_url.usr,g_url.usr); */
if (haveurl && g_url.usr) { /* Wed Oct 9 15:15:22 2002 */
if (!*(g_url.usr)) { /* Force username prompt if */
haveftpuid = 0; /* "ftp://:@host" given. */
{ "maximize", XA_WMAX, CM_PRE },
{ "minimize", XA_WMIN, CM_PRE },
{ "nobars", XA_NOBAR, CM_PRE },
+ { "noclose" , XA_NOCLOSE, CM_PRE },
#endif /* KUI */
{ "noescape", XA_NOESCAPE, CM_PRE },
#endif /* OS2 */
#ifdef OS2
{ "title", XA_TITL, CM_ARG },
#endif /* OS2 */
+#ifdef UNIX
+ { "unbuffered", XA_UNBUF, 0 },
+#endif /* UNIX */
#ifndef NOSPL
{ "user", XA_USER, CM_ARG },
#endif /* NOSPL */
xopthlp[j] = "--nointerrupts";
xarghlp[j] = "Disable keyboard interrupts.";
break;
+#ifdef UNIX
+ case XA_UNBUF:
+ xopthlp[j] = "--unbuffered";
+ xarghlp[j] = "Force unbuffered console i/o.";
+ break;
+#endif /* UNIX */
#ifdef IKSDB
case XA_DBAS:
xopthlp[j] = "--database:{on,off}";
xopthlp[j] = "--lockdown";
xarghlp[j] = "Enable all lockdown options.";
break;
+ case XA_NOCLOSE:
+ xopthlp[j] = "--noclose";
+ xarghlp[j] = "Disable Close Window and Menu Exit.";
+ break;
case XA_NOSCROLL:
xopthlp[j] = "--noscroll";
xarghlp[j] = "Disable scrollback operations.";
break;
#ifdef TCPSOCKET
case 'F':
- opthlp[i] = "Make a TCP connection";
+ opthlp[i] = "Use an existing TCP connection";
arghlp[i] = "Numeric file descriptor of open TCP connection";
break;
#endif /* TCPSOCKET */
xsuspend = 0;
break;
+#ifdef UNIX
+ case XA_UNBUF: /* Unbuffered console i/o*/
+ break; /* This one is handled in ckcmai.c */
+#endif /* UNIX */
+
#ifdef IKSDB
case XA_DBFI: {
extern char * dbdir, * dbfile;
kui_init.nostatusbar = 1;
#endif
break;
- case XA_NOSCROLL:
+#ifdef KUI
+ case XA_NOCLOSE:
+ kui_init.noclose = 1;
+ break;
+#endif /* KUI */
+ case XA_NOSCROLL:
tt_scroll = 0;
break;
- case XA_NOESCAPE:
+ case XA_NOESCAPE:
tt_escape = 0;
break;
#endif /* OS2 */
break;
}
#ifdef OS2
- case XA_TITL:
- os2settitle(p,1);
+ case XA_TITL: {
+ extern char usertitle[];
+ ckstrncpy(usertitle,p,64);
+ os2settitle("",1);
break;
+ }
#endif /* OS2 */
#ifdef COMMENT /* TO BE FILLED IN ... */
/* or contains wildcard characters matching real files */
fil2snd = 1;
nfils++;
+ } else {
+ if (!failmsg)
+ failmsg = (char *)malloc(2000);
+ if (failmsg) {
+ ckmakmsg(failmsg,2000,
+#ifdef VMS
+ "%CKERMIT-E-SEARCHFAIL "
+#else
+ "kermit -s "
+#endif /* VMS */
+ ,
+ *xargv,
+ ": ",
+ ck_errstr()
+ );
+ }
}
}
xargc++, xargv--; /* Adjust argv/argc */
if (!fil2snd && z == 0) {
+ if (!failmsg) {
#ifdef VMS
- XFATAL("%CKERMIT-E-SEARCHFAIL, no files for -s");
+ failmsg = "%CKERMIT-E-SEARCHFAIL, no files for -s";
#else
- XFATAL("No files for -s");
+ failmsg = "No files for -s";
#endif /* VMS */
+ }
+ XFATAL(failmsg);
}
if (z > 1) {
- XFATAL("-s: too many -'s");
+ XFATAL("kermit -s: too many -'s");
}
if (z == 1 && fil2snd) {
XFATAL("invalid mixture of filenames and '-' in -s");
#endif /* COMMENT */
/*
+ * -# Kermit 95 Startup Flags
* -8 Negotiate Telnet Binary in both directions
* -a Require use of Telnet authentication
* -c Do not read the .telnetrc file
* -d Turn on debug mode
* -E No escape character
+ * -f Forward credentials to host
* -K Refuse use of authentication; do not send username
+ * -k realm Set default realm
* -l user Set username and request Telnet authentication
* -L Negotiate Telnet Binary Output only
+ * -q Quiet mode (suppress messages)
* -S tos Use the IP type-of-service tos
* -x Require Encryption
* -D Disable forward-X
* -T crldir=dir Use CRLs in directory
* -T cipher=string Use only ciphers in string
* -X atype Disable use of atype authentication
- * -f Forward credentials to host
- * -k realm Set default realm
+ * -Y Disable init file processing
*
*/
case 'h': /* help */
TELOPT_DEF_C_ME_MODE(TELOPT_AUTHENTICATION) = TN_NG_MU;
break;
+ case 'Y':
+ xargv++, xargc--; /* Skip past argument */
+ break; /* Action done in prescan */
+
+#ifdef OS2
+ case '#': /* K95 stdio threads */
+ xargv++, xargc--; /* Skip past argument */
+ break; /* Action done in prescan */
+#endif /* OS2 */
+
+ case 'q': /* Quiet */
+ quiet = 1;
+ break;
+
case 'd':
#ifdef DEBUG
if (deblog) {
doexit(GOOD_EXIT,-1);
break;
+ case 'Y':
+ xargv++, xargc--; /* Skip past argument */
+ break; /* Action done in prescan */
+#ifdef OS2
+ case '#': /* K95 stdio threads */
+ xargv++, xargc--; /* Skip past argument */
+ break; /* Action done in prescan */
+#endif /* OS2 */
+ case 'q': /* Quiet */
+ quiet = 1;
+ break;
+
case 'd':
#ifdef DEBUG
if (deblog) {
/*
* -d Debug
+ * -# args Init
+ * -Y no init file
* -l user Set username
*
*/
doexit(GOOD_EXIT,-1);
break;
+ case 'Y':
+ xargv++, xargc--; /* Skip past argument */
+ break; /* Action done in prescan */
+#ifdef OS2
+ case '#': /* K95 stdio threads */
+ xargv++, xargc--; /* Skip past argument */
+ break; /* Action done in prescan */
+#endif /* OS2 */
+ case 'q': /* Quiet */
+ quiet = 1;
+ break;
+
case 'd':
#ifdef DEBUG
if (deblog) {
default:
fatal2(*xargv,
- "invalid command-line option, type \"rlogin -h\" for help"
+ "invalid command-line option, type \"ssh -h\" for help"
);
}
#else /* No command-line interface... */
-extern int xargc;
int
cmdlin() {
+ extern int xargc;
if (xargc > 1) {
XFATAL("Sorry, command-line options disabled.");
}