This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 54ef006069a Documentation/examples/uid: Add documentation for uid 
example
54ef006069a is described below

commit 54ef006069ad910c5730544a56a9829ae6c825bb
Author: hanzj <[email protected]>
AuthorDate: Fri May 29 20:49:45 2026 +0800

    Documentation/examples/uid: Add documentation for uid example
    
    The uid example was missing documentation. This commit adds complete
    documentation including:
    
    - Command syntax and options
    - Synopsis explaining the tool's purpose
    - Options table with all available flags
    - Usage examples for each query type:
      - Query user by ID (-uid)
      - Query user by name (-uname)
      - Query group by ID (-gid)
      - Query group by name (-gname)
    - Help display example
    - Configuration options
    
    The documentation is based on the actual source code in
    apps/examples/uid/uid_main.c.
    
    Signed-off-by: hanzj <[email protected]>
---
 Documentation/applications/examples/uid/index.rst | 112 +++++++++++++++++++++-
 1 file changed, 111 insertions(+), 1 deletion(-)

diff --git a/Documentation/applications/examples/uid/index.rst 
b/Documentation/applications/examples/uid/index.rst
index 1cda5d74af2..a810a28ac2a 100644
--- a/Documentation/applications/examples/uid/index.rst
+++ b/Documentation/applications/examples/uid/index.rst
@@ -2,4 +2,114 @@
 ``uid`` UID/GID example
 =======================
 
-TODO
+This example demonstrates how to query user and group information using the
+POSIX ``getpwuid_r()``, ``getpwnam_r()``, ``getgrgid_r()``, and
+``getgrnam_r()`` functions.
+
+**Command Syntax**::
+
+  uid -uid <uid>
+  uid -uname <name>
+  uid -gid <gid>
+  uid -gname <name>
+  uid -h
+
+**Synopsis**. The ``uid`` command queries and displays user or group
+information from the system's password and group databases.
+
+**Options**
+
+===================  ====================================================
+``-uid <uid>``       Show user information by numeric user ID.
+``-uname <name>``    Show user information by user name.
+``-gid <gid>``       Show group information by numeric group ID.
+``-gname <name>``    Show group information by group name.
+``-h``               Show help statement with all available options.
+===================  ====================================================
+
+Query User by ID
+----------------
+
+To query user information by numeric UID::
+
+  nsh> uid -uid 0
+  Name:   root
+  UID:    0
+  GID:    0
+  Home:   /
+  Shell:  /bin/sh
+
+The output displays:
+
+- **Name**: The login name
+- **UID**: The numeric user ID
+- **GID**: The primary group ID
+- **Home**: The home directory
+- **Shell**: The default shell
+
+Query User by Name
+------------------
+
+To query user information by login name::
+
+  nsh> uid -uname root
+  Name:   root
+  UID:    0
+  GID:    0
+  Home:   /
+  Shell:  /bin/sh
+
+Query Group by ID
+-----------------
+
+To query group information by numeric GID::
+
+  nsh> uid -gid 0
+  Name:    root
+  Passwd:  
+  GID:     0
+  Members: 
+
+The output displays:
+
+- **Name**: The group name
+- **Passwd**: The group password (usually empty)
+- **GID**: The numeric group ID
+- **Members**: Comma-separated list of group members
+
+Query Group by Name
+-------------------
+
+To query group information by group name::
+
+  nsh> uid -gname root
+  Name:    root
+  Passwd:  
+  GID:     0
+  Members: 
+
+Help
+----
+
+To display usage information::
+
+  nsh> uid -h
+  USAGE:
+       uid -uid <uid>    - Show user info by ID
+       uid -uname <name> - Show user info by name
+       uid -gid <gid>    - Show group info by ID
+       uid -gname <name> - Show group info by name
+       uid -h            - Show this help info
+
+Configuration
+-------------
+
+The ``uid`` example can be enabled in the NuttX configuration::
+
+  CONFIG_EXAMPLES_UID=y
+
+Optional configuration:
+
+- ``CONFIG_EXAMPLES_UID_PROGNAME`` – Program name. Default ``uid``.
+- ``CONFIG_EXAMPLES_UID_PRIORITY`` – Task priority. Default ``100``.
+- ``CONFIG_EXAMPLES_UID_STACKSIZE`` – Stack size. Default 
``DEFAULT_TASK_STACKSIZE``.

Reply via email to