Index: iconv.1 =================================================================== RCS file: /cvsroot/src/usr.bin/iconv/iconv.1,v retrieving revision 1.2 diff -u -r1.2 iconv.1 --- iconv.1 4 Jul 2003 07:58:10 -0000 1.2 +++ iconv.1 18 Mar 2008 09:06:20 -0000 @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd July 4, 2003 +.Dd March 18, 2008 .Dt ICONV 1 .Os .\" ---------------------------------------------------------------------- @@ -41,6 +41,18 @@ .Ar to_name .Op Ar file ... .Nm +.Fl f +.Ar from_name +.Op Fl cs +.Op Fl t Ar to_name +.Op Ar file ... +.Nm +.Fl t +.Ar to_name +.Op Fl cs +.Op Fl f Ar from_name +.Op Ar file ... +.Nm .Fl l .\" ---------------------------------------------------------------------- .Sh DESCRIPTION Index: iconv.c =================================================================== RCS file: /cvsroot/src/usr.bin/iconv/iconv.c,v retrieving revision 1.11 diff -u -r1.11 iconv.c --- iconv.c 15 Dec 2007 19:44:50 -0000 1.11 +++ iconv.c 18 Mar 2008 09:06:20 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: iconv.c,v 1.11 2007/12/15 19:44:50 perry Exp $ */ +/* $NetBSD: iconv.c,v 1.11 2007/12/15 19:44:50 perry Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -31,13 +31,14 @@ __RCSID("$NetBSD: iconv.c,v 1.11 2007/12/15 19:44:50 perry Exp $"); #endif /* LIBC_SCCS and not lint */ +#include #include +#include +#include #include #include #include -#include #include -#include #include static void usage(void) __unused; @@ -48,8 +49,11 @@ static void usage(void) { - (void)fprintf(stderr, "Usage: %s [-cs] -f -t [file ...]\n" - "\t%s -l\n", getprogname(), getprogname()); + (void)fprintf(stderr, + "Usage:\t%1$s [-cs] -f -t [file ...]\n" + "\t%1$s -f [-cs] [-t ] [file ...]\n" + "\t%1$s -t [-cs] [-f ] [file ...]\n" + "\t%1$s -l\n", getprogname()); exit(1); } @@ -200,8 +204,12 @@ } show_codesets(); } else { - if (opt_f == NULL || opt_t == NULL) - usage(); + if (opt_f == NULL) { + if (opt_t == NULL) + usage(); + opt_f = nl_langinfo(CODESET); + } else if (opt_t == NULL) + opt_t = nl_langinfo(CODESET); if (argc == 0) do_conv("", stdin, opt_f, opt_t, opt_s, opt_c);