diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-20 03:50:28 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-20 03:50:28 +0000 |
commit | 23df86474b993f98880fc5d17f2bea3e1c7494be (patch) | |
tree | 0aa05adb208b73cdbc615b09c95e338bc2560893 /usr.bin/ftp/cmds.c | |
parent | 2db8f9da625184f46fa73c7f2810ce5fb74879dd (diff) |
ansi; khalek@linuxgamers.net
Diffstat (limited to 'usr.bin/ftp/cmds.c')
-rw-r--r-- | usr.bin/ftp/cmds.c | 299 |
1 files changed, 76 insertions, 223 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 754e7ef015a..614d5fda8fe 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.46 2003/12/16 21:46:22 deraadt Exp $ */ +/* $OpenBSD: cmds.c,v 1.47 2004/07/20 03:50:25 deraadt Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -60,7 +60,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: cmds.c,v 1.46 2003/12/16 21:46:22 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.47 2004/07/20 03:50:25 deraadt Exp $"; #endif /* not lint and not SMALL */ /* @@ -106,9 +106,7 @@ struct types { * Set transfer type. */ void -settype(argc, argv) - int argc; - char *argv[]; +settype(int argc, char *argv[]) { struct types *p; int comret; @@ -155,8 +153,7 @@ settype(argc, argv) * Used to change to and from ascii for listings. */ void -changetype(newtype, show) - int newtype, show; +changetype(int newtype, int show) { struct types *p; int comret, oldverbose = verbose; @@ -194,9 +191,7 @@ char *stype[] = { */ /*VARARGS*/ void -setbinary(argc, argv) - int argc; - char *argv[]; +setbinary(int argc, char *argv[]) { stype[1] = "binary"; @@ -208,9 +203,7 @@ setbinary(argc, argv) */ /*VARARGS*/ void -setascii(argc, argv) - int argc; - char *argv[]; +setascii(int argc, char *argv[]) { stype[1] = "ascii"; @@ -222,9 +215,7 @@ setascii(argc, argv) */ /*VARARGS*/ void -settenex(argc, argv) - int argc; - char *argv[]; +settenex(int argc, char *argv[]) { stype[1] = "tenex"; @@ -236,9 +227,7 @@ settenex(argc, argv) */ /*ARGSUSED*/ void -setftmode(argc, argv) - int argc; - char *argv[]; +setftmode(int argc, char *argv[]) { fprintf(ttyout, "We only support %s mode, sorry.\n", modename); @@ -250,9 +239,7 @@ setftmode(argc, argv) */ /*ARGSUSED*/ void -setform(argc, argv) - int argc; - char *argv[]; +setform(int argc, char *argv[]) { fprintf(ttyout, "We only support %s format, sorry.\n", formname); @@ -264,9 +251,7 @@ setform(argc, argv) */ /*ARGSUSED*/ void -setstruct(argc, argv) - int argc; - char *argv[]; +setstruct(int argc, char *argv[]) { fprintf(ttyout, "We only support %s structure, sorry.\n", structname); @@ -277,9 +262,7 @@ setstruct(argc, argv) * Send a single file. */ void -put(argc, argv) - int argc; - char *argv[]; +put(int argc, char *argv[]) { char *cmd; int loc = 0; @@ -328,9 +311,7 @@ usage: * Send multiple files. */ void -mput(argc, argv) - int argc; - char *argv[]; +mput(int argc, char *argv[]) { int i; sig_t oldintr; @@ -449,18 +430,14 @@ mput(argc, argv) } void -reget(argc, argv) - int argc; - char *argv[]; +reget(int argc, char *argv[]) { (void)getit(argc, argv, 1, "r+w"); } void -get(argc, argv) - int argc; - char *argv[]; +get(int argc, char *argv[]) { (void)getit(argc, argv, 0, restart_point ? "r+w" : "w" ); @@ -470,11 +447,7 @@ get(argc, argv) * Receive one file. */ int -getit(argc, argv, restartit, mode) - int argc; - char *argv[]; - int restartit; - const char *mode; +getit(int argc, char *argv[], int restartit, const char *mode) { int loc = 0; int rval = 0; @@ -560,8 +533,7 @@ freegetit: /* ARGSUSED */ void -mabort(signo) - int signo; +mabort(int signo) { int ointer, oconf; @@ -589,9 +561,7 @@ mabort(signo) * Get multiple files. */ void -mget(argc, argv) - int argc; - char *argv[]; +mget(int argc, char *argv[]) { sig_t oldintr; int ch, ointer; @@ -640,8 +610,7 @@ mget(argc, argv) } char * -onoff(bool) - int bool; +onoff(int bool) { return (bool ? "on" : "off"); @@ -652,9 +621,7 @@ onoff(bool) */ /*ARGSUSED*/ void -status(argc, argv) - int argc; - char *argv[]; +status(int argc, char *argv[]) { int i; @@ -719,11 +686,7 @@ status(argc, argv) * Toggle a variable */ int -togglevar(argc, argv, var, mesg) - int argc; - char *argv[]; - int *var; - const char *mesg; +togglevar(int argc, char *argv[], int *var, const char *mesg) { if (argc < 2) { *var = !*var; @@ -745,9 +708,7 @@ togglevar(argc, argv, var, mesg) */ /*VARARGS*/ void -setbell(argc, argv) - int argc; - char *argv[]; +setbell(int argc, char *argv[]) { code = togglevar(argc, argv, &bell, "Bell mode"); @@ -759,9 +720,7 @@ setbell(argc, argv) */ /*VARARGS*/ void -setedit(argc, argv) - int argc; - char *argv[]; +setedit(int argc, char *argv[]) { code = togglevar(argc, argv, &editing, "Editing mode"); @@ -774,9 +733,7 @@ setedit(argc, argv) */ /*VARARGS*/ void -setepsv4(argc, argv) - int argc; - char *argv[]; +setepsv4(int argc, char *argv[]) { code = togglevar(argc, argv, &epsv4, "EPSV/EPRT on IPv4"); @@ -788,9 +745,7 @@ setepsv4(argc, argv) */ /*VARARGS*/ void -settrace(argc, argv) - int argc; - char *argv[]; +settrace(int argc, char *argv[]) { code = togglevar(argc, argv, &trace, "Packet tracing"); @@ -801,9 +756,7 @@ settrace(argc, argv) */ /*VARARGS*/ void -sethash(argc, argv) - int argc; - char *argv[]; +sethash(int argc, char *argv[]) { if (argc == 1) hash = !hash; @@ -840,9 +793,7 @@ sethash(argc, argv) */ /*VARARGS*/ void -setverbose(argc, argv) - int argc; - char *argv[]; +setverbose(int argc, char *argv[]) { code = togglevar(argc, argv, &verbose, "Verbose mode"); @@ -853,9 +804,7 @@ setverbose(argc, argv) */ /*VARARGS*/ void -setport(argc, argv) - int argc; - char *argv[]; +setport(int argc, char *argv[]) { code = togglevar(argc, argv, &sendport, "Use of PORT/LPRT cmds"); @@ -866,9 +815,7 @@ setport(argc, argv) */ /*VARARGS*/ void -setprogress(argc, argv) - int argc; - char *argv[]; +setprogress(int argc, char *argv[]) { code = togglevar(argc, argv, &progress, "Progress bar"); @@ -879,9 +826,7 @@ setprogress(argc, argv) */ /*VARARGS*/ void -setprompt(argc, argv) - int argc; - char *argv[]; +setprompt(int argc, char *argv[]) { code = togglevar(argc, argv, &interactive, "Interactive mode"); @@ -892,9 +837,7 @@ setprompt(argc, argv) */ /*VARARGS*/ void -setgate(argc, argv) - int argc; - char *argv[]; +setgate(int argc, char *argv[]) { static char gsbuf[MAXHOSTNAMELEN]; @@ -953,9 +896,7 @@ setgate(argc, argv) */ /*VARARGS*/ void -setglob(argc, argv) - int argc; - char *argv[]; +setglob(int argc, char *argv[]) { code = togglevar(argc, argv, &doglob, "Globbing"); @@ -966,9 +907,7 @@ setglob(argc, argv) */ /*VARARGS*/ void -setpreserve(argc, argv) - int argc; - char *argv[]; +setpreserve(int argc, char *argv[]) { code = togglevar(argc, argv, &preserve, "Preserve modification times"); @@ -979,9 +918,7 @@ setpreserve(argc, argv) */ /*VARARGS*/ void -setdebug(argc, argv) - int argc; - char *argv[]; +setdebug(int argc, char *argv[]) { if (argc > 2) { fprintf(ttyout, "usage: %s [ on | off | debuglevel ]\n", argv[0]); @@ -1019,9 +956,7 @@ setdebug(argc, argv) * Set current working directory on remote machine. */ void -cd(argc, argv) - int argc; - char *argv[]; +cd(int argc, char *argv[]) { int r; @@ -1049,9 +984,7 @@ cd(argc, argv) * Set current working directory on local machine. */ void -lcd(argc, argv) - int argc; - char *argv[]; +lcd(int argc, char *argv[]) { char buf[MAXPATHLEN]; char *oldargv1; @@ -1086,9 +1019,7 @@ lcd(argc, argv) * Delete a single file. */ void -delete(argc, argv) - int argc; - char *argv[]; +delete(int argc, char *argv[]) { if ((argc < 2 && !another(&argc, &argv, "remote-file")) || argc > 2) { @@ -1103,9 +1034,7 @@ delete(argc, argv) * Delete multiple files. */ void -mdelete(argc, argv) - int argc; - char *argv[]; +mdelete(int argc, char *argv[]) { sig_t oldintr; int ointer; @@ -1145,9 +1074,7 @@ mdelete(argc, argv) * Rename a remote file. */ void -renamefile(argc, argv) - int argc; - char *argv[]; +renamefile(int argc, char *argv[]) { if (argc < 2 && !another(&argc, &argv, "from-name")) @@ -1166,9 +1093,7 @@ usage: * Get a directory listing of remote files. */ void -ls(argc, argv) - int argc; - char *argv[]; +ls(int argc, char *argv[]) { const char *cmd; char *oldargv2, *globargv2; @@ -1209,9 +1134,7 @@ freels: * Get a directory listing of multiple remote files. */ void -mls(argc, argv) - int argc; - char *argv[]; +mls(int argc, char *argv[]) { sig_t oldintr; int ointer, i; @@ -1260,9 +1183,7 @@ usage: */ /*ARGSUSED*/ void -shell(argc, argv) - int argc; - char *argv[]; +shell(int argc, char *argv[]) { pid_t pid; sig_t old1, old2; @@ -1319,9 +1240,7 @@ shell(argc, argv) * Send new user information (re-login) */ void -user(argc, argv) - int argc; - char *argv[]; +user(int argc, char *argv[]) { char acct[80]; int n, aflag = 0; @@ -1365,9 +1284,7 @@ user(argc, argv) */ /*VARARGS*/ void -pwd(argc, argv) - int argc; - char *argv[]; +pwd(int argc, char *argv[]) { int oldverbose = verbose; @@ -1386,9 +1303,7 @@ pwd(argc, argv) * Print working directory on local machine. */ void -lpwd(argc, argv) - int argc; - char *argv[]; +lpwd(int argc, char *argv[]) { char buf[MAXPATHLEN]; @@ -1403,9 +1318,7 @@ lpwd(argc, argv) * Make a directory. */ void -makedir(argc, argv) - int argc; - char *argv[]; +makedir(int argc, char *argv[]) { if ((argc < 2 && !another(&argc, &argv, "directory-name")) || @@ -1425,9 +1338,7 @@ makedir(argc, argv) * Remove a directory. */ void -removedir(argc, argv) - int argc; - char *argv[]; +removedir(int argc, char *argv[]) { if ((argc < 2 && !another(&argc, &argv, "directory-name")) || @@ -1447,9 +1358,7 @@ removedir(argc, argv) * Send a line, verbatim, to the remote machine. */ void -quote(argc, argv) - int argc; - char *argv[]; +quote(int argc, char *argv[]) { if (argc < 2 && !another(&argc, &argv, "command line to send")) { @@ -1466,9 +1375,7 @@ quote(argc, argv) * word "SITE" is added at the front. */ void -site(argc, argv) - int argc; - char *argv[]; +site(int argc, char *argv[]) { if (argc < 2 && !another(&argc, &argv, "arguments to SITE command")) { @@ -1484,10 +1391,7 @@ site(argc, argv) * Send the result as a one-line command and get response. */ void -quote1(initial, argc, argv) - const char *initial; - int argc; - char *argv[]; +quote1(const char *initial, int argc, char *argv[]) { int i, len; char buf[BUFSIZ]; /* must be >= sizeof(line) */ @@ -1526,9 +1430,7 @@ quote1(initial, argc, argv) } void -do_chmod(argc, argv) - int argc; - char *argv[]; +do_chmod(int argc, char *argv[]) { if (argc < 2 && !another(&argc, &argv, "mode")) @@ -1543,9 +1445,7 @@ usage: } void -do_umask(argc, argv) - int argc; - char *argv[]; +do_umask(int argc, char *argv[]) { int oldverbose = verbose; @@ -1555,9 +1455,7 @@ do_umask(argc, argv) } void -idle(argc, argv) - int argc; - char *argv[]; +idle(int argc, char *argv[]) { int oldverbose = verbose; @@ -1570,9 +1468,7 @@ idle(argc, argv) * Ask the other side for help. */ void -rmthelp(argc, argv) - int argc; - char *argv[]; +rmthelp(int argc, char *argv[]) { int oldverbose = verbose; @@ -1586,9 +1482,7 @@ rmthelp(argc, argv) */ /*VARARGS*/ void -quit(argc, argv) - int argc; - char *argv[]; +quit(int argc, char *argv[]) { if (connected) @@ -1604,9 +1498,7 @@ quit(argc, argv) * Terminate session, but don't exit. */ void -disconnect(argc, argv) - int argc; - char *argv[]; +disconnect(int argc, char *argv[]) { if (!connected) @@ -1624,9 +1516,7 @@ disconnect(argc, argv) } void -account(argc, argv) - int argc; - char *argv[]; +account(int argc, char *argv[]) { char *ap; @@ -1645,8 +1535,7 @@ account(argc, argv) jmp_buf abortprox; void -proxabort(notused) - int notused; +proxabort(int notused) { alarmtimer(0); @@ -1664,9 +1553,7 @@ proxabort(notused) } void -doproxy(argc, argv) - int argc; - char *argv[]; +doproxy(int argc, char *argv[]) { struct cmd *c; int cmdpos; @@ -1725,27 +1612,21 @@ doproxy(argc, argv) } void -setcase(argc, argv) - int argc; - char *argv[]; +setcase(int argc, char *argv[]) { code = togglevar(argc, argv, &mcase, "Case mapping"); } void -setcr(argc, argv) - int argc; - char *argv[]; +setcr(int argc, char *argv[]) { code = togglevar(argc, argv, &crflag, "Carriage Return stripping"); } void -setntrans(argc, argv) - int argc; - char *argv[]; +setntrans(int argc, char *argv[]) { if (argc == 1) { ntflag = 0; @@ -1764,8 +1645,7 @@ setntrans(argc, argv) } char * -dotrans(name) - char *name; +dotrans(char *name) { static char new[MAXPATHLEN]; char *cp1, *cp2 = new; @@ -1793,9 +1673,7 @@ dotrans(name) } void -setnmap(argc, argv) - int argc; - char *argv[]; +setnmap(int argc, char *argv[]) { char *cp; @@ -1827,8 +1705,7 @@ setnmap(argc, argv) } char * -domap(name) - char *name; +domap(char *name) { static char new[MAXPATHLEN]; char *cp1 = name, *cp2 = mapin; @@ -1999,9 +1876,7 @@ LOOP: } void -setpassive(argc, argv) - int argc; - char *argv[]; +setpassive(int argc, char *argv[]) { code = togglevar(argc, argv, &passivemode, @@ -2009,18 +1884,14 @@ setpassive(argc, argv) } void -setsunique(argc, argv) - int argc; - char *argv[]; +setsunique(int argc, char *argv[]) { code = togglevar(argc, argv, &sunique, "Store unique"); } void -setrunique(argc, argv) - int argc; - char *argv[]; +setrunique(int argc, char *argv[]) { code = togglevar(argc, argv, &runique, "Receive unique"); @@ -2028,9 +1899,7 @@ setrunique(argc, argv) /* change directory to parent directory */ void -cdup(argc, argv) - int argc; - char *argv[]; +cdup(int argc, char *argv[]) { int r; @@ -2048,9 +1917,7 @@ cdup(argc, argv) * Restart transfer at specific point */ void -restart(argc, argv) - int argc; - char *argv[]; +restart(int argc, char *argv[]) { quad_t nrestart_point; char *ep; @@ -2074,18 +1941,14 @@ restart(argc, argv) * Show remote system type */ void -syst(argc, argv) - int argc; - char *argv[]; +syst(int argc, char *argv[]) { (void)command("SYST"); } void -macdef(argc, argv) - int argc; - char *argv[]; +macdef(int argc, char *argv[]) { char *tmp; int c; @@ -2146,9 +2009,7 @@ macdef(argc, argv) * Get size of file on remote machine */ void -sizecmd(argc, argv) - int argc; - char *argv[]; +sizecmd(int argc, char *argv[]) { off_t size; @@ -2167,9 +2028,7 @@ sizecmd(argc, argv) * Get last modification time of file on remote machine */ void -modtime(argc, argv) - int argc; - char *argv[]; +modtime(int argc, char *argv[]) { time_t mtime; @@ -2188,9 +2047,7 @@ modtime(argc, argv) * Show status on remote machine */ void -rmtstatus(argc, argv) - int argc; - char *argv[]; +rmtstatus(int argc, char *argv[]) { (void)command(argc > 1 ? "STAT %s" : "STAT" , argv[1]); @@ -2200,9 +2057,7 @@ rmtstatus(argc, argv) * Get file if modtime is more recent than current file */ void -newer(argc, argv) - int argc; - char *argv[]; +newer(int argc, char *argv[]) { if (getit(argc, argv, -1, "w")) @@ -2214,9 +2069,7 @@ newer(argc, argv) * Display one file through $PAGER (defaults to "more"). */ void -page(argc, argv) - int argc; - char *argv[]; +page(int argc, char *argv[]) { int orestart_point, ohash, overbose; char *p, *pager, *oldargv1; |