[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-inetutils] [PATCH 3/7] argp'fied argument parsing & tiny fixes
From: |
Arash Yadegarnia |
Subject: |
Re: [bug-inetutils] [PATCH 3/7] argp'fied argument parsing & tiny fixes |
Date: |
Sat, 30 Aug 2008 00:07:04 +0430 |
On Sat, 2008-08-23 at 05:09 -0400, Alfred M. Szmidt wrote:
> telnet/commands.c:
>
> * Changed some strcpy() to strncpy ()
> * Defined MAX_BUF_SIZ
>
> This should be split up into a seperate patch, since it has nothing to
> do with argp. I am also not sure why this is needed, strcpy from a
> quick glance is just fine here.
Reverted, file is unchanged.
>
> telnet/externs.h:
>
> * declare 'family' and 'user' as extern among other argument
> values
>
> Why?
Reverted, file is unchanged. Those variables moved to parse_opt().
>
> - char *args[8], **argp = args;
> -
> + char *args[8], **argptr = args;
> +
> + /* FIXME: We should proabably move all
> + * argument parsinsg to 'parse_opt ()'. */
> if (argc > 2)
> - usage ();
> - *argp++ = prompt;
> + {
> + /* XXX: using this, we simulate,
> + * argp_usage (), without a 'state' */
> + argp_help (&argp, stderr, ARGP_HELP_USAGE, "telnet");
> + exit (argp_err_exit_status);
> + }
>
> Please try to fix the two FIXME's.
>
Fixed.
* telnet/main.c: Include <argp.h> and
<libinetutils/libinetutils.h>.
Remove include for <getopt.h>.
(MAX_TLINE_BUF): New macro.
(cmd_args): New data structure.
(ARGP_PROGRAM_DATA): Call macro.
(argp, args_doc, doc, argp_options): New variables.
(parse_opt): New function.
(help, try_help, usage): Functions removed.
(long_options): Variables removed.
(args, argp): Variables removed.
(main): Use strncpy () instead of strcpy for copying command
line
args. Use argp to parse program options. Moved all of secondary
argumetn parsing to parse_opt.
Updated patch is attached.
telnet.patch
Description: Text Data