2 * usage.c - usage functions for lsof
7 * Copyright 1998 Purdue Research Foundation, West Lafayette, Indiana
8 * 47907. All rights reserved.
10 * Written by Victor A. Abell
12 * This software is not subject to any license of the American Telephone
13 * and Telegraph Company or the Regents of the University of California.
15 * Permission is granted to anyone to use this software for any purpose on
16 * any computer system, and to alter it and redistribute it freely, subject
17 * to the following restrictions:
19 * 1. Neither the authors nor Purdue University are responsible for any
20 * consequences of the use of this software.
22 * 2. The origin of this software must not be misrepresented, either by
23 * explicit claim or by omission. Credit to the authors and Purdue
24 * University must appear in documentation and sources.
26 * 3. Altered versions must be plainly marked as such, and must not be
27 * misrepresented as being the original software.
29 * 4. This notice may not be removed or altered.
33 static char copyright[] =
34 "@(#) Copyright 1998 Purdue Research Foundation.\nAll rights reserved.\n";
35 static char *rcsid = "$Id: usage.c,v 1.32 2014/10/13 22:36:20 abe Exp $";
44 * Local function prototypes
47 _PROTOTYPE(static char *isnullstr,(char *s));
48 _PROTOTYPE(static int print_in_col,(int col, char *cp));
49 _PROTOTYPE(static void report_HASDCACHE,(int type, char *ttl, char *det));
50 _PROTOTYPE(static void report_HASKERNIDCK,(char *pfx, char *verb));
51 _PROTOTYPE(static void report_SECURITY,(char *pfx, char *punct));
52 _PROTOTYPE(static void report_WARNDEVACCESS,(char *pfx, char *verb,
57 * isnullstr() - is it a null string?
62 char *s; /* string pointer */
76 * print_in_col() -- print character string in help column
81 int col; /* column number */
82 char *cp; /* what to print */
87 (void) fprintf(stderr, " %-23.23s", cp);
90 (void) fprintf(stderr, " %-25.25s", cp);
93 (void) fprintf(stderr, " %s\n", cp);
103 * report_HASDCACHE() -- report device cache file state
107 report_HASDCACHE(type, ttl, det)
108 int type; /* type: 0 == read path report
109 * 1 == full report */
110 char *ttl; /* title lines prefix
112 char *det; /* detail lines prefix
116 #if defined(HASDCACHE)
120 # if defined(WILLDROPGID)
121 int saved_Setgid = Setgid;
124 # endif /* defined(WILLDROPGID) */
129 * Report full device cache information.
131 (void) fprintf(stderr, "%sDevice cache file read-only paths:\n",
133 if ((dx = dcpath(1, 0)) < 0)
134 (void) fprintf(stderr, "%snone\n", det ? det : "");
136 (void) fprintf(stderr, "%sNamed via -D: %s\n",
138 DCpath[0] ? DCpath[0] : "none");
140 # if defined(HASENVDC)
141 (void) fprintf(stderr,
142 "%sNamed in environment variable %s: %s\n",
144 HASENVDC, DCpath[1] ? DCpath[1] : "none");
145 # endif /* defined(HASENVDC) */
147 # if defined(HASSYSDC)
149 (void) fprintf(stderr,
150 "%sSystem-wide device cache: %s\n",
153 # endif /* defined(HASSYSDC) */
155 # if defined(HASPERSDC)
156 (void) fprintf(stderr,
157 "%sPersonal path format (HASPERSDC): \"%s\"\n",
160 # if defined(HASPERSDCPATH)
161 (void) fprintf(stderr,
162 "%sModified personal path environment variable: %s\n",
165 cp = getenv(HASPERSDCPATH);
166 (void) fprintf(stderr, "%s%s value: %s\n",
168 HASPERSDCPATH, cp ? cp : "none");
169 # endif /* defined(HASPERSDCPATH) */
170 (void) fprintf(stderr, "%sPersonal path: %s\n",
172 DCpath[3] ? DCpath[3] : "none");
173 # endif /* defined(HASPERSDC) */
175 (void) fprintf(stderr, "%sDevice cache file write paths:\n",
177 if ((dx = dcpath(2, 0)) < 0)
178 (void) fprintf(stderr, "%snone\n", det ? det : "");
180 (void) fprintf(stderr, "%sNamed via -D: %s\n",
182 DCstate == 2 ? "none"
183 : DCpath[0] ? DCpath[0] : "none");
185 # if defined(HASENVDC)
186 (void) fprintf(stderr,
187 "%sNamed in environment variable %s: %s\n",
189 HASENVDC, DCpath[1] ? DCpath[1] : "none");
190 # endif /* defined(HASENVDC) */
192 # if defined(HASPERSDC)
193 (void) fprintf(stderr,
194 "%sPersonal path format (HASPERSDC): \"%s\"\n",
197 # if defined(HASPERSDCPATH)
198 (void) fprintf(stderr,
199 "%sModified personal path environment variable: %s\n",
202 cp = getenv(HASPERSDCPATH);
203 (void) fprintf(stderr, "%s%s value: %s\n",
205 HASPERSDCPATH, cp ? cp : "none");
206 # endif /* defined(HASPERSDCPATH) */
207 (void) fprintf(stderr, "%sPersonal path: %s\n",
209 DCpath[3] ? DCpath[3] : "none");
210 # endif /* defined(HASPERSDC) */
215 * Report device cache read file path.
218 # if defined(HASENVDC) || defined(HASPERSDC) || defined(HASSYSDC)
220 # if defined(HASENVDC)
221 if ((dx = dcpath(1, 0)) >= 0)
223 # endif /* defined(HASENVDC) */
224 # if defined(HASSYSDC)
227 # endif /* defined(HASSYSDC) */
228 # if defined(HASPERSDC)
229 if (!cp && dx != -1 && (dx = dcpath(1, 0)) >= 0)
231 # endif /* defined(HASPERSDC) */
233 (void) fprintf(stderr,
234 "%s%s is the default device cache file read path.\n",
238 # endif /* defined(HASENVDC) || defined(HASPERSDC) || defined(HASSYSDC) */
241 # if defined(WILLDROPGID)
242 Setgid = saved_Setgid;
243 # endif /* defined(WILLDROPGID) */
245 #endif /* defined(HASDCACHE) */
251 * report_HASKERNIDCK() -- report HASKERNIDCK state
255 report_HASKERNIDCK(pfx, verb)
256 char *pfx; /* prefix (NULL if none) */
257 char *verb; /* verb (NULL if none) */
259 (void) fprintf(stderr, "%sernel ID check %s%s%s.\n",
264 #if defined(HASKERNIDCK)
266 #else /* !defined(HASKERNIDCK) */
268 #endif /* defined(HASKERNIDCK) */
275 * report_SECURITY() -- report *SECURITY states
279 report_SECURITY(pfx, punct)
280 char *pfx; /* prefix (NULL if none) */
281 char *punct; /* short foem punctuation
284 fprintf(stderr, "%s%s can list all files%s",
287 #if defined(HASSECURITY)
289 # if defined(HASNOSOCKSECURITY)
290 ", but anyone can list socket files.\n"
291 # else /* !defined(HASNOSOCKSECURITY) */
293 # endif /* defined(HASNOSOCKSECURITY) */
294 #else /* !defined(HASSECURITY) */
297 #endif /* defined(HASSECURITY) */
304 * report_WARNDEVACCESS() -- report WEARNDEVACCESS state
308 report_WARNDEVACCESS(pfx, verb, punct)
309 char *pfx; /* prefix (NULL if none) */
310 char *verb; /* verb (NULL if none) */
311 char *punct; /* punctuation */
313 (void) fprintf(stderr, "%s/dev warnings %s%s%s%s",
318 #if defined(WARNDEVACCESS)
320 #else /* !defined(WARNDEVACCESS) */
322 #endif /* defined(WARNDEVACCESS) */
329 * usage() - display usage and exit
333 usage(xv, fh, version)
334 int xv; /* exit value */
335 int fh; /* ``-F ?'' status */
336 int version; /* ``-v'' status */
338 char buf[MAXPATHLEN+1], *cp, *cp1, *cp2;
342 (void) fprintf(stderr, "%s %s\n latest revision: %s\n",
343 Pn, LSOF_VERSION, LSOF_URL);
344 (void) fprintf(stderr, " latest FAQ: %sFAQ\n", LSOF_URL);
345 (void) fprintf(stderr, " latest man page: %slsof_man\n", LSOF_URL);
346 (void) fprintf(stderr,
347 " usage: [-?ab%sh%slnNoOP%s%stUvV%s]",
349 #if defined(HASNCACHE)
351 #else /* !defined(HASNCACHE) */
353 #endif /* defined(HASNCACHE) */
355 #if defined(HASTASKS)
357 #else /* !defined(HASTASKS) */
359 #endif /* defined(HASTASKS) */
363 #else /* !defined(HASPPID) */
365 #endif /* defined(HASPPID) */
367 #if defined(HASTCPUDPSTATE)
369 #else /* !defined(HASTCPUDPSTATE) */
371 #endif /* defined(HASTCPUDPSTATE) */
374 # if defined(HASXOPT_ROOT)
375 (Myuid == 0) ? "X" : ""
376 # else /* !defined(HASXOPT_ROOT) */
378 # endif /* defined(HASXOPT_ROOT) */
379 #else /* !defined(HASXOPT) */
381 #endif /* defined(HASXOPT) */
385 #if defined(HAS_AFS) && defined(HASAOPT)
386 (void) fprintf(stderr, " [-A A]");
387 #endif /* defined(HAS_AFS) && defined(HASAOPT) */
389 (void) fprintf(stderr, " [+|-c c] [+|-d s] [+%sD D]%s",
390 #if defined(HASDCACHE)
392 #else /* !defined(HASDCACHE) */
394 #endif /* defined(HASDCACHE) */
396 #if defined(HASEPTOPTS)
398 #else /* !defined(HASEPTOPTS) */
400 #endif /* defined(HASEPTOPTS) */
404 (void) fprintf(stderr,
405 " %s[+|-f%s%s%s%s%s%s]\n [-F [f]] [-g [s]] [-i [i]]",
409 #else /* !defined(HASEOPT) */
411 #endif /* defined(HASEOPT) */
413 #if defined(HASFSTRUCT)
416 # if defined(HASNOFSCOUNT)
418 # else /* !defined(HASNOFSCOUNT) */
420 # endif /* defined(HASNOFSCOUNT) */
422 # if defined(HASNOFSADDR)
424 # else /* !defined(HASNOFSADDR) */
426 # endif /* defined(HASNOFSADDR) */
428 # if defined(HASNOFSFLAGS)
430 # else /* !defined(HASNOFSFLAGS) */
432 # endif /* defined(HASNOFSFLAGS) */
434 # if defined(HASNOFSNADDR)
436 # else /* !defined(HASNOFSNADDR) */
438 # endif /* defined(HASNOFSNADDR) */
441 #else /* !defined(HASFSTRUCT) */
442 "", "", "", "", "", ""
443 #endif /* defined(HASFSTRUCT) */
448 (void) fprintf(stderr, " [-k k]");
449 #endif /* defined(HASKOPT) */
451 (void) fprintf(stderr, " [+|-L [l]]");
453 #if defined(HASMOPT) || defined(HASMNTSUP)
454 (void) fprintf(stderr,
455 # if defined(HASMOPT)
456 # if defined(HASMNTSUP)
458 # else /* !defined(HASMNTSUP) */
460 # endif /* defined(HASMNTSUP) */
461 # else /* !defined(HASMOPT) */
463 # endif /* defined(HASMOPT) */
465 #endif /* defined(HASMOPT) || defined(HASMNTSUP) */
467 #if !defined(HASNORPC_H)
468 (void) fprintf(stderr, " [+|-M]");
469 #endif /* !defined(HASNORPC_H) */
471 (void) fprintf(stderr,
472 " [-o [o]] [-p s]\n [+|-r [t]]%s [-S [t]] [-T [t]]",
474 #if defined(HASTCPUDPSTATE)
476 #else /* !defined(HASTCPUDPSTATE) */
478 #endif /* defined(HASTCPUDPSTATE) */
481 (void) fprintf(stderr, " [-u s] [+|-w] [-x [fl]]");
483 #if defined(HASZONES)
484 (void) fprintf(stderr, " [-z [z]]");
485 #else /* !defined(HASZONES) */
486 # if defined(HASSELINUX)
488 (void) fprintf(stderr, " [-Z [Z]]");
489 # endif /* defined(HASSELINUX) */
490 #endif /* defined(HASZONES) */
492 (void) fprintf(stderr, " [--] [names]\n");
495 (void) fprintf(stderr,
496 "Use the ``-h'' option to get more help information.\n");
501 (void) fprintf(stderr,
502 "Defaults in parentheses; comma-separated set (s) items;");
503 (void) fprintf(stderr, " dash-separated ranges.\n");
504 col = print_in_col(1, "-?|-h list help");
505 col = print_in_col(col, "-a AND selections (OR)");
506 col = print_in_col(col, "-b avoid kernel blocks");
507 col = print_in_col(col, "-c c cmd c ^c /c/[bix]");
508 (void) snpf(buf, sizeof(buf), "+c w COMMAND width (%d)", CMDL);
509 col = print_in_col(col, buf);
511 #if defined(HASNCACHE)
512 col = print_in_col(col, "-C no kernel name cache");
513 #endif /* defined(HASNCACHE) */
515 col = print_in_col(col, "+d s dir s files");
516 col = print_in_col(col, "-d s select by FD set");
517 col = print_in_col(col, "+D D dir D tree *SLOW?*");
519 #if defined(HASDCACHE)
523 # if !defined(WILLDROPGID)
526 # endif /* !defined(WILLDROPGID) */
529 cp = "?|i|b|r|u[path]";
530 (void) snpf(buf, sizeof(buf), "-D D %s", cp);
531 #else /* !defined(HASDCACHE) */
533 #endif /* defined(HASDCACHE) */
535 col = print_in_col(col, buf);
538 col = print_in_col(col, "+|-e s exempt s *RISKY*");
539 #endif /* defined(HASEOPT) */
541 (void) snpf(buf, sizeof(buf), "-i select IPv%s files",
545 #else /* !defined(HASIPv6) */
547 #endif /* defined(HASIPv6) */
550 col = print_in_col(col, buf);
552 #if defined(HASTASKS)
553 col = print_in_col(col, "-K list tasKs (threads)");
554 #endif /* defined(HASTASKS) */
556 col = print_in_col(col, "-l list UID numbers");
557 col = print_in_col(col, "-n no host names");
558 col = print_in_col(col, "-N select NFS files");
559 col = print_in_col(col, "-o list file offset");
560 col = print_in_col(col, "-O no overhead *RISKY*");
561 col = print_in_col(col, "-P no port names");
564 col = print_in_col(col, "-R list paRent PID");
565 #endif /* defined(HASPPID) */
567 col = print_in_col(col, "-s list file size");
568 col = print_in_col(col, "-t terse listing");
569 col = print_in_col(col, "-T disable TCP/TPI info");
570 col = print_in_col(col, "-U select Unix socket");
571 col = print_in_col(col, "-v list version info");
572 col = print_in_col(col, "-V verbose search");
573 (void) snpf(buf, sizeof(buf), "+|-w Warnings (%s)",
575 #if defined(WARNINGSTATE)
577 #else /* !defined(WARNINGSTATE) */
579 #endif /* defined(WARNINGSTATE) */
581 col = print_in_col(col, buf);
584 # if defined(HASXOPT_ROOT)
586 (void) snpf(buf, sizeof(buf), "-X %s", HASXOPT);
589 # else /* !defined(HASXOPT_ROOT) */
590 (void) snpf(buf, sizeof(buf), "-X %s", HASXOPT);
591 # endif /* defined(HASXOPT_ROOT) */
592 # else /* !defined(HASXOPT) */
594 #endif /* defined(HASXOPT) */
596 col = print_in_col(col, buf);
598 #if defined(HASZONES)
599 col = print_in_col(col, "-z z zone [z]");
600 #endif /* defined(HASZONES) */
602 #if defined(HASSELINUX)
603 col = print_in_col(col, "-Z Z context [Z]");
604 #endif /* defined(HASSELINUX) */
606 col = print_in_col(col, "-- end option scan");
608 (void) fprintf(stderr, "\n");
610 #if defined(HASEPTOPTS)
611 (void) fprintf(stderr, " %-36.36s %s\n",
612 "-E display endpoint info",
613 "+E display endpoint info and files"
615 #endif /* defined(HASEPTOPTS) */
617 (void) fprintf(stderr, " %-36.36s",
618 "+f|-f +filesystem or -file names");
620 #if defined(HASFSTRUCT)
621 (void) fprintf(stderr,
622 " +|-f[%s%s%s%s]%s%s%s%s %s%s%s%s%s%s%s\n",
624 # if defined(HASNOFSCOUNT)
626 # else /* !defined(HASNOFSCOUNT) */
628 # endif /* defined(HASNOFSCOUNT) */
630 # if defined(HASNOFSADDR)
632 # else /* !defined(HASNOFSADDR) */
634 # endif /* defined(HASNOFSADDR) */
636 # if defined(HASNOFSFLAGS)
638 # else /* !defined(HASNOFSFLAGS) */
640 # endif /* defined(HASNOFSFLAGS) */
642 # if defined(HASNOFSNADDR)
644 # else /* !defined(HASNOFSNADDR) */
646 # endif /* defined(HASNOFSNADDR) */
648 # if defined(HASNOFSCOUNT)
650 # else /* !defined(HASNOFSCOUNT) */
652 # endif /* defined(HASNOFSCOUNT) */
654 # if defined(HASNOFSADDR)
656 # else /* !defined(HASNOFSADDR) */
658 # endif /* defined(HASNOFSADDR) */
660 # if defined(HASNOFSFLAGS)
662 # else /* !defined(HASNOFSFLAGS) */
664 # endif /* defined(HASNOFSFLAGS) */
666 # if defined(HASNOFSNADDR)
668 # else /* !defined(HASNOFSNADDR) */
670 # endif /* defined(HASNOFSNADDR) */
673 (Fsv & FSV_CT) ? "C" : "",
674 (Fsv & FSV_FA) ? "F" : "",
675 ((Fsv & FSV_FG) && FsvFlagX) ? "g" : "",
676 ((Fsv & FSV_FG) && !FsvFlagX) ? "G" : "",
677 (Fsv & FSV_NI) ? "N" : "",
679 #else /* !defined(HASFSTRUCT) */
681 #endif /* defined(HASFSTRUCT) */
683 (void) fprintf(stderr, " %-36.36s",
684 "-F [f] select fields; -F? for help");
687 (void) fprintf(stderr,
688 " -k k kernel symbols (%s)\n",
692 # else /* !defined(N_UNIX) */
693 : (Nmlst = get_nlist_path(1)) ? Nmlst
695 # endif /* defined(N_UNIX) */
698 #else /* !defined(HASKOPT) */
700 #endif /* defined(HASKOPT) */
702 (void) fprintf(stderr,
703 " +|-L [l] list (+) suppress (-) link counts < l (0 = all; default = 0)\n");
705 #if defined(HASMOPT) || defined(HASMNTSUP)
706 # if defined(HASMOPT)
707 (void) snpf(buf, sizeof(buf), "-m m kernel memory (%s)", KMEM);
708 # else /* !defined(HASMOPT) */
710 # endif /* defined(HASMOPT) */
712 (void) fprintf(stderr, " %-36.36s", buf);
714 # if defined(HASMNTSUP)
715 (void) fprintf(stderr, " +m [m] use|create mount supplement\n");
716 # else /* !defined(HASMNTSUP) */
717 (void) fprintf(stderr, "\n");
718 # endif /* defined(HASMNTSUP) */
719 #endif /* defined(HASMOPT) || defined(HASMNTSUP) */
721 #if !defined(HASNORPC_H)
722 (void) snpf(buf, sizeof(buf), "+|-M portMap registration (%s)",
724 # if defined(HASPMAPENABLED)
726 # else /* !defined(HASPMAPENABLED) */
728 # endif /* defined(HASPMAPENABLED) */
731 #else /* defined(HASNORPC_H) */
733 #endif /* !defined(HASNORPC_H) */
735 (void) fprintf(stderr, " %-36.36s", buf);
736 (void) snpf(buf, sizeof(buf), "-o o o 0t offset digits (%d)",
738 (void) fprintf(stderr, " %s\n", buf);
739 (void) fprintf(stderr, " %-36.36s",
740 "-p s exclude(^)|select PIDs");
741 (void) fprintf(stderr, " -S [t] t second stat timeout (%d)\n",
743 (void) snpf(buf, sizeof(buf),
744 "-T %s%ss%s TCP/TPI %s%sSt%s (s) info",
746 #if defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)
748 #else /* !defined(HASSOOPT) && !defined(HASSOSTATE) && !defined(HASTCPOPT)*/
750 #endif /* defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)*/
752 #if defined(HASTCPTPIQ)
754 #else /* !defined(HASTCPTPIQ) */
756 #endif /* defined(HASTCPTPIQ) */
758 #if defined(HASTCPTPIW)
760 #else /* !defined(HASTCPTPIW) */
762 #endif /* defined(HASTCPTPIW) */
764 #if defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)
766 #else /* !defined(HASSOOPT) && !defined(HASSOSTATE) && !defined(HASTCPOPT)*/
768 #endif /* defined(HASSOOPT) || defined(HASSOSTATE) || defined(HASTCPOPT)*/
770 #if defined(HASTCPTPIQ)
772 #else /* !defined(HASTCPTPIQ) */
774 #endif /* defined(HASTCPTPIQ) */
776 #if defined(HASTCPTPIW)
778 #else /* !defined(HASTCPTPIW) */
780 #endif /* defined(HASTCPTPIW) */
783 (void) fprintf(stderr, " %s\n", buf);
785 #if defined(HAS_AFS) && defined(HASAOPT)
786 (void) fprintf(stderr,
787 " -A A AFS name list file (%s)\n", AFSAPATHDEF);
788 #endif /* defined(HAS_AFS) && defined(HASAOPT) */
790 (void) fprintf(stderr,
791 " -g [s] exclude(^)|select and print process group IDs\n");
792 (void) fprintf(stderr, " -i i select by IPv%s address:",
796 #else /* !defined(HASIPv6) */
798 #endif /* defined(HASIPv6) */
801 (void) fprintf(stderr,
802 " [%s][proto][@host|addr][:svc_list|port_list]\n",
806 #else /* !defined(HASIPv6) */
808 #endif /* defined(HASIPv6) */
812 (void) fprintf(stderr,
813 " +|-r [%s] repeat every t seconds (%d); %s",
815 #if defined(HAS_STRFTIME)
817 #else /* !defined(has_STRFTIME) */
819 #endif /* defined(HAS_STRFTIME) */
822 " + until no files, - forever.\n");
824 #if defined(HAS_STRFTIME)
825 (void) fprintf(stderr,
826 " An optional suffix to t is m<fmt>; m must separate %s",
827 "t from <fmt> and\n");
828 (void) fprintf(stderr, " <fmt> is an strftime(3) format %s",
829 "for the marker line.\n");
830 #endif /* defined(HAS_STRFTIME) */
832 #if defined(HASTCPUDPSTATE)
833 (void) fprintf(stderr,
834 " -s p:s exclude(^)|select protocol (p = TCP|UDP) states");
835 (void) fprintf(stderr, " by name(s).\n");
836 #endif /* defined(HASTCPUDPSTATE) */
838 (void) fprintf(stderr,
839 " -u s exclude(^)|select login|UID set s\n");
840 (void) fprintf(stderr,
841 " -x [fl] cross over +d|+D File systems or symbolic Links\n");
842 (void) fprintf(stderr,
843 " names select named files or files on named file systems\n");
844 (void) report_SECURITY(NULL, "; ");
845 (void) report_WARNDEVACCESS(NULL, NULL, ";");
846 (void) report_HASKERNIDCK(" k", NULL);
847 (void) report_HASDCACHE(0, NULL, NULL);
849 #if defined(DIALECT_WARNING)
850 (void) fprintf(stderr, "WARNING: %s\n", DIALECT_WARNING);
851 #endif /* defined(DIALECT_WARNING) */
855 (void) fprintf(stderr, "%s:\tID field description\n", Pn);
856 for (i = 0; FieldSel[i].nm; i++) {
858 #if !defined(HASPPID)
859 if (FieldSel[i].id == LSOF_FID_PPID)
861 #endif /* !defined(HASPPID) */
863 #if !defined(HASFSTRUCT)
864 if (FieldSel[i].id == LSOF_FID_FA
865 || FieldSel[i].id == LSOF_FID_CT
866 || FieldSel[i].id == LSOF_FID_FG
867 || FieldSel[i].id == LSOF_FID_NI)
869 #else /* defined(HASFSTRUCT) */
870 # if defined(HASNOFSADDR)
871 if (FieldSel[i].id == LSOF_FID_FA)
873 # endif /* defined(HASNOFSADDR) */
875 # if defined(HASNOFSCOUNT)
876 if (FieldSel[i].id == LSOF_FID_CT)
878 # endif /* !defined(HASNOFSCOUNT) */
880 # if defined(HASNOFSFLAGS)
881 if (FieldSel[i].id == LSOF_FID_FG)
883 # endif /* defined(HASNOFSFLAGS) */
885 # if defined(HASNOFSNADDR)
886 if (FieldSel[i].id == LSOF_FID_NI)
888 # endif /* defined(HASNOFSNADDR) */
889 #endif /* !defined(HASFSTRUCT) */
891 #if !defined(HASZONES)
892 if (FieldSel[i].id == LSOF_FID_ZONE)
894 #endif /* !defined(HASZONES) */
896 #if defined(HASSELINUX)
897 if ((FieldSel[i].id == LSOF_FID_CNTX) && !CntxStatus)
899 #else /* !defined(HASSELINUX) */
900 if (FieldSel[i].id == LSOF_FID_CNTX)
902 #endif /* !defined(HASSELINUX) */
904 (void) fprintf(stderr, "\t %c %s\n",
905 FieldSel[i].id, FieldSel[i].nm);
909 #if defined(HASDCACHE)
911 report_HASDCACHE(1, NULL, " ");
912 #endif /* defined(HASDCACHE) */
917 * Display version information in reponse to ``-v''.
919 (void) fprintf(stderr, "%s version information:\n", Pn);
920 (void) fprintf(stderr, " revision: %s\n", LSOF_VERSION);
921 (void) fprintf(stderr, " latest revision: %s\n", LSOF_URL);
922 (void) fprintf(stderr, " latest FAQ: %sFAQ\n",
924 (void) fprintf(stderr, " latest man page: %slsof_man\n",
927 #if defined(LSOF_CINFO)
928 if ((cp = isnullstr(LSOF_CINFO)))
929 (void) fprintf(stderr, " configuration info: %s\n", cp);
930 #endif /* defined(LSOF_CINFO) */
932 if ((cp = isnullstr(LSOF_CCDATE)))
933 (void) fprintf(stderr, " constructed: %s\n", cp);
934 cp = isnullstr(LSOF_HOST);
935 if (!(cp1 = isnullstr(LSOF_LOGNAME)))
936 cp1 = isnullstr(LSOF_USER);
944 (void) fprintf(stderr, " constructed %s: %s%s%s\n",
947 (cp && cp1) ? "@" : "",
952 #if defined(LSOF_BLDCMT)
953 if ((cp = isnullstr(LSOF_BLDCMT)))
954 (void) fprintf(stderr, " builder's comment: %s\n", cp);
955 #endif /* defined(LSOF_BLDCMT) */
957 if ((cp = isnullstr(LSOF_CC)))
958 (void) fprintf(stderr, " compiler: %s\n", cp);
959 if ((cp = isnullstr(LSOF_CCV)))
960 (void) fprintf(stderr, " compiler version: %s\n", cp);
961 if ((cp = isnullstr(LSOF_CCFLAGS)))
962 (void) fprintf(stderr, " compiler flags: %s\n", cp);
963 if ((cp = isnullstr(LSOF_LDFLAGS)))
964 (void) fprintf(stderr, " loader flags: %s\n", cp);
965 if ((cp = isnullstr(LSOF_SYSINFO)))
966 (void) fprintf(stderr, " system info: %s\n", cp);
967 (void) report_SECURITY(" ", ".\n");
968 (void) report_WARNDEVACCESS(" ", "are", ".\n");
969 (void) report_HASKERNIDCK(" K", "is");
971 #if defined(DIALECT_WARNING)
972 (void) fprintf(stderr, " WARNING: %s\n", DIALECT_WARNING);
973 #endif /* defined(DIALECT_WARNING) */
975 (void) report_HASDCACHE(1, " ", "\t");