Skip to content

Commit d1b4330

Browse files
committed
v1.0.2
1 parent 58bb219 commit d1b4330

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@
2626
* 2023.11.21 v1.0.1
2727
* `make all` produces binaries for x64 and Arm architectures; `make universal` creates a universal binary
2828
* `Tab` separates fields which may also contain `space`-chars as fillers
29+
30+
* 2024.06.11 v1.0.2
31+
* `-v` command-line argument to show version
32+
* Cosmetic changes to fix typos

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,10 @@ make uninstall
4242
### Usage
4343

4444
```
45-
sockstat-1.0.1
46-
47-
Usage:
48-
sockstat [-46klNrquh]
45+
Usage: sockstat [-46klNrquhv]
4946
5047
-4 Show AF_INET (IPv4) sockets
51-
-6 Show AF_INET (IPv6) sockets
48+
-6 Show AF_INET6 (IPv6) sockets
5249
-k Show AF_SYSTEM (Kernel) sockets
5350
-n Show AF_NDRV sockets
5451
-r Show AF_ROUTE sockets
@@ -58,6 +55,7 @@ Usage:
5855
-q Quiet mode - suppress header
5956
6057
-h This help message
58+
-v Shov program version
6159
```
6260

6361
Run `sockstat` as `root` to see all sockets

sockstat.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* ------------------------------------------------------------------------------------------------------------------ */
44

55
/*
6-
* Copyright (c) 2023, Mikhail Zakharov <[email protected]>
6+
* Copyright (c) 2023-2024, Mikhail Zakharov <[email protected]>
77
*
88
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
99
* following conditions are met:
@@ -44,7 +44,7 @@ void usage(int ecode);
4444

4545
/* ------------------------------------------------------------------------------------------------------------------ */
4646
#define PROG_NAME "sockstat"
47-
#define PROG_VERSION "1.0.1"
47+
#define PROG_VERSION "1.0.2"
4848

4949
#define MAXPROC 16384;
5050
/* ------------------------------------------------------------------------------------------------------------------ */
@@ -74,7 +74,7 @@ int main(int argc, char* argv[]) {
7474
int flg_u = 0; /* UNIX aka LOCAL sockets */
7575
int flg_a = 0; /* pseudo-flag ALL socket flags are on */
7676

77-
while ((flg = getopt(argc, argv, "46klnrquh")) != -1)
77+
while ((flg = getopt(argc, argv, "46klnrquhv")) != -1)
7878
switch(flg) {
7979
case '4': flg_i4 = 1; break;
8080
case '6': flg_i6 = 1; break;
@@ -85,6 +85,7 @@ int main(int argc, char* argv[]) {
8585
case 'r': flg_r = 1; break;
8686
case 'u': flg_u = 1; break;
8787
case 'h': (void)usage(0); break;
88+
case 'v': printf("%s %s\n", PROG_NAME, PROG_VERSION); exit(0); break;
8889
default: (void)usage(1);
8990
}
9091

@@ -323,11 +324,9 @@ int main(int argc, char* argv[]) {
323324

324325
/* ------------------------------------------------------------------------------------------------------------------ */
325326
void usage(int ecode) {
326-
printf("%s-%s\n\n\
327-
Usage:\n\
328-
sockstat [-46klNrquh]\n\n\
327+
printf("Usage: sockstat [-46klNrquhv]\n\n\
329328
-4\tShow AF_INET (IPv4) sockets\n\
330-
-6\tShow AF_INET (IPv6) sockets\n\
329+
-6\tShow AF_INET6 (IPv6) sockets\n\
331330
-k\tShow AF_SYSTEM (Kernel) sockets\n\
332331
-n\tShow AF_NDRV sockets\n\
333332
-r\tShow AF_ROUTE sockets\n\
@@ -336,8 +335,8 @@ Usage:\n\
336335
-l\tShow only LISTENing sockets\n\
337336
-q\tQuiet mode - suppress header\n\
338337
\n\
339-
-h\tThis help message\n\n", PROG_NAME, PROG_VERSION);
338+
-h\tThis help message\n\
339+
-v\tShov program version\n\n");
340340

341341
exit(ecode);
342342
}
343-

0 commit comments

Comments
 (0)