├── .clang-format
├── .clang-tidy
├── .copr
├── Makefile
└── prep.sh
├── .cppcheck.rules
├── .cppcheck.suppressions
├── .editorconfig
├── .github
└── ISSUE_TEMPLATE
│ └── bug_report.md
├── .gitignore
├── .oclint
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── app-compat-travis.yml
├── bin
├── README
├── lint
├── shellcheck
├── style
├── trigger-app-compat-tests.sh
├── trigger-coverity-scan.sh
└── upload-release.sh
├── config_ast.h.in
├── coverity-travis.yml
├── etc
├── README
├── hdrs.c
├── iwyu.bsd.map
├── iwyu.linux.map
└── sfinit.c
├── features
├── README
├── detect_nproc.sh
├── detect_wsl.sh
├── dll
│ ├── dll.c
│ ├── dll_next_path.sh
│ ├── dynamic.c
│ └── meson.build
├── fts.c
├── lchmod_fallback.c
├── libpath.sh
├── max_signum.c
├── meson.build
├── poll.c
├── posix_spawn.c
├── prog.sh
├── socketpair_shutdown.c
├── time
│ └── meson.build
└── utsname
│ └── meson.build
├── lib
└── package
│ ├── INIT.README
│ ├── INIT.html
│ ├── INIT.pkg
│ ├── INIT.req
│ ├── INIT.ver
│ ├── LICENSES
│ ├── bsd
│ └── epl
│ ├── ast-ast.pkg
│ ├── ast-base.pkg
│ ├── ast-base.req
│ ├── ast-base.ver
│ ├── ast-dss.pkg
│ ├── ast-ksh.pkg
│ ├── ast-ksh.req
│ ├── ast-ksh.ver
│ ├── ast-make.pkg
│ ├── ast-make.req
│ ├── ast-make.ver
│ ├── ast-open.README
│ ├── ast-open.html
│ ├── ast-open.pkg
│ ├── ast-open.req
│ ├── ast-open.ver
│ ├── ast.def
│ ├── ast.lic
│ ├── bsd.def
│ ├── bsd.lic
│ ├── epl.def
│ ├── ksh.pkg
│ ├── zlib.def
│ └── zlib.lic
├── meson.build
├── meson_options.txt
├── packaging
├── debian
│ ├── changelog
│ ├── compat
│ ├── control
│ ├── copyright
│ ├── ksh.dsc
│ ├── ksh.install
│ ├── ksh.postinst
│ ├── ksh.postrm
│ ├── ksh.prerm
│ ├── menu
│ ├── rules
│ └── source
│ │ └── format
├── fedora
│ ├── .gitignore
│ ├── dotkshrc
│ ├── ksh.spec.in
│ ├── kshcomp.conf
│ └── kshrc.rhs
└── opensuse
│ └── ksh.spec.in
├── scripts
├── README
├── build-on-docker.sh
├── build-on-macos.sh
├── build-on-obs.sh
├── builtin_documentation.sh
├── clang-asan.sh
├── create_rksh_symlink
├── extract_flags
├── fill_template.py
├── hosttype
├── install_aux_files.sh
├── libast_prereq.sh
├── partition_compile_db
├── python.sh
└── travis_common.sh
└── src
├── cmd
└── ksh93
│ ├── COMPATIBILITY
│ ├── DESIGN
│ ├── OBSOLETE
│ ├── README
│ ├── RELEASE
│ ├── RELEASE88
│ ├── RELEASE93
│ ├── TYPES
│ ├── bltins
│ ├── alias.c
│ ├── bg.c
│ ├── break.c
│ ├── builtin.c
│ ├── cd.c
│ ├── command.c
│ ├── continue.c
│ ├── disown.c
│ ├── echo.c
│ ├── enum.c
│ ├── eval.c
│ ├── exec.c
│ ├── exit.c
│ ├── export.c
│ ├── false.c
│ ├── fg.c
│ ├── getopts.c
│ ├── hist.c
│ ├── jobs.c
│ ├── kill.c
│ ├── let.c
│ ├── math.c
│ ├── meson.build
│ ├── print.c
│ ├── printf.c
│ ├── pwd.c
│ ├── read.c
│ ├── readonly.c
│ ├── return.c
│ ├── set.c
│ ├── shift.c
│ ├── sleep.c
│ ├── source.c
│ ├── test.c
│ ├── times.c
│ ├── trap.c
│ ├── true.c
│ ├── typeset.c
│ ├── ulimit.c
│ ├── umask.c
│ ├── unalias.c
│ ├── unset.c
│ ├── wait.c
│ └── whence.c
│ ├── cmds
│ ├── RELEASE
│ ├── basename.c
│ ├── cat.c
│ ├── chmod.c
│ ├── cmdinit.c
│ ├── cmp.c
│ ├── cut.c
│ ├── dirname.c
│ ├── head.c
│ ├── logname.c
│ ├── meson.build
│ ├── mkdir.c
│ ├── sync.c
│ ├── uname.c
│ └── wc.c
│ ├── data
│ ├── aliases.c
│ ├── builtins.c
│ ├── config.ksh
│ ├── keywords.c
│ ├── lexstates.c
│ ├── limits.c
│ ├── meson.build
│ ├── msg.c
│ ├── options.c
│ ├── signals.c
│ ├── strdata.c
│ ├── testops.c
│ └── variables.c
│ ├── docs
│ ├── Makefile
│ ├── README
│ ├── _build
│ │ ├── doctrees
│ │ │ ├── alias.doctree
│ │ │ ├── basename.doctree
│ │ │ ├── bg.doctree
│ │ │ ├── break.doctree
│ │ │ ├── builtin.doctree
│ │ │ ├── cat.doctree
│ │ │ ├── cd.doctree
│ │ │ ├── chmod.doctree
│ │ │ ├── cmp.doctree
│ │ │ ├── command.doctree
│ │ │ ├── compgen.doctree
│ │ │ ├── complete.doctree
│ │ │ ├── continue.doctree
│ │ │ ├── cut.doctree
│ │ │ ├── dirname.doctree
│ │ │ ├── disown.doctree
│ │ │ ├── echo.doctree
│ │ │ ├── enum.doctree
│ │ │ ├── environment.pickle
│ │ │ ├── eval.doctree
│ │ │ ├── exec.doctree
│ │ │ ├── exit.doctree
│ │ │ ├── export.doctree
│ │ │ ├── fg.doctree
│ │ │ ├── head.doctree
│ │ │ ├── hist.doctree
│ │ │ ├── index.doctree
│ │ │ ├── jobs.doctree
│ │ │ ├── kill.doctree
│ │ │ ├── ksh_intro.doctree
│ │ │ ├── let.doctree
│ │ │ ├── logname.doctree
│ │ │ ├── mkdir.doctree
│ │ │ ├── print.doctree
│ │ │ ├── printf.doctree
│ │ │ ├── pwd.doctree
│ │ │ ├── read.doctree
│ │ │ ├── readonly.doctree
│ │ │ ├── return.doctree
│ │ │ ├── shcomp.doctree
│ │ │ ├── shift.doctree
│ │ │ ├── sleep.doctree
│ │ │ ├── source.doctree
│ │ │ ├── sync.doctree
│ │ │ ├── test.doctree
│ │ │ ├── times.doctree
│ │ │ ├── trap.doctree
│ │ │ ├── ulimit.doctree
│ │ │ ├── umask.doctree
│ │ │ ├── unalias.doctree
│ │ │ ├── uname.doctree
│ │ │ ├── unset.doctree
│ │ │ ├── wait.doctree
│ │ │ ├── wc.doctree
│ │ │ └── whence.doctree
│ │ └── man
│ │ │ ├── alias.1
│ │ │ ├── basename.1
│ │ │ ├── bg.1
│ │ │ ├── break.1
│ │ │ ├── builtin.1
│ │ │ ├── cat.1
│ │ │ ├── cd.1
│ │ │ ├── chmod.1
│ │ │ ├── cmp.1
│ │ │ ├── command.1
│ │ │ ├── compgen.1
│ │ │ ├── complete.1
│ │ │ ├── continue.1
│ │ │ ├── cut.1
│ │ │ ├── dirname.1
│ │ │ ├── disown.1
│ │ │ ├── echo.1
│ │ │ ├── enum.1
│ │ │ ├── eval.1
│ │ │ ├── exec.1
│ │ │ ├── exit.1
│ │ │ ├── export.1
│ │ │ ├── fg.1
│ │ │ ├── head.1
│ │ │ ├── hist.1
│ │ │ ├── jobs.1
│ │ │ ├── kill.1
│ │ │ ├── let.1
│ │ │ ├── logname.1
│ │ │ ├── mkdir.1
│ │ │ ├── print.1
│ │ │ ├── printf.1
│ │ │ ├── pwd.1
│ │ │ ├── read.1
│ │ │ ├── readonly.1
│ │ │ ├── return.1
│ │ │ ├── shcomp.1
│ │ │ ├── shift.1
│ │ │ ├── sleep.1
│ │ │ ├── source.1
│ │ │ ├── sync.1
│ │ │ ├── test.1
│ │ │ ├── times.1
│ │ │ ├── trap.1
│ │ │ ├── ulimit.1
│ │ │ ├── umask.1
│ │ │ ├── unalias.1
│ │ │ ├── uname.1
│ │ │ ├── unset.1
│ │ │ ├── wait.1
│ │ │ ├── wc.1
│ │ │ └── whence.1
│ ├── _static
│ │ └── README
│ ├── _templates
│ │ └── README
│ ├── alias.rst
│ ├── basename.rst
│ ├── bg.rst
│ ├── break.rst
│ ├── builtin.rst
│ ├── cat.rst
│ ├── cd.rst
│ ├── chmod.rst
│ ├── cmp.rst
│ ├── command.rst
│ ├── compgen.rst
│ ├── complete.rst
│ ├── conf.py
│ ├── continue.rst
│ ├── cut.rst
│ ├── dirname.rst
│ ├── disown.rst
│ ├── echo.rst
│ ├── enum.rst
│ ├── enum_type.1
│ ├── eval.rst
│ ├── exec.rst
│ ├── exit.rst
│ ├── export.rst
│ ├── fg.rst
│ ├── getopts.1
│ ├── head.rst
│ ├── hist.rst
│ ├── index.rst
│ ├── jobs.rst
│ ├── kill.rst
│ ├── ksh.1
│ ├── ksh_intro.rst
│ ├── ksh_mini.1
│ ├── let.rst
│ ├── logname.rst
│ ├── meson.build
│ ├── mkdir.rst
│ ├── nval.3
│ ├── print.rst
│ ├── printf.rst
│ ├── pwd.rst
│ ├── read.rst
│ ├── readonly.rst
│ ├── return.rst
│ ├── set.1
│ ├── shcomp.rst
│ ├── shell.3
│ ├── shift.rst
│ ├── sleep.rst
│ ├── source.rst
│ ├── sync.rst
│ ├── test.rst
│ ├── times.rst
│ ├── trap.rst
│ ├── type.1
│ ├── typeset.1
│ ├── ulimit.rst
│ ├── umask.rst
│ ├── unalias.rst
│ ├── uname.rst
│ ├── unset.rst
│ ├── wait.rst
│ ├── wc.rst
│ └── whence.rst
│ ├── docs_historical
│ ├── PROMO.mm
│ ├── builtins.mm
│ └── sh.memo
│ ├── edit
│ ├── completion.c
│ ├── edit.c
│ ├── emacs.c
│ ├── hexpand.c
│ ├── history.c
│ ├── meson.build
│ ├── pcomplete.c
│ └── vi.c
│ ├── functions
│ ├── _ksh_print_help
│ ├── cd
│ ├── dirs
│ ├── man
│ ├── mcd
│ ├── popd
│ └── pushd
│ ├── include
│ ├── argnod.h
│ ├── b_ulimit.h
│ ├── builtins.h
│ ├── cmdext.h
│ ├── defs.h
│ ├── edit.h
│ ├── fault.h
│ ├── fcin.h
│ ├── history.h
│ ├── io.h
│ ├── jobs.h
│ ├── lexstates.h
│ ├── name.h
│ ├── path.h
│ ├── shcmd.h
│ ├── shell.h
│ ├── shlex.h
│ ├── shnodes.h
│ ├── shtable.h
│ ├── streval.h
│ ├── terminal.h
│ ├── test.h
│ ├── timeout.h
│ └── variables.h
│ ├── meson.build
│ ├── sh
│ ├── args.c
│ ├── arith.c
│ ├── array.c
│ ├── bash.c
│ ├── debug.c
│ ├── defs.c
│ ├── deparse.c
│ ├── expand.c
│ ├── fault.c
│ ├── fcin.c
│ ├── init.c
│ ├── io.c
│ ├── jobs.c
│ ├── lex.c
│ ├── macro.c
│ ├── main.c
│ ├── meson.build
│ ├── name.c
│ ├── nvdisc.c
│ ├── nvtree.c
│ ├── nvtype.c
│ ├── parse.c
│ ├── path.c
│ ├── pmain.c
│ ├── shcomp.c
│ ├── streval.c
│ ├── string.c
│ ├── subshell.c
│ ├── tdump.c
│ ├── timers.c
│ ├── trestore.c
│ ├── version.c.in
│ └── xec.c
│ └── tests
│ ├── api
│ ├── ksh_debug.c
│ ├── ksh_debug.err
│ └── meson.build
│ ├── append.sh
│ ├── arith.sh
│ ├── arrays.sh
│ ├── arrays2.sh
│ ├── attributes.sh
│ ├── autoload.sh
│ ├── b_alias.sh
│ ├── b_basename.sh
│ ├── b_cat.sh
│ ├── b_chmod.sh
│ ├── b_cmp.sh
│ ├── b_command.sh
│ ├── b_cut.sh
│ ├── b_dirname.sh
│ ├── b_echo.exp
│ ├── b_echo.exp.out
│ ├── b_enum.sh
│ ├── b_exit.sh
│ ├── b_grep.sh
│ ├── b_head.sh
│ ├── b_hist.exp
│ ├── b_hist.exp.out
│ ├── b_jobs.exp
│ ├── b_jobs.exp.out
│ ├── b_jobs.sh
│ ├── b_local.sh
│ ├── b_mkdir.sh
│ ├── b_nameref.sh
│ ├── b_print.sh
│ ├── b_printf.sh
│ ├── b_read.exp
│ ├── b_read.exp.err
│ ├── b_read.exp.out
│ ├── b_read.sh
│ ├── b_return.sh
│ ├── b_set.exp
│ ├── b_set.sh
│ ├── b_sleep.sh
│ ├── b_sync.sh
│ ├── b_test.exp
│ ├── b_test.exp.out
│ ├── b_test.sh
│ ├── b_time.exp
│ ├── b_time.exp.out
│ ├── b_times.exp
│ ├── b_times.exp.out
│ ├── b_typeset.exp
│ ├── b_typeset.exp.out
│ ├── b_typeset.sh
│ ├── b_ulimit.sh
│ ├── b_uname.sh
│ ├── b_wc.sh
│ ├── b_whence.sh
│ ├── basic.sh
│ ├── bracket.sh
│ ├── builtins.sh
│ ├── case.sh
│ ├── comvar.sh
│ ├── comvario.sh
│ ├── coprocess.sh
│ ├── cubetype.sh
│ ├── data
│ ├── sh_history
│ ├── sh_match1.xml
│ ├── sh_match2.xml
│ ├── sh_match_test.sh
│ ├── sigtst0
│ ├── sigtst1
│ ├── sigtst2
│ ├── sigtst3
│ └── skipped_dir
│ ├── directoryfd.sh
│ ├── emacs.exp
│ ├── emacs.exp.out
│ ├── exit.sh
│ ├── expand.sh
│ ├── functions.sh
│ ├── getopts.sh
│ ├── glob.exp
│ ├── glob.exp.out
│ ├── glob.sh
│ ├── heredoc.sh
│ ├── ifs.sh
│ ├── io.sh
│ ├── leaks.sh
│ ├── locale.sh
│ ├── math.sh
│ ├── meson.build
│ ├── modifiers.sh
│ ├── namespace.sh
│ ├── options.sh
│ ├── path.sh
│ ├── pointtype.sh
│ ├── quoting.sh
│ ├── quoting2.sh
│ ├── readcsv.sh
│ ├── recttype.sh
│ ├── restricted.exp
│ ├── restricted.exp.out
│ ├── restricted.sh
│ ├── rksh.sh
│ ├── select.sh
│ ├── sh_match.sh
│ ├── sigchld.sh
│ ├── signal.sh
│ ├── special-dev-paths.sh
│ ├── statics.sh
│ ├── subshell.sh
│ ├── substring.sh
│ ├── tilde.sh
│ ├── timetype.sh
│ ├── treemove.sh
│ ├── util
│ ├── interactive.expect.rc
│ ├── interactive.kshrc
│ ├── postscript.sh
│ ├── preamble.sh
│ ├── run_test.sh
│ └── util.sh
│ ├── variables.sh
│ ├── vartree1.sh
│ ├── vartree2.sh
│ ├── vi.exp
│ └── vi.exp.out
└── lib
├── libast
├── README
├── RELEASE
├── aso
│ ├── aso.c
│ └── meson.build
├── cdt
│ ├── cdtlib.h
│ ├── dtclose.c
│ ├── dtdisc.c
│ ├── dthash.c
│ ├── dtlist.c
│ ├── dtmethod.c
│ ├── dtopen.c
│ ├── dtrehash.c
│ ├── dtstat.c
│ ├── dtstrhash.c
│ ├── dttree.c
│ ├── dtuser.c
│ ├── dtview.c
│ ├── dtwalk.c
│ └── meson.build
├── include
│ ├── aso.h
│ ├── ast.h
│ ├── ast_aso.h
│ ├── ast_assert.h
│ ├── ast_dir.h
│ ├── ast_errorf.h
│ ├── ast_float.h
│ ├── ast_glob.h
│ ├── ast_mmap.h
│ ├── ast_regex.h
│ ├── ast_tty.h
│ ├── ast_windows.h
│ ├── cdt.h
│ ├── error.h
│ ├── modecanon.h
│ ├── optget_long.h
│ ├── option.h
│ ├── optlib.h
│ ├── proc.h
│ ├── sfio.h
│ ├── sig.h
│ ├── spawnvex.h
│ ├── stk.h
│ ├── times.h
│ ├── tm.h
│ ├── tmx.h
│ └── tv.h
├── man
│ ├── LIBAST.3
│ ├── aso.3
│ ├── ast.3
│ ├── astsa.3
│ ├── cdt.3
│ ├── chr.3
│ ├── compat.3
│ ├── error.3
│ ├── find.3
│ ├── fmt.3
│ ├── getcwd.3
│ ├── int.3
│ ├── magic.3
│ ├── mem.3
│ ├── optget.3
│ ├── path.3
│ ├── preroot.3
│ ├── proc.3
│ ├── re.3
│ ├── regex.3
│ ├── setenviron.3
│ ├── sfdisc.3
│ ├── sfio.3
│ ├── sig.3
│ ├── spawnveg.3
│ ├── spawnvex.3
│ ├── stak.3
│ ├── stk.3
│ ├── strdup.3
│ ├── strelapsed.3
│ ├── strerror.3
│ ├── stresc.3
│ ├── strmatch.3
│ ├── strperm.3
│ ├── strsort.3
│ ├── strton.3
│ ├── swap.3
│ ├── tab.3
│ ├── tm.3
│ ├── tmx.3
│ ├── touch.3
│ ├── tv.3
│ └── vecargs.3
├── meson.build
├── misc
│ ├── astwinsize.c
│ ├── debug.c
│ ├── environ.c
│ ├── error.c
│ ├── errorf.c
│ ├── errormsg.c
│ ├── errorx.c
│ ├── fallbacks.c
│ ├── fgetcwd.c
│ ├── glob.c
│ ├── meson.build
│ ├── optget.c
│ ├── optget_long.c
│ ├── procclose.c
│ ├── procfree.c
│ ├── procopen.c
│ ├── setlocale.c
│ ├── sigcrit.c
│ ├── spawnvex.c
│ ├── state.c
│ ├── stk.c
│ ├── translate.c
│ └── vmbusy.c
├── path
│ ├── meson.build
│ ├── pathaccess.c
│ ├── pathbin.c
│ ├── pathcanon.c
│ ├── pathcat.c
│ ├── pathexists.c
│ ├── pathgetlink.c
│ ├── pathpath.c
│ ├── pathprog.c
│ ├── pathshell.c
│ ├── pathstat.c
│ ├── pathtemp.c
│ └── pathuniverse.c
├── regex
│ ├── meson.build
│ ├── regcache.c
│ ├── regclass.c
│ ├── regcoll.c
│ ├── regcomp.c
│ ├── regexec.c
│ ├── regfatal.c
│ ├── reginit.c
│ ├── reglib.h
│ ├── regnexec.c
│ ├── regrecord.c
│ ├── regrexec.c
│ └── regstat.c
├── sfio
│ ├── _sfopen.c
│ ├── _sfputd.c
│ ├── _sfputl.c
│ ├── _sfputm.c
│ ├── _sfputu.c
│ ├── meson.build
│ ├── sfclose.c
│ ├── sfclrlock.c
│ ├── sfcvt.c
│ ├── sfdisc.c
│ ├── sfecvt.c
│ ├── sfexcept.c
│ ├── sfextern.c
│ ├── sffcvt.c
│ ├── sffilbuf.c
│ ├── sfflsbuf.c
│ ├── sfgetd.c
│ ├── sfgetl.c
│ ├── sfgetm.c
│ ├── sfgetr.c
│ ├── sfgetu.c
│ ├── sfgetwc.c
│ ├── sfhdr.h
│ ├── sfmode.c
│ ├── sfmove.c
│ ├── sfmutex.c
│ ├── sfnew.c
│ ├── sfnotify.c
│ ├── sfnputc.c
│ ├── sfopen.c
│ ├── sfpeek.c
│ ├── sfpkrd.c
│ ├── sfpool.c
│ ├── sfpopen.c
│ ├── sfprintf.c
│ ├── sfprints.c
│ ├── sfpurge.c
│ ├── sfputr.c
│ ├── sfputu.c
│ ├── sfputwc.c
│ ├── sfraise.c
│ ├── sfrd.c
│ ├── sfread.c
│ ├── sfreserve.c
│ ├── sfresize.c
│ ├── sfscanf.c
│ ├── sfseek.c
│ ├── sfset.c
│ ├── sfsetbuf.c
│ ├── sfsetfd.c
│ ├── sfsize.c
│ ├── sfsk.c
│ ├── sfstack.c
│ ├── sfstrtod.c
│ ├── sfstrtof.h
│ ├── sfswap.c
│ ├── sfsync.c
│ ├── sftable.c
│ ├── sftell.c
│ ├── sftmp.c
│ ├── sfungetc.c
│ ├── sfvprintf.c
│ ├── sfvscanf.c
│ ├── sfwr.c
│ ├── sfwrite.c
│ └── vthread.h
├── string
│ ├── base64.c
│ ├── chresc.c
│ ├── fmtbase.c
│ ├── fmtbuf.c
│ ├── fmtelapsed.c
│ ├── fmtesc.c
│ ├── fmtfmt.c
│ ├── fmtint.c
│ ├── fmtmatch.c
│ ├── fmtmode.c
│ ├── fmtperm.c
│ ├── fmtre.c
│ ├── fmtscale.c
│ ├── fmttmx.c
│ ├── memdup.c
│ ├── meson.build
│ ├── modedata.c
│ ├── modelib.h
│ ├── strelapsed.c
│ ├── stresc.c
│ ├── strlcat.c
│ ├── strlcpy.c
│ ├── strmatch.c
│ ├── strperm.c
│ ├── strsort.c
│ ├── strtoi.h
│ ├── strtonll.c
│ ├── struniq.c
│ ├── utf32stowcs.c
│ ├── utf32toutf8.c
│ ├── utf8toutf32.c
│ └── wcstoutf32s.c
├── tests
│ ├── NOTES
│ ├── RELEASE
│ ├── aso
│ │ ├── meson.build
│ │ ├── taso.c
│ │ └── tlock.c
│ ├── cdt
│ │ ├── dttest.h
│ │ ├── meson.build
│ │ ├── tannounce.c
│ │ ├── tbags.c
│ │ ├── tdeque.c
│ │ ├── tdict.c
│ │ ├── tdtstack.c
│ │ ├── tevent.c
│ │ ├── tinstall.c
│ │ ├── tlist.c
│ │ ├── tobag.c
│ │ ├── tqueue.c
│ │ ├── trehash.c
│ │ ├── trhbags.c
│ │ ├── tsafehash.c
│ │ ├── tsafetree.c
│ │ ├── tsearch.c
│ │ ├── tstringset.c
│ │ ├── tuser.c
│ │ ├── tview.c
│ │ ├── tvthread.c
│ │ └── twalk.c
│ ├── date.msk
│ ├── meson.build
│ ├── misc
│ │ ├── debug.c
│ │ ├── debug.err
│ │ ├── environ.c
│ │ ├── glob.c
│ │ ├── meson.build
│ │ ├── opt.c
│ │ ├── optget_long.c
│ │ └── stk.c
│ ├── path
│ │ ├── meson.build
│ │ ├── pathaccess.c
│ │ ├── pathbin.c
│ │ ├── pathcanon.c
│ │ ├── pathcat.c
│ │ ├── pathexists.c
│ │ ├── pathgetlink.c
│ │ ├── pathpath.c
│ │ ├── pathprog.c
│ │ ├── pathshell.c
│ │ ├── pathstat.c
│ │ └── pathtemp.c
│ ├── run_test.sh
│ ├── sfio
│ │ ├── meson.build
│ │ ├── talarm.c
│ │ ├── talign.c
│ │ ├── tappend.c
│ │ ├── tatexit.c
│ │ ├── tbadargs.c
│ │ ├── tclose.c
│ │ ├── terrno.c
│ │ ├── texcept.c
│ │ ├── tflags.c
│ │ ├── tfmt.c
│ │ ├── tgetr.c
│ │ ├── thole.c
│ │ ├── tleak.c
│ │ ├── tlocale.c
│ │ ├── tlongdouble.c
│ │ ├── tmode.c
│ │ ├── tmove.c
│ │ ├── tmprdwr.c
│ │ ├── tmpread.c
│ │ ├── tmprocess.c
│ │ ├── tmtsafe.c
│ │ ├── tmultiple.c
│ │ ├── tmwrite.c
│ │ ├── tnoseek.c
│ │ ├── tnotify.c
│ │ ├── topen.c
│ │ ├── tpipe.c
│ │ ├── tpipemove.c
│ │ ├── tpkrd.c
│ │ ├── tpool.c
│ │ ├── tpopen.c
│ │ ├── tpopenrw.c
│ │ ├── tprintf.c
│ │ ├── tpublic.c
│ │ ├── tputgetc.c
│ │ ├── tputgetd.c
│ │ ├── tputgetl.c
│ │ ├── tputgetm.c
│ │ ├── tputgetr.c
│ │ ├── tputgetu.c
│ │ ├── trcrv.c
│ │ ├── treserve.c
│ │ ├── tresize.c
│ │ ├── tscanf.c
│ │ ├── tscanf1.c
│ │ ├── tseek.c
│ │ ├── tsetbuf.c
│ │ ├── tsetfd.c
│ │ ├── tsfstr.c
│ │ ├── tshare.c
│ │ ├── tsize.c
│ │ ├── tstack.c
│ │ ├── tstatus.c
│ │ ├── tstkpk.c
│ │ ├── tstring.c
│ │ ├── tswap.c
│ │ ├── tsync.c
│ │ ├── ttell.c
│ │ ├── ttmp.c
│ │ ├── ttmpfile.c
│ │ ├── tungetc.c
│ │ ├── twhole.c
│ │ └── twrrd.c
│ ├── strelapsed.tst
│ ├── string
│ │ ├── base64.c
│ │ ├── chresc.c
│ │ ├── fmtbase.c
│ │ ├── fmtelapsed.c
│ │ ├── fmtesc.c
│ │ ├── fmtfmt.c
│ │ ├── fmtint.c
│ │ ├── fmtmatch.c
│ │ ├── fmtmode.c
│ │ ├── fmtperm.c
│ │ ├── fmtre.c
│ │ ├── fmtscale.c
│ │ ├── fmttmx.c
│ │ ├── meson.build
│ │ ├── strelapsed.c
│ │ ├── stresc.c
│ │ ├── strlcat.c
│ │ ├── strlcpy.c
│ │ ├── strmatch.c
│ │ ├── strperm.c
│ │ ├── strsort.c
│ │ ├── strtonll.c
│ │ ├── struniq.c
│ │ └── utf.c
│ ├── strtoi.tst
│ ├── terror.h
│ ├── testdate.sh
│ ├── testlib
│ ├── tm
│ │ ├── meson.build
│ │ └── tvgettime.c
│ ├── week.dat
│ └── zone.dat
└── tm
│ ├── meson.build
│ ├── tmdata.c
│ ├── tmequiv.c
│ ├── tmfix.c
│ ├── tmgoff.c
│ ├── tminit.c
│ ├── tmlex.c
│ ├── tmlocale.c
│ ├── tmmake.c
│ ├── tmpoff.c
│ ├── tmsleep.c
│ ├── tmtime.c
│ ├── tmtype.c
│ ├── tmweek.c
│ ├── tmword.c
│ ├── tmxdate.c
│ ├── tmxfmt.c
│ ├── tmxgettime.c
│ ├── tmxmake.c
│ ├── tmxscan.c
│ ├── tmxtime.c
│ ├── tmzone.c
│ ├── tvgettime.c
│ ├── tvsleep.c
│ └── tvtouch.c
└── libdll
├── RELEASE
├── dlfcn.c
├── dllcheck.c
├── dlldefs.h
├── dllerror.c
├── dllfind.c
├── dlllib.h
├── dlllook.c
├── dllnext.c
├── dllopen.c
├── dllplug.c
├── dllscan.c
├── meson.build
└── sample.c
/.clang-format:
--------------------------------------------------------------------------------
1 | # Use the Google style with these modifications and a couple of others:
2 | #
3 | # 1) Lines can be up to 100 chars long rather than 80.
4 | # 2) Use a four space indent rather than two spaces.
5 | #
6 | Language: Cpp
7 | BasedOnStyle: Google
8 | ColumnLimit: 100
9 | IndentWidth: 4
10 |
11 | # The following directives override defaults established above.
12 |
13 | # We don't want OCLint pragmas to be reformatted.
14 | CommentPragmas: '^!OCLINT'
15 |
16 | # Do not try to infer the most common alignment of `&` and `*` by analyzing the
17 | # source file. Use right alignment; i.e., bind to the symbol not the type.
18 | DerivePointerAlignment: false
19 | PointerAlignment: Right
20 |
--------------------------------------------------------------------------------
/.clang-tidy:
--------------------------------------------------------------------------------
1 | CheckOptions:
2 | - key: readability-braces-around-statements.ShortStatementLines
3 | value: 1
4 |
--------------------------------------------------------------------------------
/.copr/Makefile:
--------------------------------------------------------------------------------
1 | mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
2 | current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
3 |
4 | srpm:
5 | dnf -y install git-core sed
6 | $(current_dir)/prep.sh
7 | rpmbuild -bs -D "dist %{nil}" -D "_sourcedir packaging/fedora" -D "_srcrpmdir $(outdir)" --nodeps packaging/fedora/ksh.spec
8 |
--------------------------------------------------------------------------------
/.copr/prep.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -euf
2 | set -x
3 |
4 | # Copr sets clone depth to 500 to avoid cloning big repositories
5 | # however we use number of commits in version number, so fetch
6 | # full repository
7 | # If `get fetch --unshallow` fails, this means if we have full
8 | # repo, so ignore if it fails.
9 | git fetch --unshallow || :
10 |
11 | # Fetch tags to determine version number
12 | git fetch --tags
13 |
14 | # 2017.0.0-devel-1535-g7c33a1cd-dirty
15 | VCS_VERSION=$(git describe --always --dirty --tags)
16 |
17 | # Extract development version number i.e. 2017.0.0
18 | DEVEL_VERSION_NUM=$(echo "$VCS_VERSION" | cut -d'-' -f1)
19 |
20 | # 1535
21 | COMMIT_NUM=$(echo "$VCS_VERSION" | cut -d'-' -f3)
22 |
23 | # g7c33a1cd
24 | SHORT_COMMIT=$(echo "$VCS_VERSION" | cut -d'-' -f4)
25 |
26 | COMMIT=$(git rev-parse HEAD)
27 |
28 | sed "s,#VCS_VERSION#,${VCS_VERSION},;
29 | s,#DEVEL_VERSION_NUM#,${DEVEL_VERSION_NUM},;
30 | s,#COMMIT_NUM#,${COMMIT_NUM},;
31 | s,#SHORT_COMMIT#,${SHORT_COMMIT},;
32 | s,#COMMIT#,${COMMIT}," \
33 | packaging/fedora/ksh.spec.in > packaging/fedora/ksh.spec
34 |
35 | git archive --prefix "ast-${COMMIT}/" --format "tar.gz" HEAD -o "packaging/fedora/ksh-${SHORT_COMMIT}.tar.gz"
36 |
--------------------------------------------------------------------------------
/.cppcheck.rules:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 | wcwidth \(
10 |
11 | wcwidthForbidden
12 | warning
13 | Always use fish_wcwidth rather than wcwidth.
14 |
15 |
16 |
17 |
18 | wcswidth \(
19 |
20 | wcswidthForbidden
21 | warning
22 | Always use fish_wcswidth rather than wcswidth.
23 |
24 |
25 | <--!>
26 | ]]>
27 |
--------------------------------------------------------------------------------
/.cppcheck.suppressions:
--------------------------------------------------------------------------------
1 | // suppress all instances of varFuncNullUB: "Passing NULL after the last typed
2 | // argument to a variadic function leads to undefined behaviour." That's
3 | // because all the places we do this are valid and won't cause problems even
4 | // on a ILP64 platform because we're careful about using NULL rather than 0.
5 | varFuncNullUB
6 | // Suppress the warning about unmatched suppressions. At the moment these
7 | // warnings are emitted even when removing the suppression comment results in
8 | // the warning being suppressed. In other words this unmatchedSuppression
9 | // warnings are false positives.
10 | unmatchedSuppression
11 | // There is currently one function which triggers this warning multiple times:
12 | // src/cmd/ksh93/sh/io.c. Those warnings are all false positives. Suppressing
13 | // them with inline warnings is too hideous to allow so globally suppress them.
14 | resourceLeak
15 | // For the moment we ignore warnings about using non-reentrant functions when
16 | // a reentrant thread-safe variant exists. Since ksh is single-threaded this
17 | // isn't a problem although it could be is a third-party plugin created
18 | // threads that used any of these functions.
19 | getpwuidCalled
20 | ttynameCalled
21 | getloginCalled
22 | getpwnamCalled
23 | // The fallbacks.c module is likely to need cppcheck suppressions. But due to
24 | // how they are parsed, independent of any enclosing `#if` directives, they are
25 | // also likely to cause warnings like "Unmatched suppression: mktempCalled".
26 | unmatchedSuppression:../src/lib/libast/misc/fallbacks.c
27 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_size = 4
5 | indent_style = space
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 | max_line_length = 100
11 |
12 | [{Makefile,*.in}]
13 | indent_style = tab
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Template for bug reports
4 | ---
5 |
6 | **Description of problem:**
7 |
8 |
9 | **Ksh version:**
10 |
11 |
12 | **How reproducible:**
13 |
14 |
15 | **Steps to reproduce:**
16 | 1.
17 | 2.
18 | 3.
19 |
20 | **Actual results:**
21 |
22 |
23 | **Expected results:**
24 |
25 |
26 | **Additional info:**
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # There are some patterns below we include reluctantly. They should be in an
2 | # individual's ~/.config/git/ignore file. For example, ".DS_Store" for people
3 | # working on MacOS. We include them to help ensure they arent't added to the
4 | # project.
5 |
6 | # Files and file extensions that should never be checked in regardless of
7 | # which project directory they reside in.
8 | *.exe
9 | *.app
10 | *.so
11 | *.dylib
12 | *.dll
13 | *.lai
14 | *.la
15 | *.a
16 | *.lib
17 | *.o
18 | *.obj
19 | *.lo
20 | *.slo
21 | *.d
22 | *.gch
23 | *.pch
24 | *.bak
25 | *.new
26 | *.orig
27 | *.log
28 | *.DS_Store
29 | *~
30 | *~HEAD
31 | .AppleDouble
32 | .LSOverride
33 | .Trash-*
34 | ._*
35 | Desktop.ini
36 |
37 | # Artifacts of the build, install, and test process that should not be committed.
38 | build/
39 |
--------------------------------------------------------------------------------
/app-compat-travis.yml:
--------------------------------------------------------------------------------
1 | # Test compatibility with applications written in ksh
2 | sudo: required
3 |
4 | services:
5 | - docker
6 |
7 | matrix:
8 | include:
9 | - os: linux
10 | env:
11 | - PROJECT_NAME=kshdb
12 | GIT_URL="https://github.com/rocky/kshdb.git"
13 | COMMANDS="git checkout att-ksh93v-testing; ksh ./autogen.sh; make test"
14 |
15 | # These tests are run from yash fork that contains list of tests and a test runner script
16 | - os: linux
17 | env:
18 | - PROJECT_NAME="posix-shell-tests"
19 | GIT_URL="https://github.com/siteshwar/posix-shell-tests.git"
20 | COMMANDS="git checkout ksh-tests; cd src; LANG=C ./run-ksh-tests.sh"
21 |
22 | script:
23 | - docker pull fedora
24 |
25 | # Test builds from https://copr.fedorainfracloud.org/coprs/g/ksh/latest/
26 | - docker run fedora bash -c "
27 | dnf install -y 'dnf-command(copr)';
28 | dnf copr enable -y @ksh/latest;
29 | dnf install -y ksh git autoconf automake make findutils diffutils yash;
30 | git clone $GIT_URL;
31 | cd $PROJECT_NAME;
32 | $COMMANDS"
33 |
--------------------------------------------------------------------------------
/bin/README:
--------------------------------------------------------------------------------
1 | This directory is for commands that people working on this project might run.
2 | For example, to restyle the source code or run it through linting tools.
3 |
--------------------------------------------------------------------------------
/bin/shellcheck:
--------------------------------------------------------------------------------
1 | #!/bin/sh -x
2 | #
3 | # Run shellcheck on all scripts that are not unit test scripts. The latter
4 | # should not have a `#!/bin/sh` like shebang line. That will cause the `file`
5 | # command to not classify them as shell scripts. All other scripts, even those
6 | # meant to be `source`d or equivalent should have a shebang line that
7 | # identifies them as a shell script.
8 | #
9 | # shellcheck disable=SC2046
10 | shellcheck -s ksh $(find ./* -type f -print0 |
11 | xargs -0 file |
12 | grep -E '(shell|ksh) script' |
13 | cut -d':' -f1)
14 |
--------------------------------------------------------------------------------
/bin/trigger-app-compat-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Get current branch name
3 | # shellcheck disable=SC1117
4 | current=$(git rev-parse --abbrev-ref HEAD | tr -d "\n")
5 | git branch -D application_compatibility 2>/dev/null
6 | git checkout -b application_compatibility
7 | # Use custom .travis.yml file
8 | cp app-compat-travis.yml .travis.yml
9 | git commit -a -m "Trigger application compatibility tests"
10 | git push --force -u origin application_compatibility
11 | # Switch back to previous branch
12 | git checkout "$current"
13 |
--------------------------------------------------------------------------------
/bin/trigger-coverity-scan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Get current branch name
3 | # shellcheck disable=SC1117
4 | current=$(git rev-parse --abbrev-ref HEAD | tr -d "\n")
5 | # Coverity scan is triggered only for coverity_scan branch
6 | git branch -D coverity_scan 2>/dev/null
7 | git checkout -b coverity_scan
8 | # Use custom .travis.yml file for coverity
9 | cp coverity-travis.yml .travis.yml
10 | git commit -a -m "Trigger coverity scan"
11 | git push --force -u origin coverity_scan
12 | # Switch back to previous branch
13 | git checkout "$current"
14 |
--------------------------------------------------------------------------------
/coverity-travis.yml:
--------------------------------------------------------------------------------
1 | sudo: required
2 | language: c
3 | env:
4 | global:
5 | # COVERITY_SCAN_TOKEN
6 | - secure: "BsKgvr97ykXKfTwCHQshe4pUMsPySrbqDr1LC+8ixKap3GOHO9wz8sMlPHtIuYjMeJ7sRHiNpDcZ+GC3j3uwj3Wn+2mIIcPF/lefw6KZbxSmuPwELfXdI3MCZwOgZr2KfnsAPMbv7fWFTHwLYUCler8WI+ko9Yvc/ZC1w7hEiP8="
7 |
8 | before_install:
9 | - sudo apt-get update
10 | - sudo apt-get install python3-pip
11 | - sudo apt-get install python3-setuptools
12 | - sudo pip3 install meson==0.44.0
13 | # Ubuntu repositories have older version of ninja
14 | - wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
15 | - unzip ninja-linux.zip
16 | - mv ninja ~/bin
17 |
18 | script:
19 | - exit 0
20 |
21 | addons:
22 | coverity_scan:
23 | # GitHub project metadata
24 | project:
25 | name: ksh
26 |
27 | # Where email notification of build analysis results will be sent
28 | notification_email: svashisht@redhat.com
29 |
30 | # Commands to prepare for build_command
31 | build_command_prepend: meson -Dbuild-api-tests=false build
32 |
33 | # The command that will be added as an argument to "cov-build" to
34 | # compile your project for analysis,
35 | build_command: ninja -C build
36 |
37 | # Pattern to match selecting branches that will run analysis. We
38 | # recommend leaving this set to 'coverity_scan'. Take care in resource
39 | # usage, and consider the build frequency allowances per
40 | # https://scan.coverity.com/faq#frequency
41 | branch_pattern: coverity_scan
42 |
--------------------------------------------------------------------------------
/etc/README:
--------------------------------------------------------------------------------
1 | This directory is for files needed by the commands in the `bin` or `scripts`
2 | directory. These will typically be config files and the like for the tools
3 | used by those commands and scripts.
4 |
--------------------------------------------------------------------------------
/etc/hdrs.c:
--------------------------------------------------------------------------------
1 | // This is a trivial program used by the `lint` script to find out where the
2 | // compiler thinks the system headers live.
3 | #include
4 | int main() { return 0; }
5 |
--------------------------------------------------------------------------------
/features/README:
--------------------------------------------------------------------------------
1 | This directory contains code for platform feature detection. Such as which
2 | header files, functions, syscalls, system libraries are available. Also,
3 | whether syscalls/functions provide specific functionality. It does not
4 | contain any code directly included in `ksh` although it may generate
5 | files (both .h and .c) that are needed to build ksh. Those generated
6 | files should be placed in the `build` directory.
7 |
--------------------------------------------------------------------------------
/features/detect_nproc.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Exit with a status reflecting the CPU count if we can determine it. If not
4 | # assume two CPUs since at least one test, API/trehash.c, deadlocks if the CPU
5 | # count is one.
6 | nproc=''
7 | if getconf _NPROCESSORS_ONLN >/dev/null 2>&1
8 | then
9 | # Some systems have a getconf that supports this var. Use it in preference
10 | # to the options below because those other mechanisms include offline CPUs.
11 | nproc=$(getconf _NPROCESSORS_ONLN)
12 | elif type nproc >/dev/null 2>&1
13 | then
14 | # Linux and macOS but not other BSD.
15 | nproc=$(nproc)
16 | elif sysctl -n hw.ncpu >/dev/null 2>&1
17 | then
18 | # BSD
19 | nproc=$(sysctl -n hw.ncpu)
20 | fi
21 |
22 | if [ -z "$nproc" ]
23 | then
24 | nproc=2
25 | elif [ $nproc -lt 2 ]
26 | then
27 | nproc=2
28 | elif [ $nproc -gt 64 ]
29 | then
30 | nproc=64
31 | fi
32 | exit $nproc
33 |
--------------------------------------------------------------------------------
/features/detect_wsl.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Exit with a zero status if the system appears to be WSL (Windows Subsystem
4 | # for Linux).
5 | uname --kernel-release | grep -q 'Microsoft$'
6 |
--------------------------------------------------------------------------------
/features/dll/dynamic.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | extern struct link_dynamic _DYNAMIC;
5 |
6 | int main() { return _DYNAMIC.ld_version; }
7 |
--------------------------------------------------------------------------------
/features/fts.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {}
4 |
--------------------------------------------------------------------------------
/features/max_signum.c:
--------------------------------------------------------------------------------
1 | // This is used during the Meson config step to detect the largest signal number.
2 | // On some systems, such as FreeBSD, NSIG is incorrect but the platform does
3 | // define SIGRTMAX so check that first.
4 | #include
5 | #include
6 |
7 | int main() {
8 | #ifdef SIGRTMAX
9 | printf("%d\n", SIGRTMAX);
10 | return 0;
11 | #else // SIGRTMAX
12 | #ifdef _NSIG
13 | printf("%d\n", _NSIG - 1);
14 | return 0;
15 | #else // _NSIG
16 | #ifdef NSIG
17 | printf("%d\n", NSIG - 1);
18 | return 0;
19 | #else // NSIG
20 | return 1;
21 | #endif // NSIG
22 | #endif // _NSIG
23 | #endif // SIGRTMAX
24 | }
25 |
--------------------------------------------------------------------------------
/features/prog.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 | set -x
4 | for p in /proc/self/exe /proc/self/path/a.out
5 | do if test -e $p
6 | then echo "\"$p\""
7 | exit 0
8 | fi
9 | done
10 | exit 1
11 |
--------------------------------------------------------------------------------
/features/socketpair_shutdown.c:
--------------------------------------------------------------------------------
1 | // This is used during the Meson config step to detect whether the platform has `socketpair()`
2 | // behavior ksh needs.
3 | #include
4 | #include
5 | #include
6 |
7 | int main() {
8 | int sfd[2];
9 | struct stat st0;
10 | struct stat st1;
11 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sfd) < 0 || shutdown(sfd[0], 1) < 0 ||
12 | shutdown(sfd[1], 0) < 0) {
13 | return 1;
14 | }
15 | if (fstat(sfd[0], &st0) < 0 || fstat(sfd[1], &st1) < 0) {
16 | return 1;
17 | }
18 | if ((st0.st_mode & (S_IRUSR | S_IWUSR)) == S_IRUSR &&
19 | (st1.st_mode & (S_IRUSR | S_IWUSR)) == S_IWUSR) {
20 | return 1;
21 | }
22 | if (fchmod(sfd[0], S_IRUSR) < 0 || fstat(sfd[0], &st0) < 0 ||
23 | (st0.st_mode & (S_IRUSR | S_IWUSR)) != S_IRUSR) {
24 | return 1;
25 | }
26 | if (fchmod(sfd[1], S_IWUSR) < 0 || fstat(sfd[1], &st1) < 0 ||
27 | (st1.st_mode & (S_IRUSR | S_IWUSR)) != S_IWUSR) {
28 | return 1;
29 | }
30 | return 0;
31 | }
32 |
--------------------------------------------------------------------------------
/features/time/meson.build:
--------------------------------------------------------------------------------
1 | # This symbol also implies the availability of `clock_settime()` since the
2 | # presence of one should mean the other API exists.
3 | feature_data.set10('_lib_clock_gettime',
4 | cc.has_function('clock_gettime', prefix: '#include ', args: feature_test_args))
5 |
6 | # This symbol also implies the availability of `settimeofday()` since the
7 | # presence of one should mean the other API exists.
8 | feature_data.set10('_lib_gettimeofday',
9 | cc.has_function('gettimeofday', prefix: '#include ', args: feature_test_args))
10 |
--------------------------------------------------------------------------------
/features/utsname/meson.build:
--------------------------------------------------------------------------------
1 | feature_data.set10('_sys_syscall', cc.has_header('sys/syscall.h', args: feature_test_args))
2 | feature_data.set10('_sys_systeminfo', cc.has_header('sys/systeminfo.h', args: feature_test_args))
3 | feature_data.set10('_sys_syssgi', cc.has_header('sys/syssgi.h', args: feature_test_args))
4 |
5 | feature_data.set10('_lib_syscall',
6 | cc.has_function('syscall', prefix: '#include ', args: feature_test_args))
7 | feature_data.set10('_lib_systeminfo',
8 | cc.has_function('systeminfo', prefix: '#include ', args: feature_test_args))
9 |
--------------------------------------------------------------------------------
/lib/package/INIT.pkg:
--------------------------------------------------------------------------------
1 | INIT :PACKAGE:
2 |
3 | :CATEGORY: admin utils
4 |
5 | :INDEX: the package command with support scripts and utilities
6 |
7 | :DESCRIPTION:
8 | The INIT package is required by all but the standalone
9 | and self extracting archive packages. It contains
10 | the package command, support scripts, and utilities.
11 | The package command installs binary packages, makes
12 | source packages, and generates new package tarballs.
13 |
--------------------------------------------------------------------------------
/lib/package/INIT.req:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/lib/package/INIT.req
--------------------------------------------------------------------------------
/lib/package/INIT.ver:
--------------------------------------------------------------------------------
1 | INIT 2014-12-24 2014-12-24 1
2 |
--------------------------------------------------------------------------------
/lib/package/ast-ast.pkg:
--------------------------------------------------------------------------------
1 | ast-ast :PACKAGE: libast
2 |
3 | :LICENSE: *.open
4 |
5 | :CATEGORY: devel libs
6 |
7 | :INDEX: the ast library, period
8 |
9 | :DESCRIPTION:
10 | The AT&T Software Technology ast-ast package from AT&T Research
11 | contains the ast library.
12 |
--------------------------------------------------------------------------------
/lib/package/ast-base.pkg:
--------------------------------------------------------------------------------
1 | ast-base :PACKAGE: \
2 | ksh93 pax html proto bzip tw builtin libast libardir libcmd \
3 | libdll libexpr libodelta librecsort libsum libuu libvdelta \
4 | libbz libz tests coshell cpp cs mam msggen msgcc nmake probe ss \
5 | libcoshell libcs libmam libpp libcodex paxlib codexlib \
6 | libdss libpz dsslib libvcodex libvgraph vcodexlib
7 |
8 | :COVERS: ast-make ast-ksh ast-ast
9 |
10 | :LICENSE: *.open
11 |
12 | :CATEGORY: devel libs shells
13 |
14 | :INDEX: ksh, ksh builtin commands, pax, nmake, tw, sfio, and ast libraries
15 |
16 | :DESCRIPTION:
17 | The AT&T Software Technology ast-base package from AT&T Research
18 | contains commands and libraries required by all other ast based
19 | packages. Included are ksh93, ksh93 builtin commands, a pax that
20 | generates compact delta archives, nmake, coshell for network
21 | execution, a multi-dialect C preprocessor and companion library,
22 | and libraries shared by the other ast packages.
23 |
--------------------------------------------------------------------------------
/lib/package/ast-base.req:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/lib/package/ast-base.req
--------------------------------------------------------------------------------
/lib/package/ast-base.ver:
--------------------------------------------------------------------------------
1 | ast-base 2014-07-21 2014-07-21 1
2 |
--------------------------------------------------------------------------------
/lib/package/ast-dss.pkg:
--------------------------------------------------------------------------------
1 | ast-dss :PACKAGE: dss libdss libpz dsslib
2 |
3 | :REQUIRES: ast-base
4 |
5 | :LICENSE: *.(open|proprietary|special)
6 |
7 | :CATEGORY: algorithms database utils
8 |
9 | :INDEX: data stream scan command and support libraries
10 |
11 | :DESCRIPTION:
12 | The AT&T Software Technology ast-dss package from AT&T Research
13 | contains the dss command, plugins and support libraries.
14 |
--------------------------------------------------------------------------------
/lib/package/ast-ksh.req:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/lib/package/ast-ksh.req
--------------------------------------------------------------------------------
/lib/package/ast-ksh.ver:
--------------------------------------------------------------------------------
1 | ast-ksh 2014-12-24 2014-12-24 1
2 |
--------------------------------------------------------------------------------
/lib/package/ast-make.pkg:
--------------------------------------------------------------------------------
1 | ast-make :PACKAGE: \
2 | nmake cpp probe 3d ksh93 coshell cs ss pax paxlib tw \
3 | libast libardir libcmd libsum libdll libcoshell libpp
4 |
5 | :AUXILIARY: bin/proto bin/pax
6 |
7 | :LICENSE: *.open
8 |
9 | :COVERS: ast-ksh ast-ast
10 |
11 | :CATEGORY: devel libs shells
12 |
13 | :INDEX: ksh, pax, nmake
14 |
15 | :DESCRIPTION:
16 | The AT&T Software Technology ast-make package from AT&T Research
17 | contains an almost minimal set of commands and libraries required
18 | to run ast nmake. ksh, coshell, pax, tw, and the 3d user-level
19 | filesystem are also included.
20 |
--------------------------------------------------------------------------------
/lib/package/ast-make.req:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/lib/package/ast-make.req
--------------------------------------------------------------------------------
/lib/package/ast-make.ver:
--------------------------------------------------------------------------------
1 | ast-make 2014-03-17 2014-03-17 1
2 |
--------------------------------------------------------------------------------
/lib/package/ast-open.html:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/lib/package/ast-open.html
--------------------------------------------------------------------------------
/lib/package/ast-open.pkg:
--------------------------------------------------------------------------------
1 | ast-open :PACKAGE: \
2 | ksh93 kshlib pax html proto bzip libast libardir libcmd libdll \
3 | libexpr libodelta librecsort libsum libuu libvdelta libbz \
4 | libz tests coshell cpp cs mam msggen msgcc nmake probe ss \
5 | libcoshell libcs libmam libpp libcodex paxlib codexlib \
6 | at builtin codex dss dsslib ie mailx mam ncsl pack pzip \
7 | re sort sortlib std tksh tw warp libdss libpz \
8 | libtksh libtk vczip libvcodex libvgraph vcodexlib jcl libjcl fus3d
9 |
10 | :COVERS: ast-base ast-dss
11 |
12 | :LICENSE: *.open
13 |
14 | :CATEGORY: devel libs mail shells utils
15 |
16 | :INDEX: ksh, pax, nmake, sfio, and ast open source commands and libraries
17 |
18 | :DESCRIPTION:
19 | The AT&T Software Technology ast-open package from AT&T Research
20 | contains all of the ast open source commands and libraries.
21 |
--------------------------------------------------------------------------------
/lib/package/ast-open.req:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/lib/package/ast-open.req
--------------------------------------------------------------------------------
/lib/package/ast-open.ver:
--------------------------------------------------------------------------------
1 | ast-open 2014-12-24 2014-12-24 1
2 |
--------------------------------------------------------------------------------
/lib/package/ast.lic:
--------------------------------------------------------------------------------
1 | . ast.def
2 | . epl.def
3 | license+=(
4 | start=2011
5 | )
6 |
--------------------------------------------------------------------------------
/lib/package/bsd.lic:
--------------------------------------------------------------------------------
1 | . bsd.def
2 |
--------------------------------------------------------------------------------
/lib/package/epl.def:
--------------------------------------------------------------------------------
1 | license+=(
2 | type=epl
3 | id=eclipse
4 | name="Eclipse Public License"
5 | version=1.0
6 | url=http://www.eclipse.org/org/documents/${license.type}-v${license.version//./}.html
7 | urlmd5=b35adb5213ca9657e911e9befb180842
8 | )
9 |
--------------------------------------------------------------------------------
/lib/package/ksh.pkg:
--------------------------------------------------------------------------------
1 | ksh :PACKAGE:
2 |
3 | :LICENSE: *.open
4 |
5 | :CATEGORY: shells
6 |
7 | :INDEX: standalone AT&T ksh executable
8 |
9 | :DESCRIPTION:
10 | The AT&T Software Technology ksh package from AT&T Research
11 | contains the AT&T ksh executable implemented by David Korn.
12 | The download file is a gzipped ksh executable. If you want
13 | to build ksh from the source then download one of the ast-ksh,
14 | ast-base or ast-open packages.
15 |
--------------------------------------------------------------------------------
/lib/package/zlib.def:
--------------------------------------------------------------------------------
1 | message_set=20
2 |
3 | contributor+=(
4 | [jlg]="Jean-loup Gailly"
5 | [ma]="Mark Adler"
6 | )
7 |
8 | license+=(
9 | company="Jean-loup Gailly and Mark Adler"
10 |
11 | package=zlib
12 | since=1995
13 |
14 | type=zlib
15 | name="${license.package} Open Source"
16 | url=http://www.opensource.org/licenses/Zlib
17 | urlmd5=4cfd2c17b0340c2f3c80b577a8e45bee
18 |
19 | notice='
20 | This software is provided "as-is", without any express or implied
21 | warranty. In no event will the authors be held liable for any damages
22 | arising from the use of this software.
23 |
24 | Permission is granted to anyone to use this software for any purpose,
25 | including commercial applications, and to alter it and redistribute it
26 | freely, subject to the following restrictions:
27 |
28 | 1. The origin of this software must not be misrepresented; you must not
29 | claim that you wrote the original software. If you use this software
30 | in a product, an acknowledgment in the product documentation would
31 | be appreciated but is not required.
32 |
33 | 2. Altered source versions must be plainly marked as such, and must not
34 | be misrepresented as being the original software.
35 |
36 | 3. This notice may not be removed or altered from any source
37 | distribution.
38 | '
39 | )
40 |
--------------------------------------------------------------------------------
/lib/package/zlib.lic:
--------------------------------------------------------------------------------
1 | . zlib.def
2 |
--------------------------------------------------------------------------------
/packaging/debian/changelog:
--------------------------------------------------------------------------------
1 | ksh (#VERSION#) testing; urgency=low
2 |
3 | * Built from commit #COMMIT#
4 |
5 | #COMMIT#
6 |
7 | -- Siteshwar Vashisht #CHANGELOG_DATE#
8 |
--------------------------------------------------------------------------------
/packaging/debian/compat:
--------------------------------------------------------------------------------
1 | 9
2 |
--------------------------------------------------------------------------------
/packaging/debian/control:
--------------------------------------------------------------------------------
1 | Source: ksh
2 | Section: shells
3 | Priority: extra
4 | Maintainer: Siteshwar Vashisht
5 | Uploaders: Siteshwar Vashisht
6 | Build-Depends: debhelper (>= 10.3.0), meson
7 | Standards-Version: 3.9.4
8 | Homepage: http://kornshell.com/
9 | Vcs-Git: https://github.com/att/ast.git
10 | Vcs-Browser: https://github.com/att/ast
11 |
12 | Package: ksh
13 | Architecture: any
14 | Depends: ${shlibs:Depends}, ${misc:Depends}, man-db
15 | Description: The Original ATT Korn Shell
16 | KSH-93 is the most recent version of the KornShell by David Korn of
17 | AT&T Bell Laboratories.
18 | KornShell is a shell programming language, which is upward compatible
19 | with "sh" (the Bourne Shell).
20 |
21 | Package: ksh-dbg
22 | Architecture: any
23 | Section: debug
24 | Priority: extra
25 | Depends: ksh (= ${binary:Version}), ${misc:Depends}
26 | Description: Debugging symbols for KornShell
27 | KSH-93 is the most recent version of the KornShell by David Korn of
28 | AT&T Bell Laboratories.
29 | KornShell is a shell programming language, which is upward compatible
30 | with "sh" (the Bourne Shell). This package contains the debugging
31 | symbols for ksh.
32 |
--------------------------------------------------------------------------------
/packaging/debian/copyright:
--------------------------------------------------------------------------------
1 | Copyright: Copyright (c) 1982-2014 AT&T Intellectual Property
2 | License: Eclipse_Public_License_1.0
3 |
--------------------------------------------------------------------------------
/packaging/debian/ksh.dsc:
--------------------------------------------------------------------------------
1 | Format: 1.0
2 | Source: ksh
3 | Version: #VERSION#
4 | Binary: ksh
5 | Maintainer: Siteshwar Vashisht
6 | Architecture: any
7 | Build-Depends: debhelper (>= 10.3.0), meson
8 | Files:
9 | #MD5SUM# #FILESIZE# ksh_#VERSION#.orig.tar.gz
10 |
--------------------------------------------------------------------------------
/packaging/debian/ksh.install:
--------------------------------------------------------------------------------
1 | debian/tmp/usr/bin
2 | debian/tmp/usr/share/man/man1
3 |
--------------------------------------------------------------------------------
/packaging/debian/ksh.postinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # postinst script for ksh
3 | #
4 | # see: dh_installdeb(1)
5 |
6 | set -e
7 |
8 | # summary of how this script can be called:
9 | # * `configure'
10 | # * `abort-upgrade'
11 | # * `abort-remove' `in-favour'
12 | #
13 | # * `abort-remove'
14 | # * `abort-deconfigure' `in-favour'
15 | # `removing'
16 | #
17 | # for details, see http://www.debian.org/doc/debian-policy/ or
18 | # the debian-policy package
19 |
20 | add_shell() {
21 | if ! type add-shell > /dev/null 2>&1; then
22 | return
23 | fi
24 |
25 | add-shell /usr/bin/ksh
26 | }
27 |
28 | case "$1" in
29 | configure)
30 | add_shell
31 | ;;
32 |
33 | abort-upgrade|abort-remove|abort-deconfigure)
34 | ;;
35 |
36 | *)
37 | echo "postinst called with unknown argument \`$1'" >&2
38 | exit 1
39 | ;;
40 | esac
41 |
42 | # dh_installdeb will replace this with shell code automatically
43 | # generated by other debhelper scripts.
44 |
45 | #DEBHELPER#
46 |
47 | exit 0
48 |
--------------------------------------------------------------------------------
/packaging/debian/ksh.postrm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # postrm script for ksh
3 | #
4 | # see: dh_installdeb(1)
5 |
6 | set -e
7 |
8 | # summary of how this script can be called:
9 | # * `remove'
10 | # * `purge'
11 | # * `upgrade'
12 | # * `failed-upgrade'
13 | # * `abort-install'
14 | # * `abort-install'
15 | # * `abort-upgrade'
16 | # * `disappear'
17 | #
18 | # for details, see http://www.debian.org/doc/debian-policy/ or
19 | # the debian-policy package
20 |
21 |
22 | case "$1" in
23 | purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
24 | ;;
25 |
26 | *)
27 | echo "postrm called with unknown argument \`$1'" >&2
28 | exit 1
29 | ;;
30 | esac
31 |
32 | # dh_installdeb will replace this with shell code automatically
33 | # generated by other debhelper scripts.
34 |
35 | #DEBHELPER#
36 |
37 | exit 0
38 |
--------------------------------------------------------------------------------
/packaging/debian/ksh.prerm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # prerm script for ksh
3 | #
4 | # see: dh_installdeb(1)
5 |
6 | set -e
7 |
8 | # summary of how this script can be called:
9 | # * `remove'
10 | # * `upgrade'
11 | # * `failed-upgrade'
12 | # * `remove' `in-favour'
13 | # * `deconfigure' `in-favour'
14 | # `removing'
15 | #
16 | # for details, see http://www.debian.org/doc/debian-policy/ or
17 | # the debian-policy package
18 |
19 | remove_shell() {
20 | if ! type remove-shell > /dev/null 2>&1; then
21 | return
22 | fi
23 |
24 | remove-shell /usr/bin/ksh
25 | }
26 |
27 | case "$1" in
28 | remove|deconfigure)
29 | remove_shell
30 | ;;
31 |
32 | upgrade|failed-upgrade)
33 | ;;
34 |
35 | *)
36 | echo "prerm called with unknown argument \`$1'" >&2
37 | exit 1
38 | ;;
39 | esac
40 |
41 | # dh_installdeb will replace this with shell code automatically
42 | # generated by other debhelper scripts.
43 |
44 | #DEBHELPER#
45 |
46 | exit 0
47 |
--------------------------------------------------------------------------------
/packaging/debian/menu:
--------------------------------------------------------------------------------
1 | ?package(ksh):needs="text" section="Applications/Shells"\
2 | title="ksh" command="/usr/bin/ksh"
3 |
--------------------------------------------------------------------------------
/packaging/debian/rules:
--------------------------------------------------------------------------------
1 | #!/usr/bin/make -f
2 | # -*- makefile -*-
3 |
4 | # Uncomment this to turn on verbose mode.
5 | export DH_VERBOSE=1
6 |
7 | %:
8 | dh $@
9 |
10 | override_dh_auto_configure:
11 | # Note: Meson is only available for debhelper >= 10.3
12 | dh_auto_configure --buildsystem=meson --parallel -- -Dbuild-api-tests=false -Dfallback-version-number=#VCS_VERSION#
13 |
14 | override_dh_installdocs:
15 | dh_installdocs --link-doc=ksh
16 |
17 | # Still needed until all platforms have debhelper 9.20151219
18 | # Consider transitioning https://wiki.debian.org/DebugPackage
19 | override_dh_strip:
20 | dh_strip --dbg-package=ksh-dbg
21 |
22 | # Don't run tests; they don't work until ksh is installed
23 | override_dh_auto_test:
24 |
--------------------------------------------------------------------------------
/packaging/debian/source/format:
--------------------------------------------------------------------------------
1 | 3.0 (native)
2 |
--------------------------------------------------------------------------------
/packaging/fedora/.gitignore:
--------------------------------------------------------------------------------
1 | /ksh.spec
2 | /*.tar.gz
3 |
--------------------------------------------------------------------------------
/packaging/fedora/dotkshrc:
--------------------------------------------------------------------------------
1 | # .kshrc
2 |
3 | # Source global definitions
4 | if [ -f /etc/kshrc ]; then
5 | . /etc/kshrc
6 | fi
7 |
8 | # use emacs editing mode by default
9 | set -o emacs
10 |
11 | # User specific aliases and functions
12 |
13 |
--------------------------------------------------------------------------------
/packaging/fedora/kshcomp.conf:
--------------------------------------------------------------------------------
1 | :kshcomp:M::\x0b\x13\x08::/bin/ksh:
2 |
--------------------------------------------------------------------------------
/packaging/fedora/kshrc.rhs:
--------------------------------------------------------------------------------
1 | #
2 | # /etc/kshrc is sourced in interactive shells. It
3 | # should contain commands to set up aliases, functions,
4 | # options, key bindings, etc.
5 | #
6 |
7 | # Set prompts
8 | #PROMPT='[%n@%m]%~%# ' # default prompt
9 | #RPROMPT=' %~' # prompt for right side of screen
10 |
11 | _src_etc_profile_d()
12 | {
13 | # from zshrc, with ksh fixes
14 | if [[ ! -o login ]]; then # We're not a login shell
15 | for i in /etc/profile.d/*.sh; do
16 | if [ -r "$i" ]; then
17 | . $i
18 | fi
19 | done
20 | unset i
21 | fi
22 | }
23 |
24 | pathmunge () {
25 | case ":${PATH}:" in
26 | *:"$1":*)
27 | ;;
28 | *)
29 | if [ "$2" = "after" ]; then
30 | PATH=$PATH:$1
31 | else
32 | PATH=$1:$PATH
33 | fi
34 | esac
35 | }
36 |
37 | _src_etc_profile_d
38 |
39 | unset -f _src_etc_profile_d
40 | unset -f pathmunge
41 |
42 | # key bindings - make Delete, Home, End,... work
43 | keybd_trap () {
44 | case ${.sh.edchar} in
45 | $'\e[1~') .sh.edchar=$'\001';; # Home = beginning-of-line
46 | $'\e[F') .sh.edchar=$'\005';; # End = end-of-line
47 | $'\e[5~') .sh.edchar=$'\e>';; # PgUp = history-previous
48 | $'\e[6~') .sh.edchar=$'\e<';; # PgDn = history-next
49 | $'\e[3~') .sh.edchar=$'\004';; # Delete = delete-char
50 | esac
51 | }
52 | trap keybd_trap KEYBD
53 |
54 |
--------------------------------------------------------------------------------
/scripts/README:
--------------------------------------------------------------------------------
1 | This directory is for scripts (more generally, programs) used indirectly when
2 | building/testing the code (e.g., `meson test`) or by the commands in the `bin`
3 | directory.
4 |
--------------------------------------------------------------------------------
/scripts/build-on-docker.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | export DISTRO_TYPE=$1
5 |
6 | # shellcheck disable=SC1091
7 | source /source/scripts/travis_common.sh
8 |
9 | # See the "compiler: gcc" and INSTALL_REQUIREMENTS lines in the .travis.yml
10 | # config file. They had better be in agreement and both specify "gcc".
11 | # Strictly speaking this isn't necessary but is here to mirror what happens in
12 | # the non-Docker test environments (e.g., macOS).
13 | export CC=gcc
14 |
15 | # Git repo is mounted to this directory in docker
16 | cd /source
17 | mkdir build
18 | cd build
19 |
20 | echo ==== Configuring the build
21 | if ! meson -Dwarnings-are-errors=true --prefix="$(mktemp -dt ksh.XXXXXX)" \
22 | --buildtype=debug
23 | then
24 | cat meson-logs/meson-log.txt
25 | exit 1
26 | fi
27 |
28 | echo ==== Building the code
29 | echo CC=$CC
30 | ninja
31 |
32 | echo ==== Running unit tests
33 | ulimit -n 1024
34 | CORE_COUNT=$(nproc)
35 | export MESON_TESTTHREADS=$(( 4 * ${CORE_COUNT:-1} ))
36 | echo MESON_TESTTHREADS=$MESON_TESTTHREADS
37 |
38 | ninja install
39 | if ! meson test --setup=malloc
40 | then
41 | cat meson-logs/testlog-malloc.txt
42 | exit 1
43 | fi
44 |
--------------------------------------------------------------------------------
/scripts/build-on-macos.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo ==== Installing prereqs
5 | brew list
6 | # Note that python3 is already installed. As is python2. We need to unlink
7 | # python2 to avoid conflicts when meson is installed.
8 | brew unlink python@2
9 | brew install meson
10 | brew install sphinx
11 |
12 | . scripts/travis_common.sh
13 |
14 | mkdir build
15 | cd build
16 |
17 | echo ==== Configuring the build
18 | if ! meson -Dwarnings-are-errors=true --prefix="$(mktemp -dt ksh.XXXXXX)" \
19 | --buildtype=debug
20 | then
21 | cat meson-logs/meson-log.txt
22 | exit 1
23 | fi
24 |
25 | echo ==== Building the code
26 | echo " CC=$CC"
27 | ninja || exit
28 |
29 | echo ==== Running unit tests
30 | # shellcheck disable=SC2039
31 | ulimit -n 1024
32 | CORE_COUNT=$(sysctl -n hw.ncpu)
33 | export MESON_TESTTHREADS=$(( 2 * ${CORE_COUNT:-1} ))
34 | echo " CORE_COUNT=$CORE_COUNT MESON_TESTTHREADS=$MESON_TESTTHREADS"
35 |
36 | # Enable command auditing.
37 | echo "/tmp/ksh_auditfile;$(id -u)" | sudo tee /etc/ksh_audit
38 |
39 | ninja install
40 | if ! meson test -t2 --setup=malloc
41 | then
42 | cat meson-logs/testlog-malloc.txt
43 | exit 1
44 | fi
45 |
--------------------------------------------------------------------------------
/scripts/builtin_documentation.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Generate the source module containing the builtin command documentation from
3 | # the raw markup text.
4 | out_file="$MESON_BUILD_ROOT/$MESON_SUBDIR/documentation.c"
5 | exec > "$out_file"
6 | for in_file in "$MESON_SOURCE_ROOT/src/cmd/ksh93/docs/"*.1
7 | do
8 | cmd_name=$(basename "$in_file" .1)
9 | [ "$cmd_name" = ksh ] && continue
10 | echo "const char sh_opt${cmd_name}[] ="
11 | sed -e 's/\(.*\)/ "\1\\n"/' < "$in_file"
12 | echo ";"
13 | done
14 |
--------------------------------------------------------------------------------
/scripts/clang-asan.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Helper script to determine a couple of options needed when building with
4 | # clang and ASAN enabled.
5 | #
6 | rpath_arg=no
7 |
8 | for arg in $( clang -fsanitize=address -v -o /tmp/clang$$.out etc/hdrs.c 2>&1 | tail -1 )
9 | do
10 | if [ $rpath_arg = yes ]
11 | then
12 | rpath_arg=no
13 | echo "$arg"
14 | else
15 | case "$arg" in
16 | -rpath)
17 | rpath_arg=yes
18 | echo "$arg"
19 | ;;
20 | -lpthread)
21 | echo "$arg"
22 | ;;
23 | -L*)
24 | echo "$arg"
25 | ;;
26 | *libclang_rt.asan*)
27 | echo "$arg"
28 | ;;
29 | esac
30 | fi
31 | done
32 | rm /tmp/clang$$.out
33 |
--------------------------------------------------------------------------------
/scripts/create_rksh_symlink:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is used by a Meson custom_target() to create a "rksh" symlink to the
3 | # "ksh" binary. This is slightly convoluted to support platforms, such as
4 | # Cygwin, where the ksh binary might have an extension such as ".exe".
5 | cmd=$(basename "$1")
6 | cd "$(dirname "$1")" || exit 1
7 | rm -f "r$cmd"
8 | ln -s "$cmd" "r$cmd"
9 |
--------------------------------------------------------------------------------
/scripts/extract_flags:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | #
3 | # Usage: extract_flags input.json source_file
4 | #
5 | # This finds the named source_file in the compiler json file and writes all
6 | # the -D and -I flags from the build command for that source file to stdout.
7 | #
8 | import json
9 | import shlex
10 | import sys
11 |
12 | input_build_db = sys.argv[1]
13 | file_to_lint = sys.argv[2]
14 |
15 |
16 | # This assumes all the `-D` and `-I` flags we care about have the value
17 | # concatenated to the flag rather than separated by whitespace. If that
18 | # assumption ever becomes invalid this will need to become more complicated.
19 | def extract_defines(command_line):
20 | for token in shlex.split(command_line):
21 | if token.startswith("-D") or token.startswith("-I"):
22 | yield token
23 |
24 |
25 | input_json = json.load(open(input_build_db, mode='r'))
26 | output_json = []
27 | for file_item in input_json:
28 | if file_item["file"] == file_to_lint:
29 | for define in extract_defines(file_item["command"]):
30 | print(define, file=sys.stdout)
31 | break
32 |
33 | sys.exit(0)
34 |
--------------------------------------------------------------------------------
/scripts/fill_template.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import sys
3 |
4 | # Convert the sequence of key/value pairs on the command line into a dict.
5 | # Note that the first element of sys.argv is the script name which we ignore.
6 | i = iter(sys.argv[1:])
7 | data = dict(zip(i, i))
8 |
9 | # Slurp the template from stdin.
10 | template = sys.stdin.read()
11 |
12 | # Sub the data into the template.
13 | s = template.format(**data)
14 |
15 | # Write the document to stdout.
16 | print(s)
17 |
--------------------------------------------------------------------------------
/scripts/hosttype:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Generate the value for the HOSTTYPE macro. This used to be done by the
4 | # legacy Nmake *bin/package* command. This implementation is considerably
5 | # simpler and does not perform some of the dubious transformations of the
6 | # original. Such as changing `x86_64` to `i386`.
7 | #
8 | # See issue #297.
9 | #
10 | os_name=$(uname -s | tr '[:upper:]' '[:lower:]')
11 | hw_name=$(uname -m | tr '[:upper:]' '[:lower:]')
12 | # Cygwin on MS Windows is odd in that `uname -s` might output values like
13 | # `CYGWIN_NT-10.0` where we only want the prefix before the first underscore.
14 | if test "${os_name%_*}" = cygwin
15 | then
16 | os_name=cygwin
17 | fi
18 | echo "$os_name.$hw_name"
19 |
--------------------------------------------------------------------------------
/scripts/install_aux_files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # Do installation steps that are hard to do via standard Meson functions such
4 | # as `install_subdir()`.
5 | #
6 | # shellcheck disable=SC2016
7 | KSH_VERSION="$("$MESON_BUILD_ROOT/src/cmd/ksh93/ksh" -c 'echo ${.sh.version}')"
8 | export KSH_VERSION
9 |
10 | ksh_aux_dir="${MESON_INSTALL_DESTDIR_PREFIX}/share/ksh"
11 | ksh_man_dir="$ksh_aux_dir/man"
12 | ksh_man_src="$MESON_SOURCE_ROOT/src/cmd/ksh93/docs"
13 | umask 022
14 |
15 | set -x
16 | mkdir -m 755 "$ksh_aux_dir"
17 | mkdir -m 755 "$ksh_man_dir"
18 | mkdir -m 755 "$ksh_man_dir/man1"
19 |
20 | # Note: I can't figure out how to make Sphinx `make man` emit the
21 | # documentation in the expected hierachy under the _build dir. Since we
22 | # currently only care about section one (i.e., command) documentation force
23 | # those docs to be installed in that directory.
24 | cd "$ksh_man_src" || exit 99
25 | if [ -n "$(command -v sphinx-build)" ]
26 | then
27 | make clean
28 | make man
29 | fi
30 | cp _build/man/*.1 "$ksh_man_dir/man1"
31 |
32 | # Old versions of Meson (e.g., 0.44) don't recognize the `install_mode` option
33 | # of functions like `install_subdir()` and don't use sensible default
34 | # permissions (e.g., they have no public read/execute). So try to ensure all
35 | # the aux files have reasonable permissions.
36 | find "$ksh_aux_dir" -type d -print0 | xargs -0 chmod 755
37 | find "$ksh_aux_dir" -type f -print0 | xargs -0 chmod 644
38 |
--------------------------------------------------------------------------------
/scripts/libast_prereq.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This script does not do feature detection in the usual sense. In fact it
3 | # must be run after the normal Meson feature detection and the config_ast.h
4 | # header has been created. That is why it isn't part of the feature detection
5 | # code in the "features" subdirectory.
6 | #
7 | # This script creates dynamically generated source files. Which can involve
8 | # detecting whether the platform supports specific symbols (e.g.,
9 | # ABI_AIO_XFER_MAX) but that is secondary.
10 | #
11 | set -e
12 | bin_dir="$MESON_SOURCE_ROOT/bin"
13 | PATH=$bin_dir:$PATH
14 | INC_DIRS=""
15 | INC_DIRS="$INC_DIRS -I$MESON_BUILD_ROOT"
16 | INC_DIRS="$INC_DIRS -I$MESON_SOURCE_ROOT/src/lib/libast/include"
17 |
18 | if [ -z "$CC" ]
19 | then
20 | CC=cc
21 | fi
22 |
23 | cd "$MESON_BUILD_ROOT"
24 |
25 | # Generate header files whose content depends on the current platform.
26 | # shellcheck disable=SC2086
27 | $CC -D_BLD_DLL $INC_DIRS -std=gnu99 -o "sfinit" "$MESON_SOURCE_ROOT/etc/sfinit.c"
28 | ./sfinit > features/sfinit.h
29 |
--------------------------------------------------------------------------------
/scripts/partition_compile_db:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | #
3 | # Usage: partition_compile_commands input.json output.json defs source_file...
4 | #
5 | # This filters the contents of the input.json compile commands database to
6 | # output.json including only those source modules listed on our command line.
7 | #
8 | import json
9 | import sys
10 |
11 | input_build_db = sys.argv[1]
12 | output_build_db = sys.argv[2]
13 | files_to_lint = set(sys.argv[3:])
14 | source_files = []
15 |
16 | input_json = json.load(open(input_build_db, mode='r'))
17 | output_json = []
18 | for file_item in input_json:
19 | if file_item["file"] in files_to_lint:
20 | output_json.append(file_item)
21 | source_files.append(file_item["file"])
22 | files_to_lint.remove(file_item["file"])
23 |
24 | json.dump(output_json, open(output_build_db, mode='w'), indent=4)
25 | if files_to_lint:
26 | # There were source files for which we could not find a build rule.
27 | for f in sorted(files_to_lint):
28 | if f.startswith("../"):
29 | f = f[3:] # change "../src/..." to "src/..."
30 | print("WARN: No build rule so ignoring file: {!r}".format(f),
31 | file=sys.stderr)
32 |
33 | for f in sorted(source_files):
34 | print(f)
35 |
36 | sys.exit(0)
37 |
--------------------------------------------------------------------------------
/scripts/python.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #
3 | # This wraps the python scripts used during the build configuration phase. We
4 | # do this because we can't count on python to be in PATH under that name. It
5 | # might be installed as a large number of variants. Hence this script to try
6 | # and find it.
7 | #
8 | script=$1
9 | shift
10 |
11 | for name in python python3 python2 python3.6 python3.5 python2.7
12 | do
13 | path=$(command -v $name)
14 | if test -n "$path"
15 | then
16 | exec "$path" "$MESON_SOURCE_ROOT/scripts/$script" "$@"
17 | fi
18 | done
19 |
20 | echo Error: Could not find python under any of the names we know >&2
21 | find / -xdev -name python\* >&2
22 | exit 1
23 |
--------------------------------------------------------------------------------
/scripts/travis_common.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is meant to be sourced by the script that actually manages the build
3 | # and running the unit tests.
4 | #
5 | export LANG=en_US.UTF-8
6 |
7 | # Removing all the TRAVIS_*, NodeJS, Ruby and other irrelevant env vars. This
8 | # makes a huge difference in the size of the unit test logfile.
9 | unset GEM_HOME
10 | unset GEM_PATH
11 | unset HAS_JOSH_K_SEAL_OF_APPROVAL
12 | unset MANPATH
13 | unset MY_RUBY_HOME
14 | for v in $(env | sed -n -e '/^TRAVIS/s/=.*//p' -e '/^NVM/s/=.*//p' -e '/^rvm/s/=.*//p')
15 | do
16 | unset "$v"
17 | done
18 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/bltins/false.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | * *
3 | * This software is part of the ast package *
4 | * Copyright (c) 1982-2012 AT&T Intellectual Property *
5 | * and is licensed under the *
6 | * Eclipse Public License, Version 1.0 *
7 | * by AT&T Intellectual Property *
8 | * *
9 | * A copy of the License is available at *
10 | * http://www.eclipse.org/org/documents/epl-v10.html *
11 | * (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12 | * *
13 | * Information and Software Systems Research *
14 | * AT&T Research *
15 | * Florham Park NJ *
16 | * *
17 | * David Korn *
18 | * *
19 | ***********************************************************************/
20 | #include "config_ast.h" // IWYU pragma: keep
21 |
22 | //
23 | // Builtin `false`.
24 | //
25 | int b_false(int argc, char *argv[], Shbltin_t *context) {
26 | UNUSED(argc);
27 | UNUSED(argv[0]);
28 | UNUSED(context);
29 | return 1;
30 | }
31 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/bltins/meson.build:
--------------------------------------------------------------------------------
1 | ksh93_files += [
2 | 'bltins/alias.c',
3 | 'bltins/bg.c',
4 | 'bltins/break.c',
5 | 'bltins/builtin.c',
6 | 'bltins/cd.c',
7 | 'bltins/command.c',
8 | 'bltins/continue.c',
9 | 'bltins/disown.c',
10 | 'bltins/enum.c',
11 | 'bltins/echo.c',
12 | 'bltins/exec.c',
13 | 'bltins/exit.c',
14 | 'bltins/export.c',
15 | 'bltins/eval.c',
16 | 'bltins/false.c',
17 | 'bltins/fg.c',
18 | 'bltins/getopts.c',
19 | 'bltins/hist.c',
20 | 'bltins/jobs.c',
21 | 'bltins/kill.c',
22 | 'bltins/let.c',
23 | 'bltins/math.c',
24 | 'bltins/print.c',
25 | 'bltins/printf.c',
26 | 'bltins/pwd.c',
27 | 'bltins/read.c',
28 | 'bltins/readonly.c',
29 | 'bltins/return.c',
30 | 'bltins/set.c',
31 | 'bltins/shift.c',
32 | 'bltins/sleep.c',
33 | 'bltins/source.c',
34 | 'bltins/test.c',
35 | 'bltins/times.c',
36 | 'bltins/trap.c',
37 | 'bltins/true.c',
38 | 'bltins/typeset.c',
39 | 'bltins/ulimit.c',
40 | 'bltins/umask.c',
41 | 'bltins/unalias.c',
42 | 'bltins/unset.c',
43 | 'bltins/wait.c',
44 | 'bltins/whence.c'
45 | ]
46 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/bltins/true.c:
--------------------------------------------------------------------------------
1 | /***********************************************************************
2 | * *
3 | * This software is part of the ast package *
4 | * Copyright (c) 1982-2012 AT&T Intellectual Property *
5 | * and is licensed under the *
6 | * Eclipse Public License, Version 1.0 *
7 | * by AT&T Intellectual Property *
8 | * *
9 | * A copy of the License is available at *
10 | * http://www.eclipse.org/org/documents/epl-v10.html *
11 | * (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12 | * *
13 | * Information and Software Systems Research *
14 | * AT&T Research *
15 | * Florham Park NJ *
16 | * *
17 | * David Korn *
18 | * *
19 | ***********************************************************************/
20 | #include "config_ast.h" // IWYU pragma: keep
21 |
22 | //
23 | // Builtins `:` and `true`.
24 | //
25 | int b_true(int argc, char *argv[], Shbltin_t *context) {
26 | UNUSED(argc);
27 | UNUSED(argv[0]);
28 | UNUSED(context);
29 | return 0;
30 | }
31 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/cmds/meson.build:
--------------------------------------------------------------------------------
1 | # These modules contains builtins for standard commands.
2 | libcmd_files = [
3 | 'basename.c',
4 | 'cat.c',
5 | 'chmod.c',
6 | 'cmdinit.c',
7 | 'cmp.c',
8 | 'cut.c',
9 | 'dirname.c',
10 | 'head.c',
11 | 'logname.c',
12 | 'mkdir.c',
13 | 'sync.c',
14 | 'uname.c',
15 | 'wc.c',
16 | ]
17 |
18 | libcmd = library('cmd', libcmd_files, c_args: shared_c_args,
19 | include_directories: [configuration_incdir, ksh93_incdir],
20 | dependencies: libfts_dep,
21 | link_with: libast,
22 | install: get_option('default_library') == 'shared')
23 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/data/meson.build:
--------------------------------------------------------------------------------
1 | documentation_module = configure_file(output : 'documentation.c',
2 | command: [source_dir + '/scripts/builtin_documentation.sh'])
3 |
4 | ksh93_files += [
5 | 'data/aliases.c',
6 | 'data/builtins.c',
7 | 'data/keywords.c',
8 | 'data/lexstates.c',
9 | 'data/limits.c',
10 | 'data/msg.c',
11 | 'data/options.c',
12 | 'data/signals.c',
13 | 'data/strdata.c',
14 | 'data/testops.c',
15 | 'data/variables.c',
16 | # This file is dynamically constructed by the configure_file() directive above. It will be
17 | # removed in the future when the documentation format is changed to something more modern.
18 | # See https://github.com/att/ast/issues/507
19 | documentation_module,
20 | ]
21 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/README:
--------------------------------------------------------------------------------
1 | All reStructuredText (*.rst) files should follow the usual rules for line
2 | length such as imposted on the C source modules. That is, keep lines to
3 | 100 chars or less. Use the features of reStructuredText to automatically
4 | concatenate lines.
5 |
6 | The *.1 files in this directory don't follow the usual rules for line
7 | length as imposed on C source modules and other files such as this
8 | readme. Each paragraph should be a single line. This helps ensure that line
9 | wraps are made by the presentation mechanism which is in the best position
10 | to adapt the output to the display width. They will be removed once the
11 | conversion to Sphinx/reStructuredText based documentation is complete.
12 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/alias.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/alias.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/basename.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/basename.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/bg.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/bg.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/break.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/break.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/builtin.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/builtin.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/cat.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/cat.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/cd.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/cd.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/chmod.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/chmod.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/cmp.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/cmp.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/command.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/command.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/compgen.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/compgen.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/complete.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/complete.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/continue.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/continue.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/cut.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/cut.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/dirname.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/dirname.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/disown.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/disown.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/echo.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/echo.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/enum.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/enum.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/environment.pickle
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/eval.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/eval.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/exec.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/exec.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/exit.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/exit.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/export.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/export.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/fg.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/fg.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/head.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/head.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/hist.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/hist.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/index.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/jobs.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/jobs.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/kill.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/kill.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/ksh_intro.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/ksh_intro.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/let.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/let.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/logname.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/logname.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/mkdir.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/mkdir.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/print.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/print.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/printf.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/printf.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/pwd.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/pwd.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/read.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/read.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/readonly.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/readonly.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/return.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/return.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/shcomp.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/shcomp.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/shift.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/shift.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/sleep.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/sleep.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/source.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/source.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/sync.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/sync.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/test.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/test.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/times.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/times.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/trap.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/trap.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/ulimit.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/ulimit.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/umask.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/umask.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/unalias.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/unalias.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/uname.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/uname.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/unset.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/unset.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/wait.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/wait.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/wc.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/wc.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/doctrees/whence.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/docs/_build/doctrees/whence.doctree
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/man/break.1:
--------------------------------------------------------------------------------
1 | .\" Man page generated from reStructuredText.
2 | .
3 | .TH "BREAK" "1" "Oct 03, 2019" "" "Korn Shell"
4 | .SH NAME
5 | break \- break out of loop
6 | .
7 | .nr rst2man-indent-level 0
8 | .
9 | .de1 rstReportMargin
10 | \\$1 \\n[an-margin]
11 | level \\n[rst2man-indent-level]
12 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
13 | -
14 | \\n[rst2man-indent0]
15 | \\n[rst2man-indent1]
16 | \\n[rst2man-indent2]
17 | ..
18 | .de1 INDENT
19 | .\" .rstReportMargin pre:
20 | . RS \\$1
21 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
22 | . nr rst2man-indent-level +1
23 | .\" .rstReportMargin post:
24 | ..
25 | .de UNINDENT
26 | . RE
27 | .\" indent \\n[an-margin]
28 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 | .nr rst2man-indent-level -1
30 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
31 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
32 | ..
33 | .SH SYNOPSIS
34 | .nf
35 | break [n]
36 | .fi
37 | .sp
38 | .SH DESCRIPTION
39 | .sp
40 | \fBfg\fP is a shell special built\-in that exits the smallest enclosing
41 | for, select, while, or until loop, or the n\-th enclosing loop if n is
42 | specified. Execution continues at the command following the loop(s).
43 | .sp
44 | If \fBn\fP is given it must be a positive integer >= 1. If n is larger than
45 | the number of enclosing loops the last enclosing loop will be exited.
46 | .SH EXIT STATUS
47 | .sp
48 | 0
49 | .SH SEE ALSO
50 | .sp
51 | \fBcontinue\fP(1), \fBreturn\fP(1)
52 | .SH AUTHOR
53 | David J. Korn, et. al.
54 | .SH COPYRIGHT
55 | 2019, David J. Korn, et.al.
56 | .\" Generated by docutils manpage writer.
57 | .
58 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/man/continue.1:
--------------------------------------------------------------------------------
1 | .\" Man page generated from reStructuredText.
2 | .
3 | .TH "CONTINUE" "1" "Oct 03, 2019" "" "Korn Shell"
4 | .SH NAME
5 | continue \- continue execution at top of the loop
6 | .
7 | .nr rst2man-indent-level 0
8 | .
9 | .de1 rstReportMargin
10 | \\$1 \\n[an-margin]
11 | level \\n[rst2man-indent-level]
12 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
13 | -
14 | \\n[rst2man-indent0]
15 | \\n[rst2man-indent1]
16 | \\n[rst2man-indent2]
17 | ..
18 | .de1 INDENT
19 | .\" .rstReportMargin pre:
20 | . RS \\$1
21 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
22 | . nr rst2man-indent-level +1
23 | .\" .rstReportMargin post:
24 | ..
25 | .de UNINDENT
26 | . RE
27 | .\" indent \\n[an-margin]
28 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 | .nr rst2man-indent-level -1
30 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
31 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
32 | ..
33 | .SH SYNOPSIS
34 | .nf
35 | continue [n]
36 | .fi
37 | .sp
38 | .SH DESCRIPTION
39 | .sp
40 | \fBcontinue\fP is a shell special built\-in that continues execution at the
41 | top of smallest enclosing enclosing \fBfor\fP, \fBselect\fP, \fBwhile\fP, or \fBuntil\fP
42 | loop, if any; or the top of the \fIn\fP\-th enclosing loop if \fIn\fP is specified.
43 | .sp
44 | If \fIn\fP is given, it must be a positive integer >= 1. If \fIn\fP is larger
45 | than the number of enclosing loops, the last enclosing loop will be used.
46 | .SH SEE ALSO
47 | .sp
48 | \fBbreak\fP(1)
49 | .SH AUTHOR
50 | David J. Korn, et. al.
51 | .SH COPYRIGHT
52 | 2019, David J. Korn, et.al.
53 | .\" Generated by docutils manpage writer.
54 | .
55 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/man/logname.1:
--------------------------------------------------------------------------------
1 | .\" Man page generated from reStructuredText.
2 | .
3 | .TH "LOGNAME" "1" "Oct 03, 2019" "" "Korn Shell"
4 | .SH NAME
5 | logname \- return the user's login name
6 | .
7 | .nr rst2man-indent-level 0
8 | .
9 | .de1 rstReportMargin
10 | \\$1 \\n[an-margin]
11 | level \\n[rst2man-indent-level]
12 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
13 | -
14 | \\n[rst2man-indent0]
15 | \\n[rst2man-indent1]
16 | \\n[rst2man-indent2]
17 | ..
18 | .de1 INDENT
19 | .\" .rstReportMargin pre:
20 | . RS \\$1
21 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
22 | . nr rst2man-indent-level +1
23 | .\" .rstReportMargin post:
24 | ..
25 | .de UNINDENT
26 | . RE
27 | .\" indent \\n[an-margin]
28 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 | .nr rst2man-indent-level -1
30 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
31 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
32 | ..
33 | .SH SYNOPSIS
34 | .nf
35 | logname
36 | .fi
37 | .sp
38 | .SH DESCRIPTION
39 | .sp
40 | \fBlogname\fP writes the users\(aqs login name to standard output. The login
41 | name is the string that is returned by the \fBgetlogin\fP(2) function.
42 | If \fBgetlogin\fP(2) does not return successfully, the corresponding to
43 | the real user id of the calling process is used instead.
44 | .SH EXIT STATUS
45 | .INDENT 0.0
46 | .TP
47 | .B 0
48 | Successful Completion.
49 | .TP
50 | .B >0
51 | An error occurred.
52 | .UNINDENT
53 | .SH SEE ALSO
54 | .sp
55 | \fBgetlogin\fP(2)
56 | .SH AUTHOR
57 | David J. Korn, et. al.
58 | .SH COPYRIGHT
59 | 2019, David J. Korn, et.al.
60 | .\" Generated by docutils manpage writer.
61 | .
62 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_build/man/times.1:
--------------------------------------------------------------------------------
1 | .\" Man page generated from reStructuredText.
2 | .
3 | .TH "TIMES" "1" "Oct 03, 2019" "" "Korn Shell"
4 | .SH NAME
5 | times \- display CPU usage by the shell and child processes
6 | .
7 | .nr rst2man-indent-level 0
8 | .
9 | .de1 rstReportMargin
10 | \\$1 \\n[an-margin]
11 | level \\n[rst2man-indent-level]
12 | level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
13 | -
14 | \\n[rst2man-indent0]
15 | \\n[rst2man-indent1]
16 | \\n[rst2man-indent2]
17 | ..
18 | .de1 INDENT
19 | .\" .rstReportMargin pre:
20 | . RS \\$1
21 | . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
22 | . nr rst2man-indent-level +1
23 | .\" .rstReportMargin post:
24 | ..
25 | .de UNINDENT
26 | . RE
27 | .\" indent \\n[an-margin]
28 | .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 | .nr rst2man-indent-level -1
30 | .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
31 | .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
32 | ..
33 | .SH SYNOPSIS
34 | .nf
35 | times [flags]
36 | .fi
37 | .sp
38 | .SH DESCRIPTION
39 | .sp
40 | \fBtimes\fP shows the user mode and system mode CPU time used by the shell
41 | and all of its child processes.
42 | .SH SEE ALSO
43 | .sp
44 | \fBtime\fP(1)
45 | .SH AUTHOR
46 | David J. Korn, et. al.
47 | .SH COPYRIGHT
48 | 2019, David J. Korn, et.al.
49 | .\" Generated by docutils manpage writer.
50 | .
51 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_static/README:
--------------------------------------------------------------------------------
1 | This directory holds static content incorporated into Sphinx output.
2 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/_templates/README:
--------------------------------------------------------------------------------
1 | This directory holds HTML templates used to generate Sphinx output.
2 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/basename.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`basename` -- strip directory and suffix from filenames
4 | ==============================================================
5 |
6 | Synopsis
7 | --------
8 | | basename [flags] string [suffix]
9 | | basename [flags] string...
10 |
11 | Description
12 | -----------
13 | `basename` removes all leading directory components from the file name
14 | defined by *string*. If the file name defined by *string* has a suffix
15 | that ends in *suffix*, it is removed as well.
16 |
17 | If *string* consists solely of **/** characters the output will be a
18 | single **/**. Trailing **/** characters are removed, and if there are
19 | any remaining **/** characters in *string*, all characters up to and
20 | including the last **/** are removed. Finally, if *suffix* is specified,
21 | and is identical the end of *string*, these characters are removed. The
22 | characters not removed from *string* will be written on a single line to
23 | the standard output.
24 |
25 | .. index:: builtin
26 |
27 | **This command is not enabled by default.** To enable it run `builtin basename`.
28 |
29 | Flags
30 | -----
31 | :-a, --all: All operands are treated as *string* and each modified pathname
32 | is printed on a separate line on the standard output.
33 |
34 | :-s, --suffix: All operands are treated as *string* and each modified
35 | pathname, with *suffix* removed if it exists, is printed on a separate
36 | line on the standard output.
37 |
38 |
39 | Exit Status
40 | -----------
41 | :0: Successful completion.
42 |
43 | :>0: An error occurred.
44 |
45 | See Also
46 | --------
47 | `dirname`\(1), `basename`\(3)
48 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/bg.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`bg` -- resume jobs in the background
4 | ============================================
5 |
6 | Synopsis
7 | --------
8 | | bg [job ...]
9 |
10 |
11 | Description
12 | -----------
13 | `bg` places the given *job*\ s into the background and sends them a
14 | `CONT` signal to start them running. If *job* is omitted, the most
15 | recently started or stopped background job is resumed or continued in
16 | the background.
17 |
18 | Each *job* can be specified in one of the following ways:
19 |
20 | :*int*: Refers to a process id (pid).
21 | :`%`\ *int*: Refers to a job number.
22 | :`%`\ *str*: Refers to a job whose name begins with *str*.
23 | :`%?`\ *str*: Refers to a job whose name contains *str*.
24 | :`%%`: Refers to the current job.
25 | :`%+`: Refers to the current job.
26 | :`%-`: Refers to the previous job.
27 |
28 | Exit Status
29 | -----------
30 | :0: If all background jobs are started.
31 |
32 | :>0: If one more jobs does not exist or there are no background jobs.
33 |
34 | See Also
35 | --------
36 | `wait`\(1), `fg`\(1), `disown`\(1), `jobs`\(1)
37 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/break.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`break` -- break out of loop
4 | ===================================
5 |
6 | Synopsis
7 | --------
8 | | break [n]
9 |
10 | Description
11 | -----------
12 | `fg` is a shell special built-in that exits the smallest enclosing
13 | for, select, while, or until loop, or the n-th enclosing loop if n is
14 | specified. Execution continues at the command following the loop(s).
15 |
16 | If `n` is given it must be a positive integer >= 1. If n is larger than
17 | the number of enclosing loops the last enclosing loop will be exited.
18 |
19 | Exit Status
20 | -----------
21 | 0
22 |
23 | See Also
24 | --------
25 | `continue`\(1), `return`\(1)
26 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/continue.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`continue` -- continue execution at top of the loop
4 | ==========================================================
5 |
6 | Synopsis
7 | --------
8 | | continue [n]
9 |
10 | Description
11 | -----------
12 | `continue` is a shell special built-in that continues execution at the
13 | top of smallest enclosing enclosing `for`, `select`, `while`, or `until`
14 | loop, if any; or the top of the *n*-th enclosing loop if *n* is specified.
15 |
16 | If *n* is given, it must be a positive integer >= 1. If *n* is larger
17 | than the number of enclosing loops, the last enclosing loop will be used.
18 |
19 | See Also
20 | --------
21 | `break`\(1)
22 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/dirname.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`dirname` -- return directory portion of file name
4 | =========================================================
5 |
6 | Synopsis
7 | --------
8 | | dirname string
9 |
10 | Description
11 | -----------
12 | `dirname` treats *string* as a file name and returns the name of the
13 | directory containing the file name by deleting the last component from
14 | *string*.
15 |
16 | If *string* consists solely of `/` characters the output will be a single
17 | `/`. Trailing `/` characters are removed, and if there are no remaining
18 | `/` characters in *string*, the string `.` will be written to standard
19 | output. Otherwise, all characters following the last `/` are removed.
20 | If the remaining string consists solely of `/` characters, the output
21 | will be as if the original string had consisted solely as `/` characters
22 | as described above. Otherwise, all trailing slashes are removed and the
23 | output will be this string unless this string is empty. If empty the
24 | output will be `.`.
25 |
26 | Flags
27 | -----
28 | :-f, --file: Print the `$PATH` relative regular file path for *string*.
29 |
30 | :-r, --relative: Print the `$PATH` relative readable file path for *string*.
31 |
32 | :-x, --executable: Print the `$PATH` relative executable file path for *string*.
33 |
34 | Exit Status
35 | -----------
36 | :0: Successful Completion.
37 |
38 | :>0: An error occurred.
39 |
40 | See Also
41 | --------
42 | basename`\(1), `getconf`\(1), `dirname`\(3), `pathname`\(3)
43 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/disown.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`disown` -- disassociate a job from the current shell
4 | ============================================================
5 |
6 | Synopsis
7 | --------
8 | | disown [job ...]
9 |
10 | Description
11 | -----------
12 | `disown` prevents the current shell from sending a `HUP` signal to
13 | each of the given *job*\s when the current shell terminates a login session.
14 |
15 | If *job* is omitted, the most recently started or stopped background job
16 | is used.
17 |
18 | Each *job* can be specified as one of the following:
19 |
20 | :*number*: *number* refers to a process id.
21 |
22 | :-*number*: *number* refers to a process group id.
23 |
24 | :%*number*: *number* refer to a job number.
25 |
26 | :%*string*: Refers to a job whose name begins with *string*.
27 |
28 | :%??*string*: Refers to a job whose name contains *string*.
29 |
30 | :%+ `or` %%: Refers to the current job.
31 |
32 | :%-: Refers to the previous job.
33 |
34 | Exit Status
35 | -----------
36 | :0: If all jobs are successfully disowned.
37 |
38 | :>0: If one more *job*\s does not exist.
39 |
40 | See Also
41 | --------
42 | `wait`\(1), `bg`\(1), `jobs`\(1)
43 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/echo.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`echo` -- output a line of text
4 | ======================================
5 |
6 | Synopsis
7 | --------
8 | | echo [-n] [-e] [arg...]
9 |
10 | Description
11 | -----------
12 | `echo` builtin prints all of its arguments separated by space and
13 | terminated by newline.
14 |
15 | You should avoid using this command unless you need compatibility with
16 | non-ksh shells like bash. Use `print` instead. That's because whether or
17 | not the `-e` and `-n` flags are available depends on whether the shell is
18 | in *att* or *bsd* mode as determined by `$PATH`..
19 |
20 | Flags
21 | -----
22 | :-e: Enable interpreting escape sequences.
23 | Only available in the *bsd* universe.
24 | In the *att* universe this flag is printed verbatim.
25 |
26 | :-n: Skip putting a newline character at the end of the output.
27 | Only available in the *bsd* universe.
28 | In the *att* universe this flag is printed verbatim.
29 |
30 | Exit Status
31 | -----------
32 | :0: Successful completion.
33 |
34 | :>0: An error such as an invalid flag occurred.
35 |
36 | See Also
37 | --------
38 | `print`\(1), `printf`\(1)
39 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/enum.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`enum` -- create an enumeration type
4 | ===========================================
5 |
6 | Synopsis
7 | --------
8 | | enum [flags] *typename*[ `=(` *value* ... `)` ]
9 |
10 | Description
11 | -----------
12 | `enum` is a declaration command that creates an enumeration type *typename*
13 | that can only store any one of the values in the indexed array variable
14 | *typename*.
15 |
16 | If the list of *value*s is omitted, then *typename* must name an indexed
17 | array variable with at least two elements.
18 |
19 | When an enumeration variable is used in an arithmetic expression, its
20 | value is the index into the array that defined it starting from index
21 | 0. Enumeration strings can be used in an arithmetic expression when
22 | comparing against an enumeration variable.
23 |
24 | The enum `_Bool` exists by default with values `true` and `false`. The
25 | predefined alias `bool` is defined as `_Bool`.
26 |
27 | Flags
28 | -----
29 | :-i, --ignorecase: The values are case insensitive.
30 |
31 | :-p: Writes the enums to standard output. If *typename* is omitted
32 | then all `enum`\s are written.
33 |
34 | Exit Status
35 | -----------
36 | :0: Successful completion.
37 |
38 | :>0: An error occurred.
39 |
40 | See Also
41 | --------
42 | `typeset`\(1).
43 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/eval.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`eval` -- create a shell command and process it
4 | ======================================================
5 |
6 | Synopsis
7 | --------
8 | | eval [arg ...]
9 |
10 | Description
11 | -----------
12 | `eval` is a shell special built-in command that constructs a command
13 | by concatenating the *arg*s together, separating each with a space.
14 | The resulting string is then taken as input to the shell and evaluated
15 | in the current environment. Note that command words are expanded twice;
16 | once to construct *arg*, and again when the shell executes the constructed
17 | command.
18 |
19 | It is not an error if *arg* is not given.
20 |
21 | Exit Status
22 | -----------
23 | If *arg* is not specified, the exit status is `0`. Otherwise, it is the
24 | exit status of the command defined by the *arg* operands.
25 |
26 | See Also
27 | --------
28 | `exec`\(1), `trap`\(1), `.`\(1)
29 |
30 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/exit.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`exit` -- exit the current shell
4 | =======================================
5 |
6 | Synopsis
7 | --------
8 | | exit [n]
9 |
10 | Description
11 | -----------
12 | `exit` is shell special built-in that causes the shell that invokes it
13 | to exit. Before exiting the shell, if the `EXIT` trap is set it will
14 | be invoked.
15 |
16 | If *n* is given, it will be used to set the exit status.
17 |
18 | Exit Status
19 | -----------
20 | If *n* is specified, the exit status is the least significant eight bits
21 | of the value of *n*. Otherwise, the exit status is the exit status of
22 | the preceding command. When invoked inside a trap, the preceding command
23 | means the command that invoked the trap.
24 |
25 | See Also
26 | --------
27 | `break`\(1), `return`\(1)
28 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/export.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`export` -- set export attribute on variables
4 | ====================================================
5 |
6 | Synopsis
7 | --------
8 | | export [flags] [name[=value]...]
9 |
10 | Description
11 | -----------
12 | `export` sets the export attribute on each of the variables specified
13 | by *name* which causes them to be in the environment of subsequently
14 | executed commands. If `=`\ *value* is specified, the variable *name*
15 | is set to *value*.
16 |
17 | If no *name*\s are specified then the names and values of all exported
18 | variables are written to standard output.
19 |
20 | `export` is built-in to the shell as a declaration command so that field
21 | splitting and pathname expansion are not performed on the arguments.
22 | Tilde expansion occurs on *value*.
23 |
24 | Flags
25 | -----
26 | :-n: Remove the variable from the export list.
27 |
28 | :-p: Causes the output to be in the form of `export` commands that can
29 | be used as input to the shell to recreate the current exports.
30 |
31 | Exit Status
32 | -----------
33 | :0: Successful completion.
34 |
35 | :>0: An error occurred.
36 |
37 | See Also
38 | --------
39 | `sh`\(1), `declare`\(1), `typeset`\(1)
40 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/fg.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`fg` -- move jobs to the foreground
4 | ==========================================
5 |
6 | Synopsis
7 | --------
8 | | fg [job ...]
9 |
10 | Description
11 | -----------
12 | `fg` places the given *job*\ s into the foreground and sends them a `CONT`
13 | signal to start them running. If *job* is omitted, the most recently
14 | started or stopped background job is moved to the foreground.
15 |
16 | Each *job* can be specified in one of the following ways:
17 |
18 | :*int*: Refers to a process id (pid).
19 | :`%`\ *int*: Refers to a job number.
20 | :`%`\ *str*: Refers to a job whose name begins with *str*.
21 | :`%?`\ *str*: Refers to a job whose name contains *str*.
22 | :`%%`: Refers to the current job.
23 | :`%+`: Refers to the current job.
24 | :`%-`: Refers to the previous job.
25 |
26 | Exit Status
27 | -----------
28 | If `fg` brings one or more jobs into the foreground, the exit status of
29 | `fg` will be that of the last job. If one or more jobs does not exist or
30 | has completed, `fg` will return a non-zero exit status.
31 |
32 | See Also
33 | --------
34 | `wait`\(1), `bg`\(1), `disown`\(1), `jobs`\(1)
35 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/head.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`head` -- output beginning portion of one or more files
4 | ==============================================================
5 |
6 | Synopsis
7 | --------
8 | | head [flags] [file ...]
9 |
10 | Description
11 | -----------
12 | `head` copies one or more input files to standard output stopping at a
13 | designated point for each file or to the end of the file whichever comes
14 | first. Copying ends at the point indicated by the options. By default a
15 | header of the form `==> `\ *filename*\ ` <==` is output before all but the
16 | first file but this can be changed with the `-q` and `-v` options.
17 |
18 | If no *file* is given, or if the *file* is `-`, `head` copies from standard
19 | input starting at the current location.
20 |
21 | The option argument for `-c`, and `-s` can optionally be followed by
22 | one of the following characters to specify a different unit other than
23 | a single byte:
24 |
25 | :b: 512 bytes.
26 | :k: 1-killobyte.
27 | :m: 1-megabyte.
28 |
29 | Flags
30 | -----
31 | For backwards compatibility, `-`\ *number* is equivalent to `-n` *number*.
32 |
33 | :-n, --lines=*n*: Copy *n* lines from each file. The default is 10.
34 |
35 | :-c, --bytes=*n*: Copy *n* bytes from each file.
36 |
37 | :-q, --quiet, --silent: Never output filename headers.
38 |
39 | :-s, --skip=*n*: Skip *n* characters or lines from each file before copying.
40 |
41 | :-v, --verbose: Always output filename headers.
42 |
43 | Exit Status
44 | -----------
45 | :0: All files copied successfully.
46 |
47 | :>0: One or more files did not copy.
48 |
49 | See Also
50 | --------
51 | `cat`\(1), `tail`\(1)
52 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/index.rst:
--------------------------------------------------------------------------------
1 | Welcome to the Korn Shell
2 | =========================
3 |
4 | .. toctree::
5 | :maxdepth: 2
6 | :caption: Overviews:
7 |
8 | ksh_intro
9 | shcomp
10 |
11 | .. toctree::
12 | :maxdepth: 1
13 | :caption: Special Builtins:
14 |
15 | alias
16 | bg
17 | break
18 | builtin
19 | cd
20 | command
21 | compgen
22 | complete
23 | continue
24 | disown
25 | echo
26 | enum
27 | eval
28 | exec
29 | exit
30 | export
31 | fg
32 | hist
33 | jobs
34 | kill
35 | let
36 | print
37 | printf
38 | pwd
39 | read
40 | readonly
41 | return
42 | shift
43 | sleep
44 | source
45 | test
46 | times
47 | trap
48 | ulimit
49 | umask
50 | unalias
51 | unset
52 | wait
53 | whence
54 |
55 | .. toctree::
56 | :maxdepth: 1
57 | :caption: Command Builtins:
58 |
59 | basename
60 | cat
61 | chmod
62 | cmp
63 | cut
64 | dirname
65 | head
66 | logname
67 | mkdir
68 | sync
69 | uname
70 | wc
71 |
72 | Indices and tables
73 | ==================
74 |
75 | * :ref:`genindex`
76 | * :ref:`search`
77 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/ksh_intro.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | KSH Introduction
4 | ================
5 |
6 | This will eventually have a useful overview of, or introduction to, the
7 | `ksh` program.
8 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/let.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`let` -- evaluate arithmetic expressions
4 | ===============================================
5 |
6 | Synopsis
7 | --------
8 | | let [expr ...]
9 |
10 | Description
11 | -----------
12 | `let` evaluates each *expr* in the current shell environment as an
13 | arithmetic expression using ANSI C syntax. Variables names are shell
14 | variables and they are recursively evaluated as arithmetic expressions
15 | to get numerical values.
16 |
17 | `let` has been made obsolete by the `((` ... `))` syntax of `ksh`\(1)
18 | which does not require quoting of the operators to pass them as command
19 | arguments.
20 |
21 | Exit Status
22 | -----------
23 | :0: The last *expr* evaluates to a non-zero value.
24 |
25 | :>0: The last *expr* evaluates to `0` or an error occurred.
26 |
27 | See Also
28 | --------
29 | `expr`\(1), `test`\(1), `ksh`\(1)
30 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/logname.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`logname` -- return the user's login name
4 | ================================================
5 |
6 | Synopsis
7 | --------
8 | | logname
9 |
10 | Description
11 | -----------
12 | `logname` writes the users's login name to standard output. The login
13 | name is the string that is returned by the `getlogin`\(2) function.
14 | If `getlogin`\(2) does not return successfully, the corresponding to
15 | the real user id of the calling process is used instead.
16 |
17 | Exit Status
18 | -----------
19 | :0: Successful Completion.
20 | :>0: An error occurred.
21 |
22 | See Also
23 | --------
24 | `getlogin`\(2)
25 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/meson.build:
--------------------------------------------------------------------------------
1 | #
2 | # Install the man pages. If /usr/local is the install prefix this will put the `ksh` man page in the
3 | # default man page directory: /usr/local/share/man/man1. The man pages for individual builtins will
4 | # be installed in /usr/local/share/ksh/man.
5 | #
6 | install_man('ksh.1', install_mode: 'rw-r--r--')
7 |
8 | # See also scripts/install_aux_files.sh which takes care of installing the private man pages.
9 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/mkdir.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`mkdir` -- make directories
4 | ==================================
5 |
6 | Synopsis
7 | --------
8 | | mkdir [flags] directory ...
9 |
10 | Description
11 | -----------
12 | `mkdir` creates one or more directories. By default, the mode of created
13 | directories is `a=rwx` minus the bits set in the `umask`\(1).
14 |
15 | Flags
16 | -----
17 | :-m, --mode=*mode*: Set the mode of created directories to *mode*. *mode*
18 | is symbolic or octal mode as in `chmod`\(1). Relative modes assume an
19 | initial mode of `a=rwx`.
20 |
21 | :-p, --parents: Create any missing intermediate pathname components. For
22 | each dir operand that does not name an existing directory, effects
23 | equivalent to those caused by the following command shall occur: \vmkdir -p
24 | -m $(umask -S),u+wx $(dirname dir) && mkdir [-m mode]] dir\v where the `-m`
25 | mode option represents that option supplied to the original invocation of
26 | `mkdir`, if any. Each dir operand that names an existing directory shall
27 | be ignored without error.
28 |
29 | :-v, --verbose: Print a message on the standard error for each created directory.
30 |
31 |
32 | Exit Status
33 | -----------
34 | :0: All directories created successfully, or the `-p` option was
35 | specified and all the specified directories now exist.
36 |
37 | :>0: An error occurred.
38 |
39 | See Also
40 | --------
41 | `chmod`\(1), `rmdir`\(1), `umask`\(1)
42 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/pwd.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`pwd` -- write working directory name
4 | ============================================
5 |
6 | Synopsis
7 | --------
8 | | pwd [flags]
9 |
10 | Description
11 | -----------
12 | `pwd` writes an absolute pathname of the current working directory to
13 | standard output. An absolute pathname is a pathname that begins with
14 | `/` that does not contains any `.` or `..` components.
15 |
16 | If both `-L` and `-P` are specified, the last one specified will be used.
17 | If neither `-P` or `-L` is specified the default behavior is as if `-L`
18 | was specified.
19 |
20 | Flags
21 | -----
22 | :-L: The absolute pathname may contains symbolic link components. This is
23 | the default.
24 |
25 | :-P: The absolute pathname will not contain any symbolic link components.
26 |
27 | :-f *fd*: Print the directory name for the open directory file descriptor
28 | *fd*. Cannot be combined with other options.
29 |
30 | Exit Status
31 | -----------
32 | :0: Successful completion.
33 |
34 | :>0: An error occurred.
35 |
36 | See Also
37 | --------
38 | `cd`\(1), `getconf`\(1), `readlink`\(1), `realpath`\(1)
39 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/readonly.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`readonly` -- set readonly attribute on variables
4 | ========================================================
5 |
6 | Synopsis
7 | --------
8 | | readonly [flags] [name[=value]...]
9 |
10 | Description
11 | -----------
12 | `readonly` sets the readonly attribute on each of the variables specified
13 | by *name* which prevents their values from being changed. If `=`\ *value*
14 | is specified, the variable *name* is set to *value* before the variable
15 | is made readonly.
16 |
17 | Within a type definition, if the value is not specified, then a value
18 | must be specified when creating each instance of the type and the value
19 | is readonly for each instance.
20 |
21 | If no *name*\s are specified then the names and values of all readonly
22 | variables are written to standard output.
23 |
24 | `readonly` is built-in to the shell as a declaration command so that
25 | field splitting and pathname expansion are not performed on the arguments.
26 | Tilde expansion occurs on *value*.
27 |
28 | Flags
29 | -----
30 | :-p: Causes the output to be in a form of `readonly` commands that can
31 | be used as input to the shell to recreate the current set of readonly
32 | variables.
33 |
34 | Exit Status
35 | -----------
36 | :0: Successful completion.
37 |
38 | :>0: An error occurred.
39 |
40 | See Also
41 | --------
42 | `sh`\(1), `declare`\(1), `typeset`\(1)
43 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/return.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`return` -- return from a function or dot script
4 | =======================================================
5 |
6 | Synopsis
7 | --------
8 | | return [n]
9 |
10 | Description
11 | -----------
12 | `return` is a shell special built-in that causes the function or dot
13 | script that invokes it to exit. If `return` is invoked outside of a
14 | function or dot script it is equivalent to `exit`.
15 |
16 | If `return` is invoked inside a function defined with the `function`
17 | reserved word syntax, then any `EXIT` trap set within the then function
18 | will be invoked in the context of the caller before the function returns.
19 |
20 | If *n* is given it will be used to set the exit status.
21 |
22 | Exit Status
23 | -----------
24 | If *n* is specified, the exit status is the least significant eight bits
25 | of the value of *n*. Otherwise, the exit status is the exit status of
26 | preceding command.
27 |
28 | See Also
29 | --------
30 | `break`\(1), `exit`\(1)
31 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/shcomp.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`shcomp` -- compile a shell script
4 | =========================================
5 |
6 | Synopsis
7 | --------
8 | | shcomp [flags] [infile [outfile]]
9 |
10 | Description
11 | -----------
12 | Unless `-D` is specified, `shcomp` takes a shell script, *infile*, and creates a binary format file, *outfile*, that `ksh` can read and execute with the same effect as the original script.
13 |
14 | Since aliases are processed as the script is read, alias definitions whose value requires variable expansion will not work correctly.
15 |
16 | If `-D` is specified, all double quoted strings that are preceded by `$` are output. These are the messages that need to be translated to locale specific versions for internationalization.
17 |
18 | If *outfile* is omitted, then the results will be written to standard output. If *infile* is also omitted, the shell script will be read from standard input.
19 |
20 | Flags
21 | -----
22 | :-D, --dictionary: Generate a list of strings that need to be placed in
23 | a message catalog for internationalization.
24 |
25 | :-n, --noexec: Displays warning messages for obsolete or non-conforming constructs.
26 |
27 | :-v, --verbose: Displays input from *infile* onto standard error as it reads it.
28 |
29 | Exit Status
30 | -----------
31 | :0: Successful completion.
32 |
33 | :>0: An error occurred.
34 |
35 | See Also
36 | --------
37 | `ksh`\(1)
38 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/shift.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`shift` -- shift positional parameters
4 | =============================================
5 |
6 | Synopsis
7 | --------
8 | | shift [n]
9 |
10 | Description
11 | -----------
12 | `shift` is a shell special built-in that shifts the positional parameters
13 | to the left by the number of places defined by *n*, or `1` if *n* is
14 | omitted. The number of positional parameters remaining will be reduced
15 | by the number of places that are shifted.
16 |
17 | If *n* is given, it will be evaluated as an arithmetic expression to
18 | determinate the number of places to shift. It is an error to shift more
19 | than the number of positional parameters or a negative number of places.
20 |
21 | Exit Status
22 | -----------
23 | :0: The positional parameters were successfully shifted.
24 |
25 | :>0: An error occurred.
26 |
27 | See Also
28 | --------
29 | `set`\(1)
30 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/sleep.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`sleep` -- suspend execution for an interval
4 | ===================================================
5 |
6 | Synopsis
7 | --------
8 | | sleep [flags] [duration]
9 |
10 | Description
11 | -----------
12 | `sleep` suspends execution for at least the time specified by *duration*
13 | or until a `SIGALRM` signal is received. The *duration* is a floating
14 | point literal for the number of seconds to sleep. The actual granularity
15 | depends on the underlying system, normally around 1 millisecond. This
16 | can be followed by `s` for seconds, `m` for minutes, `h` for hours, or
17 | `d` for days.
18 |
19 | Flags
20 | -----
21 | :-s: Sleep until a signal or a timeout is received. If *duration* is
22 | omitted or less than or equal to zero then no timeout will be used.
23 |
24 | Exit Status
25 | -----------
26 | :0: The execution was successfully suspended for at least *duration* or a
27 | `SIGALRM` signal was received.
28 |
29 | :>0: An error occurred.
30 |
31 | See Also
32 | --------
33 | `date`\(1), `time`\(1), `wait`\(1)
34 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/source.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | .. index: dot
4 | .. index: .
5 |
6 | :index:`source` -- execute commands in the current environment
7 | ==============================================================
8 |
9 | Synopsis
10 | --------
11 | | `source` *name* [*arg* ...]
12 | | `.` *name* [*arg* ...]
13 |
14 | Description
15 | -----------
16 | `source` is a special built-in command that executes commands from a
17 | function or a file in the current environment.
18 |
19 | If *name* refers to a function defined with the `function` *name*
20 | syntax, the function executes in the current environment as if it had
21 | been defined with the *name*`()` syntax so that there is no scoping.
22 | Otherwise, commands from the file defined by *name* are executed in
23 | the current environment. Note that the complete script is read before
24 | it begins to execute so that any aliases defined in this script will not
25 | take effect until the script completes execution.
26 |
27 | When *name* refers to a file, the `PATH` variable is searched for
28 | the file containing commands. In this case execute permission is not
29 | required for *name*.
30 |
31 | If any *arg*\s are specified, these become the positional parameters for
32 | the duration of the function or script and are restored upon completion.
33 |
34 | Exit Status
35 | -----------
36 | If *name* is found, then the exit status is that of the last command
37 | executed. Otherwise, since this is a special built-in, an error will
38 | cause a non-interactive shell to exit with a non-zero exit status.
39 | An interactive shell returns a non-zero exit status to indicate an error.
40 |
41 | See Also
42 | --------
43 | `command`\(1), `ksh`\(1)
44 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/times.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`times` -- display CPU usage by the shell and child processes
4 | ====================================================================
5 |
6 | Synopsis
7 | --------
8 | | times [flags]
9 |
10 | Description
11 | -----------
12 | `times` shows the user mode and system mode CPU time used by the shell
13 | and all of its child processes.
14 |
15 | See Also
16 | --------
17 | `time`\(1)
18 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/umask.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`umask` -- get or set the file creation mask
4 | ===================================================
5 |
6 | Synopsis
7 | --------
8 | | umask [flags] [mask]
9 |
10 | Description
11 | -----------
12 | `umask` sets the file creation mask of the current shell execution
13 | environment to the value specified by the *mask* operand. This mask
14 | affects the file permission bits of subsequently created files. *mask* can
15 | either be an octal number or a symbolic value as described in `chmod`\(1).
16 | If a symbolic value is given, the new file creation mask is the complement
17 | of the result of applying *mask* to the complement of the current file
18 | creation mask.
19 |
20 | If *mask* is not specified, `umask` writes the value of the file creation
21 | mask for the current process to standard output.
22 |
23 | Flags
24 | -----
25 | :-S: Causes the file creation mask to be written or treated as a symbolic
26 | value rather than an octal number.
27 |
28 | :-p: Write the file creation mask in a format that can be use for re-input.
29 |
30 | Exit Status
31 | -----------
32 | :0: The file creation mask was successfully changed, or no *mask* operand
33 | was supplied.
34 |
35 | :>0: An error occurred.
36 |
37 | See Also
38 | --------
39 | `chmod`\(1)
40 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/unalias.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`unalias` -- remove alias definitions
4 | ============================================
5 |
6 | Synopsis
7 | --------
8 | | unalias [flags] name...
9 |
10 | Description
11 | -----------
12 | `unalias` removes the definition of each named alias from the current shell execution environment, or all aliases if `-a` is specified. It will not affect any commands that have already been read and subsequently executed.
13 |
14 | Flags
15 | -----
16 | :-a: Causes all alias definitions to be removed. *name* operands are
17 | optional and ignored in this case.
18 |
19 | Exit Status
20 | -----------
21 | :0: Successful completion.
22 |
23 | :>0: `-a` was not specified and one or more *name* operands did not
24 | have an alias definition, or an error occurred.
25 |
26 | See Also
27 | --------
28 | `alias`\(1)
29 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/unset.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`unset` -- unset values and attributes of variables and functions
4 | ========================================================================
5 |
6 | Synopsis
7 | --------
8 | | unset [flags] name...
9 |
10 | Description
11 | -----------
12 | For each *name* specified, `unset` unsets the variable, or function
13 | if `-f` is specified, from the current shell execution environment.
14 | Readonly variables cannot be unset.
15 |
16 | Flags
17 | -----
18 | :-n: If *name* refers to variable that is a reference, the variable *name*
19 | will be unset rather than the variable it references. Otherwise, is is
20 | equivalent to `-v`.
21 |
22 | :-f: *aname* refers to a function name and the shell will unset the
23 | function definition.
24 |
25 | :-v: *name* refers to a variable name and the shell will unset it and
26 | remove it from the environment. This is the default behavior.
27 |
28 | Exit Status
29 | -----------
30 | :0: All *name*\s were successfully unset.
31 |
32 | :>0: One or more *name* operands could not be unset or an error occurred.
33 |
34 | See Also
35 | --------
36 | `declare`\(1), `typeset`\(1)
37 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/wait.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`wait` -- wait for process or job completion
4 | ===================================================
5 |
6 | Synopsis
7 | --------
8 | | wait [flags] [job...]
9 |
10 | Description
11 | -----------
12 | `wait` with no operands, waits until all jobs known to the invoking
13 | shell have terminated. If one or more *job* operands are specified,
14 | `wait` waits until all of them have completed.
15 |
16 | Each *job* can be specified as one of the following:
17 |
18 | :*int*: Refers to a process id (pid).
19 | :`%`\ *int*: Refers to a job number.
20 | :`%`\ *str*: Refers to a job whose name begins with *str*.
21 | :`%?`\ *str*: Refers to a job whose name contains *str*.
22 | :`%%`: Refers to the current job.
23 | :`%+`: Refers to the current job.
24 | :`%-`: Refers to the previous job.
25 |
26 | If one ore more *job* operands is a process id or process group id not
27 | known by the current shell environment, `wait` treats each of them as if
28 | it were a process that exited with status 127.
29 |
30 |
31 | Exit Status
32 | -----------
33 | If *wait* is invoked with one or more *job*\s, and all of them have
34 | terminated or were not known by the invoking shell, the exit status of
35 | `wait` will be that of the last *job*. Otherwise, it will be one of
36 | the following:
37 |
38 | :0: `wait` utility was invoked with no operands and all processes known
39 | by the invoking process have terminated.
40 |
41 | :127: *job* is a process id or process group id that is unknown to the
42 | current shell environment.
43 |
44 | See Also
45 | --------
46 | `jobs`\(1), `ps`\(1)
47 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/docs/whence.rst:
--------------------------------------------------------------------------------
1 | .. default-role:: code
2 |
3 | :index:`whence` -- locate a command and describe its type
4 | =========================================================
5 |
6 | Synopsis
7 | --------
8 | | whence [flags] name...
9 |
10 | Description
11 | -----------
12 | Without `-v`, `whence` writes on standard output an absolute pathname,
13 | if any, corresponding to *name* based on the complete search order that
14 | the shell uses. If *name* is not found, then no output is produced.
15 |
16 | If `-v` is specified, the output will also contain information that
17 | indicates how the given *name* would be interpreted by the shell in
18 | the current execution environment.
19 |
20 | Flags
21 | -----
22 | :-p, -P: Do not check to see if *name* is a reserved word, a built-in,
23 | an alias, or a function. This turns off the `-v` option.
24 |
25 | :-a: Displays all uses for each *name* rather than the first.
26 |
27 | :-f: Do not check for functions.
28 |
29 | :-t: Output only the type for each command.
30 |
31 | :-q: Quiet mode. Returns 0 if all arguments are built-ins, functions,
32 | or are programs found on the path.
33 |
34 | :-v: For each name you specify, the shell displays a line that indicates
35 | if that name is one of the following:
36 |
37 | * Reserved word
38 | * Alias
39 | * Built-in
40 | * Undefined function
41 | * Function
42 | * Tracked alias
43 | * Program
44 |
45 | Exit Status
46 | -----------
47 | :0: Each *name* was found by the shell.
48 |
49 | :1: One or more *name*\s were not found by the shell.
50 |
51 | :>1: An error occurred.
52 |
53 | See Also
54 | --------
55 | `command`\(1)
56 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/edit/meson.build:
--------------------------------------------------------------------------------
1 | ksh93_files += [
2 | 'edit/completion.c',
3 | 'edit/edit.c',
4 | 'edit/emacs.c',
5 | 'edit/hexpand.c',
6 | 'edit/history.c',
7 | 'edit/pcomplete.c',
8 | 'edit/vi.c'
9 | ]
10 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/functions/dirs:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ksh
2 | # Display directory stack -- $HOME displayed as ~.
3 | function dirs {
4 | typeset dir="${PWD#$HOME/}"
5 | case $dir in
6 | $HOME)
7 | dir=\~
8 | ;;
9 | /*)
10 | ;;
11 | *)
12 | dir=\~/$dir
13 | ;;
14 | esac
15 |
16 | # shellcheck disable=SC2154
17 | select _ in "$dir" "${.sh._push_stack[@]}"
18 | do
19 | :
20 | done < /dev/null
21 | }
22 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/functions/man:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ksh
2 | # Format and display manual pages. The primary purpose of this function is to prepend the directory
3 | # containing the ksh man pages to MANPATH so that they are given priority when searching for a
4 | # matching man page.
5 | function man {
6 | local manpath
7 | if [[ -n $MANPATH ]]
8 | then
9 | manpath="$MANPATH"
10 | else
11 | manpath_cmd=$(whence -p manpath)
12 | [[ -n $manpath_cmd ]] && manpath="$($manpath_cmd)"
13 | fi
14 | local -x MANPATH="$manpath"
15 | # shellcheck disable=SC2154
16 | local ksh_manpath="${.sh.install_prefix}/share/ksh/man"
17 | if [[ -d "$ksh_manpath" && -n "$MANPATH" ]]
18 | then
19 | MANPATH="$ksh_manpath:$MANPATH"
20 | # Invoke man with this manpath, and we're done.
21 | $(whence -p man) "$@"
22 | return
23 | fi
24 |
25 | # If ksh's man pages could not be found, just invoke man normally.
26 | $(whence -p man) "$@"
27 | }
28 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/functions/mcd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ksh
2 | # Menu driven change directory command.
3 | function mcd {
4 | typeset dir="${PWD#$HOME/}"
5 | case $dir in
6 | $HOME) dir=\~
7 | ;;
8 | /*) ;;
9 | *) dir=\~/$dir
10 | ;;
11 | esac
12 |
13 | PS3='Select by number or enter a name: '
14 | # shellcheck disable=SC2154
15 | select dir in "$dir" "${.sh._push_stack[@]}"
16 | do
17 | cd "$REPLY" && return
18 | done
19 | }
20 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/functions/popd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ksh
2 | # Pops the top directory
3 | # shellcheck disable=SC2154 # .sh._push_stack[@] is referenced but not assigned
4 | # shellcheck disable=SC2211 # .sh.var assignments are not "glob used as a command name"
5 |
6 | function popd {
7 | typeset dir
8 | # shellcheck disable=SC2154
9 | if ((.sh._push_top >= .sh._push_max))
10 | then print popd: Nothing to pop.
11 | return 1
12 | fi
13 | case $1 in
14 | "")
15 | dir="${.sh._push_stack[.sh._push_top]}"
16 | case $dir in
17 | \~*) dir="$HOME${dir#\~}"
18 | esac
19 | cd "$dir" || return 1
20 | ;;
21 | +[1-9]|+[1-9][0-9])
22 | integer i=$((.sh._push_top - $1))
23 | if ((i >= .sh._push_max))
24 | then
25 | print pushd: Directory stack not that deep.
26 | return 1
27 | fi
28 | while ((i > .sh._push_top))
29 | do
30 | .sh._push_stack[i]="${.sh._push_stack[i-1]}"
31 | (( i = i - 1 ))
32 | done
33 | ;;
34 | *) print pushd: Bad directory.
35 | return 1
36 | esac
37 | unset '.sh._push_stack[.sh._push_top]'
38 | (( .sh._push_top = .sh._push_top + 1 ))
39 | dirs
40 | }
41 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/sh/meson.build:
--------------------------------------------------------------------------------
1 | vcs_version = vcs_tag(command: ['git', 'describe', '--always', '--dirty', '--tags'],
2 | input: 'version.c.in', output: 'version.c',
3 | fallback: get_option('fallback-version-number'))
4 |
5 | ksh93_files += [
6 | vcs_version,
7 | 'sh/args.c',
8 | 'sh/arith.c',
9 | 'sh/array.c',
10 | 'sh/bash.c',
11 | 'sh/debug.c',
12 | 'sh/defs.c',
13 | # There is no code that uses the code in these modules so don't bother compiling, linting,
14 | # or styling it. But keep the module because it may prove useful in the future.
15 | # 'sh/deparse.c',
16 | 'sh/expand.c',
17 | 'sh/fault.c',
18 | 'sh/fcin.c',
19 | 'sh/init.c',
20 | 'sh/io.c',
21 | 'sh/jobs.c',
22 | 'sh/lex.c',
23 | 'sh/macro.c',
24 | 'sh/main.c',
25 | 'sh/name.c',
26 | 'sh/nvdisc.c',
27 | 'sh/nvtree.c',
28 | 'sh/nvtype.c',
29 | 'sh/parse.c',
30 | 'sh/path.c',
31 | 'sh/streval.c',
32 | 'sh/string.c',
33 | 'sh/subshell.c',
34 | 'sh/tdump.c',
35 | 'sh/timers.c',
36 | 'sh/trestore.c',
37 | 'sh/xec.c'
38 | ]
39 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/sh/version.c.in:
--------------------------------------------------------------------------------
1 | // This is used as input to the Meson vcs_tag() function to produce the corresponding version.c
2 | // module.
3 | #include "config_ast.h" // IWYU pragma: keep
4 |
5 | const char *ksh_version = "@VCS_TAG@";
6 | const char *e_version =
7 | "Version "
8 | // Do not remove this string. See https://github.com/att/ast/issues/1443. There may be people or
9 | // scripts depending on "Version A" being present to distinguish this code from ksh clones even
10 | // though there is no guarantee legacy ksh builds include this string. So even if we ultimately
11 | // remove the insecure command audit facility this string needs to be retained. See also
12 | // https://github.com/att/ast/issues/240.
13 | "A"
14 | #if SHOPT_BASH
15 | "B"
16 | #endif
17 | " @VCS_TAG@";
18 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/autoload.sh:
--------------------------------------------------------------------------------
1 | # Verify the behavior of autoloaded functions.
2 |
3 | # ====================
4 | # Verify that directories in the path search list which should be skipped (e.g., because they don't
5 | # exist) interacts correctly with autoloaded functions.
6 | #
7 | # See https://github.com/att/ast/issues/1454
8 | expect=$"Func cd called with |$TEST_DIR/usr|\n$TEST_DIR/usr"
9 | actual=$($SHELL "$TEST_ROOT/data/skipped_dir")
10 | actual_status=$?
11 | expect_status=0
12 | [[ $actual_status == $expect_status ]] ||
13 | log_error "autoload function skipped dir test wrong status" "$expect_status" "$actual_status"
14 | [[ $actual == $expect ]] ||
15 | log_error "autoload function skipped dir test wrong output" "$expect" "$actual"
16 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_basename.sh:
--------------------------------------------------------------------------------
1 | # Tests for `basename` builtin
2 |
3 | # ==========
4 | actual=$(basename "$TEST_DIR/foo.bar")
5 | expect="foo.bar"
6 | [[ "$actual" = "$expect" ]] || log_error "basename failed to print filename" "$expect" "$actual"
7 |
8 | # ==========
9 | # Last argument is treated as suffix and removed from output
10 | actual=$(basename "$TEST_DIR/foo.bar" .bar)
11 | expect="foo"
12 | [[ "$actual" = "$expect" ]] || log_error "basename failed to strip suffix" "$expect" "$actual"
13 |
14 | # ==========
15 | # -a, --all All operands are treated as string and each modified pathname
16 | # is printed on a separate line on the standard output.
17 | actual=$(basename -a "$TEST_DIR/foo.bar" "$TEST_DIR/bar.bar" "$TEST_DIR/baz.bar")
18 | expect=$'foo.bar\nbar.bar\nbaz.bar'
19 | [[ "$actual" = "$expect" ]] || log_error "basename -a failed" "$expect" "$actual"
20 |
21 | # ==========
22 | # -s, --suffix=suffix
23 | # All operands are treated as string and each modified
24 | # pathname, with suffix removed if it exists, is printed on a
25 | # separate line on the standard output.
26 | actual=$(basename -s bar "$TEST_DIR/foo.bar" "$TEST_DIR/bar.bar" "$TEST_DIR/baz.bar")
27 | expect=$'foo.\nbar.\nbaz.'
28 | [[ "$actual" = "$expect" ]] || log_error "basename -s failed" "$expect" "$actual"
29 |
30 | # ==========
31 | actual=$(basename "$TEST_DIR/.bar")
32 | expect=".bar"
33 | [[ "$actual" = "$expect" ]] || log_error "basename failed" "$expect" "$actual"
34 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_dirname.sh:
--------------------------------------------------------------------------------
1 | # Tests for `dirname` builtin
2 |
3 | # dirname treats string as a file name and returns the name of the directory
4 | # containing the file name by deleting the last component from string.
5 | mkdir "$TEST_DIR/foo"
6 |
7 | actual=$(dirname "$TEST_DIR/foo")
8 | expect="$TEST_DIR"
9 | [[ "$actual" = "$expect" ]] || log_error "dirname failed" "$expect" "$actual"
10 |
11 | # ==========
12 | # -f, --file Print the $PATH relative regular file path for string.
13 | actual=$(dirname -f cat)
14 | expect=$(which cat)
15 | expect=$(which cat) || log_error "dirname -f failed" "$expect" "$actual"
16 |
17 | # ==========
18 | # -r, --relative Print the $PATH relative readable file path for string.
19 | actual=$(dirname -r cat)
20 | expect=$(which cat)
21 | expect=$(which cat) || log_error "dirname -r failed" "$expect" "$actual"
22 |
23 | # ==========
24 | # -x, --executable
25 | # Print the $PATH relative executable file path for string.
26 | actual=$(dirname -x cat)
27 | expect=$(which cat) || log_error "dirname -x failed" "$expect" "$actual"
28 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_echo.exp.out:
--------------------------------------------------------------------------------
1 | bsd echo -n does not print new line
2 | bsd echo \c does print new line
3 | bsd echo -e interprets escape sequences
4 | bsd echo -ne does not print new line and interprets escape sequences
5 | bsd echo -en does not print new line and interprets escape sequences
6 | att echo -n does print new line
7 | att echo \c does not print new line
8 | att echo -e interprets escape sequences
9 | att echo -ne does print new line and interprets escape sequences
10 | att echo -en does print new line and interprets escape sequences
11 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_exit.sh:
--------------------------------------------------------------------------------
1 | #
2 | # Verify the `exit` command behaves as expected.
3 | #
4 |
5 | # =======
6 | actual=$($SHELL -c 'exit' 2>&1)
7 | status=$?
8 | expect=0
9 | [[ -z $actual ]] || log_error 'bare exit' "" "$actual"
10 | [[ $expect == $status ]] || log_error 'bare exit' "$expect" "$status"
11 |
12 | # =======
13 | actual=$($SHELL -c 'exit 0' 2>&1)
14 | status=$?
15 | expect=0
16 | [[ -z $actual ]] || log_error 'exit 0' "" "$actual"
17 | [[ $expect == $status ]] || log_error 'exit 0' "$expect" "$status"
18 |
19 | # =======
20 | actual=$($SHELL -c 'exit 1' 2>&1)
21 | status=$?
22 | expect=1
23 | [[ -z $actual ]] || log_error 'exit 1' "" "$actual"
24 | [[ $expect == $status ]] || log_error 'exit 1' "$expect" "$status"
25 |
26 | # =======
27 | actual=$($SHELL -c 'function e37 { return 37; } ; e37' 2>&1)
28 | status=$?
29 | expect=37
30 | [[ -z $actual ]] || log_error 'exit 37' "" "$actual"
31 | [[ $expect == $status ]] || log_error 'exit 37' "$expect" "$status"
32 |
33 | # =======
34 | actual=$($SHELL -c 'exit -1' 2>&1)
35 | status=$?
36 | expect=255
37 | [[ -z $actual ]] || log_error 'exit -1' "" "$actual"
38 | [[ $expect == $status ]] || log_error 'exit -1' "$expect" "$status"
39 |
40 | # =======
41 | actual=$($SHELL -c 'exit -2' 2>&1)
42 | status=$?
43 | expect=254
44 | [[ -z $actual ]] || log_error 'exit -2' "" "$actual"
45 | [[ $expect == $status ]] || log_error 'exit -2' "$expect" "$status"
46 |
47 | # =======
48 | $SHELL +E -i <<- \! && log_error 'interactive shell should not exit 0 after false'
49 | false
50 | exit
51 | !
52 | status=$?
53 | expect=1
54 | [[ $expect == $status ]] || log_error 'bare exit after false' "$expect" "$status"
55 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_hist.exp.out:
--------------------------------------------------------------------------------
1 | hist -l lists commands on standard output
2 | hist -lr lists commands on standard output in reverse order
3 | hist -ln skips command numbers while listing commands
4 | hist -s old=new replaces text 'old' with 'new' in command
5 | hist echo finds last echo command
6 | hist -N starts N commands back
7 | hist command triggers ed editor
8 | hist -p writes history expansion on standard output
9 | hist -e vi triggers vi editor
10 | HISTEDIT=vi triggers vi editor
11 | When both HISTEDIT and FCEDIT are set, HISTEDIT takes priority
12 | !! executes prev command
13 | !!:s/// executes prev command w/substitution
14 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_jobs.exp.out:
--------------------------------------------------------------------------------
1 | disown invalid job ID fails
2 | bg invalid job ID fails
3 | fg invalid job ID fails
4 | background job killed when shell exits
5 | disowned background job not killed when shell exits
6 | Ctrl-z stops sleep 60 processs
7 | jobs lists stopped sleep 60 process
8 | jobs -l lists pid of stopped sleep 60 process
9 | jobs -p lists process group of stopped sleep 60 process
10 | bg brings last stopped process to background
11 | Warning before exit for stopped jobs works
12 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_local.sh:
--------------------------------------------------------------------------------
1 | # Verify the `local` command behaves correctly.
2 |
3 | # =======
4 | # `local` outside a function is an error.
5 | actual=$(local var 2>&1)
6 | expect='local: local can only be used in a function'
7 | [[ $actual == *"$expect" ]] || log_error "local outside a function is an error " "$expect" "$actual"
8 |
9 | # =======
10 | # `local` inside a function is allowed and shadows a global, or function, var of the same name.
11 | var=hello
12 | actual=$(
13 | function shadow1 {
14 | print -n "func shadow1 var=$var; "
15 | local var=shadow1
16 | print -n "func shadow1 var=$var; "
17 | }
18 | function shadow2 {
19 | print -n "func shadow2 var=$var; "
20 | local var=shadow2
21 | print -n "func shadow2 var=$var; "
22 | shadow1
23 | print -n "func shadow2 var=$var; "
24 | }
25 | shadow2; print "global var=$var" 2>&1
26 | )
27 | expect="func shadow2 var=hello; func shadow2 var=shadow2; func shadow1 var=hello;"
28 | expect="$expect func shadow1 var=shadow1; func shadow2 var=shadow2; global var=hello"
29 | [[ $actual == "$expect" ]] || log_error "local inside a function is allowed" "$expect" "$actual"
30 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_read.exp.err:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/tests/b_read.exp.err
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_read.exp.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/tests/b_read.exp.out
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_sync.sh:
--------------------------------------------------------------------------------
1 | # Tests for `sync` builtin
2 |
3 | # ==========
4 | # sync -S1
5 | # Will succeed silently if the system has syncfs() otherwise it fails in a predictable manner.
6 | actual=$(sync -S1 2>&1)
7 | e1="sync: syncfs(1) failed [Function not implemented]"
8 | e2="sync: syncfs(1) failed [Operation not applicable]"
9 | [[ "$actual" == "" || "$actual" == "$e1" || "$actual" == "$e2" ]] ||
10 | log_error "sync -S1" "$e1" "$actual"
11 |
12 | # ==========
13 | # sync -s1
14 | actual=$(sync -s1 2>&1)
15 | expect=""
16 | [[ "$actual" == "$expect" ]] || log_error "sync -s1" "$expect" "$actual"
17 |
18 | # ==========
19 | # sync -s 999
20 | # An invalid file descriptor should fail. We don't verify the errno portion of the message because
21 | # it can vary across systems -- even though it should be EBADF which should be the same numeric
22 | # value on every system that cares at all about being UNIX compatible.
23 | #
24 | # We don't use fd 3 because it might be opened by a debug malloc subsystem. We expect fd 999 to be
25 | # unused if not invalid.
26 | actual=$(sync -s 999 2>&1)
27 | expect="sync: fsync(999) failed"
28 | [[ "$actual" =~ "$expect".* ]] || log_error "sync -s 999" "$expect" "$actual"
29 |
30 | # ==========
31 | # sync -f
32 | actual=$(sync -f 2>&1)
33 | expect=""
34 | [[ "$actual" == "$expect" ]] || log_error "sync -f" "$expect" "$actual"
35 |
36 | # ==========
37 | # sync -X
38 | actual=$(sync -X 2>&1)
39 | expect=""
40 | [[ "$actual" == "$expect" ]] || log_error "sync -X" "$expect" "$actual"
41 |
42 | # ==========
43 | # sync -x
44 | actual=$(sync -x 2>&1)
45 | expect="sync: -x: unknown option"
46 | [[ "$actual" =~ "$expect".* ]] || log_error "sync -x" "$expect" "$actual"
47 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_test.exp.out:
--------------------------------------------------------------------------------
1 | stdin is a terminal device
2 | stdout is a terminal device
3 | implicit stdout is a terminal device
4 | stdout is not a terminal device
5 | implicit stdout is not a terminal device
6 | test -t true in complex expression
7 | test -t false in complex expression
8 | -t1 in comsub works correctly
9 | -t1 in comsub with exec >/dev/tty works correctly
10 | stdout is a char device
11 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_time.exp.out:
--------------------------------------------------------------------------------
1 | time with no pipeline produces expected output
2 | time sleep 1 produces expected output
3 | time sleep 0.05 pipeline produces expected output
4 | time CPU bound pipeline produces expected output
5 | time %3P produces correct output
6 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_times.exp.out:
--------------------------------------------------------------------------------
1 | times produces expected output
2 | times sleep 1 produces syntax error
3 | times produces expected non-zero output for shell
4 | times produces expected non-zero output for child processes
5 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_typeset.exp:
--------------------------------------------------------------------------------
1 | # vim: set filetype=expect:
2 | #
3 | # Tests of `typeset` keyword/builtin.
4 | set pid [spawn $ksh]
5 | expect_prompt
6 | # Terminal rows and columns may default to zero so ensure sane values.
7 | send "stty rows 24 cols 80\r"
8 | expect_prompt
9 |
10 | # ==========
11 | # Ensure enumerating functions works if any of them are marked autoloaded but not actually loaded.
12 | # Regression: https://github.com/att/ast/issues/1436
13 | log_test_entry
14 | send "functions\r"
15 | expect -re "\r\ntypeset -fu _ksh_print_help\r\n.*\r\ntypeset -fu pushd\r\n" {
16 | puts "typeset -f produces expected output"
17 | }
18 | expect_prompt
19 |
20 | # ==========
21 | # Exit the shell.
22 | log_test_entry
23 | send "\r"
24 | expect_prompt
25 | send [ctrl D]
26 | catch {expect default exp_continue} output
27 | log_debug "EOF output: $output"
28 | wait
29 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/b_typeset.exp.out:
--------------------------------------------------------------------------------
1 | typeset -f produces expected output
2 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/data/sh_history:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ksh2020/ksh/8cf92b281a8d5da075b28e4421ec7ec0ab0de1ce/src/cmd/ksh93/tests/data/sh_history
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/data/sh_match2.xml:
--------------------------------------------------------------------------------
1 | >
a text
More [TEXT].
2 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/data/sigtst2:
--------------------------------------------------------------------------------
1 | print 2-main
2 | test_mode=$1
3 |
4 | x_int_trap() {
5 | read -t2 -u9 actual
6 | expect=go2
7 | [[ $actual == $expect ]] ||
8 | log_error "$test_mode unexpected go message received" "$expect" "$actual"
9 | print 2-intr
10 | print -u8 int1
11 | exit 0
12 | }
13 |
14 | t_int_trap() {
15 | read -t2 -u9 actual
16 | expect=go2
17 | [[ $actual == $expect ]] ||
18 | log_error "$test_mode unexpected go message received" "$expect" "$actual"
19 | print 2-intr
20 | print -u8 int1
21 | trap - INT
22 | kill -s INT $$
23 | print 2-running
24 | }
25 |
26 | case $test_mode in
27 | *x*) trap x_int_trap INT
28 | ;;
29 | *t*) trap t_int_trap INT
30 | ;;
31 | esac
32 |
33 | case $test_mode in
34 | *d*) sigtst3 $test_mode; status=$? ;;
35 | *) $SHELL -c "sigtst3 $test_mode"; status=$? ;;
36 | esac
37 |
38 | read -t0.01 -u9 actual && log_warning "$test_mode unexpected data on fifo9" "" "$actual"
39 | printf '2-%04d\n' $status
40 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/data/sigtst3:
--------------------------------------------------------------------------------
1 | print 3-main
2 | test_mode=$1
3 |
4 | x_int_trap() {
5 | print 3-intr
6 | print -u9 go2
7 | exit 0
8 | }
9 |
10 | t_int_trap() {
11 | print 3-intr
12 | case $test_mode in
13 | *t*) print -u9 go2 ;;
14 | esac
15 | trap - INT
16 | kill -s INT $$
17 | print 3-running
18 | }
19 |
20 | case $test_mode in
21 | *x*) trap x_int_trap INT
22 | ;;
23 | *) trap t_int_trap INT
24 | ;;
25 | esac
26 |
27 | print -u9 go1
28 | sleep 1
29 | print '3-9999' # we shouldn't get here because a INT trap above should cause us to exit
30 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/data/skipped_dir:
--------------------------------------------------------------------------------
1 | # See https://github.com/att/ast/issues/1454
2 |
3 | mkdir -p "$TEST_DIR/usr/bin"
4 | print '#!/bin/sh' >"$TEST_DIR/usr/bin/cd"
5 | print 'builtin cd "$@"' >>"$TEST_DIR/usr/bin/cd"
6 | prefix="$TEST_DIR/ksh.$$"
7 |
8 | FPATH="$prefix/bad:$prefix/functions"
9 | mkdir -p "$prefix/functions"
10 | print 'function cd { echo "Func cd called with |$*|"; command cd "$@"; }' >"$prefix/functions/cd"
11 | typeset -fu cd
12 |
13 | PATH="/arglebargle:$PATH:$TEST_DIR/usr/bin:$TEST_DIR/bin"
14 | cd "$TEST_DIR/usr"
15 | pwd
16 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/emacs.exp.out:
--------------------------------------------------------------------------------
1 | echo 1 works
2 | echo 2 works
3 | ctrl-p works
4 | ctrl-n works
5 | ctrl-a works
6 | ctrl-e works
7 | ctrl-b works
8 | ctrl-f works
9 | alt-f works
10 | ctrl-d deletes a char
11 | alt-d deletes a word
12 | alt-backspace deletes previous word
13 | alt-h deletes previous word
14 | alt-delete deletes previous word
15 | ctrl-t transposes characters
16 | alt-c capitalizes current word
17 | alt-l changes current word to lowercase
18 | ctrl-k deletes characters to end of line
19 | ctrl-w kills from cursor to mark
20 | ctrl-y yanks back item to the line
21 | alt-< fetches least recent history line
22 | ctrl-r reverse searches history for a previous command
23 | ctrl-o executes current history entry
24 | ctrl-o executes current history entry and retrieves next history entry
25 | alt-. inserts last word from previous command
26 | alt-_ inserts last word from previous command
27 | alt-* generates file name completions
28 | tab generates command or file name completions
29 | alt-= generates file or command name completions
30 | alt-ctrl-v generates version number
31 | alt-# appends '#' to beginning of line
32 | alt-# appends '#' to beginning of line and puts it in history
33 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/glob.exp:
--------------------------------------------------------------------------------
1 | # vim: set filetype=expect:
2 | #
3 | # Tests for globbing
4 | set pid [spawn $ksh]
5 | expect_prompt
6 | # Terminal rows and columns may default to zero so ensure sane values.
7 | send "stty rows 24 cols 80\r"
8 | expect_prompt
9 |
10 | # ==========
11 | # If `FIGNORE` is set, `.` and `..` should be ignored
12 | # https://github.com/att/ast/issues/11
13 | log_test_entry
14 | send "FIGNORE=foo; mkdir -p bar/baz; cd bar; echo *\r"
15 | expect -re "\r\nbaz\r\n" {
16 | puts "`.` and `..` are ignored if `FIGNORE` is set"
17 | }
18 | expect_prompt
19 |
20 | # ==========
21 | # Exit the shell.
22 | log_test_entry
23 | send "\r"
24 | expect_prompt
25 | send [ctrl D]
26 | catch {expect default exp_continue} output
27 | log_debug "EOF output: $output"
28 | wait
29 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/glob.exp.out:
--------------------------------------------------------------------------------
1 | `.` and `..` are ignored if `FIGNORE` is set
2 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/ifs.sh:
--------------------------------------------------------------------------------
1 | # These are the tests for the internal field separator (IFS).
2 |
3 | IFS=e
4 | set : :
5 | [[ "$*" == ":e:" ]] || log_error "IFS failed" ":e:" "$*"
6 |
7 | IFS='|' read -r first second third <<< 'one|two|three'
8 | [[ "${first}" == "one" ]] || log_error "IFS failed" "one" "${first}"
9 | [[ "${second}" == "two" ]] || log_error "IFS failed" "two" "${second}"
10 | [[ "${third}" == "three" ]] || log_error "IFS failed" "three" "${third}"
11 |
12 | # Multi-byte (wide) character checks will only work if UTF-8 inputs are enabled. We can't just set
13 | # LC_ALL here because the literal UTF-8 strings will have already been read.
14 | if [[ $LC_ALL == en_US.UTF-8 ]]
15 | then
16 | # 2 byte latin accented e character
17 | IFS=é
18 | set : :
19 | [[ "$*" == ":é:" ]] || log_error "IFS failed with multibyte character" ":é:" "$*"
20 |
21 | # 4 byte roman sestertius character
22 | IFS=𐆘 read -r first second third <<< 'one𐆘two𐆘three'
23 | [[ "${first}" == "one" ]] || log_error "IFS failed" "one" "${first}"
24 | [[ "${second}" == "two" ]] || log_error "IFS failed" "two" "${second}"
25 | [[ "${third}" == "three" ]] || log_error "IFS failed" "three" "${third}"
26 |
27 | # Ensure subshells don't get corrupted when IFS becomes multibyte character
28 | expect=$(printf ":é:\\ntrap -- 'echo end' EXIT\\nend")
29 | actual=$(IFS=é; set : :; echo "$*"; trap "echo end" EXIT; trap)
30 | [[ "$expect" == "$actual" ]] || log_error "IFS subshell failed" "$expect" "$actual"
31 | fi
32 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/restricted.exp:
--------------------------------------------------------------------------------
1 | # vim: set filetype=expect:
2 | #
3 | # Interactive tests of restricted shell behavior. This is primarily to avoid regressions of
4 | # https://github.com/att/ast/issues/1459. It doesn't need to be a comprehensive test of restricted
5 | # shell behavior. That is already done in unit test restricted.sh.
6 | set pid [spawn $rksh]
7 | expect_prompt
8 | # Terminal rows and columns may default to zero so ensure sane values.
9 | send "stty rows 24 cols 80\r"
10 | expect_prompt
11 |
12 | # ==========
13 | # Changing a restricted env var should be an error.
14 | log_test_entry
15 | send "PATH=/bin\r"
16 | expect -re ": PATH: restricted\r\n" {
17 | puts "modifying PATH is restricted"
18 | }
19 | expect_prompt
20 |
21 | # ==========
22 | # Exit the shell.
23 | log_test_entry
24 | send "\r"
25 | expect_prompt
26 | send [ctrl D]
27 | catch {expect default exp_continue} output
28 | log_debug "EOF output: $output"
29 | wait
30 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/restricted.exp.out:
--------------------------------------------------------------------------------
1 | modifying PATH is restricted
2 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/util/interactive.kshrc:
--------------------------------------------------------------------------------
1 | # vim: set filetype=sh sw=4 ts=4 et:
2 |
3 | # See the `expect_prompt` function in interactive.expect.rc. This provides a prompt that changes in
4 | # a predictable manner each time the prompt appears. This helps ensure that a complex expect based
5 | # test stays in sync with the output of the shell.
6 | integer prompt_counter=0
7 | PS1='KSH PROMPT:$(( ++prompt_counter )): '
8 |
9 | # This is a helper function for use in expect `send` commands to help delimit output for easier
10 | # matching. Alternatively, to ensure the expected marker appears in the output.
11 | function _marker {
12 | print "@MARKER:$*@"
13 | }
14 |
--------------------------------------------------------------------------------
/src/cmd/ksh93/tests/util/postscript.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ksh
2 | #
3 | # Verify that the fifos are empty and exit with a zero status if no errors else an error count that
4 | # doesn't overflow what can safely be represented in the exit status.
5 | #
6 | empty_fifos
7 | # shellcheck disable=SC2154
8 | if (( error_count != 0 ))
9 | then
10 | # shellcheck disable=SC2154
11 | 'log_warning' $(( start_of_test_lineno - 1 )) "error_count = $error_count"
12 | exit $(( error_count < 50 ? error_count : 50 ))
13 | fi
14 | exit 0
15 |
--------------------------------------------------------------------------------
/src/lib/libast/cdt/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'cdt/dtclose.c',
3 | 'cdt/dtdisc.c',
4 | 'cdt/dthash.c',
5 | 'cdt/dtlist.c',
6 | 'cdt/dtmethod.c',
7 | 'cdt/dtopen.c',
8 | 'cdt/dtrehash.c',
9 | 'cdt/dtstat.c',
10 | 'cdt/dtstrhash.c',
11 | 'cdt/dttree.c',
12 | 'cdt/dtuser.c',
13 | 'cdt/dtview.c',
14 | 'cdt/dtwalk.c',
15 | ]
16 |
--------------------------------------------------------------------------------
/src/lib/libast/include/ast_assert.h:
--------------------------------------------------------------------------------
1 | //
2 | // We have our own private `assert()` implementation because too many platform implementations
3 | // cause lint warnings from tools like cppcheck. They also tend to write the error to stdout
4 | // rather than stderr which is wrong.
5 | //
6 | #ifndef _AST_ASSERT_H
7 | #define _AST_ASSERT_H 1
8 |
9 | #include
10 | #include
11 |
12 | #undef assert
13 |
14 | #ifdef NDEBUG
15 |
16 | #define assert(e) ((void)0)
17 |
18 | #else // NDEBUG
19 |
20 | // The odd construction is to avoid "multiple unary operator" warnings from lint tools like oclint.
21 | // While still making this syntactically valid for `assert(xyz);` style invocations.
22 | #define assert(e) \
23 | if (e) { \
24 | ; \
25 | } else \
26 | __assert(#e, __FILE__, __LINE__)
27 |
28 | __attribute__((noreturn)) static inline void __assert(const char *e, const char *file, int line) {
29 | (void)fprintf(stderr, "%s:%d: failed assertion '%s'\n", file, line, e), (void)fflush(stderr);
30 | (void)fflush(stderr);
31 | abort();
32 | }
33 |
34 | #endif // NDEBUG
35 |
36 | #endif // _AST_ASSERT_H
37 |
--------------------------------------------------------------------------------
/src/lib/libast/include/ast_float.h:
--------------------------------------------------------------------------------
1 | /* : : generated from float by iffe version 2013-11-14 : : */
2 | #ifndef _def_float_features
3 | #define _def_float_features 1
4 | #include
5 | #include
6 |
7 | /*TODO: Verify limits set in this file are valid for all systems */
8 |
9 | #define UINT_DIG 9
10 | #define ULONG_DIG 19
11 |
12 | #define DBL_ULONG_MAX 18014398509481983.0
13 | #define DBL_ULLONG_MAX DBL_ULONG_MAX
14 | #define DBL_LONG_MAX 9007199254740991.0
15 | #define DBL_LLONG_MAX DBL_LONG_MAX
16 | #define DBL_LONG_MIN (-9007199254740992.0)
17 | #define DBL_LLONG_MIN DBL_LONG_MIN
18 |
19 | #define LDBL_ULONG_MAX 18446744073709551615.0L
20 | #define LDBL_ULLONG_MAX LDBL_ULONG_MAX
21 | #define LDBL_LONG_MAX 9223372036854775807.0L
22 | #define LDBL_LLONG_MAX LDBL_LONG_MAX
23 | #define LDBL_LONG_MIN (-9223372036854775808.0L)
24 | #define LDBL_LLONG_MIN LDBL_LONG_MIN
25 |
26 | #define _ast_flt_unsigned_max_t unsigned long long
27 | #define _ast_flt_nan_init 0x00, 0x00, 0xc0, 0x7f
28 | #define _ast_flt_inf_init 0x00, 0x00, 0x80, 0x7f
29 | #define _ast_dbl_nan_init 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f
30 | #define _ast_dbl_inf_init 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f
31 | #define _ast_ldbl_nan_init \
32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00
33 | #define _ast_ldbl_inf_init \
34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/lib/libast/include/ast_mmap.h:
--------------------------------------------------------------------------------
1 | /* : : generated from mmap by iffe version 2013-11-14 : : */
2 | #ifndef _def_mmap_features
3 | #define _def_mmap_features 1
4 |
5 | #define _mmap_anon 1
6 |
7 | /* some systems get it wrong but escape concise detection */
8 | #if __CYGWIN__
9 | #define _NO_MMAP 1
10 | #endif
11 |
12 | #if _NO_MMAP
13 | #undef _mmap_anon
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/lib/libast/include/ast_tty.h:
--------------------------------------------------------------------------------
1 | /* : : generated from tty by iffe version 2013-11-14 : : */
2 | #ifndef _def_tty_features
3 | #define _def_tty_features 1
4 |
5 | #if _mac__POSIX_VDISABLE
6 | #undef _POSIX_VDISABLE
7 | #endif
8 | #include
9 |
10 | #undef tcgetattr
11 | #undef tcsetattr
12 | #undef tcgetpgrp
13 | #undef tcsetpgrp
14 | #undef cfgetospeed
15 | #ifndef TCSANOW
16 | #define TCSANOW TCSETS
17 | #define TCSADRAIN TCSETSW
18 | #define TCSAFLUSH TCSETSF
19 | #endif /* TCSANOW */
20 | /* The following corrects bugs in some implementations */
21 | #if defined(TCSADFLUSH) && !defined(TCSAFLUSH)
22 | #define TCSAFLUSH TCSADFLUSH
23 | #endif /* TCSADFLUSH */
24 | #undef TIOCGETC
25 |
26 | /* set ECHOCTL if driver can echo control charaters as ^c */
27 | #ifdef LCTLECH
28 | #ifndef ECHOCTL
29 | #define ECHOCTL LCTLECH
30 | #endif /* !ECHOCTL */
31 | #endif /* LCTLECH */
32 | #ifdef LNEW_CTLECH
33 | #ifndef ECHOCTL
34 | #define ECHOCTL LNEW_CTLECH
35 | #endif /* !ECHOCTL */
36 | #endif /* LNEW_CTLECH */
37 | #ifdef LNEW_PENDIN
38 | #ifndef PENDIN
39 | #define PENDIN LNEW_PENDIN
40 | #endif /* !PENDIN */
41 | #endif /* LNEW_PENDIN */
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/lib/libast/include/sig.h:
--------------------------------------------------------------------------------
1 | #ifndef _AST_SIG_H
2 | #define _AST_SIG_H 1
3 |
4 | #define SIG_REG_POP 0
5 | #define SIG_REG_EXEC (1 << 0)
6 | #define SIG_REG_PROC (1 << 1)
7 | #define SIG_REG_TERM (1 << 2)
8 |
9 | extern int sigcritical(int);
10 |
11 | #endif // _AST_SIG_H
12 |
--------------------------------------------------------------------------------
/src/lib/libast/man/ast.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH AST 3
40 | .SH NAME
41 | ast \- miscellaneous libast support
42 | .SH SYNOPSIS
43 | .EX
44 | #include
45 | .EE
46 | .SH DESCRIPTION
47 | .L astwinsize
48 | returns the number of rows in
49 | .I *rows
50 | and the number of columns
51 | .I *col
52 | for the terminal file descriptor
53 | .IR fd .
54 | If the number of rows or columns cannot be determined or if
55 | .I fd
56 | is not a terminal then
57 | .I *rows
58 | and
59 | .I *cols
60 | are set to
61 | .LR 0 .
62 | If
63 | .I ioctl (2)
64 | methods fail then the environment variable
65 | .L LINES
66 | is used to set
67 | .I *rows
68 | and the environment variable
69 | .L COLUMNS
70 | is used to set
71 | .IR *cols .
72 | .SH "SEE ALSO"
73 | getconf(1), confstr(2), mmap(2), pathconf(2), read(2), sysconf(2), write(2)
74 |
--------------------------------------------------------------------------------
/src/lib/libast/man/getcwd.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH GETCWD 3
40 | .SH NAME
41 | getcwd \- return absolute path to current directory
42 | .SH SYNOPSIS
43 | .EX
44 | #include
45 |
46 | char* getcwd(char* \fIbuf\fP, size_t \fIlen\fP);
47 | .EE
48 | .SH DESCRIPTION
49 | .L getcwd
50 | copies the absolute path name of the current directory info into
51 | .I buf
52 | of length
53 | .IR len .
54 | The return path may be longer than
55 | .LR PATH_MAX .
56 | If
57 | .I "buff == 0"
58 | then space is allocated via
59 | .IR malloc (3)
60 | and
61 | .I len
62 | extra characters are reserved after the generated path name.
63 | A pointer to the path name is returned,
64 | .L 0
65 | on error.
66 | .SH "SEE ALSO"
67 | pathcd(3)
68 |
--------------------------------------------------------------------------------
/src/lib/libast/man/int.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH INT 3
40 | .SH NAME
41 | int \- integral type macros
42 | .SH SYNOPSIS
43 | .EX
44 | #include
45 | .EE
46 | .SH DESCRIPTION
47 | This header defines macros for the local integral types.
48 | .LR int_1 ,
49 | .LR int_2
50 | and
51 | .L int_4
52 | are always defined to integral types with a size of
53 | 1, 2 and 4 bytes respectively.
54 | The macros
55 | .LI int_ n
56 | where
57 | .I n
58 | is a power of 2 greater than 4 are defined if the type is supported.
59 | .L int_max
60 | is defined to be the largest support integral type.
61 | .L int_swap
62 | is the
63 | .IR swap (3)
64 | operation that converts a local
65 | .L int
66 | to canonical big-endian representation.
67 | .SH "SEE ALSO"
68 | swap(3)
69 |
--------------------------------------------------------------------------------
/src/lib/libast/man/optget.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH OPTGET 3
40 | .SH NAME
41 | optget \- option parse assist
42 | .SH SYNOPSIS
43 | .EX
44 | #include
45 |
46 | Opt_t
47 | {
48 | };
49 |
50 | Optdisc_t
51 | {
52 | unsigned long version;
53 | unsigned long flags;
54 | char* catalog;
55 | Optinfo_f infof;
56 | };
57 |
58 | Opt_t opt_info;
59 |
60 | void optinit(Optdisc_t* \fIdisc\fP, Error_f \fIerrorf\fP);
61 | int optget(char** \fIargv\fP, const char* \fIusage\fP);
62 | int optstr(const char* \fIstring\fP, const char* \fIusage\fP);
63 | char* optusage(const char* \fIopts\fP);
64 | .EE
65 | .SH DESCRIPTION
66 | .SH "SEE ALSO"
67 |
--------------------------------------------------------------------------------
/src/lib/libast/man/setenviron.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH LIBAST 3
40 | .SH NAME
41 | setenviron \- set environment value
42 | .SH SYNOPSIS
43 | .EX
44 | #include
45 |
46 | char* setenviron(const char* \fIkey\fP);
47 | .EE
48 | .SH DESCRIPTION
49 | .L setenviron
50 | controls environment
51 | .I name=value
52 | pairs.
53 | .L setenviron("\fIname=value\fP")
54 | adds
55 | .I name
56 | to the environment and returns a pointer to a
57 | .IR strdup (3)
58 | copy of
59 | .IR name=value .
60 | .L setenviron("\fIname\fP")
61 | removes
62 | .I name
63 | from the environment and returns the empty string.
64 | .L setenviron
65 | preserves the
66 | .IR ksh (1)
67 | convention of
68 | .L _
69 | as the first environment variable name.
70 | .SH "SEE ALSO"
71 | env(1), exec(2)
72 | .SH BUGS
73 | POSIX will eventually settle on an interface.
74 | It has already picked a few of the names we did in .2 drafts.
75 | This is about the third name change for ours.
76 |
--------------------------------------------------------------------------------
/src/lib/libast/man/sig.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH SIG 3
40 | .SH NAME
41 | sig \- signal interface routines
42 | .SH SYNOPSIS
43 | .L "#include "
44 | .L "#include "
45 | .sp
46 | .L "int sigcritical(int op);"
47 | .SH DESCRIPTION
48 | .PP
49 | .L sigcritical
50 | controls a critical region for the
51 | .LR SIGINT ,
52 | .L SIGQUIT
53 | and
54 | .L SIGHUP
55 | signals.
56 | .L "op > 0"
57 | pushes the region,
58 | .L "op == 0"
59 | pops the region, and
60 | .L "op < 0"
61 | returns non-zero if any signals are being held in the current
62 | critical region.
63 | Signal critical regions may be nested.
64 | The current critical region level is returned,
65 | .L \-1
66 | on error.
67 | .SH "SEE ALSO"
68 | signal(2)
69 |
--------------------------------------------------------------------------------
/src/lib/libast/man/strdup.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH STRDUP 3
40 | .SH NAME
41 | strdup \- duplicate nul-terminated string
42 | .SH SYNOPSIS
43 | .L "char* strdup(char* s)"
44 | .SH DESCRIPTION
45 | .I strdup
46 | copies the nul-terminated string
47 | .I s
48 | to a new location provided by
49 | .IR malloc (3)
50 | and returns a pointer to the new copy.
51 | 0 is returned if
52 | .IR malloc (3)
53 | failed.
54 | .SH "SEE ALSO"
55 | malloc(3), memdup(3)
56 |
--------------------------------------------------------------------------------
/src/lib/libast/man/strelapsed.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH STRELAPSED 3
40 | .SH NAME
41 | strelapsed \- parse elapsed time expression
42 | .SH SYNOPSIS
43 | .L "unsigned long strelapsed(char* buf, char** next, int persec)"
44 | .SH DESCRIPTION
45 | .I strelapsed
46 | returns a pointer to a string representation of the elapsed time for
47 | .L (count/persec)
48 | seconds.
49 | The two largest time units are used, limiting the return value length
50 | to at most 6 characters.
51 | The units are:
52 | .TP
53 | .B s
54 | seconds
55 | .TP
56 | .B m
57 | minutes
58 | .TP
59 | .B h
60 | hours
61 | .TP
62 | .B days
63 | .TP
64 | .B weeks
65 | .TP
66 | .B M
67 | months
68 | .TP
69 | .B Y
70 | years
71 | .TP
72 | .B S
73 | scores
74 | .SH "SEE ALSO"
75 | strelapsed(3)
76 | .SH CAVEATS
77 | The return value points to a static area that is overwritten on each call.
78 |
--------------------------------------------------------------------------------
/src/lib/libast/man/strerror.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH STRERROR 3
40 | .SH NAME
41 | strerror \- return error message string given error number
42 | .SH SYNOPSIS
43 | .L "char* strerror(int err)"
44 | .SH DESCRIPTION
45 | .I strerror
46 | returns the error message string corresponding to the error message number
47 | .IR err .
48 | .BI "Error " nnn
49 | is returned if
50 | .I err
51 | is invalid.
52 | .SH "SEE ALSO"
53 | error(3)
54 |
--------------------------------------------------------------------------------
/src/lib/libast/man/stresc.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH STRESC 3
40 | .SH NAME
41 | stresc \- convert character constants in string
42 | .SH SYNOPSIS
43 | .L "int stresc(char* s)"
44 | .SH DESCRIPTION
45 | .I stresc
46 | converts
47 | .L \e
48 | character constant expressions in the nul-terminated string
49 | .I s
50 | in place and returns the length of the converted
51 | .IR s .
52 | .SH "SEE ALSO"
53 | chresc(3), ctoi(3)
54 |
--------------------------------------------------------------------------------
/src/lib/libast/man/strsort.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH HSORT 3
40 | .SH NAME
41 | hsort \- array heap sort
42 | .SH SYNOPSIS
43 | .EX
44 | #include
45 |
46 | void strsort(char** \fIarray\fP, int \fIelements\fP, int (*\fIcompare\fP)(const char* \fIa\fP, const char* \fIb\fP));
47 | .EE
48 | .SH DESCRIPTION
49 | .L strsort
50 | does a heap sort on the array of pointers
51 | .I array
52 | with
53 | .I elements
54 | elements using the comparison function
55 | .IR compare .
56 | .I compare
57 | returns
58 | .L \-1
59 | if
60 | .I a
61 | is lexicographically less than
62 | .IR b ,
63 | .L 0
64 | if
65 | .I a
66 | is equal to
67 | .IR b ,
68 | and
69 | .L 1
70 | if
71 | .I a
72 | is lexicographically greater than
73 | .IR b .
74 |
--------------------------------------------------------------------------------
/src/lib/libast/man/tab.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH TAB 3
40 | .SH NAME
41 | tab \- simple table lookup routines
42 | .SH SYNOPSIS
43 | .L "#include "
44 | .sp
45 | .L "int tabindex(const void* tab, int size, const char* name);"
46 | .L "void* tablook(const void* tab, int size, const char* name);"
47 | .SH DESCRIPTION
48 | These routines do linear lookups in
49 | .I small
50 | tables (on the order of 32 elements).
51 | Each table element has a size of
52 | .L size
53 | bytes and the beginning of the element points to a name that is
54 | matched by the lookup routines.
55 | .PP
56 | .L tabindex
57 | returns the index of the table element in
58 | .L tab
59 | that matches
60 | .LR name .
61 | If there is no match then
62 | .L \-1
63 | is returned.
64 | .PP
65 | .L tablook
66 | returns a pointer to the table element in
67 | .L tab
68 | that matches
69 | .LR name .
70 | If there is no match then
71 | .L 0
72 | is returned.
73 | .SH "SEE ALSO"
74 | hash(3)
75 |
--------------------------------------------------------------------------------
/src/lib/libast/man/touch.3:
--------------------------------------------------------------------------------
1 | .fp 5 CW
2 | .de Af
3 | .ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
4 | .if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
5 | ..
6 | .de aF
7 | .ie \\$3 .ft \\$1
8 | .el \{\
9 | .ds ;G \&
10 | .nr ;G \\n(.f
11 | .Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
12 | \\*(;G
13 | .ft \\n(;G \}
14 | ..
15 | .de L
16 | .aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
17 | ..
18 | .de LR
19 | .aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
20 | ..
21 | .de RL
22 | .aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
23 | ..
24 | .de EX \" start example
25 | .ta 1i 2i 3i 4i 5i 6i
26 | .PP
27 | .RS
28 | .PD 0
29 | .ft 5
30 | .nf
31 | ..
32 | .de EE \" end example
33 | .fi
34 | .ft
35 | .PD
36 | .RE
37 | .PP
38 | ..
39 | .TH TOUCH 3
40 | .SH NAME
41 | touch \- set file access and modify times
42 | .SH SYNOPSIS
43 | .L "#include "
44 | .sp
45 | .L "int touch(const char* path, time_t atime, time_t mtime, int force);"
46 | .SH DESCRIPTION
47 | .L touch
48 | sets the access and modify times of the file named by
49 | .LR path .
50 | If
51 | .L "force != 0"
52 | then the file is created if it doesn't exist;
53 | otherwise the file is not created and
54 | .L \-1
55 | is returned.
56 | If
57 | .L "force < 0"
58 | then
59 | .L atime
60 | and
61 | .L mtime
62 | are taken verbatim; otherwise
63 | .L "(time_t)(-1)"
64 | retains the current value for the file and
65 | .L "(time_t)(0)"
66 | uses the current time.
67 | .SH CAVEATS
68 | By default the change time is always changed to the current time.
69 |
--------------------------------------------------------------------------------
/src/lib/libast/meson.build:
--------------------------------------------------------------------------------
1 | libast_files = []
2 | libast_incdir = include_directories(
3 | 'aso', 'cdt', 'include', 'misc', 'path', 'sfio', 'string', 'tm',
4 | )
5 | libast_c_args = shared_c_args
6 |
7 | subdir('aso')
8 | subdir('cdt')
9 | subdir('misc')
10 | subdir('path')
11 | subdir('regex')
12 | subdir('sfio')
13 | subdir('string')
14 | subdir('tm')
15 |
16 | libast = library('ast', libast_files,
17 | include_directories: [configuration_incdir, libast_incdir],
18 | c_args: libast_c_args,
19 | dependencies: [libm_dep, libiconv_dep, libcatgets_dep, libexecinfo_dep, libdl_dep,
20 | libsocket_dep, libnsl_dep],
21 | install: get_option('default_library') == 'shared')
22 |
23 | # This library exists solely to support libast unit tests so that `sh_getenv()` and
24 | # `sh_setenviron()` has an implementation. These are normally supplied by ksh but the
25 | # libast unit tests don't link against the ksh code.
26 | libenv = library('env', ['misc/environ.c'],
27 | include_directories: [configuration_incdir, libast_incdir],
28 | c_args: libast_c_args,
29 | install: false)
30 |
--------------------------------------------------------------------------------
/src/lib/libast/misc/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'misc/astwinsize.c',
3 | 'misc/debug.c',
4 | 'misc/error.c',
5 | 'misc/errorf.c',
6 | 'misc/errormsg.c',
7 | 'misc/errorx.c',
8 | 'misc/fallbacks.c',
9 | 'misc/fgetcwd.c',
10 | 'misc/glob.c',
11 | 'misc/optget.c',
12 | 'misc/optget_long.c',
13 | 'misc/procclose.c',
14 | 'misc/procfree.c',
15 | 'misc/procopen.c',
16 | 'misc/setlocale.c',
17 | 'misc/sigcrit.c',
18 | 'misc/state.c',
19 | 'misc/stk.c',
20 | 'misc/translate.c',
21 | 'misc/vmbusy.c',
22 | ]
23 |
24 | if shared_c_args.contains('-DUSE_SPAWN=1')
25 | libast_files += [ 'misc/spawnvex.c' ]
26 | endif
27 |
--------------------------------------------------------------------------------
/src/lib/libast/misc/vmbusy.c:
--------------------------------------------------------------------------------
1 | // This module exists because there is code run by signal handlers that allocate memory. Most
2 | // notably `job_waitsafe()`. They need to know if it is safe to do so. So we wrap the malloc family
3 | // of functions. See issue #563.
4 | //
5 | // TODO: Refactor those signal handlers so they only use async safe functions. Then remove this
6 | // code.
7 | //
8 | #define NO_MALLOC_WRAPPERS 1
9 | #include "config_ast.h"
10 |
11 | #include
12 |
13 | #if _hdr_stdlib
14 | #include
15 | #elif _hdr_malloc
16 | #include
17 | #endif
18 |
19 | #include "ast_assert.h"
20 |
21 | volatile bool vmbusy_flag = false;
22 |
23 | void *ast_malloc(size_t size) {
24 | vmbusy_flag = true;
25 | void *p = malloc(size);
26 | vmbusy_flag = false;
27 | return p;
28 | }
29 |
30 | void *ast_calloc(size_t count, size_t size) {
31 | vmbusy_flag = true;
32 | void *p = calloc(count, size);
33 | vmbusy_flag = false;
34 | assert(p);
35 | return p;
36 | }
37 |
38 | void *ast_realloc(void *ptr, size_t size) {
39 | vmbusy_flag = true;
40 | void *p = realloc(ptr, size);
41 | vmbusy_flag = false;
42 | // On platforms like FreeBSD realloc with size == 0 frees the buffer and returns NULL. On other
43 | // platforms a size of zero gets you a minimally sized block (typically four or eight bytes).
44 | assert(!size || p);
45 | return p;
46 | }
47 |
48 | void ast_free(void *ptr) {
49 | vmbusy_flag = true;
50 | free(ptr);
51 | vmbusy_flag = false;
52 | }
53 |
--------------------------------------------------------------------------------
/src/lib/libast/path/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'path/pathaccess.c', 'path/pathbin.c', 'path/pathcanon.c', 'path/pathcat.c',
3 | 'path/pathexists.c',
4 | 'path/pathgetlink.c', 'path/pathpath.c',
5 | 'path/pathprog.c',
6 | 'path/pathshell.c', 'path/pathstat.c',
7 | 'path/pathtemp.c', 'path/pathuniverse.c',
8 | ]
9 |
--------------------------------------------------------------------------------
/src/lib/libast/regex/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'regex/regcache.c', 'regex/regclass.c',
3 | 'regex/regcoll.c', 'regex/regcomp.c',
4 | 'regex/regfatal.c', 'regex/regexec.c',
5 | 'regex/reginit.c', 'regex/regnexec.c', 'regex/regrecord.c',
6 | 'regex/regrexec.c', 'regex/regstat.c',
7 | ]
8 |
--------------------------------------------------------------------------------
/src/lib/libast/sfio/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'sfio/_sfopen.c', 'sfio/_sfputd.c', 'sfio/_sfputl.c', 'sfio/_sfputm.c', 'sfio/_sfputu.c',
3 | 'sfio/sfclose.c', 'sfio/sfclrlock.c', 'sfio/sfcvt.c', 'sfio/sfdisc.c', 'sfio/sfecvt.c',
4 | 'sfio/sfexcept.c', 'sfio/sfextern.c', 'sfio/sffcvt.c', 'sfio/sffilbuf.c', 'sfio/sfflsbuf.c',
5 | 'sfio/sfgetd.c', 'sfio/sfgetl.c', 'sfio/sfgetm.c', 'sfio/sfgetr.c', 'sfio/sfgetu.c',
6 | 'sfio/sfgetwc.c', 'sfio/sfmode.c', 'sfio/sfmove.c', 'sfio/sfmutex.c', 'sfio/sfnew.c',
7 | 'sfio/sfnotify.c', 'sfio/sfnputc.c', 'sfio/sfopen.c', 'sfio/sfpeek.c', 'sfio/sfpkrd.c',
8 | 'sfio/sfpool.c', 'sfio/sfpopen.c', 'sfio/sfprintf.c', 'sfio/sfprints.c', 'sfio/sfpurge.c',
9 | 'sfio/sfputr.c', 'sfio/sfputu.c', 'sfio/sfputwc.c', 'sfio/sfraise.c', 'sfio/sfrd.c',
10 | 'sfio/sfread.c', 'sfio/sfreserve.c', 'sfio/sfresize.c', 'sfio/sfscanf.c', 'sfio/sfseek.c',
11 | 'sfio/sfset.c', 'sfio/sfsetbuf.c', 'sfio/sfsetfd.c', 'sfio/sfsize.c', 'sfio/sfsk.c',
12 | 'sfio/sfstack.c', 'sfio/sfstrtod.c', 'sfio/sfswap.c', 'sfio/sfsync.c', 'sfio/sftable.c',
13 | 'sfio/sftell.c', 'sfio/sftmp.c', 'sfio/sfungetc.c', 'sfio/sfvprintf.c', 'sfio/sfvscanf.c',
14 | 'sfio/sfwr.c', 'sfio/sfwrite.c'
15 | ]
16 |
--------------------------------------------------------------------------------
/src/lib/libast/string/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'string/base64.c',
3 | 'string/chresc.c',
4 | 'string/fmtbase.c',
5 | 'string/fmtbuf.c',
6 | 'string/fmtelapsed.c',
7 | 'string/fmtesc.c',
8 | 'string/fmtfmt.c',
9 | 'string/fmtint.c',
10 | 'string/fmtmatch.c',
11 | 'string/fmtmode.c',
12 | 'string/fmtperm.c',
13 | 'string/fmtre.c',
14 | 'string/fmtscale.c',
15 | 'string/fmttmx.c',
16 | 'string/memdup.c',
17 | 'string/modedata.c',
18 | 'string/strelapsed.c',
19 | 'string/stresc.c',
20 | 'string/strlcat.c',
21 | 'string/strlcpy.c',
22 | 'string/strmatch.c',
23 | 'string/strperm.c',
24 | 'string/strsort.c',
25 | 'string/strtonll.c',
26 | 'string/struniq.c',
27 | 'string/utf32stowcs.c',
28 | 'string/utf32toutf8.c',
29 | 'string/utf8toutf32.c',
30 | 'string/wcstoutf32s.c'
31 | ]
32 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/NOTES:
--------------------------------------------------------------------------------
1 | arch strtoi strtof notes
2 | ---- ------ ------ -----
3 | darwin.i386 32/64 6.37.38-15.307.308-18.4931.4932 libc nan sign
4 | darwin.ppc 32/64 6.37.38-15.307.308-31.291.308
5 | freebsd6.i386 32/64 6.37.38-15.307.308-18.4931.4932 DEBUG
6 | hp.ia64 32/64 6.37.38-15.307.308-33.4931.4932
7 | ibm.risc 32/64 6.37.38-15.307.308-15.307.308 libc nan sign
8 | linux.i386 32/64 6.37.38-15.307.308-18.4931.4932
9 | linux.i386-64 64/64 6.37.38-15.307.308-18.4931.4932
10 | linux.ia64 64/64 6.37.38-15.307.308-18.4931.4932 libc nan sign
11 | linux.ppc64 32/64 6.37.38-15.307.308-15.307.308
12 | netbsd6.i386 32/64 6.37.38-15.307.308-18.4931.4932 DEBUG
13 | sgi.mips3 32/64 6.37.38-15.307.308-31.307.308 libc { nan 0.0 } sign
14 | sol8.sun4 32/64 6.37.38-15.307.308-33.4931.4932 libc nan sign
15 | sol10.sun4 32/64 6.37.38-15.307.308-33.4931.4932
16 |
17 | if (tchild())
18 | { /* exec'd child */
19 | }
20 | else
21 | { /* original parent */
22 | }
23 | check argv[1] for "--child"
24 | child proc exec inserts "--child" as first arg
25 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/aso/meson.build:
--------------------------------------------------------------------------------
1 | test_dir = meson.current_source_dir()
2 | tests = ['taso', 'tlock']
3 |
4 | incdir = include_directories('..', '../../include/')
5 |
6 | foreach test_name: tests
7 | test_target = executable(
8 | test_name, test_name + '.c',
9 | c_args: shared_c_args,
10 | include_directories: [configuration_incdir, incdir],
11 | link_with: [libast, libenv],
12 | dependencies: [libm_dep],
13 | install: false)
14 | test('API/aso/' + test_name, sh_exe, args: [test_driver, test_target, test_dir])
15 | endforeach
16 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/cdt/meson.build:
--------------------------------------------------------------------------------
1 | test_dir = meson.current_source_dir()
2 |
3 | # TODO: Enable these tests when they are fixed to work reliably. At the moment these
4 | # timeout or fail on most platforms:
5 | # ['tsafehash.c', 120], ['tsafetree.c', 120],
6 | tests = ['tannounce', 'tbags', 'tdeque', 'tdict', 'tdtstack', 'tevent', 'tinstall', 'tlist',
7 | 'tobag', 'tqueue', 'trhbags', 'tsearch', 'tstringset', 'tuser',
8 | # See https://github.com/att/ast/issues/1428 for why this test is disabled.
9 | # 'tvthread',
10 | 'twalk', 'tview', 'trehash']
11 |
12 | incdir = include_directories('..', '../../include/')
13 |
14 | foreach test_name: tests
15 | test_target = executable(
16 | test_name, test_name + '.c',
17 | c_args: shared_c_args,
18 | include_directories: [configuration_incdir, incdir],
19 | link_with: [libast, libenv],
20 | link_args: ['-lpthread'],
21 | install: false)
22 | test('API/cdt/' + test_name, sh_exe, args: [test_driver, test_target, test_dir])
23 | endforeach
24 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/date.msk:
--------------------------------------------------------------------------------
1 | %m
2 | %A %B %d, %Y, %H:%M:%S
3 | %A
4 | %B
5 | %m/%d/%y %I %p
6 | %d,%m,%Y %H:%M
7 | at %A the %dst of %B in %Y
8 | run job at %I %p, %B %dnd
9 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/meson.build:
--------------------------------------------------------------------------------
1 | sh_exe = find_program('sh')
2 | test_driver = join_paths(meson.current_source_dir(), 'run_test.sh')
3 |
4 | subdir('aso')
5 | subdir('cdt')
6 | subdir('misc')
7 | subdir('path')
8 | subdir('sfio')
9 | subdir('string')
10 | subdir('tm')
11 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/misc/debug.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #include "ast.h"
8 | #include "terror.h"
9 |
10 | extern bool _dprintf_debug;
11 | extern int _dprint_fixed_line;
12 | extern int (*_debug_getpid)();
13 | extern char *_debug_lsof;
14 | extern int _dprintf_buf_sz;
15 |
16 | static_fn int debug_getpid() { return 666; }
17 |
18 | static_fn void test_run_lsof() {
19 | _debug_lsof = "echo";
20 | run_lsof();
21 | }
22 |
23 | static_fn void test_addr2info() {
24 | errno = 123;
25 | const char *info = addr2info(debug_getpid);
26 | fprintf(stderr, "addr2info(): %s\n", info);
27 | if (errno != 123) terror("Expected errno == 123 but it is %d", errno);
28 | }
29 |
30 | static_fn void test_backtrace() {
31 | errno = 456;
32 | dump_backtrace(2);
33 | if (errno != 456) terror("Expected errno == 456 but it is %d", errno);
34 | dump_backtrace(-1);
35 | dump_backtrace(0);
36 | dump_backtrace(999999);
37 | }
38 |
39 | tmain() {
40 | UNUSED(argc);
41 | _dprintf_debug = true;
42 | _dprint_fixed_line = 987;
43 | _debug_getpid = debug_getpid;
44 | set_debug_filename(argv[0]);
45 |
46 | test_run_lsof();
47 | test_addr2info();
48 | test_backtrace();
49 |
50 | // Verify that a debug message that is longer than can be constructed in a fixed size buffer is
51 | // properly truncated.
52 | _dprintf_buf_sz = 80;
53 | DPRINTF("0123456789012345678901234567890123456789");
54 | _dprintf_buf_sz = 70;
55 | DPRINTF("012345678901234567890123456789");
56 |
57 | texit(0);
58 | }
59 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/misc/debug.err:
--------------------------------------------------------------------------------
1 | ### 666 0.000 debug.c:987 run_lsof() Running lsof:
2 | -p 666
3 | addr2info(): hello unit test
4 | ### 666 Function backtrace:
5 | 1 test_backtrace + 0
6 | 2 main + 0
7 | ### 666 Function backtrace:
8 | 1 test_backtrace + 0
9 | 2 main + 0
10 | ### 666 Function backtrace:
11 | 1 test_backtrace + 0
12 | 2 main + 0
13 | ### 666 Function backtrace:
14 | 1 test_backtrace + 0
15 | 2 main + 0
16 | ### 666 0.000 debug.c:987 main() 01234567890123456789012...
17 | ### 666 0.000 debug.c:987 main() 0123456789012...
18 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/meson.build:
--------------------------------------------------------------------------------
1 | test_dir = meson.current_source_dir()
2 | tests = ['pathaccess', 'pathbin', 'pathcanon', 'pathcat', 'pathexists', 'pathgetlink', 'pathprog',
3 | 'pathpath', 'pathshell', 'pathstat', 'pathtemp']
4 |
5 | incdir = include_directories('..', '../../include/')
6 |
7 | foreach test_name: tests
8 | test_target = executable(
9 | test_name, test_name + '.c',
10 | c_args: shared_c_args,
11 | include_directories: [configuration_incdir, incdir],
12 | link_with: [libast, libenv],
13 | install: false)
14 | test('API/path/' + test_name, sh_exe, args: [test_driver, test_target, test_dir])
15 | endforeach
16 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathaccess.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "ast.h"
10 | #include "terror.h"
11 |
12 | const char *relative_path = "foo";
13 |
14 | tmain() {
15 | UNUSED(argc);
16 | UNUSED(argv);
17 |
18 | char path[PATH_MAX];
19 | char cwd[PATH_MAX];
20 | char expanded_relative_path[2 * PATH_MAX];
21 |
22 | const char *paths = "/usr:/usr/bin:/usr/local/bin";
23 | pathaccess(paths, 0, 0, 0, path, sizeof(path));
24 |
25 | if (strcmp(path, "/usr")) terror("pathaccess() failed to resolve path");
26 |
27 | paths = "this_path_does_not_exist";
28 |
29 | if (pathaccess(paths, 0, 0, PATH_ABSOLUTE, path, sizeof(path))) {
30 | terror("pathaccess() returns path to a file that does not exist");
31 | }
32 |
33 | // Test for relative paths
34 | int fd = open(relative_path, O_CREAT, 0666);
35 | if (fd == -1) terror("Failed to create test file");
36 |
37 | if (!getcwd(cwd, sizeof(cwd))) terror("Failed to get current working directory");
38 |
39 | snprintf(expanded_relative_path, sizeof(expanded_relative_path), "%s/%s", cwd, relative_path);
40 |
41 | if (!pathaccess("", relative_path, 0, PATH_ABSOLUTE, path, PATH_MAX) ||
42 | strcmp(path, expanded_relative_path)) {
43 | terror("pathaccess() does not recognize relative paths");
44 | }
45 |
46 | texit(0);
47 | }
48 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathbin.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "ast.h"
10 | #include "terror.h"
11 |
12 | tmain() {
13 | UNUSED(argc);
14 | UNUSED(argv);
15 | int failed = 0;
16 | char *result = NULL;
17 | char default_cs_path[BUFSIZ];
18 |
19 | char *custom_path = "/foo:/bar:/baz";
20 |
21 | // Set custom path for testing
22 | if (setenv("PATH", custom_path, 1)) {
23 | fprintf(stderr, "Failed to set custom path");
24 | failed = 1;
25 | }
26 |
27 | // Check return value of `pathbin()` when `PATH` is a custom path
28 | result = pathbin();
29 | if (strcmp(result, custom_path)) {
30 | fprintf(stderr, "pathbin() function fails when PATH is set to custom path");
31 | failed = 1;
32 | }
33 |
34 | // Unset `PATH`
35 | if (unsetenv("PATH")) {
36 | fprintf(stderr, "Failed to set custom path");
37 | failed = 1;
38 | }
39 |
40 | // When `PATH` is not set, `pathbin()` gets default value from `confstr()` function
41 | if (confstr(_CS_PATH, default_cs_path, BUFSIZ) == 0 && errno == EINVAL) {
42 | fprintf(stderr, "Failed to get default cs_path");
43 | failed = 1;
44 | }
45 |
46 | // Check return value of `pathbin()` when `PATH` is not set
47 | result = pathbin();
48 | if (strcmp(result, default_cs_path)) {
49 | fprintf(stderr, "pathbin() function fails when PATH is not set");
50 | failed = 1;
51 | }
52 |
53 | texit(failed);
54 | }
55 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathexists.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include "ast.h"
9 | #include "terror.h"
10 |
11 | char test_path[PATH_MAX] = "foo";
12 |
13 | tmain() {
14 | UNUSED(argc);
15 | UNUSED(argv);
16 |
17 | char path[PATH_MAX];
18 |
19 | int fd = open(test_path, O_CREAT, 0666);
20 | if (fd == -1) terror("Failed to create test file");
21 |
22 | if (!getcwd(path, PATH_MAX)) terror("Failed to get current directory");
23 |
24 | strcat(path, "/");
25 | strcat(path, test_path);
26 |
27 | if (pathexists(path, PATH_READ) != 1) terror("Path should be readable");
28 | // Second call to same path should pick up permissions from cache
29 | if (pathexists(path, PATH_READ) != 1)
30 | terror("pathexists() fails to get permissions from cache");
31 |
32 | // https://github.com/att/ast/issues/1215 - `pathexists()` function does not invalidate cache
33 | // Uncomment following test case when this bug has been fixed.
34 | // Remove all permissions from file
35 | // if (chmod(path, 0) < 0) terror("Failed to change permissions");
36 |
37 | // if (pathexists(path, PATH_READ) == 1) terror("Path should not be readable");
38 |
39 | texit(0);
40 | }
41 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathgetlink.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #include "ast.h"
8 | #include "terror.h"
9 |
10 | tmain() {
11 | UNUSED(argc);
12 | UNUSED(argv);
13 | const char *linkname = "foo";
14 |
15 | char buff[10];
16 | const char *filename = "foobarbaz";
17 | char smallbuff[4];
18 |
19 | int fd = open(filename, O_CREAT, 0666);
20 | if (fd == -1) terror("Failed to create test file");
21 | close(fd);
22 |
23 | if (symlink(filename, linkname) < 0) {
24 | terror("Failed to create symbolic link");
25 | }
26 |
27 | if ((pathgetlink(linkname, buff, sizeof(buff)) < 0) || strcmp(buff, filename)) {
28 | terror("pathgetlink() should return filename of link");
29 | }
30 |
31 | if (pathgetlink(linkname, smallbuff, sizeof(smallbuff)) > 0) {
32 | terror("pathgetlink() should fail when buffer is small");
33 | }
34 |
35 | texit(0);
36 | }
37 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathpath.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include "ast.h"
10 | #include "terror.h"
11 |
12 | char test_path[PATH_MAX] = "foo";
13 |
14 | tmain() {
15 | UNUSED(argc);
16 | UNUSED(argv);
17 |
18 | char path[PATH_MAX];
19 | char absolute_path[PATH_MAX];
20 | char absolute_test_path[PATH_MAX];
21 |
22 | getcwd(absolute_test_path, sizeof(absolute_test_path));
23 | strcat(absolute_test_path, "/");
24 | strcat(absolute_test_path, "foo");
25 |
26 | int fd = open(test_path, O_CREAT, 0666);
27 | if (fd == -1) terror("Failed to create test file");
28 |
29 | // Search this path in current directory and expand it
30 | pathpath("foo", NULL, PATH_ABSOLUTE, path, sizeof(path));
31 | if (strcmp(path, absolute_test_path))
32 | terror("Failed to expand path of file in current directory");
33 |
34 | if (!pathpath("cat", NULL, PATH_EXECUTE, absolute_path, sizeof(absolute_path)))
35 | terror("Failed to find `cat` in current $PATH");
36 |
37 | if (!pathpath(absolute_path, NULL, PATH_EXECUTE, path, sizeof(path)))
38 | terror("Failed to find `%s` with absolute path", path);
39 |
40 | // Tests for serching paths through `FPATH`
41 | setenv("PATH", "", 1);
42 | setenv("FPATH", "/bin:/usr/bin:/usr/local/bin", 1);
43 | if (!pathpath("cat", NULL, PATH_EXECUTE, path, sizeof(path)))
44 | terror("Failed to search path through `FPATH`");
45 |
46 | texit(0);
47 | }
48 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathprog.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 |
6 | #include "ast.h"
7 | #include "terror.h"
8 |
9 | tmain() {
10 | UNUSED(argc);
11 | UNUSED(argv);
12 |
13 | char path[PATH_MAX];
14 |
15 | pathprog(argv[0], path, sizeof(path));
16 |
17 | if (strcmp(path, argv[0]))
18 | terror("pathprog() fails to return correct path. Expected: %s Actual: %s", path, argv[0]);
19 |
20 | texit(0);
21 | }
22 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathshell.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 |
6 | #include "ast.h"
7 | #include "terror.h"
8 |
9 | tmain() {
10 | UNUSED(argc);
11 | UNUSED(argv);
12 |
13 | char *shell;
14 |
15 | char *shells[] = {"/bin/bash", "/bin/ksh", "/bin/zsh", NULL};
16 | for (int i = 0; shells[i]; ++i) {
17 | setenv("SHELL", shells[i], 1);
18 | shell = pathshell();
19 | if (strcmp(shell, shells[i])) terror("pathshell() fails when 'SHELL=%s'", shells[i]);
20 | }
21 |
22 | // If shell is a variant of csh or it does not exists, default path is returned
23 | char *csh_paths[] = {"/bin/tcsh", "/bin/csh", "/bin/this_shell_does_not_exist", NULL};
24 | for (int i = 0; csh_paths[i]; ++i) {
25 | setenv("SHELL", csh_paths[i], 1);
26 | shell = pathshell();
27 | if (strcmp(shell, "/bin/sh")) terror("pathshell() fails when 'SHELL=%s'", csh_paths[i]);
28 | }
29 |
30 | texit(0);
31 | }
32 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathstat.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #include "ast.h"
8 | #include "terror.h"
9 |
10 | const char *link_to_temp_file = "link_to_temp_file";
11 |
12 | tmain() {
13 | UNUSED(argc);
14 | UNUSED(argv);
15 |
16 | const char *temp_file = "temp_file";
17 |
18 | struct stat statbuf;
19 |
20 | int fd = open(temp_file, O_CREAT, 0666);
21 | if (fd == -1) terror("Failed to create temp file");
22 | close(fd);
23 |
24 | if (pathstat(temp_file, &statbuf) && statbuf.st_mode == 0666) {
25 | terror("Failed to stat() %s", temp_file);
26 | }
27 |
28 | if (symlink(temp_file, link_to_temp_file) < 0) {
29 | terror("Failed to create symbolic link to %s", temp_file);
30 | }
31 |
32 | // Unlink target file to create a broken symbolic link
33 | unlink(temp_file);
34 |
35 | if (pathstat(link_to_temp_file, &statbuf)) {
36 | terror("Failed to stat %s if it's broken", link_to_temp_file);
37 | }
38 |
39 | texit(0);
40 | }
41 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/path/pathtemp.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 |
6 | #include "ast.h"
7 | #include "terror.h"
8 |
9 | const char *temp_file = NULL;
10 |
11 | tmain() {
12 | UNUSED(argc);
13 | UNUSED(argv);
14 |
15 | char cwd[PATH_MAX];
16 | int fd;
17 |
18 | if (!getcwd(cwd, sizeof(cwd))) terror("Failed to get current directory");
19 |
20 | temp_file = ast_temp_file(cwd, NULL, &fd, 0);
21 | if (!temp_file || fd < 0) terror("Failed to create temporary file");
22 |
23 | texit(0);
24 | }
25 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/strelapsed.tst:
--------------------------------------------------------------------------------
1 | # regression tests for the ast strelapsed() routine
2 |
3 | TEST 01 'basics'
4 | EXEC 1 '1h5s' 1 '1hour5sec' 1 '1 hour 5 sec'
5 | OUTPUT - $'strelapsed "1h5s" "" 3605 1
6 | strelapsed "1hour5sec" "" 3605 1
7 | strelapsed "1 hour 5 sec" "" 3605 1'
8 | EXEC 10 '1h5s' 10 '1hour5sec' 10 '1 hour 5 sec'
9 | OUTPUT - $'strelapsed "1h5s" "" 36050 10
10 | strelapsed "1hour5sec" "" 36050 10
11 | strelapsed "1 hour 5 sec" "" 36050 10'
12 | EXEC 1 '3m5d' 1 '3mi5da' 1 '3M5da' 1 '3mo5da' 1 '3MI5da' 1 '3Mi5da' 1 '3Mo5da' 1 '3MO5da'
13 | OUTPUT - $'strelapsed "3m5d" "" 432180 1
14 | strelapsed "3mi5da" "" 432180 1
15 | strelapsed "3M5da" "" 7689600 1
16 | strelapsed "3mo5da" "" 7689600 1
17 | strelapsed "3MI5da" "" 432180 1
18 | strelapsed "3Mi5da" "" 432180 1
19 | strelapsed "3Mo5da" "" 7689600 1
20 | strelapsed "3MO5da" "" 7689600 1'
21 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/fmtelapsed.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 | char *actual_result;
12 |
13 | struct IntegerToStringTest tests[] = {{10, "10.00s"},
14 | {60, "1m00s"},
15 | {60 * 60, "1h00m"},
16 | {24 * 60 * 60, "1d00h"},
17 | {28 * 24 * 60 * 60, "4w00d"},
18 | {364 * 24 * 60 * 60, "11M29d"},
19 | {365 * 24 * 60 * 60, "1Y00M"},
20 | {10 * 365 * 24 * 60 * 60, "9Y11M"},
21 | {0, NULL}};
22 |
23 | for (int i = 0; tests[i].expected_result; ++i) {
24 | actual_result = fmtelapsed(tests[i].input, 1);
25 |
26 | if (strcmp(actual_result, tests[i].expected_result)) {
27 | terror(
28 | "fmtelapsed() :: Failed to convert seconds to readable time :: Expected: %s, "
29 | "Actual: %s",
30 | tests[i].expected_result, actual_result);
31 | }
32 | }
33 |
34 | texit(0);
35 | }
36 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/fmtfmt.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | const char *actual_result = NULL;
13 |
14 | struct StringToStringTest tests[] = {
15 | {"%c", "c"}, {"%d", "i"}, {"%D", "i"}, {"%f", "f"}, {"%h", "h"}, {"%i", "i"},
16 | {"%j", "j"}, {"%l", "l"}, {"%p", "p"}, {"%s", "s"}, {"%t", "t"}, {"%z", "z"},
17 | {"%e", "d"}, {"%g", "d"}, {"%*d", "1i"}, {"%(123)d", "i"}, {NULL, NULL}};
18 |
19 | for (int i = 0; tests[i].input; ++i) {
20 | actual_result = fmtfmt(tests[i].input);
21 | if (strcmp(actual_result, tests[i].expected_result)) {
22 | terror(
23 | "fmtfmt() :: Failed to convert format to signature :: Expected Result : %s, Actual "
24 | "Result : %s\n",
25 | tests[i].expected_result, actual_result);
26 | }
27 | }
28 |
29 | texit(0);
30 | }
31 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/fmtint.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | const char *actual_result;
13 |
14 | struct IntegerToStringTest tests[] = {
15 | {9, "9"}, {123, "123"}, {24321, "24321"}, {10000000, "10000000"},
16 | {-10000, "-10000"}, {-151, "-151"}, {0, "0"}, {0, NULL}};
17 |
18 | for (int i = 0; tests[i].expected_result; ++i) {
19 | actual_result = fmtint(tests[i].input, 0);
20 | if (strcmp(actual_result, tests[i].expected_result)) {
21 | terror(
22 | "fmtint() failed :: Failed to convert number to string :: Actual Result : %d, "
23 | "Expected Result : %d",
24 | actual_result, tests[i].expected_result);
25 | }
26 | }
27 |
28 | texit(0);
29 | }
30 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/fmtmode.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | const char *actual_result = NULL;
13 |
14 | struct IntegerToStringTest tests[] = {{0777, "-rwxrwxrwx"},
15 | {0555, "-r-xr-xr-x"},
16 | {0444, "-r--r--r--"},
17 | {0755, "-rwxr-xr-x"},
18 | {0, NULL}};
19 |
20 | for (int i = 0; tests[i].input; ++i) {
21 | actual_result = fmtmode(tests[i].input);
22 | if (strcmp(actual_result, tests[i].expected_result)) {
23 | terror(
24 | "fmtmode() failed :: Failed to convert mode to formatted string :: Actual Result : "
25 | "%s, Expected Result : %s",
26 | actual_result, tests[i].expected_result);
27 | }
28 | }
29 | texit(0);
30 | }
31 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/fmtperm.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | const char *actual_result = NULL;
13 |
14 | struct IntegerToStringTest tests[] = {{0777, "u=rwx,g=rwx,o=rwx"},
15 | {0555, "u=rx,g=rx,o=rx"},
16 | {0444, "u=r,g=r,o=r"},
17 | {0755, "u=rwx,g=rx,o=rx"},
18 | {0, NULL}};
19 |
20 | for (int i = 0; tests[i].input; ++i) {
21 | actual_result = fmtperm(tests[i].input);
22 |
23 | if (strcmp(actual_result, tests[i].expected_result)) {
24 | terror(
25 | "fmtperm() failed :: Failed to convert mode to string :: Actual Result : %s, "
26 | "Expected Result : %s",
27 | actual_result, tests[i].expected_result);
28 | }
29 | }
30 |
31 | texit(0);
32 | }
33 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/fmttmx.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #include "terror.h"
8 | #include "tmx.h"
9 |
10 | tmain() {
11 | UNUSED(argc);
12 | UNUSED(argv);
13 |
14 | // Unix Epoch
15 | Time_t t = 0;
16 | const char *actual_result;
17 |
18 | const char *expected_result = "Thu Jan 1 00:00:00 UTC 1970";
19 |
20 | // Set timezone to match expected result
21 | setenv("TZ", "UTC", 1);
22 | tzset();
23 |
24 | // Format strings will be tested through `tmxfmt()` function tests
25 | actual_result = fmttmx("", t);
26 |
27 | if (strcmp(actual_result, expected_result)) {
28 | terror("fmttmx() failed :: Actual Result : %s, Expected Result : %s", actual_result,
29 | expected_result);
30 | }
31 | texit(0);
32 | }
33 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/meson.build:
--------------------------------------------------------------------------------
1 | test_dir = meson.current_source_dir()
2 | tests = [
3 | 'base64',
4 | 'chresc',
5 | 'fmtbase',
6 | 'fmtelapsed',
7 | 'fmtesc',
8 | 'fmtfmt',
9 | 'fmtint',
10 | 'fmtmatch',
11 | 'fmtmode',
12 | 'fmtperm',
13 | 'fmtre',
14 | 'fmtscale',
15 | 'fmttmx',
16 | 'strelapsed',
17 | 'stresc',
18 | 'strlcat',
19 | 'strlcpy',
20 | 'strmatch',
21 | 'strperm',
22 | 'strsort',
23 | 'strtonll',
24 | 'struniq',
25 | 'utf',
26 | ]
27 |
28 | # Some tests are known to fail on some platforms. For example, tests involving UTF-8 <=> UTF-32
29 | # fail on Cygwin because sizeof(wchar_t) == 2.
30 | tests_to_skip = [
31 | ['cygwin', 'utf'],
32 | ]
33 |
34 | incdir = include_directories('..', '../../include/')
35 |
36 | foreach test_name: tests
37 | skip_test = false
38 | foreach skip : tests_to_skip
39 | if system == skip[0] and test_name == skip[1]
40 | warning('skipping API/string/' + test_name + ' on ' + system)
41 | skip_test = true
42 | # break # Not until meson 0.49
43 | endif
44 | endforeach
45 | if not skip_test
46 | test_target = executable(
47 | test_name, test_name + '.c',
48 | c_args: shared_c_args,
49 | include_directories: [configuration_incdir, incdir],
50 | link_with: [libast, libenv],
51 | install: false)
52 | test('API/string/' + test_name, sh_exe, args: [test_driver, test_target, test_dir])
53 | endif
54 | endforeach
55 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/strelapsed.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 | int actual_result;
12 | char *error = NULL;
13 |
14 | struct StringToIntegerTest tests[] = {
15 | {"1h5s", 3605}, {"1h5Se", 3605}, {"1hour5sec", 3605}, {"1 hour 5 sec", 3605},
16 | {"1:0:05", 3605}, {"3mi5da", 432180}, {"1w", 604800}, {"3M5da", 7689600},
17 | {"3mo5da", 7689600}, {"3MI5da", 432180}, {"3Mi5da", 432180}, {"3Mo5da", 7689600},
18 | {"3MO5da", 7689600}, {"1Y", 29030400}, {"1S", 580608000}, {NULL, 0}};
19 |
20 | for (int i = 0; tests[i].input; ++i) {
21 | actual_result = strelapsed(tests[i].input, &error, 1);
22 |
23 | if (actual_result != tests[i].expected_result || *error) {
24 | terror(
25 | "fmtelapsed() :: Failed to convert readable time to seconds :: Expected: %d, "
26 | "Actual: %d :: First unrecognized character : %s",
27 | tests[i].expected_result, actual_result, error);
28 | }
29 | }
30 |
31 | texit(0);
32 | }
33 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/stresc.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | // Very simple test to check if escape sequences are expanded
13 | // `stresc()` internally uses `chresc()` function to expand escape sequences
14 | // and it has more thorough tests.
15 | char input[] = "\\n\\r";
16 | char expected_result[] = "\n\r";
17 |
18 | if (stresc(input) <= 0 || strcmp(input, expected_result)) {
19 | terror("stresc() failed :: Actual Result : %s, Expected Result: %s", input,
20 | expected_result);
21 | }
22 |
23 | texit(0);
24 | }
25 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/strlcat.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "terror.h"
6 |
7 | tmain() {
8 | UNUSED(argc);
9 | UNUSED(argv);
10 |
11 | char buffer[7] = "foo";
12 | char buffer_to_append[] = "barbaz";
13 |
14 | strlcat(buffer, buffer_to_append, 7);
15 |
16 | if (strcmp(buffer, "foobar"))
17 | terror("strlcat() :: Failed to append buffer :: Actual Result: %s, Expected Result: %s",
18 | buffer, "foobar");
19 |
20 | texit(0);
21 | }
22 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/strlcpy.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "terror.h"
6 |
7 | tmain() {
8 | UNUSED(argc);
9 | UNUSED(argv);
10 |
11 | char buffer[4] = "foo";
12 | char buffer_to_append[] = "barbaz";
13 |
14 | strlcpy(buffer, buffer_to_append, sizeof(buffer));
15 |
16 | if (strcmp(buffer, "bar"))
17 | terror(
18 | "strlcat() :: Failed to copy buffer with truncation :: Actual Result: %s, Expected "
19 | "Result: %s",
20 | buffer, "bar");
21 |
22 | texit(0);
23 | }
24 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/strperm.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | struct Test {
9 | const char *permissions_to_apply;
10 | int existing_permissions;
11 | int expected_result;
12 | };
13 |
14 | tmain() {
15 | UNUSED(argc);
16 | UNUSED(argv);
17 |
18 | char *error;
19 | int actual_result;
20 |
21 | struct Test tests[] = {{"g=rwx", 0700, 0770},
22 | {"o=rwx", 0700, 0707},
23 | {"u+rwx,g+rwx,o+rwx", 0, 0777},
24 | {"a+rwx", 0, 0777},
25 | {"a+rwX", 0, 0666},
26 | {"u&rw,g-rwx,o-rwx", 0777, 0600},
27 | {"u|rwx,g-rwx,o-rwx", 0077, 0700},
28 | {"u-rwx,g-rwx,o-rwx", 0777, 0},
29 | {"s,u=rwx", 0777, 02700},
30 | {"0755", 0, 0755},
31 | {NULL, 0, 0}};
32 |
33 | for (int i = 0; tests[i].permissions_to_apply; ++i) {
34 | error = NULL;
35 | actual_result =
36 | strperm(tests[i].permissions_to_apply, &error, tests[i].existing_permissions);
37 | if (actual_result != tests[i].expected_result || *error) {
38 | terror(
39 | "strperm() failed :: Failed to apply permissions :: Actual Result : %o, Expected "
40 | "Result : %o",
41 | actual_result, tests[i].expected_result);
42 | }
43 | }
44 |
45 | texit(0);
46 | }
47 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/strsort.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | char *unsorted_strings[] = {"Line 9", "Line 8", "Line 7", "Line 6", "Line 5",
13 | "Line 4", "Line 3", "Line 2", "Line 1"};
14 |
15 | char *sorted_strings[] = {
16 | "Line 1", "Line 2", "Line 3", "Line 4", "Line 5", "Line 6", "Line 7", "Line 8", "Line 9",
17 | };
18 |
19 | strsort(unsorted_strings, sizeof(unsorted_strings) / sizeof(char *), strcmp);
20 |
21 | for (int i = 0; i < sizeof(unsorted_strings) / sizeof(char *); ++i) {
22 | if (strcmp(unsorted_strings[i], sorted_strings[i])) {
23 | terror(
24 | "strsort() failed :: Failed to sort strings :: Actual Result : %s, Expected Result "
25 | ": %s",
26 | unsorted_strings[i], sorted_strings[i]);
27 | }
28 | }
29 |
30 | texit(0);
31 | }
32 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/strtonll.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 |
6 | #include "ast.h"
7 | #include "terror.h"
8 |
9 | tmain() {
10 | UNUSED(argc);
11 | UNUSED(argv);
12 |
13 | int64_t actual_result;
14 | char *error;
15 |
16 | struct StringToIntegerTest tests[] = {{"500", 500}, {"999", 999}, {"-123", -123},
17 | {"0x0f", 15}, {"010", 8}, {NULL, 0}};
18 |
19 | for (int i = 0; tests[i].input; ++i) {
20 | actual_result = strton64(tests[i].input, &error, NULL, 1);
21 | if (actual_result != tests[i].expected_result) {
22 | terror(
23 | "strton64 failed() :: Failed to convert string to number :: Actual Result : %d, "
24 | "Expected Result : %d",
25 | actual_result, tests[i].expected_result);
26 | }
27 | }
28 |
29 | texit(0);
30 | }
31 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/string/struniq.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | #include "ast.h"
6 | #include "terror.h"
7 |
8 | tmain() {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | char *unsorted_strings[] = {"Line 9", "Line 8", "Line 7", "Line 6", "Line 5", "Line 4",
13 | "Line 3", "Line 2", "Line 1", "Line 9", "Line 8", "Line 7",
14 | "Line 6", "Line 5", "Line 4", "Line 3", "Line 2", "Line 1"};
15 |
16 | char *unique_strings[] = {
17 | "Line 1", "Line 2", "Line 3", "Line 4", "Line 5", "Line 6", "Line 7", "Line 8", "Line 9",
18 | };
19 |
20 | strsort(unsorted_strings, sizeof(unsorted_strings) / sizeof(char *), strcmp);
21 | struniq(unsorted_strings, sizeof(unsorted_strings) / sizeof(char *));
22 |
23 | for (int i = 0; i < sizeof(unique_strings) / sizeof(char *); ++i) {
24 | if (strcmp(unsorted_strings[i], unique_strings[i])) {
25 | terror(
26 | "struniq() failed :: Failed to remove duplicate strings :: Actual Result : %s, "
27 | "Expected Result "
28 | ": %s",
29 | unsorted_strings[i], unique_strings[i]);
30 | }
31 | }
32 |
33 | texit(0);
34 | }
35 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/tm/meson.build:
--------------------------------------------------------------------------------
1 | test_dir = meson.current_source_dir()
2 | tests = ['tvgettime']
3 |
4 | incdir = include_directories('..', '../../include/')
5 |
6 | foreach test_name: tests
7 | test_target = executable(
8 | test_name, test_name + '.c',
9 | c_args: shared_c_args,
10 | include_directories: [configuration_incdir, incdir],
11 | link_with: [libast, libenv],
12 | install: false)
13 | test('API/tm/' + test_name, sh_exe, args: [test_driver, test_target, test_dir])
14 | endforeach
15 |
--------------------------------------------------------------------------------
/src/lib/libast/tests/tm/tvgettime.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 | #include
5 |
6 | #include "terror.h"
7 | #include "tv.h"
8 |
9 | tmain() {
10 | UNUSED(argc);
11 | UNUSED(argv);
12 |
13 | Tv_t tv;
14 | struct timeval timeval;
15 |
16 | tvgettime(&tv);
17 |
18 | gettimeofday(&timeval, NULL);
19 |
20 | // If time difference is greater than 1 second, treat it as an error.
21 | if (timeval.tv_sec - tv.tv_sec > 1) {
22 | terror("tvgetime() failed :: tvgetime() failed to get current time");
23 | }
24 |
25 | texit(0);
26 | }
27 |
--------------------------------------------------------------------------------
/src/lib/libast/tm/meson.build:
--------------------------------------------------------------------------------
1 | libast_files += [
2 | 'tm/tmdata.c', 'tm/tmequiv.c', 'tm/tmfix.c',
3 | 'tm/tmgoff.c', 'tm/tminit.c',
4 | 'tm/tmlex.c', 'tm/tmlocale.c', 'tm/tmmake.c',
5 | 'tm/tmpoff.c', 'tm/tmsleep.c', 'tm/tmtime.c',
6 | 'tm/tmtype.c', 'tm/tmweek.c', 'tm/tmword.c', 'tm/tmxdate.c',
7 | 'tm/tmxfmt.c', 'tm/tmxgettime.c',
8 | 'tm/tmxmake.c', 'tm/tmxscan.c',
9 | 'tm/tmxtime.c', 'tm/tmzone.c',
10 | 'tm/tvgettime.c', 'tm/tvsleep.c', 'tm/tvtouch.c'
11 | ]
12 |
--------------------------------------------------------------------------------
/src/lib/libdll/meson.build:
--------------------------------------------------------------------------------
1 | libdll_files = ['dlfcn.c', 'dllcheck.c', 'dllerror.c', 'dllfind.c', 'dlllook.c',
2 | 'dllnext.c', 'dllopen.c', 'dllplug.c', 'dllscan.c']
3 |
4 | libdll_c_args = shared_c_args + [
5 | '-D_BLD_Dll',
6 | ]
7 |
8 | libdll = library('dll', libdll_files, c_args: libdll_c_args,
9 | include_directories: [configuration_incdir, libast_incdir],
10 | dependencies: libfts_dep,
11 | link_with: libast,
12 | install: get_option('default_library') == 'shared')
13 |
14 | libsample_files = ['sample.c']
15 | libsample = shared_library('sample', libsample_files,
16 | include_directories: [configuration_incdir, libast_incdir],
17 | install: false)
18 |
--------------------------------------------------------------------------------
/src/lib/libdll/sample.c:
--------------------------------------------------------------------------------
1 | #include "config_ast.h" // IWYU pragma: keep
2 |
3 | #include
4 |
5 | // Version of the libast API that plugin is linked to.
6 | unsigned long plugin_version(void) { return 20131127; }
7 |
8 | int b_sample(int argc, char *argv[]) {
9 | UNUSED(argc);
10 | UNUSED(argv);
11 |
12 | printf("This is a sample builtin");
13 | fflush(stdout);
14 | return 0;
15 | }
16 |
--------------------------------------------------------------------------------