Re: [PATCH] ldattach(8)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 06, 2008 at 12:13:56AM +0100, Tilman Schmidt wrote:
> --- a/sys-utils/ldattach.8	1970-01-01 01:00:00.000000000 +0100
> +++ b/sys-utils/ldattach.8	2008-02-03 13:00:56.000000000 +0100

[...]

> +With no arguments,
> +.B ldattach
> +prints usage information.

 I'd be nice to print list of supported line disciplines together with
 usage information.

> +.SH OPTIONS

 The long options are undocumented, that's wrong. Please, use

      -d, --debug   ....text

 format.

> +.TP
> +.B \-e
> +Sets the parity of the serial line to even.
> +.TP
> +.B \-e
> +Sets the parity of the serial line to odd.

 you mean -o, right?

> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <string.h>
> +#include <getopt.h>
> +#include <sys/types.h>
> +#include <sys/stat.h>
> +#include <fcntl.h>
> +#include <sys/ioctl.h>
> +#include <errno.h>
> +#include <termios.h>
> +#include <unistd.h>
> +
> +#define dbg(format, arg...) \
> +	do { if (debug) fprintf(stderr , format , ## arg); } while (0)
> +
> +#ifndef N_GIGASET_M101
> +#define N_GIGASET_M101 16
> +#endif

 What about fallbacks for the others line disciplines (I assume there
 is dependence on kernel version)?

> +    ld_table[] = {
[...]
> +	{ NULL,	-1 }
> +    };

 Please, use ARRAY_SIZE (see Make's response).

> +static void usage(const char *prog)
> +{
> +    fprintf(stderr,
> +	    "Usage: %s [ -d78neo12 ] [ -s <speed> ] <ldisc> <device>\n", 
> prog);
> +    exit(EXIT_FAILURE);
> +}
> +
> +int main(int argc, char **argv)
> +{
> +    int tty_fd;
> +    struct termios ts;
> +    int  bits = 0, parity = 0, stop = 0;
> +    int optc;
> +    char *prog = argv[0];
> +    char *dev;
> +    static const struct option opttbl[] = {
> +	{"speed", 1, 0, 's'},
> +	{"debug", 0, 0, 'd'},
> +	{0, 0, 0, 0}
> +    };
> +
> +    /* parse options */
> +    while ((optc = getopt_long(argc, argv, "d78neo12s:", opttbl, NULL)) >= 

 I don't see --help and --version. Note, as a --version output use

    printf(_("ldattach from %s\n"), PACKAGE_STRING);


 I also don't see long options for -e, -o and -n.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux