Re: For review: newlocale.3

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

 



On Wed 12 Mar 2014 16:47:43 Michael Kerrisk wrote:
> .SH DESCRIPTION
> The
> .BR newlocale ()
> function creates a new locale object, or modifies an existing object,
> returning a reference to the new or modified object as the function result.
> Whether the call creates a new object or modifies an existing object
> is determined by the value of
> .IR base :

you discuss the value of |base| first ...

> .PP
> The
> .I category_mask

... then the |category_mask| ...

> The following preset values of
> .I locale

... then the |locale| ...

(side note: shouldn't there be a .PP to start this portion ?)

> .PP
> If
> .I base

... then back to |base| ?  generally i expect the discussion of each argument 
to be together rather than split across paragraphs.  if i were referring to 
this for programming, i probably wouldn't have even made it this far.

> .B EINVAL
> One or more bits in
> .I category_mask
> does not correspond to a valid locale category.

does->do

> Having created and initialized the locale object,
> the program then applies it using
> .BR uselocale (),

shouldn't that be (3) ?

> Te Paraire, te 07 o Poutū-te-rangi, 2014 00:38:44 CET
> .fi
> .in
> 
> .in +4n
> .nf
> 
> .fi
> .in
> .SS Program source

this ends up rendering 3 blank lines before "Program source" when really only 
one is needed

> .nf
> #define _XOPEN_SOURCE 700
> #include <stdio.h>
> #include <stdlib.h>
> #include <locale.h>
> #include <time.h>
> 
> #define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\
>                         } while (0)

not sure what standard you're aiming for, but if you include err.h, you don't 
need this macro.  you can just call err(1, msg).

>     if (argc > 2) {
>         nloc = newlocale(LC_TIME_MASK, argv[2], loc);
>         if (loc == (locale_t) 0)

shouldn't you be testing nloc ?

if you're just going to exit on error, i wonder why even bother with nloc 
indirection

>     s = strftime(buf, BUF_SIZE, "%c", tm);

why not sizeof(buf) ?  avoids needing BUF_SIZE at all.
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux 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