source code and how to be able to interpret a command

I used the command jls for example. then it responded with the following table:

JID IP Address Hostname Path
7 hydroponique /jails/hydroshop

now I want to know if IP Address is an IPV4 address or an IPV6 address. So what are my options? man jls

ok let's do that, see bottom of page quote. it doesn't appear to answer that question... now since I may have compiled my compiler code but no major modifications to the kernel , I think I can view the code from github source tree. Where are the commands written in the source tree of bsd so I could see for myself how jls or other commands are written in the hope that I will be able to have my answer the variable that the column for IP address corresponds to is an IP Address like it says or just an IPV4 address, etc..? It would save me the time when the documentation from the manual is limited and then I don't need to push the question since I could just look it up.

is there a way to navigate the source code? it might be fair to say that it is any IP Address since there is nothing that indicates distinguishing between IPV4 and IPV6

JLS(8) FreeBSD System Manager's Manual JLS(8)

NAME
jls – list jails

SYNOPSIS
jls [--libxo] [-dhNnqsv] [-j jail] [parameter ...]

DESCRIPTION
The jls utility lists all active jails, or the specified jail. Each jail
is represented by one row which contains space-separated values of the
listed parameters, including the pseudo-parameter all which will show all
available jail parameters. A list of available parameters can be
retrieved via “sysctl -d security.jail.param”. See jail(8) for a
description of some core parameters.

If no parameters or any of the options -hns are given, the following four
columns will be printed: jail identifier (jid), IP address (ip4.addr),
hostname (host.hostname), and path (path).

The following options are available:

--libxo
Generate output via libxo(3) in a selection of different human
and machine readable formats. See xo_parse_args(3) for details
on command line arguments.

-d List dying as well as active jails.

-h Print a header line containing the parameters listed. If no
parameters are given on the command line, all is assumed.

-N In the standard display mode, print each jail's name instead of
its numeric ID. If the jail does not have a name, the numeric ID
is printed instead.

-n Print parameters in “name=value” format, where each parameter is
preceded by its name. If no parameters are given on the command
line, all is assumed.

-q Put quotes around parameters if they contain spaces or quotes, or
are the empty string.

-s Print parameters suitable for passing to jail(8), skipping read-
only and unused parameters. Implies -nq.

-v Extend the standard display with a multiple-line summary per
jail, containing the following parameters: jail identifier (jid),
hostname (host.hostname), path (path), jail name (name), jail
state (dying), cpuset ID (cpuset), IP address(es) (ip4.addr and
ip6.addr).

-j jail
The jid or name of the jail to list. Without this option, all
active jails will be listed.

SEE ALSO
jail_get(2), libxo(3), xo_parse_args(3), jail(8), jexec(8)

HISTORY
The jls utility was added in FreeBSD 5.1. Extensible jail parameters
were introduced in FreeBSD 8.0. libxo support was added in FreeBSD 11.0.
 
now I want to know if IP Address is an IPV4 address or an IPV6 address. So what are my options? man jls
ok let's do that, see bottom of page quote. it doesn't appear to answer that question...
You need to read more carefully. From the jls manpage:
If no parameters or any of the options -hns are given, the following four
columns will be printed: jail identifier (jid), IP address (ip4.addr),
hostname (host.hostname), and path (path).
 
how is command line input handled from command line? I am just trying to understand the cin part where they are able to break it down to plags and take in the command.

Just to show that I was able to look at the jls.c file and get an understanding of it. I am curious about the command line to have a better feel on how it works. Thanks.
 
Simple, read the source code. First, arguments for the XO library are stripped out (line 93, there should be none in most use cases). Then getopt() is called (line 100), and flags are mostly turned into the pflags variable (pretty obvious). Then the remaining parameters are copied into arrays (line 185-187), and then the program runs.
 
Back
Top