# source code and how to be able to interpret a command



## sixpiece (May 24, 2022)

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
> ...


----------



## SirDice (May 24, 2022)

sixpiece said:


> Where are the commands written in the source tree of bsd


Look in /usr/src/bin, /usr/src/sbin,  /usr/src/usr.bin and /usr/src/usr.sbin. 



sixpiece said:


> is there a way to navigate the source code?


Download the source code locally, or just use https://cgit.freebsd.org/ or https://github.com/freebsd/freebsd-src


----------



## bakul (May 24, 2022)

sixpiece said:


> 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).


----------



## sixpiece (May 26, 2022)

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.








						freebsd-src/jls.c at main · freebsd/freebsd-src
					

FreeBSD src tree (read-only mirror). Contribute to freebsd/freebsd-src development by creating an account on GitHub.




					github.com


----------



## ralphbsz (May 26, 2022)

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.


----------



## grahamperrin@ (May 27, 2022)

SirDice said:


> … use https://cgit.freebsd.org/ or https://github.com/freebsd/freebsd-src



I often forget that the roadmap exists.

<https://github.com/freebsd/freebsd-src#source-roadmap> | <https://github.com/freebsd/freebsd-src/blob/main/README.md#source-roadmap>

<https://gitlab.com/FreeBSD/freebsd-src#source-roadmap> | <https://gitlab.com/FreeBSD/freebsd-src/-/blob/main/README.md#user-content-source-roadmap>


----------

