Fwd: New applet: microcom

Bernhard Fischer rep.dot.nop at gmail.com
Fri Sep 21 00:21:31 PDT 2007


On Thu, Sep 20, 2007 at 10:02:37PM +0100, Denys Vlasenko wrote:
>On Wednesday 19 September 2007 07:58, Vladimir Dronnikov wrote:
>> Hello!
>> 
>> I've added new applet microcom which can be used to communicate with serial ports.
>> Inspired by mgetty's microcom utility.
>> 
>> Comments are welcome!

You have to have a copyright block in there (look at any other file for
a stub).

Also, i, personally, would prefer that microcom doesn't live in
util-linux, which is a defined set of applets (the ones that are shipped
in the "big" util-linux), but in e.g. miscutils, or even network/
>
>Edited it a bit. There were many warnings.
>
>Didn't apply to svn yet. Please test attached.
>
>Issues I would like to be looked at:
>
>Make it possible to work if /var/lock doesn't exist (or is not a dir).
>
>+       if (tcsetattr(STDIN_FILENO, TCSANOW, &tio)) {
>+               eitcode = 2;
>+               bb_perror_msg_and_die("can't tcsetattr for STDIN");
>+       }
>
>Do you really need different exit code? Do you ever plan
>to check for exit code of microcom, whether it is 1 or 2?
>--
>vda


>+static int lock_device(const char *device)

This is only called once. I'd fold this into the only caller, which
should allow for removing some of the errno fiddling for good.
>+{
>+	char *s;
>+	int fd;
>+
>+	// compose lock file name
>+	s = strchr(device, '/');

We already have a path concatenating function, IIRC
>+	if (s)
>+		device = s + 1;
>+	if (!device[0]) {
>+		errno = ENODEV;
>+		return errno;
>+	}
>+	device_lock_file = xasprintf("/var/lock/LCK..%s", device);

ditto.


More information about the busybox mailing list