aboutsummaryrefslogtreecommitdiff
path: root/riemann.fmi.uni-sofia.bg
diff options
context:
space:
mode:
authorKlaatu Sverige <[email protected]>2015-08-05 21:31:21 +0000
committerKlaatu Sverige <[email protected]>2015-08-05 21:31:21 +0000
commit86f0721bd904d8163c5f8f2472b78169146cc67d (patch)
treecf9e61bd495c73ece45b96242e6f575af228d01d /riemann.fmi.uni-sofia.bg
parent75a501d32dff3c1c1ee9a2a3dc6d5b704cc7c6d1 (diff)
added website data, because it had heaps of good tutorials and info
Diffstat (limited to 'riemann.fmi.uni-sofia.bg')
-rw-r--r--riemann.fmi.uni-sofia.bg/COPYING.txt340
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/News.txt13
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/all.html26
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/binary/index.html20
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/comments.txt4
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/guarantee.html47
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/index.html307
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/CHANGES120
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/COPYING339
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Conf4
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Makefile235
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README29
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README.upstart24
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Version2
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/check_first.c45
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/cleanutmp.c72
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/const_io.c16
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/README.install9
-rwxr-xr-xriemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/install.sh48
-rwxr-xr-xriemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/setup31
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/dumputmp.c63
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_nmb_.c12
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_number.h16
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_str_.c6
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_time.c67
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_ulong.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_utmp_ip.c50
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_xlong.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fork_and_exec.c14
-rwxr-xr-xriemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_headers25
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_uptime.c34
-rwxr-xr-xriemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/init.d/ngetty52
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/lib.h36
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-1.1.spec55
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-argv.c148
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-helper.c335
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.8666
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.c278
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nv_gmtime.c36
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nwho.c131
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/opts_make.c106
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/out_put.c23
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sample.Conf53
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sig_action.h30
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sortpfd.h21
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/splitmem.c16
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_add.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copy.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copynz.c7
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_diffn.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_len.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/system-i386.S123
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/test-helper.c37
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryboottime.c17
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/trysysinfo.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryvhangup.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tzmap.c84
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_do.c98
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_io.c27
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_struct.h50
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_users.c18
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c12
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ngetty.man452
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/pr_other.html103
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/ps_tree20
-rw-r--r--riemann.fmi.uni-sofia.bg/ngetty/style.css83
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/CHANGES129
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/Donations.html40
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/FAQ.html361
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/LK/Abstract57
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/LK/Author14
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/LK/Commment15
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/LK/index.html13
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/README213
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/all.html34
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/all_time.html34
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/boot.html75
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/files.html500
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/guarantee.html48
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/index.html395
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/install.html115
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/links.html32
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/ls-R.txt306
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/README3
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/bootlog.man75
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/index.html26
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/inittab.man77
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/ninit.man130
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/nkillall.man110
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/nsvc.man151
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/pidfile.man65
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/pututmpid.man63
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/reboot.man56
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/reload.man82
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/run.html53
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/runlevel.man71
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/scan.man78
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/service.man43
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/shutdown.man71
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/man/sysvinit.man102
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/ngetty.html307
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/ninit.html395
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/packages/index.html12
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/style.css83
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/subdirs.html219
-rw-r--r--riemann.fmi.uni-sofia.bg/ninit/test/index.html31
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c521
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/CHANGES5
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/COPYING339
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Makefile103
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/README22
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Version2
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__end_parse.c10
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_feed.c14
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_getline.c14
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_split.c15
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__prepare_parse.c22
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_copy.c6
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_diff.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_set.c7
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_zero.c4
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/config.h54
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/faillog_do.c70
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/fmt_ulong.c10
-rwxr-xr-xriemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_headers25
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_tz.c42
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/lastlog_do.c43
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/log_do.c21
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.c177
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.h21
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5crypt.c140
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-auth.c125
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-tiny.c175
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin.c129
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_ctime.c41
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrent.c37
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrgid.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrnam.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrouplist.c33
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwent.c44
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwgid.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwnam.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwuid.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspent.c47
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspnam.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_initgroups.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/parselib.h10
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/pass_check.c20
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/prot_uidgid.c11
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/read_password.c15
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/safe_io.c21
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_uid.c14
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_ulong.c8
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_add.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copy.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copynz.c7
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diff.c4
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diffn.c13
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_len.c5
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_lib.c6
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_mycat.c9
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_do.c53
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_io.c30
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/write_devlog.c16
-rw-r--r--riemann.fmi.uni-sofia.bg/programs/xinit.c370
165 files changed, 12893 insertions, 0 deletions
diff --git a/riemann.fmi.uni-sofia.bg/COPYING.txt b/riemann.fmi.uni-sofia.bg/COPYING.txt
new file mode 100644
index 0000000..5b6e7c6
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/COPYING.txt
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/News.txt b/riemann.fmi.uni-sofia.bg/ngetty/News.txt
new file mode 100644
index 0000000..89587c7
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/News.txt
@@ -0,0 +1,13 @@
+20080321: version-0.3
+20080322: patch to Makefile to work 'make -j2'
+20080326: ln -s ngetty-0.3.tar.gz ngetty-0.3.final.tar.gz
+ this is for debian watch: ~/ngetty/ngetty-(.*)\.tar\.gz
+20080412: ngetty-XXX.spec files
+20080525: version-0.4
+20080623: archlinux accepted setup script
+ updated typos in manual page (thx Jan)
+ in the future I'll put current in Version.patch
+20081016: version-0.5-rc1
+20081017: added pstree output
+20081216: version-1.0
+20100526: version-1.1 (test)
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/all.html b/riemann.fmi.uni-sofia.bg/ngetty/all.html
new file mode 100644
index 0000000..5642a95
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/all.html
@@ -0,0 +1,26 @@
+<html>
+<head><title>Index</title></head>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<h2>Index</h2>
+<font>
+Parent <a href=../>directory</a>
+<pre>mode size last-change name<hr>
+-r-- 3.0k May 27 2010 <a href="CHANGES">CHANGES</a>
+lrwx Feb 9 2008 <a href="Donations.html">Donations.html</a> -&gt; =/vladov/donations.html
+-r-- 483 May 26 2010 <a href="News.txt">News.txt</a>
+dr-x Mar 16 04:39 <a href="binary/index.html">binary/</a>
+-r-- 103 Jan 23 2008 <a href="comments.txt">comments.txt</a>
+-r-- 1.2k May 27 2010 <a href="guarantee.html">guarantee.html</a>
+lrwx Jul 18 2007 <a href="index.html">index.html</a> -&gt; ngetty.html
+-r-- 36k May 25 2010 <a href="ngetty-1.1.tar.gz">ngetty-1.1.tar.gz</a>
+-r-- 52 May 27 2010 <a href="ngetty-1.1.tar.gz.md5">ngetty-1.1.tar.gz.md5</a>
+-r-- 37k Feb 22 19:24 <a href="ngetty-1.2-rc1.tar.gz">ngetty-1.2-rc1.tar.gz</a>
+-r-- 8.4k May 27 2010 <a href="ngetty.html">ngetty.html</a>
+-r-- 16k May 27 2010 <a href="ngetty.man">ngetty.man</a>
+lrwx Oct 20 2009 <a href="ngetty_debian.man">ngetty_debian.man</a> -&gt; =http://linuxcertif.com/man/8/ngetty/
+dr-x May 27 2010 <a href="old/index.html">old/</a>
+-r-- 2.4k Jun 23 2008 <a href="pr_other.html">pr_other.html</a>
+-r-- 371 Oct 17 2008 <a href="ps_tree">ps_tree</a>
+
+index genereted on <b>Jul 5 2011 05:47 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/binary/index.html b/riemann.fmi.uni-sofia.bg/ngetty/binary/index.html
new file mode 100644
index 0000000..feb06e1
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/binary/index.html
@@ -0,0 +1,20 @@
+<html>
+<head><title>Index</title></head>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<h2>Index</h2>
+<font>
+Parent <a href=../>directory</a>
+<pre>mode size last-change name<hr>
+-r-- 227 May 27 2010 <a href="MD5sum">MD5sum</a>
+-r-- 710 Mar 23 2008 <a href="README">README</a>
+lrwx Feb 2 2010 <a href="archlinux">archlinux</a> -&gt; =http://aur.archlinux.org/packages.php?ID=14183
+lrwx Feb 2 2010 <a href="archlinux-glibc">archlinux-glibc</a> -&gt; =http://aur.archlinux.org/packages.php?ID=26615
+-r-- 1.5k Mar 16 04:37 <a href="debian.html">debian.html</a>
+-r-- 24k Dec 16 2008 <a href="ngetty-1.0-1.i386.rpm">ngetty-1.0-1.i386.rpm</a>
+-r-- 38k Dec 16 2008 <a href="ngetty-1.0-1.src.rpm">ngetty-1.0-1.src.rpm</a>
+-r-- 19k May 27 2010 <a href="ngetty-1.1-i386.tar.gz">ngetty-1.1-i386.tar.gz</a>
+-r-- 23k May 27 2010 <a href="ngetty-1.1-x86_64.tar.gz">ngetty-1.1-x86_64.tar.gz</a>
+lrwx Feb 16 2010 <a href="ubuntu">ubuntu</a> -&gt; =http://code.launchpad.net/ubuntu/+source/ngetty
+
+index genereted on <b>Jul 5 2011 05:47 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/comments.txt b/riemann.fmi.uni-sofia.bg/ngetty/comments.txt
new file mode 100644
index 0000000..98e7535
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/comments.txt
@@ -0,0 +1,4 @@
+
+Wed, 23 Jan 2008 14:54:01
+There is no comments until now. If you send any I'll put them here.
+Nikola
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/guarantee.html b/riemann.fmi.uni-sofia.bg/ngetty/guarantee.html
new file mode 100644
index 0000000..efa2785
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/guarantee.html
@@ -0,0 +1,47 @@
+<html>
+<body>
+<a href="/ngetty/index.html">ngetty</a>
+<h1>The ngetty security guarantee</h1>
+
+I offer <b><font size=+1 color=red>50 Euro</font></b>
+to the first person
+who publish a verifiable security hole in the latest stable
+version of ngetty (0.2): for example,
+a way for a user to exploit ngetty to take over another account.
+
+<p>
+
+My judgment is final as to what constitutes a security hole in
+ngetty. Any disputes will be reported here.
+
+<p>
+24 January 2008, Sofia
+<br>
+Nikola Vladov
+<p>
+<hr>
+
+<b>2009-04-01</b>: &nbsp; From now on the guarantee for ngetty (1.0) is
+<b><font size=+1 color=red>100 Euro</font></b>.
+
+<p>
+<b>2008-03-23</b>: &nbsp; There is not any guarantee for binary packages
+(including also
+<a href=binary/>mine</a>).
+<br>
+Build and install all from source with MD5sums:
+<pre>
+ 2d3c73e1326c855cf7b15d6ab724f48a ngetty-0.2.tar.gz
+ 35bcfd70073e1b9cafd483c307f1e169 ngetty-0.3.tar.gz
+ af2f85b107311d4657be8c92e97947cf ngetty-0.4.tar.gz
+ a04d944c7fa625ac561751e7c507465b ngetty-1.0.tar.gz
+ 9248a9a41d3807669e03561102fb9af7 ngetty-1.1.tar.gz
+</pre>
+
+<p>
+See also
+<a href=http://cr.yp.to/qmail/guarantee.html>here</a>
+<br>
+Last modifed: 1 April 2009
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/index.html b/riemann.fmi.uni-sofia.bg/ngetty/index.html
new file mode 100644
index 0000000..4e53767
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/index.html
@@ -0,0 +1,307 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>ngetty</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ngetty - one daemon for all virtual consoles</h1>
+<div class="endtop"></div>
+</div>
+
+<table>
+<ul>
+<td>
+<li>
+ <a href=/ngetty/old/ngetty-1.0.tar.gz>
+ ngetty-1.0.tar.gz</a> (old)
+</li><li>
+ <a href=/ngetty/ngetty-1.1.tar.gz>
+ ngetty-1.1.tar.gz</a> (stable)
+</li><li>
+ <a href=all.html>Index</a>
+</li>
+</ul>
+
+</td><td>
+<ul>
+<li>
+ Manual <a href=/ngetty/ngetty.man> page</a>
+</li><li>
+ Other <a href=/ngetty/pr_other.html> programs</a>
+</li><li>
+ Binary <a href=/ngetty/binary/> packages</a>
+</li>
+</ul>
+
+</td><td>
+<ul>
+<li>
+ Recent <a href=News.txt>news</a>
+</li><li>
+ Security <a href=guarantee.html>guarantee</a>
+</li>
+</ul>
+</td>
+
+</table>
+
+<h2>About</h2>
+<b>ngetty</b> is a daemon that starts login sessions on virtual console
+terminals, on demand. It is a good replacement for all those getty
+processes started from init that, most of the time, are only taking up
+memory. When compiled statically with dietlibc, the ngetty binary
+size is only about 2k and uses considerably less
+<a href="pr_other.html#Memory">memory</a>
+than a getty. See pstree <a href=ps_tree>here</a>.
+<a name="Resources">
+<pre>
+riemann$ ps uww -C ngetty
+USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
+root 145 0.0 0.0 8 8 ? Ss Jan05 0:00 ngetty 1 2 3 4
+</pre>
+</a>
+
+Ngetty is designed to stop including <b>getty-like</b> code
+in init programs.
+<br>
+I used source and ideas from
+<a href=http://sites.google.com/site/anbadeol/logind>logind</a>.
+Many thanks, Andre!
+
+<p>
+<a name=List>
+There is a
+&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#32;&#108;&#105;&#115;&#116;
+for ngetty. To &#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#44;
+send an empty &#109;&#101;&#115;&#115;&#97;&#103;&#101;
+to <br>
+<font size=+1>
+<a href=
+&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#110;&#103;&#101;&#116;&#116;&#121;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+>
+&#110;&#103;&#101;&#116;&#116;&#121;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+</a>
+</font>
+</a>
+<br>
+Some delay is possible due to
+&#103;&#114;&#101;&#121;&#108;&#105;&#115;&#116;&#105;&#110;&#103;&#46;
+
+<h2>Benefits</h2>
+<ul>
+<li>
+ one process (instead of many) using
+ minimal <a href="#Resources">resources</a>
+</li><li>
+ work with different <a href="#Login">login</a> applications
+<br>
+ can start any program with arbitrary arguments
+</li><li>
+ easy to start by
+ <a href="#Init_d"><tt>init.d</tt></a>
+or
+ <a href="#Inittab"><tt>/etc/inittab</tt></a><br>
+ easy to start by other <a href="#Init">init</a> systems
+</li><li>
+ makes <b>utmp/wtmp</b> records<br>
+ no need of <b>ngetty</b>-monitoring by some other process
+</li><li>
+ easy to setup modifying <tt>/etc/ngetty/Conf[.sed]</tt>
+</li><li>
+ modular (<tt>ngetty-helper</tt> and
+ <tt>ngetty-argv</tt>)
+</li><li>
+ easy to upgrade <tt>ngetty-helper</tt><br>
+ <tt>cp /path/to/new/ngetty-helper /sbin</tt>
+</li><li>
+ uses minimal <tt>libc</tt> library functions<br>
+ easy to build by
+ <a href=http://www.fefe.de/dietlibc/>dietlibc</a> -
+ <tt>make CC='diet -Os gcc'</tt>
+</li><li>
+ small code size with <a href=guarantee.html>security</a> guarantee
+<li>
+</ul>
+
+<h2>Install</h2>
+Ready to use binary packages are
+<a href=binary/>here</a>.
+I prepared them using
+<pre>
+ make package CC='diet -Os gcc -W'
+ make rpm
+</pre>
+
+If you have
+<a href=http://www.fefe.de/dietlibc/>
+dietlibc</a> already installed do
+<pre>
+ wget http://riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1.tar.gz
+ gzip -dc ngetty-1.1.tar.gz | tar -xv
+ cd ngetty-1.1
+ # Read the ngetty.8 manual page (man ./ngetty.8)
+ # Browse lib.h (check if the LOGIN path is correct!)
+ # Edit Makefile to taste
+ make CC='diet -Os gcc -W'
+ make install
+ # If you want to install some additional programs do:
+ make install_other
+</pre>
+To compile <tt>ngetty</tt> with glibc skip <tt>CC=...</tt> above.
+<pre>
+ make
+ make install
+</pre>
+It is possible to do also
+<pre>
+ make dietbuild
+ make install
+</pre>
+Last download and install dietlibc in current dir and then
+compile ngetty. It takes
+1-2 minutes to build dietlibc (depends on how fast ist your CPU).
+See also <a href=pr_other.html>here</a>.
+
+<h2>Post install</h2>
+Browse the files: <tt>/etc/ngetty/Conf[.sed], /etc/ngetty/sample.Conf</tt>
+<br>
+<a name="Init_d">
+Execute <tt>./init.d/ngetty start</tt></a>
+<br>
+If all is right you'll have working terminals on
+<br>
+<tt>/dev/tty{8|9|10}</tt> or <tt>/dev/vc/{8|9|10}</tt>
+<br>
+Try to login/logout on some of them.
+<p>
+ Some logins requires the TTY variable. Set it in
+ <tt>/etc/ngetty/Conf</tt>.
+ How to do this see the
+<a href=ngetty.man>manual</a> page of ngetty. Examples:
+<pre>
+ tty4=environ=,TERM=linux,TTY=/dev/tty4
+ tty5=environ=,TERM=linux,TTY=/dev/tty5
+ tty6=environ=,TERM=linux,TTY=/dev/tty6
+</pre>
+If you can login in the system then
+you can make ngetty default.
+</br>
+You have to edit
+<tt>/etc/inittab</tt> file.
+<p>
+Do this in two steps. Fist comment default getty on
+<tt>tty{4|5|6}</tt>
+<br>
+and edit
+<tt>/etc/inittab</tt> like next:
+<pre>
+ 1:2345:respawn:/sbin/mingetty tty1
+ 2:2345:respawn:/sbin/mingetty tty2
+ 3:2345:respawn:/sbin/mingetty tty3
+ # 4:2345:respawn:/sbin/mingetty tty4
+ # 5:2345:respawn:/sbin/mingetty tty5
+ # 6:2345:respawn:/sbin/mingetty tty6
+
+ # Run ngetty in standard run-levels
+ ng:2345:respawn:/sbin/ngetty 4 5 6
+</pre>
+If your <tt>/etc/inittab</tt> have different entries only comment
+the last three of them and add two lines for ngetty as above.
+Now it's time to reboot the computer. After the reboot
+try to login/logout on <tt>tty{4|5|6}</tt>.
+<p>
+<a name=Inittab>
+If it is successful change <tt>/etc/inittab</tt></a>
+like:
+<pre>
+ # 1:2345:respawn:/sbin/mingetty tty1
+ # 2:2345:respawn:/sbin/mingetty tty2
+ # 3:2345:respawn:/sbin/mingetty tty3
+ # 4:2345:respawn:/sbin/mingetty tty4
+ # 5:2345:respawn:/sbin/mingetty tty5
+ # 6:2345:respawn:/sbin/mingetty tty6
+
+ # Run ngetty in standard run-levels
+ ng:2345:respawn:/sbin/ngetty 1 2 3 4 5 6
+</pre>
+and reboot again.
+<br>
+That's all. You will have one ngetty instead of six
+<tt>{a|f|min}getty</tt>.
+<br>
+If <tt>ngetty</tt> is compiled with dietlibc it will use 16k RAM only.
+<p>
+<font color=red>WARNING</font>:
+May be it's possible to make all without reboot. I don't use
+<tt>/sbin/init</tt> and don't know how to do this. The manual page
+<b>init</b>(8) says to use <tt>kill -HUP 1</tt>
+
+
+<h2><a name="Init">Using ngetty with other init systems</a></h2>
+If you use
+<a href=http://www.fefe.de/minit/>minit</a> or
+<a href=/ninit/>ninit</a> you have
+to make one new service <tt>ngetty</tt>, include it in
+<br>
+<tt>default/depends</tt> and comment running <tt>getty</tt>
+there.
+<p>
+The preparation of service <tt>ngetty</tt> is simple:
+<pre>
+ mkdir /etc/ninit/ngetty
+ cd /etc/ninit/ngetty
+ ( echo '' ; echo TERM=linux ) > environ
+ ( for f in 1 2 3 4 5 6 ; do echo $f ; done ) > params
+ ln -s /sbin/ngetty run
+</pre>
+You can use ngetty also with <a href=http://smarden.org/runit/>runit</a>.
+Start it as ordinary service. Since ngetty does utmp/wtmp records there
+is no need ot any additional setup.
+
+<h2><a name="Login">Using ngetty with other logins</a></h2>
+Ngetty uses the deafult <tt>/bin/login</tt> program.
+It's easy to use another login also.
+<br>
+My login program is
+<a href=/programs/nlogin-0.3-pre.tar.gz>here</a>.
+Copy it to <tt>/bin/nlogin</tt> and add in
+<tt>/etc/ngetty/Conf</tt>
+<pre>
+=login-prog=/bin/nlogin
+</pre>
+
+It's possible to start any program with arbitrary arguments using
+<tt>ngetty-argv</tt> helper.
+<br>
+To use ngetty with <a href=http://www.fefe.de/fgetty/>fgetty</a>
+logins add in <tt>/etc/ngetty/Conf</tt>
+<pre>
+=echo-off
+=login-prog=/bin/login1
+ on debian system replace login1 with fgetty-login
+</pre>
+
+I still use
+startx script with my <a href=/programs/xinit.c>xinit.c</a>.
+
+<p>
+<hr>
+
+Author: Nikola Vladov
+<p>
+Send comments and suggestions using
+ngetty
+<a
+href=#List>&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#45;&#108;&#105;&#115;&#116;</a>
+or
+<a href=/email.html>qform</a>.
+<p>
+Last modified: 26 May 2010.
+<br>
+Some <a href=comments.txt>comments</a> about ngetty.
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/CHANGES b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/CHANGES
new file mode 100644
index 0000000..a9c5a6c
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/CHANGES
@@ -0,0 +1,120 @@
+Thu May 25 07:20:02 UTC 2010
+fixed fmt_number.h
+shorter splitmem.c
+fixed sstip.bin in Makefile
+updated README.upstart
+nwho, cleanutmp, dumputmp (see lib.h HAVE_C_UTMP[X])
+dumputmp, nwho print ip (V4 or V6)
+Version 1.1
+
+Tue Dec 16 20:09:24 UTC 2008
+Version 1.0
+
+Thu Oct 16 11:28:15 UTC 2008
+option -ll for nwho
+Version 0.5-rc1
+
+Mon Jun 30 07:41:48 UTC 2008
+small and fast sortpfd()
+Makefile
+test time/utmp functions
+some comments in ngetty-helper.c
+
+Mon Jun 23 17:31:27 UTC 2008
+option login-buffer
+opitons -D -N -C for ngetty-argv
+updated manual page
+better test-helper.c
+
+Sat May 24 06:02:29 UTC 2008
+Makefile; make FLAG_DEBUG=yes
+options months, days
+/etc/ngetty/setup convert XXX=tz=AUTO to XXX=tz=number
+updated manual page
+ May be some distro will try as default on tty1 and tty2
+ their working gettys and on tty3, tty4, ... ngetty
+ On i386 with dietlibc try also 'make ngetty.i386'
+Version 0.4
+
+Wed Apr 16 14:14:29 UTC 2008
+ngetty-helper checks /etc/localtime before parsing it
+option tz
+
+Thu Apr 10 18:35:56 UTC 2008
+ngetty-XXX.spec (thx Blair Lowe)
+utmpdump --> dumputmp (avoid conflicts with Sys-V-Init)
+
+Sun Apr 6 12:12:39 UTC 2008
+ngetty: Are there rice between SIGCHLD and poll() ?
+ It's don't use setjmp(), longjmp() any more.
+
+Tue Apr 1 11:55:03 UTC 2008
+If ngetty receives SIGCHLD it restart failed tty devices
+
+Sun Mar 23 09:37:46 UTC 2008
+added installation script and README.install for binary packages.
+Freue Ostern Maria!
+added check for syscall vhangup()
+
+Fri Mar 22 18:49:36 UTC 2008
+updated man page (SIGNALS)
+fixed Makefile to support 'make -jX' (thx G. Lango)
+
+Fri Mar 21 06:07:02 UTC 2008
+ngetty-helper exits if stdout or stderr are open
+added test-helper.c (mainly for developers)
+options clear and newline
+updated manual page
+Version-0.3
+
+Tue Mar 18 08:27:11 UTC 2008
+new opt_get scheme; see opts_do.c
+ngetty-helper.tiny (does not support escapes \d \t \u \U)
+ngetty-helper.c; option print
+
+Sat Mar 15 12:56:57 UTC 2008
+ngetty-helper.c: option: login-argv
+ngetty-argv.c: new program
+Makefile: make install prefix=/some/dir (thx to Blair Lowe)
+updated man page
+
+Fri Mar 8 16:15:31 UTC 2008
+ngetty-helper.c: options: allow, deny
+safe_io.c (thanks to R.L. Horn)
+
+Wed Mar 5 20:49:54 UTC 2008
+ngetty.8: login-prog example
+ngetty-helper.c: updated Copyright
+
+Mon Feb 25 17:09:05 UTC 2008
+CLEAR_STRING marco in lib.h
+get_uptime.c; tryboottime.c
+
+Sat Feb 23 15:20:34 UTC 2008
+check_first.c; trysysinfo.c
+
+Thu Feb 22 11:44:03 UTC 2008
+some changes in Makefile
+
+Tue Feb 12 08:41:34 EET 2008
+fmt_number.h; scan_number.h
+
+Thu Jan 24 18:09:09 EET 2008
+string.h is removed from all headers
+Makefile: make all creates ngetty.8.gz
+
+Thu Jan 24 15:53:29 EET 2008
+Version-0.2
+http://riemann.fmi.uni-sofia.bg/ngetty/guarantee.html
+
+Mon Jan 21 11:24:15 EET 2008
+added nwho
+
+Mon Jan 21 00:30:37 EET 2008
+monor changes; only repackeged to use string byte routines.
+ngetty-helper option echo-off
+
+Mon Dec 10 14:58:33 EET 2007
+fixed a typo in Makefile. (thanks to Giorgio Lando)
+mailing list ngetty@...
+updated http-link in ngetty.8
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/COPYING b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/COPYING
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Conf b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Conf
new file mode 100644
index 0000000..e64c4fb
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Conf
@@ -0,0 +1,4 @@
+# options format:
+# [ttyX]=option[=value]
+#=debug
+=environ=,TERM=linux
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Makefile b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Makefile
new file mode 100644
index 0000000..fde80a9
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Makefile
@@ -0,0 +1,235 @@
+## next is statically build in ngetty-helper. Do not change !!!
+NGETTY_DIR = /etc/ngetty
+
+DESTDIR = /
+prefix = ${DESTDIR}
+sbin_prefix = ${prefix}/sbin
+etc_prefix = ${prefix}/etc
+ngetty_prefix = ${etc_prefix}/ngetty
+usrbin_prefix = ${prefix}/usr/bin
+mandir = ${prefix}/usr/share/man
+man8dir = ${mandir}/man8
+
+### next are aditinal options for make install
+# P = -o root -g root
+
+CC = gcc
+CFLAGS = -Wall -Os
+LDFLAGS = -s
+FLAG_DEBUG = no
+
+ALL_EXEC = ngetty ngetty.tiny ngetty.sortpfd \
+ ngetty-helper ngetty-helper.tiny ngetty-argv \
+ cleanutmp dumputmp nwho
+ALL_MAN = ngetty.8.gz ngetty-helper.8.gz ngetty-argv.8.gz
+
+ifeq ($(FLAG_DEBUG),no)
+CCC_ = @echo ' CC $< ' ;
+CCL_ = @echo ' CL $< -> $@ ' ;
+C = @
+else
+CCC_ =
+CCL_ =
+C =
+endif
+
+CC_C = $(CC) $(CFLAGS)
+CC_L = $(CC) $(CFLAGS) $(LDFLAGS)
+
+CCC = $(CCC_) $(CC_C)
+CCL = $(CCL_) $(CC_L)
+STR = $(C) strip -R .comment -R .note
+
+ifeq (${prefix},/)
+prefix =
+endif
+
+MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6]t\?e\?[lb]/arm/')
+
+ALL = $(ALL_EXEC) $(ALL_MAN)
+all: $(ALL)
+
+%.o: %.c lib.h utmp_struct.h all_defs.h sysinfo_defs.h boottime_defs.h
+ $(CCC) -c $<
+
+STR_O = $(patsubst %.c,%.o,$(wildcard str_*.c s*mem.c out_*.c))
+FMT_O = $(patsubst %.c,%.o,$(wildcard fmt_*.c))
+SCAN_O = $(patsubst %.c,%.o,$(wildcard x_atoi.c))
+DJB_O = $(STR_O) $(SCAN_O) $(FMT_O)
+UTMP_O = $(patsubst %.c,%.o,$(wildcard *_io.c *_do.c *_users.c *_devlog.c))
+TIME_O = $(patsubst %.c,%.o,$(wildcard *gmtime.c get_up*.c))
+MISC_O = $(patsubst %.c,%.o,$(wildcard first_*.c fork_*.c check_*))
+ALL_O = $(UTMP_O) $(TIME_O) $(MISC_O)
+
+opts_make: opts_make.c str_defs.h fmt_defs.h lib.a vhangup_defs.h lib.a
+ $(CCL) -o $@ $< lib.a
+
+all_defs.h: $(patsubst %.o,%.c,$(ALL_O)) tzmap.c ngetty-helper.c
+ $(C) ./get_headers $@ -Gsys/stat.h -Gtime.h \
+ -Lstr_defs.h -Lfmt_defs.h -Lscan_defs.h -Lutmp_struct.h $^ > $@
+fmt_defs.h: fmt_*.c
+ $(C) ./get_headers $@ $^ > $@
+scan_defs.h: x_atoi.c const_io.c
+ $(C) ./get_headers $@ $^ > $@
+str_defs.h: str_*.c splitmem.c out_*.c const_io.c
+ $(C) ./get_headers $@ $^ > $@
+utmp_defs.h: utmp_do.c
+ $(C) sed -n -e '/EXTRACT_START/,/EXTRACT_END/p' $< > $@
+opts_defs.h: opts_make
+ ./opts_make | sed -n -e '/ O[odmt]/p' > opts__defs.h
+ ./opts_make > $@
+
+sysinfo_defs.h: trysysinfo.c
+ $(C) ( ( rm -f $@Z; $(CC_L) -o $@Z $< && ./$@Z ) > /dev/null 2>&1 \
+ && echo '#define HAVE_SYSTEM_SYSINFO' || true ) > $@
+ $(C) rm -f $@Z; cat $@
+boottime_defs.h: tryboottime.c
+ $(C) ( ( rm -f $@Z; $(CC_L) -o $@Z $< && ./$@Z ) > /dev/null 2>&1 \
+ && echo '#define HAVE_SYSTEM_BOOTTIME' || true ) > $@
+ $(C) rm -f $@Z; cat $@
+vhangup_defs.h: tryvhangup.c
+ $(C) ( ( rm -f $@Z; $(CC_L) -o $@Z $< ) > /dev/null 2>&1 && \
+ echo '#define HAVE_SYSTEM_VHANGUP' || true ) > $@
+ $(C) rm -f $@Z; cat $@
+
+lib.a: $(patsubst fmt_time.o,,$(DJB_O)) $(ALL_O)
+ ar cr lib.a $^
+tzmap.a: tzmap.o fmt_time.o
+ ar cr $@ $^
+tzmap_mmap.a: tzmap_mmap.o
+ ar cr $@ $^
+
+
+ngetty_h = all_defs.h sortpfd.h sig_action.h
+ngetty-helper_h = tzmap.a opts_defs.h lib.a
+
+diet_flags = -isystem /opt/diet/include -D__dietlibc__ \
+ -Os -mpreferred-stack-boundary=2 -falign-functions=1 -falign-jumps=1 \
+ -falign-loops=1 -fomit-frame-pointer -DNGETTY_TINY -DNGETTY_$(MYARCH)
+
+system-$(MYARCH).o: system-$(MYARCH).S
+ $(CCC_) $(CC) $(diet_flags) -c $<
+ngetty.$(MYARCH): ngetty.c $(ngetty_h) system-$(MYARCH).o
+ $(CCL_) $(CC) -nostdlib $(diet_flags) system-$(MYARCH).o \
+ -s -Wl,-N -o $@ $<
+ $(STR) $@
+
+ngetty: ngetty.c $(ngetty_h)
+ $(C) $(CC) --version || true; uname -a || true
+ $(C) echo "ARCH = $(MYARCH)"; echo "CC = $(CC)"; \
+ echo "CFLAGS = $(CFLAGS)"; echo "LDFLAGS = $(LDFLAGS)";
+ $(CCL) -DNGETTY_SELFPIPE -o $@ $<
+ $(STR) $@
+
+ngetty.sortpfd: ngetty.c $(ngetty_h)
+ $(CCL) -DNGETTY_SELFPIPE -DNGETTY_SORT -o $@ $<
+ $(STR) $@
+ngetty.tiny: ngetty.c $(ngetty_h)
+ $(CCL) -DNGETTY_TINY -o $@ $<
+ $(STR) $@
+ngetty-helper: ngetty-helper.c $(ngetty-helper_h)
+ $(CCL) -DNGETTY_HOME=\"$(NGETTY_DIR)\" -o $@ $< lib.a tzmap.a
+ $(STR) $@
+ngetty-helper.tiny: ngetty-helper.c $(ngetty-helper_h)
+ $(CCL) -DNGETTY_HOME=\"$(NGETTY_DIR)\" -DDONT_NEED_ESC_TIME -DDONT_NEED_ESC_USERS -o $@ $< lib.a
+ $(STR) $@
+
+%: %.c
+ $(CCL) -o $@ $^
+ $(STR) $@
+
+tzmap_mmap.c: tzmap.c
+ $(C) ( echo '#define TZ_MMAP'; echo '#include "tzmap.c"' ) > $@
+
+all_defs.h: str_defs.h scan_defs.h fmt_defs.h utmp_defs.h
+cleanutmp: lib.a
+ngetty-argv: lib.a
+dumputmp: tzmap_mmap.a lib.a
+nwho: tzmap_mmap.a lib.a
+
+str_%.o: str_defs.h splitmem.c
+fmt_%.o: fmt_defs.h
+fmt_time.o: opts_defs.h
+tzmap.o: opts_defs.h
+
+ngetty.8.gz: ngetty.8 ngetty-helper dumputmp ngetty-argv
+ gzip -9 < $< > $@
+ $(C) ls -la /var/run/utmp* /dev/tty1 /dev/vc/1 2>/dev/null || true
+ ./dumputmp < /var/run/utmp | head || true
+ date '+%nCurrent time: %Y-%m-%d %T %Z %z'
+ ./ngetty-argv :-N:-a1:./ngetty-helper::TestTime || true
+ngetty-%.8.gz:
+ $(C) echo '.so ngetty.8' | gzip -9 > $@
+
+install_other: $(ALL)
+ install -m 755 $(P) -d $(usrbin_prefix)
+ install -m 755 $(P) nwho dumputmp $(usrbin_prefix)
+ install -m 2711 -o root -g utmp cleanutmp $(usrbin_prefix) || \
+ install -m 755 $(P) cleanutmp $(usrbin_prefix)
+ install -m 755 $(P) ngetty.sortpfd ngetty.tiny ngetty-helper.tiny $(sbin_prefix)
+
+install: $(ALL)
+ install -m 755 $(P) -d $(sbin_prefix)
+ install -m 755 $(P) -d $(etc_prefix)
+ install -m 700 $(P) -d $(ngetty_prefix)
+ install -m 755 $(P) -d $(man8dir)
+ install -m 755 $(P) ngetty ngetty-helper ngetty-argv $(sbin_prefix)
+ install -m 644 $(P) ngetty.8.gz ngetty-*.8.gz $(man8dir)
+ install -m 600 $(P) sample.Conf $(ngetty_prefix)
+ install -m 755 $(P) contrib/setup $(ngetty_prefix)
+ install -m 644 $(P) Version $(ngetty_prefix)
+ test -f $(ngetty_prefix)/Conf || \
+ install -m 600 $(P) Conf $(ngetty_prefix)
+ @echo
+ @echo ' If you want to install some additional programs do:'
+ @echo ' make install_other'
+
+clean:
+ rm -f $(ALL) *.o *.a *.s *_defs.h *.hZ a.out tzmap_mmap.c \
+ *.c.orig test-helper opts_make ngetty.$(MYARCH) sstrip.* elf_print*
+ rm -rf PACKAGE
+distclean:
+ make clean
+ rm -rf d dietlibc
+
+withdiet:
+ @echo ' Please, start: make CC="diet -Os gcc"'
+dietlibc/bin-$(MYARCH)/diet:
+ cvs -d :pserver:[email protected]:/cvs -z9 co dietlibc
+ cd dietlibc && make
+dietbuild: dietlibc/bin-$(MYARCH)/diet
+ DIETHOME=$(CURDIR)/dietlibc make CC="./$< -Os gcc -nostdinc"
+
+
+AUTHORS_SITE = http://riemann.fmi.uni-sofia.bg
+sstrip.bin: sstrip.c
+ $(CCL) -DNV_PRINT_ELF_HEADER -o elf_print $^
+ ./elf_print < elf_print > elf_defs.h
+ $(CCL) -o $@ $^
+ rm -f elf_print*
+sstrip.c:
+ rm -f $@
+ wget -O $@ $(AUTHORS_SITE)/programs/$@
+sstrip: $(ALL_EXEC) sstrip.bin
+ ./sstrip.bin $(ALL_EXEC) ngetty.$(MYARCH) || true
+
+TAR=tar
+TAR_OPT=
+MY_NAME=$(notdir $(CURDIR))
+GZIP_PR = 7za a -tgzip -si -so -bd Z
+
+tar:
+ cd .. && $(TAR) -cv $(TAR_OPT) \
+ --owner=root --group=root --exclude $(MY_NAME)/dietlibc $(MY_NAME) | \
+$(GZIP_PR) > $(MY_NAME).tar.gz
+packit:
+ ( echo $(MY_NAME); date -u ) > Version
+ make clean tar TAR=tar.f TAR_OPT=--sort
+package:
+ make all install install_other DESTDIR=PACKAGE P=
+ install ngetty.$(MYARCH) PACKAGE/sbin || true
+ install contrib/*install* PACKAGE
+ cd PACKAGE && tar -cvzf /tmp/$(MY_NAME)-$(MYARCH).tar.gz \
+ --owner=root --group=root *
+rpm: $(MY_NAME).spec
+ rpmbuild -ba --clean $<
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README
new file mode 100644
index 0000000..2bee2e1
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README
@@ -0,0 +1,29 @@
+See http://riemann.fmi.uni-sofia.bg/ngetty/
+
+ngetty is a daemon that starts login sessions on virtual console terminals,
+on demand. It is a good replacement for all those getty processes started
+from init that, most of the time, are only taking up memory.
+When compiled statically with dietlibc, the ngetty binary size is only
+about 2k and uses considerably less memory than a getty.
+
+I wrote ngetty inspired by logind. Many thanks Andre!
+logind source: http://anbadeol.googlepages.com/logind.html
+
+
+Quick install:
+0. read the ngetty.8 manual page
+1. browse lib.h (check if the LOGIN path is correct!)
+2. edit Makefile to taste
+3. build:
+ make
+ If dietlibc is available:
+ make CC='diet -Os gcc -W'
+ To build dietlibc try:
+ make dietbuild
+4. install:
+ make install
+5. if you want to some additional programs do:
+ make install_other
+6. see init.d/ngetty, /etc/ngetty/Conf, /etc/ngetty/sample.Conf.
+
+Nikola Vladov
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README.upstart b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README.upstart
new file mode 100644
index 0000000..5c71b39
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/README.upstart
@@ -0,0 +1,24 @@
+If upstart (http://en.wikipedia.org/wiki/Upstart)
+is the default init (PID 1) save next
+
+--------------------------------
+# ngetty
+start on runlevel [2345]
+stop on shutdown
+respawn
+exec /sbin/ngetty 1 2 3 4 5 6
+--------------------------------
+
+in /etc/init/ngetty.tmp and then type:
+mv /etc/init/ngetty.tmp /etc/init/ngetty.conf
+
+If you have running tty stop them before above "mv" with:
+stop tty1
+stop tty2
+...
+
+See also:
+http://upstart.ubuntu.com/getting-started.html
+
+If someone uses ngetty with upstart and has more
+experience let me know.
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Version b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Version
new file mode 100644
index 0000000..aab6f3b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/Version
@@ -0,0 +1,2 @@
+ngetty-1.1
+Tue May 25 12:53:00 UTC 2010
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/check_first.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/check_first.c
new file mode 100644
index 0000000..129a84a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/check_first.c
@@ -0,0 +1,45 @@
+#include <sys/stat.h>
+#include "sysinfo_defs.h"
+#include "boottime_defs.h"
+
+#if !defined(HAVE_SYSTEM_SYSINFO) && !defined(HAVE_SYSTEM_BOOTTIME)
+int check_first(char *lock, struct stat *st) { return 0; }
+
+#else
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <time.h>
+extern int get_uptime(time_t *t);
+
+int check_first(char *lock, struct stat *st) /*EXTRACT_INCL*/{
+ int k;
+ /* If a stat error other than "no such file" occurs, I don't
+ know what went wrong, so I'll proceed with caution by
+ denying the autologin request. */
+ if ((k=stat(lock, st)) && errno != ENOENT)
+ return 0;
+
+ if (k==0) {
+ time_t uptime;
+ if (get_uptime(&uptime))
+ return 0;
+
+ /* If there's been an autologin granted since the last boot,
+ deny this and any subsequent attempts. Note that this test
+ is skipped if the LOCK file doesn't exist. */
+ if (time(0) - uptime < st->st_mtime)
+ return 0;
+ }
+
+ /* Create the LOCK file. The mtime of this file provides
+ a persistent record of the last time that an autologin
+ request was granted. Deny the autologin request if either
+ the file open or file close fails. */
+ if ((k=open(lock, O_WRONLY|O_CREAT|O_TRUNC, 0644)) < 0 || close(k))
+ return 0;
+
+ /* All tests are okay, so grant the autologin request. */
+ return 1;
+}
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/cleanutmp.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/cleanutmp.c
new file mode 100644
index 0000000..c4bde50
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/cleanutmp.c
@@ -0,0 +1,72 @@
+/* cleanutmp.c
+ chown root.utmp cleanutmp
+ chmod 2711 cleanutmp
+ */
+
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include "lib.h"
+
+void ops(int n, const char *s0, const char *s1) {
+ write(2,s0,str_len(s0));
+ write(2,s1,str_len(s1));
+ write(2,"\n",1);
+ _exit(n);
+}
+
+#ifdef USE_LIBC_UTMP
+int main () {
+ struct utmp_type *ut, u;
+ setutent();
+
+ while (f_getutent()) {
+ if (ut->ut_type != USER_PROCESS) continue;
+ if (kill(ut->ut_pid, 0) && errno == ESRCH) {
+ u = *ut;
+ u.ut_type = DEAD_PROCESS;
+ u.ut_tv.tv_sec = time(0);
+
+ f_setutent();
+ if (0==f_pututline(&u))
+ ops(2,"error writing to: ", Utmp_File);
+ f_updwtmp(Wtmp_File, &u);
+ }
+ }
+ f_endutent();
+ return 0;
+}
+
+#else
+int main() {
+ int fd,wfd;
+ struct utmp_type ut[1];
+ off_t pos=0;
+
+ if ((fd = open(Utmp_File,O_RDWR)) <0 &&
+ (fd = open(Utmp_File,O_RDONLY)) <0)
+ ops(1,"error opening: ", Utmp_File);
+
+ while (utmp_io(fd,ut,F_RDLCK)) {
+ pos += UTMP_SIZE;
+ if (ut->ut_type != USER_PROCESS) continue;
+ if (kill(ut->ut_pid, 0) && errno == ESRCH) {
+ ut->ut_type = DEAD_PROCESS;
+ ut->ut_tv.tv_sec = time(0);
+
+ pos -= UTMP_SIZE;
+ if (lseek(fd, pos, SEEK_SET) != pos ||
+ !utmp_io(fd,ut,F_WRLCK))
+ ops(2,"error writing to: ", Utmp_File);
+ pos += UTMP_SIZE;
+
+ wfd=open(Wtmp_File, O_WRONLY|O_APPEND);
+ write(wfd, ut, UTMP_SIZE);
+ close(wfd);
+ }
+ }
+ close(fd);
+ return 0;
+}
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/const_io.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/const_io.c
new file mode 100644
index 0000000..6e456f7
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/const_io.c
@@ -0,0 +1,16 @@
+#include <unistd.h>
+#include <errno.h>
+
+int const_io(int (*op)(), int fd, void *buf, int len) /*EXTRACT_INCL*/{
+ char *x = buf;
+ while (len > 0) {
+ int ret = op(fd, x, len);
+ if (ret <= 0) {
+ if (ret && errno == EINTR) continue;
+ break;
+ }
+ x += ret;
+ len -= ret;
+ }
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/README.install b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/README.install
new file mode 100644
index 0000000..34ad849
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/README.install
@@ -0,0 +1,9 @@
+To install the package XXX.tar.gz do:
+ mkdir /tmp/ngetty
+ cd /tmp/ngetty
+ tar -xvzf /path/to/XXX.tar.gz
+ env -i ./install.sh
+
+See first if the paths in install.sh are correct!
+
+Nikola
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/install.sh b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/install.sh
new file mode 100755
index 0000000..397ba5a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/install.sh
@@ -0,0 +1,48 @@
+#!/bin/sh -x
+export PATH=/bin:/usr/bin
+
+if [ "$DESTDIR" = "" ] ; then
+ P="-o root -g root"
+fi
+
+prefix="$DESTDIR"
+mandir="$prefix/usr/share/man"
+man8dir="$mandir/man8"
+
+sbin_prefix="$prefix/sbin"
+etc_prefix="$prefix/etc"
+ngetty_prefix="$etc_prefix/ngetty"
+usrbin_prefix="$prefix/usr/bin"
+
+### ----- stop editing here -----
+if test ! -f ./etc/ngetty/Conf -o ! -x ./sbin/ngetty ; then
+ echo go out
+ exit 1
+fi
+
+umask 022
+
+mk_dir () {
+ test -d $2 || install -m $1 $P -d $2
+}
+
+mk_dir 755 $usrbin_prefix
+mk_dir 755 $sbin_prefix
+mk_dir 755 $man8dir
+mk_dir 755 $etc_prefix
+install -m 700 $P -d $ngetty_prefix
+
+install -m 755 $P ./usr/bin/* $usrbin_prefix
+install -m 2711 -o root -g utmp ./usr/bin/cleanutmp $usrbin_prefix || \
+ install -m 755 $P ./usr/bin/cleanutmp $usrbin_prefix
+
+install -m 755 $P ./sbin/* $sbin_prefix
+install -m 644 $P ./usr/share/man/man8/* $man8dir
+
+install -m 755 $P ./etc/ngetty/setup $ngetty_prefix
+install -m 644 $P ./etc/ngetty/Version $ngetty_prefix
+install -m 600 $P ./etc/ngetty/sample.Conf $ngetty_prefix
+test -f $ngetty_prefix/Conf || \
+ install -m 600 $P ./etc/ngetty/Conf $ngetty_prefix
+
+cd /etc/ngetty && test -x setup && ./setup
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/setup b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/setup
new file mode 100755
index 0000000..15d15db
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/contrib/setup
@@ -0,0 +1,31 @@
+#!/bin/sh
+export PATH=/bin:/usr/bin
+
+test -f Conf.sed || exit 111
+umask 077
+
+z=`date '+%z %Z'`
+
+tz=`echo "$z" | awk '{
+ hour = substr($1, 1, 3);
+ min = substr($1, 4, 2);
+ if (hour < 0) min = -min;
+ print (hour *60 +min) *60;
+}'`
+
+echo 'AUTO time zone: '$z' -> '$tz
+
+# merges lines ending with slash (/) like bash
+
+sed -e '1i# Auto-generated file. Do not edit!
+:a
+/[^\\]\\$/{
+N
+s/\\\n//
+ta
+}
+s/^\([a-z0-9/]*=tz=\)AUTO$/\1'$tz'/
+/^$/d
+/^[ # ]/d
+s/\\\\$/\\/
+' Conf.sed > 'Conf.__#*tmp*#' && mv 'Conf.__#*tmp*#' Conf \ No newline at end of file
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/dumputmp.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/dumputmp.c
new file mode 100644
index 0000000..88d647c
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/dumputmp.c
@@ -0,0 +1,63 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include "lib.h"
+
+#define S(a,b) str_copy(a,b)
+#define SN(a,b) str_copynz(a,b,sizeof(b))
+#define N(a,b,c,d) fmt_nmb_(a,b,c,d)
+
+int main(int argc, char **argv) {
+ struct tm *tm;
+ time_t tmp_time;
+ char buf[1024];
+ char *p;
+#ifdef USE_LIBC_UTMP
+ struct utmp_type *ut;
+ if (argc>1) f_utmpname(argv[1]);
+ f_setutent();
+#else
+ struct utmp_type ut[1];
+ int fd=0;
+ if (argc>1) {
+ fd = open(argv[1], O_RDONLY);
+ if (fd == -1) { write(1,buf,S(buf,"error open()\n")); _exit(1); }
+ }
+#endif
+
+ write(1,buf,S(buf,"type pid id user line host ip date "
+ "[term exit]\n"));
+
+ while (f_getutent()) {
+ tmp_time = ut->ut_tv.tv_sec;
+ tmp_time += get_tz(tmp_time);
+ tm=nv_gmtime(&tmp_time);
+
+ p = buf;
+ *p++ = '[';
+ p += N(p, ut->ut_type, 1,0); p +=S(p,"] [");
+ p += N(p, ut->ut_pid, 5,0); p +=S(p,"] [");
+ p += fmt_str_(p,ut->ut_id,4); p +=S(p,"] [");
+ p += SN(p, ut->ut_user); p +=S(p,"] [");
+ p += SN(p, ut->ut_line); p +=S(p,"] [");
+ p += SN(p, ut->ut_host); p +=S(p,"] [");
+ p += fmt_utmp_ip(p, (char *)ut->ut_addr_v6); p +=S(p,"] [");
+
+ p += fmt_ulong(p, (1900 +tm->tm_year) % 100); *p++ = '-';
+ p += N(p, 1+tm->tm_mon,2,1); *p++ = '-';
+ p += N(p, tm->tm_mday, 2,1); *p++ = ' ';
+ p += N(p, tm->tm_hour, 2,1); *p++ = ':';
+ p += N(p, tm->tm_min, 2,1); *p++ = ':';
+ p += N(p, tm->tm_sec, 2,1);
+
+ if (argc>2) {
+ p +=S(p,"] [");
+ p += fmt_ulong(p,ut->ut_exit.e_termination); *p++ = ' ';
+ p += fmt_ulong(p,ut->ut_exit.e_exit);
+ }
+
+ p +=S(p,"]\n");
+ write(1,buf, p-buf);
+ }
+ f_endutent();
+ return 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_nmb_.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_nmb_.c
new file mode 100644
index 0000000..667aa76
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_nmb_.c
@@ -0,0 +1,12 @@
+unsigned int fmt_nmb_(char *b, unsigned long u, char len, char fill) /*EXTRACT_INCL*/ {
+ unsigned char k=len;
+ char ch = (fill)?'0':' ';
+ do {
+ if (k == 0) break;
+ b[--k] = '0' + u%10;
+ u /= 10;
+ } while (u);
+ while (k)
+ b[--k] = ch;
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_number.h b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_number.h
new file mode 100644
index 0000000..34ba68d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_number.h
@@ -0,0 +1,16 @@
+#define fmt_number_macro(f,type,base) \
+unsigned int f(char *s, type u) {\
+ type tmp=u;\
+ unsigned int len=0;\
+ do { tmp /=base; ++len; } while(tmp);\
+ if (s) {\
+ s +=len;\
+ do {\
+ unsigned char c = u%base;\
+ if (base <= 10) *--s = c+'0';\
+ else *--s = (c<10) ? c+'0' : c-10+'a';\
+ u /=base;\
+ } while (u);\
+ }\
+ return len;\
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_str_.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_str_.c
new file mode 100644
index 0000000..0decd6e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_str_.c
@@ -0,0 +1,6 @@
+#include "str_defs.h"
+unsigned int fmt_str_(char *b, char *s, unsigned int len) /*EXTRACT_INCL*/{
+ unsigned int k = str_add(b,s,len);
+ while (k<len) b[k++] = ' ';
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_time.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_time.c
new file mode 100644
index 0000000..8dd3208
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_time.c
@@ -0,0 +1,67 @@
+#include "all_defs.h"
+#include "opts__defs.h"
+#include <stdint.h>
+
+#define Z(X)
+#define sn(X) tod = X; goto no
+
+void fmt_time(char *fmt) /*EXTRACT_INCL*/{
+ uint32_t day, mon, year, tod;
+ uint32_t tm_wday, tm_sec, tm_min, tm_hour;
+#if 0
+ uint32_t yday=0;
+#endif
+ char buf[16], *m;
+
+ time_t now = time(0);
+ now += get_tz(now);
+
+ tod = (uint32_t)now % 86400;
+ day = (uint32_t)now / 86400;
+
+ tm_wday = ((day+4) % 7);
+ tm_sec = tod%60; tod /= 60;
+ tm_min = tod%60;
+ tm_hour = tod/60;
+
+ year = 4*day + 2;
+ year /= 1461;
+
+ day += 671;
+ day %= 1461; /* day 0 is march 1, 1972 */
+ Z(if (day < 306) yday = 1);
+ if (day == 1460) { day = 365; Z(yday = 59); }
+ else { day %= 365; Z(yday += (day + 59) % 365); }
+
+ day *= 10;
+ mon = (day + 5) / 306;
+ day = day + 5 - 306 * mon;
+ day /= 10;
+ if (mon >= 10) mon -= 10;
+ else mon += 2; /* day 0,1,30, mon 0..11, year 1970=0,1,2 */
+
+ year += 1970;
+ day += 1;
+
+ for (; (*buf=*fmt); ++fmt) {
+ tod = 1;
+ m = Oo[Omonths] + 3*mon;
+ switch (*buf) {
+ no:
+ if (tod<10) out_char('0');
+ tod = fmt_ulong(buf,tod);
+ break;
+ case 'Y': sn(year);
+ case 'm': sn(mon +1);
+ case 'd': sn(day);
+ case 'H': sn(tm_hour);
+ case 'M': sn(tm_min);
+ case 'S': sn(tm_sec);
+ case 'a': m = Oo[Odays] + 3*tm_wday;
+ case 'b':
+ tod = str_copynz(buf,m,3);
+ }
+ buf[tod] = 0;
+ out_puts(buf);
+ }
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_ulong.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_ulong.c
new file mode 100644
index 0000000..b8c51d6
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_ulong.c
@@ -0,0 +1,5 @@
+#include "fmt_number.h"
+fmt_number_macro(fmt_ulong, unsigned long, 10)
+#if 0
+unsigned int fmt_ulong(char *s, unsigned long u) /*EXTRACT_INCL*/
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_utmp_ip.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_utmp_ip.c
new file mode 100644
index 0000000..2fcf643
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_utmp_ip.c
@@ -0,0 +1,50 @@
+#include "fmt_defs.h"
+#include <stdint.h>
+
+/* ip must be int32_t aligned */
+unsigned int fmt_utmp_ip(char *buf, const char ip[16]) /*EXTRACT_INCL*/{
+ unsigned int temp, k, pos0=0, len0=0, pos1=0, compr=0;
+ int32_t *u = (void *)ip;
+ char *s = buf;
+
+ if (u[1]==0 && u[2]==0 && u[3]==0) {
+ if (u[0]) {
+ for (k=0; k<4; k++) {
+ s += fmt_ulong(s, (unsigned char)ip[k]);
+ if (k<3) *s++ = '.';
+ }
+ }
+ } else {
+ for (k=0; k<16; k+=2) {
+ if (ip[k]==0 && ip[k+1]==0) {
+ if (!compr) {
+ compr=1;
+ pos1=k;
+ }
+ if (k==14) { k=16; goto last; }
+ } else if (compr) {
+ last:
+ if ((temp=k-pos1) > len0) {
+ len0=temp;
+ pos0=pos1;
+ }
+ compr=0;
+ }
+ }
+
+ for (k=0; k<16; k+=2) {
+ if (pos0==k && len0) {
+ if (k==0) *s++ = ':';
+ *s++ = ':';
+ k += len0-2;
+ continue;
+ }
+ temp = ((unsigned long) (unsigned char) ip[k] << 8) +
+ (unsigned long) (unsigned char) ip[k+1];
+ s += fmt_xlong(s, temp);
+ if (k<14) *s++ = ':';
+ }
+ }
+ *s = 0;
+ return s-buf;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_xlong.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_xlong.c
new file mode 100644
index 0000000..7251791
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fmt_xlong.c
@@ -0,0 +1,5 @@
+#include "fmt_number.h"
+fmt_number_macro(fmt_xlong, unsigned long, 16)
+#if 0
+unsigned int fmt_xlong(char *s, unsigned long u) /*EXTRACT_INCL*/
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fork_and_exec.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fork_and_exec.c
new file mode 100644
index 0000000..db6a72b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/fork_and_exec.c
@@ -0,0 +1,14 @@
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+extern char **environ;
+
+void fork_and_exec(char *line) /*EXTRACT_INCL*/{
+ if (line) {
+ char *qq[4] = { "/bin/sh", "-c", line, 0 };
+ pid_t pid=fork();
+ if (pid==-1) return;
+ if (pid==0) { execve(*qq,qq,environ); _exit(127); }
+ waitpid(pid,0,0);
+ }
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_headers b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_headers
new file mode 100755
index 0000000..a18b474
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_headers
@@ -0,0 +1,25 @@
+#!/bin/sh
+[ $# -lt 2 ] && exit 1
+
+export PATH=/bin:/usr/bin
+name=`echo $1 | sed -e 's/\./__DOT__/g' -e 's/\//__SLASH__/g'`
+shift
+
+echo '#ifndef' AUTO_FILE__$$__$name
+echo '#define' AUTO_FILE__$$__$name
+echo '/* '`date`' */'
+
+while test $# -gt 0; do
+ case $1 in
+ -L*) echo $1 | sed -e 's/^../#include "/' -e 's/$/"/' ; shift;;
+ -G*) echo $1 | sed -e 's/^../#include </' -e 's/$/>/' ; shift;;
+ -I*) echo $1 | sed -e 's/^../#include /'; shift;;
+ *) break;;
+ esac
+done
+
+if [ $# -gt 0 ] ; then
+ sed -n -e 's/\(.*\) \/\*EXTRACT_INCL\*\/.*/extern \1;/p' \
+ -e 's/ \/\*EXTRACT_UNMOD\*\/.*//p' $@
+fi
+echo '#endif'
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_uptime.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_uptime.c
new file mode 100644
index 0000000..a65d314
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/get_uptime.c
@@ -0,0 +1,34 @@
+#include "sysinfo_defs.h"
+#include "boottime_defs.h"
+
+#include <time.h>
+#include <sys/types.h>
+
+#ifdef HAVE_SYSTEM_SYSINFO
+#include <sys/sysinfo.h>
+
+int get_uptime(time_t *uptime) /*EXTRACT_INCL*/{
+ struct sysinfo info;
+ if (sysinfo(&info)) return -1;
+ *uptime = info.uptime;
+ return 0;
+}
+
+#else
+
+#ifdef HAVE_SYSTEM_BOOTTIME
+#include <sys/sysctl.h>
+#include <sys/time.h>
+
+int get_uptime(time_t *uptime) {
+ struct timeval res = { 0, 0 };
+ int req[2] = { CTL_KERN, KERN_BOOTTIME };
+ size_t res_len = sizeof res;
+ if (sysctl(req, 2, &res, &res_len, 0, 0) >= 0 && res.tv_sec > 0) {
+ *uptime = res.tv_sec;
+ return 0;
+ }
+ return -1;
+}
+#endif
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/init.d/ngetty b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/init.d/ngetty
new file mode 100755
index 0000000..739eb47
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/init.d/ngetty
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+# To set correct TERM edit /etc/ngetty/Conf. Examples:
+#=environ=,TERM=linux
+#=environ=,TERM=vt100,OTHER_ENV=123,PATH=/usr/bin:/bin,HOME=/
+
+# It's possible to start ngetty also by init. Comment the lines
+# for getty in /etc/inittab and add a line for ngetty. Example:
+#
+# # Run gettys in standard runlevels
+# # 1:2345:respawn:/sbin/mingetty tty1
+# ...
+# # 6:2345:respawn:/sbin/mingetty tty6
+#
+# # Run ngetty in standard runlevels
+# ng:2345:respawn:/sbin/ngetty 1 2 3 4 5 6
+#
+
+cmdline="ngetty 8 9 10"
+pid="/var/run/ngetty-8-9-10.pid"
+
+exe="/sbin/ngetty"
+starter="/sbin/ngetty-argv"
+
+
+case $1 in
+start)
+ cd /
+ if [ -f $pid ] ; then
+ echo May be one ngetty is running now
+ echo If not, remove the file $pid
+ exit 1
+ fi
+ if [ -x /sbin/ngetty-helper ] ; then
+ $starter " -D -S -e -p$pid -- $exe $cmdline" user null
+ else
+ echo $0: Unable to find /sbin/ngetty-helper
+ exit 1;
+ fi
+ ;;
+stop)
+ pkill -fx "$cmdline"
+ rm -f $pid
+ ;;
+status)
+ [ -f $pid ] && read n < $pid
+ [ $? -eq 0 ] && echo ngetty PID is: $n
+ ;;
+*)
+ echo "Usage: $0 start|stop|status"
+ exit 1
+esac
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/lib.h b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/lib.h
new file mode 100644
index 0000000..9ba9373
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/lib.h
@@ -0,0 +1,36 @@
+#ifndef LIB_H
+#define LIB_H
+
+/* Pathname of the login(1) program. */
+#define LOGIN "/bin/login"
+
+/* Start ngetty with ohter appl: /sbin/ngetty -H/path/to/helper 1 2 3 */
+// #define NEED_HELPER_OPTION
+
+/* Define one of the next to use libc utmp() or utmpx() functions */
+// #define HAVE_C_UTMP
+// #define HAVE_C_UTMPX
+
+/* Poll only nonnegative fd */
+// #define NGETTY_SORT
+
+/* ----- stop changes here ----- */
+
+/* Pathname of the ngetty-helper program. */
+#define NGETTY_HELPER "/sbin/ngetty-helper"
+
+extern char **environ;
+
+#define GLOBAL_fstat_READ(fd,st,s, len,max_len, plus) \
+ fstat(fd,&st) || (unsigned int)(len=st.st_size) > max_len || \
+ (s=alloca(len+plus))==0 || const_io((int(*)())read,fd,s,len)
+
+#define GLOBAL_split_plus(aa,s,ch, len,plus) do { /* aa must be 0 !!! */ \
+ len=splitmem(aa,s,ch); \
+ if (aa) break; \
+ aa=alloca((len+plus) * sizeof(char*)); } while(1)
+
+#define GLOBAL_split(aa,s,ch, len) GLOBAL_split_plus(aa,s,ch, len,1)
+
+#include "all_defs.h"
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-1.1.spec b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-1.1.spec
new file mode 100644
index 0000000..ea44c25
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-1.1.spec
@@ -0,0 +1,55 @@
+Summary: getty replacement - one single daemon for all consoles
+Name: ngetty
+Version: 1.1
+Release: 1
+Group: System Environment/Daemons
+Packager: Blair Lowe <[email protected]>
+Source: http://riemann.fmi.uni-sofia.bg/ngetty/ngetty-%{version}.tar.gz
+URL: http://riemann.fmi.uni-sofia.bg/ngetty/
+License: GPL
+Prefix: /
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+
+%description
+
+Ngetty is a daemon that starts login sessions on virtual console
+terminals, on demand. It is a good replacement for all those getty
+processes started from init that, most of the time, are only taking up
+memory. When compiled statically with dietlibc, the ngetty binary
+size is only about 2k and uses considerably less memory than a getty.
+
+You have to edit /etc/inittab to make ngetty default. See the
+manual page or the examples on ngetty home page.
+
+%prep
+
+%setup -q
+
+%build
+make CC='diet -Os gcc -W' prefix=${RPM_BUILD_ROOT}
+
+%install
+make install install_other prefix=${RPM_BUILD_ROOT}
+
+%clean
+rm -rf ${RPM_BUILD_ROOT}
+
+%post
+( cd /etc/ngetty && test -x setup && ./setup ) || true
+
+%postun
+
+%files
+%defattr(-,root,root)
+/sbin
+/usr
+/etc
+%doc README
+
+%changelog
+* Thu Apr 10 2008 Nikola Vladov <[email protected]>
+- remove /usr prefix
+- add option for dietlibc
+
+* Fri Mar 12 2008 Blair Lowe <[email protected]>
+- Create rpm for Nikola Vladov
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-argv.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-argv.c
new file mode 100644
index 0000000..a8b943d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-argv.c
@@ -0,0 +1,148 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <time.h>
+#include <alloca.h>
+#include <grp.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include "lib.h"
+#define UUU "unable to "
+
+void w(char *s) { write(2, s, str_len(s)); }
+void e(char *x0, char *x1)
+ { w("\nngetty-argv: "); w(x0); w(x1); w("\n"); sleep(1); }
+/* sleep is needed to see the erros. see the option clear also */
+
+unsigned int expand_string(char *tmp, char *string, char *user, char *tty) {
+ char *s=string, *pos=tmp, *exp, ch, found_one = 0;
+ for (; (ch=*s); s++) {
+ if (ch == '%') {
+ found_one = 1;
+ ch = s[1];
+ exp = user;
+
+ switch (ch) {
+ case 'T': exp = tty;
+ case 'U':
+ pos += (tmp) ? str_copy(pos, exp) : str_len(exp);
+ ++s;
+ break;
+ case '%': /* %%U -> %U */
+ ++s;
+ default:
+ ch = *s;
+ goto non_special;
+ }
+ } else {
+ non_special:
+ if (tmp) *pos = ch;
+ ++pos;
+ }
+ }
+
+ if (found_one) {
+ if (tmp==0) return pos - tmp + 1;
+ else *pos = 0;
+ }
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ char **arg=0, **ee, **aa, *in=0, *s, ch;
+ char *user, *tty, flagsetsid=0, flagdaemon=0, flagtty=0, *flagpid=0;
+ unsigned long n;
+ uid_t uid=0;
+ gid_t gid=0;
+
+ if (argc<2) {
+ usage:
+ e("usage:\n\tngetty-argv [Options][--]ArgvString [user [tty]]\n\n",
+ "\tArgvString:\t:/bin/sleep:hacker_sleep:39:other:args...\n"
+ "\tOptions:\t:-D:-S:-N:-C:-u123:-g59:-a45:-s3:-d/tmp:-r/var/tmp\n"
+ "\tOptions:\t:-e,HOME=/,TERM=linux:-p/var/run/ngetty.pid\n"
+ "\tExample:\t:-u106:-g506:-d/var/qmail:--:./bin/qmail-qread:queue\n");
+ return 100;
+ }
+
+ user =(argc>2) ? argv[2] : "";
+ tty =(argc>3) ? argv[3] : "";
+
+ do {
+ n = expand_string(in, argv[1], user, tty);
+ if (n==0) break;
+ in = alloca(n);
+ } while (1);
+ if (in==0) in=argv[1];
+
+ ch = *in++; /* don't use '%' as split char */
+ if (ch == 0 || *in == 0) goto usage;
+ GLOBAL_split_plus(arg,in,ch, n,5);
+ if (n < 2) goto usage;
+
+ for (aa=arg; (s=*aa); aa++) {
+ if (*s != '-') break;
+ s += 2;
+ n=x_atoi(s);
+ switch (s[-1]) {
+ case 'e':
+ ee = 0;
+ ch = *s++;
+ if (ch) GLOBAL_split(ee,s,ch, n);
+ environ = ee;
+ break;
+ case 'D': flagdaemon=1; break;
+ case 'S': flagsetsid=1; break;
+ case 'N': flagtty=1; break;
+ case 'C': flagtty=2; break;
+ case 'p': if (*s) flagpid=s; break;
+ case 'g': gid = n; break;
+ case 'u': uid = n; break;
+ case 'a': alarm(n); break;
+ case 's': sleep(n); break;
+ case 'd': if (chdir(s)) { e(s, ": chdir error"); return 100; } break;
+ case 'r': if (chroot(s)) { e(s, ": chroot error"); return 100; } break;
+ case '-': aa++; goto do_it;
+ default:
+ e(s-2, " : unknown option");
+ return 1;
+ }
+ }
+
+ do_it:
+ if (flagdaemon) {
+ int pid;
+ while ((pid=fork()) <0) sleep(1);
+ if (pid) _exit(0);
+ }
+
+ if (flagsetsid) setsid();
+ if (flagtty==1) ioctl(0, TIOCNOTTY, (void *)1);
+ if (flagtty==2) ioctl(0, TIOCSCTTY, (void *)1);
+
+ if (flagpid) {
+ int fd = open(flagpid, O_RDWR | O_TRUNC | O_CREAT, 0644);
+ if (fd>=0) {
+ char tmp[3*sizeof(unsigned long)];
+ n=fmt_ulong(tmp, getpid());
+ tmp[n] = '\n';
+ write(fd, tmp, n+1);
+ close(fd);
+ }
+ }
+
+ if (uid || gid) {
+ if (gid==0) gid = uid;
+ if (setgroups(1,&gid) ||
+ setgid(gid) ||
+ setuid(uid)) { e(UUU, "set uidgid"); return 100; }
+ }
+
+ s = *aa++;
+ if (s==0 || *aa==0) return 0;
+ if (aa[0][0] == 0) aa[0] = s;
+
+ execve(s, aa, environ);
+ e(s, ": exec error");
+ return 127;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-helper.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-helper.c
new file mode 100644
index 0000000..a368b7a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty-helper.c
@@ -0,0 +1,335 @@
+#define _GNU_SOURCE
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <alloca.h>
+#include <errno.h>
+#include <termios.h>
+#include <sys/utsname.h>
+#include <sys/ioctl.h>
+#include <sys/param.h>
+#include "lib.h"
+#include "opts_defs.h"
+
+/* most of the functions here (like str_copy, fmt_ulong)
+ have manual pages in libowfat; http://www.fefe.de/
+ see also opts_defs.h for o[Oxxx]; man ngetty */
+
+/* see out_put.c; man buffer */
+#define outs(X) out_puts(X)
+#define GO_out "go out!"
+
+static struct utsname uts;
+static struct stat st;
+static char *tty, *o_opt, o_endchar;
+char **Oo = o; /* see opts_defs.h */
+
+static void tty_flush() { ioctl(0, TCFLSH, TCIFLUSH); }
+
+/* Format of o[Oprint]: ab:cq:09:AZ:...; man ngetty
+ return -1 if 'ch' does not belongs to the set o[Oprint]; 0 success */
+static int char_allow(unsigned char ch) {
+ unsigned char c0, c1, *x = (unsigned char *)o[Oprint];
+ again:
+ c0 = x[0]; if (!c0) return -1;
+ c1 = x[1]; if (!c1) return -1;
+ if (c0 <= ch && ch <= c1) return 0;
+ if (x[2] == ':') { x += 3; goto again; }
+ return -1;
+}
+
+/* print maximal 'len' chars from 's'; see strncpy, snprintf, printf */
+static void out_max(char *s, unsigned int len) {
+ char c = 0;
+ if (s == uts.nodename && !o[Olonghostname]) c = '.';
+ while (len && *s && *s != c) {
+ out_char(*s); ++s; --len;
+ }
+}
+
+#define Out_MAX(X) x=X; len=sizeof(X); goto system
+
+/* print string with escapes; man ngetty; man issue */
+static void output_special_char(char *s, int len) {
+ char *last = s + len;
+ while (s < last) {
+ char *x, c;
+ if (*s != '\\') { out_char(*s); ++s; continue; }
+ if (++s == last) return;
+
+ c = *s++;
+ switch (c) {
+ case 's': Out_MAX(uts.sysname);
+ case 'n': Out_MAX(uts.nodename);
+ case 'r': Out_MAX(uts.release);
+ case 'v': Out_MAX(uts.version);
+ case 'm': Out_MAX(uts.machine);
+ case 'o': Out_MAX(uts.domainname);
+ system:
+ out_max(x,len); break;
+ case 'l':
+ outs(tty); break;
+#ifndef DONT_NEED_ESC_TIME
+ case 't':
+ x = "H:M:S"; goto do_time;
+ case 'd':
+ x = (o[Odatestring]) ? "a b d Y" : "Y-m-d";
+ do_time:
+ fmt_time(x); break;
+#endif
+#ifndef DONT_NEED_ESC_USERS
+ case 'u':
+ case 'U':
+ {
+ char ubuf[8 + 3*sizeof(unsigned long)], *x = ubuf;
+ unsigned long usrs = utmp_users();
+ x += fmt_ulong(x, usrs);
+ if (c=='U') {
+ x += str_copynz(x, " users", 10);
+ if (usrs==1) --x;
+ }
+ *x = 0;
+ outs(ubuf);
+ }
+ break;
+#endif
+ default:
+ if (s+1 < last) {
+ unsigned char uch = (unsigned char)c-'0';
+ if (uch < 4) { /* XXX \0xy is not tested */
+ c = (uch<<6) | ((s[0]-'0')<<3) | (s[1]-'0');
+ s += 2;
+ }
+ }
+ out_char(c);
+ }
+ }
+}
+
+/* print string 's' with escapes; man ngetty */
+static void Out_sp_ch(char *s) { output_special_char(s, str_len(s)); }
+
+/* exception: print string 's' and exit with status 'i' */
+void error(char *s,int i) {
+ struct timespec ts = { 2, 500111222 };
+ Out_sp_ch("\nngetty-helper: \\d \\t \\l: ");
+ outs(s); out_char('\n'); out_flush();
+ nanosleep(&ts, 0);
+ tty_flush();
+ _exit(i);
+}
+
+/* print /etc/issue and login prompt; man issue */
+static void do_prompt() {
+ int fd,len;
+ char *s;
+ Out_sp_ch(o[Onewline]);
+ s = o[Oissuefile];
+ if (s[0] && (fd=open(s, O_RDONLY)) >= 0) {
+ if (GLOBAL_fstat_READ(fd,st,s, len,64000, 1)) _exit(1);
+ close(fd);
+ output_special_char(s, len);
+ }
+ Out_sp_ch(o[Ologinprompt]);
+ out_flush();
+}
+
+/* get login name in logname. max length = last-logname
+ man ngetty; options: login-buffer, timeout */
+static void get_logname(char *logname, char *last) {
+ char *c;
+ alarm(x_atoi(o[Otimeout]));
+ for (;;) {
+ for (c=logname;; c++) {
+ if (c == last)
+ error("login name too long",11);
+ if (read(0,c,1)<1) {
+ if (errno==EINTR || errno==EIO || errno==ENOENT)
+ _exit(0);
+ error("received strange error",9);
+ }
+ if (*c == '\n' || *c == '\r') {
+ *c=0;
+ break;
+ }
+ if (char_allow((unsigned char)*c))
+ error("bad character in login name",10);
+ } /* end read */
+ if (*logname == '-')
+ error("username may not start with a dash",13);
+ if (*logname) break;
+ do_prompt();
+ }
+ alarm(0);
+}
+
+/* parse string; store it in o[XXX]; see opts_defs.h; /etc/ngetty/Conf */
+static char *opt_get(char *s, int len) {
+ if (*o_opt == *s) {
+ char *x = o_opt;
+ if (!str_diffn(x,s,len) && x[len] == o_endchar) {
+ if (o[Odebug] && s != tty) {
+ outs(x - 1);
+ out_char('\n');
+ }
+ return x+len+1;
+ }
+ }
+ return 0;
+}
+
+/* return 1 if user is in s, otherwise 0;
+ Format of s: ,ab,uvw,MlqR, ... ,last */
+static char in_list(char *s, const char *user) {
+ char ch;
+ int len;
+ if (s==0 || *s==0 || user==0) return 0;
+ len = str_len(user);
+ ch = *s++;
+ again:
+ if (!str_diffn(s,user,len))
+ if (s[len]==ch || s[len]==0) return 1;
+ while (*s && *s != ch) s++;
+ if (*s++) goto again;
+ return 0;
+}
+
+/* set controlling tty */
+static void set_ctty() {
+ if (setsid() == -1 || ioctl(0, TIOCSCTTY, (void *)1))
+ error(GO_out, 111);
+}
+
+int main(int argc,char *argv[]) {
+ int fd,len;
+ char *s;
+ struct termios term;
+ if (argc < 2) _exit(100);
+
+ o[Oautologinfirst] = o[Onoclearfirst] = o[Oautologinname] = "";
+ o[Oissuefile] = "/etc/issue";
+ o[Ologinprog] = LOGIN;
+ o[Oprint] = "az:AZ:09:,.:__";
+ o[Otimeout] = "180";
+ o[Ologinprompt] = "\\n login: ";
+ o[Onewline] = "\n";
+ o[Oclear] = "\033c";
+#ifndef DONT_NEED_ESC_TIME
+ o[Omonths] = "JanFebMarAprMayJunJulAugSepOctNovDec";
+ o[Odays] = "SunMonTueWedThuFriSat";
+ o[Otz] = "/etc/localtime";
+#endif
+
+ tty = argv[1];
+ uname(&uts);
+ if (dup(0) !=1 || dup(0) !=2 || ioctl(0,TCGETS,&term)) error(GO_out, 100);
+ if (!str_diffn(tty, "/dev/", 5)) tty += 5;
+
+ if ((fd = open(NGETTY_HOME "/Conf", O_RDONLY)) >=0) {
+ char **aa=0, *q;
+ int tty_len = str_len(tty);
+ /* 40 bytes for Months or Days */
+ if (GLOBAL_fstat_READ(fd,st,s, len,64000, 40)) _exit(1);
+ close(fd);
+ if (st.st_uid || st.st_gid || (st.st_mode & 07177)) len = 0;
+ s[len]=0;
+
+ GLOBAL_split(aa,s,'\n', len);
+
+ for (; *aa; aa++) {
+ s=aa[0];
+ if (*s==0 || *s=='#' || *s=='\t' || *s==' ') continue;
+
+ o_endchar = '=';
+ if (*s=='=') o_opt = s+1;
+ else {
+ o_opt = s;
+ if (!(o_opt = opt_get(tty, tty_len))) continue;
+ }
+
+ for (len=0, q=(char *)P_opt; len < MAX_options; len++) {
+ int k = P_len[len];
+ if (len >= MAX_equal) o_endchar = 0;
+ if ((s = opt_get(q, k))) { o[len] = s; break; }
+ q += k;
+ }
+ }
+ }
+
+ if ((s=o[Onice])) nice(x_atoi(s));
+
+ if ((s=o[Oenviron])) {
+ char **ee=0, ch=*s++;
+ if (ch) GLOBAL_split(ee,s,ch, len);
+ environ=ee;
+ }
+
+ if (argc>2 && argv[2][0] == 'l') { /* get logname and execve() login */
+ char *loginargv[]={ o[Ologinprog], "--", 0, 0, 0 };
+ fork_and_exec(o[OshB]);
+
+ s = o[Oautologinfirst];
+ if (*s && !check_first(s,&st)) o[Oautologinname] = "";
+
+ s = o[Oautologinname];
+ if (*s) {
+ loginargv[1] = "-f";
+ loginargv[2] = s;
+ } else {
+ o[Oissuefile] = "";
+ if (!o[Onousername]) {
+ char *last, *buf = o[Ologinbuffer];
+ if (buf) last = buf + str_len(buf);
+ else { buf = alloca(41); last = buf + 40; }
+ loginargv[2] = buf;
+ get_logname(buf, last);
+ }
+ }
+
+ if (o[Oechooff]) {
+ term.c_lflag &= ~(ECHO|ISIG);
+ ioctl(0, TCSETS, &term);
+ }
+
+ if ((s=o[Ologinargv])) {
+ loginargv[1] = s; /* change '--' or '-f' with login-argv */
+ loginargv[3] = tty;
+ }
+
+ s = loginargv[2];
+ if (in_list(o[Odeny],s) ||
+ (o[Oallow] && in_list(o[Oallow],s)==0))
+ error("login is disabled",14);
+
+ out_flush();
+ tty_flush();
+ utmp_do(1,tty);
+
+ if ((s=o[Ochroot])) chroot(s);
+ if ((s=o[Ochdir])) chdir(s);
+ set_ctty();
+ execve(*loginargv, loginargv, environ);
+ } else { /* print /etc/issue and exit */
+ char *clear = o[Oclear];
+ tty_flush();
+
+ fork_and_exec(o[OshA]);
+ if ((s=o[Odelay])) {
+ struct timespec ts = { x_atoi(s), 100200300 };
+ nanosleep(&ts, 0);
+ }
+
+ s = o[Onoclearfirst];
+ if (*s && check_first(s,&st)) clear = "";
+
+ Out_sp_ch(clear);
+ utmp_do(0,tty);
+ do_prompt();
+
+#ifdef HAVE_SYSTEM_VHANGUP
+ if (!o[Onohangup]) { set_ctty(); vhangup(); }
+#endif
+ }
+ _exit(0);
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.8 b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.8
new file mode 100644
index 0000000..7e552f5
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.8
@@ -0,0 +1,666 @@
+.TH NGETTY 8 "May 2010"
+.
+.SH NAME
+.
+.BR ngetty
+\- daemon for virtual console terminals
+.
+.SH SYNOPSIS
+.BR ngetty
+[ tty1 | vc/1 | 1 ] [ /dev/tty2 | vc/2 | 2 ] ...
+.br
+.BR ngetty-helper
+/dev/ttyX [ login ]
+.br
+.BR ngetty-argv
+:options:child:[name]:args [user [tty]]
+
+.
+.SH DESCRIPTION
+.
+.B ngetty
+is a daemon that starts login sessions on virtual console terminals,
+on demand. It opens the virtual console terminals specified by the
+.I tty...
+arguments, displays a
+.IR /etc/issue
+message,
+prints the login prompt
+on each terminal
+and waits for user name.
+On user action,
+.B ngetty
+executes
+.BR login (1)
+in a new process with the terminal the user is typing in as the
+controlling terminal.
+.PP
+.BR login (1)
+then prompts for a password to login with the system and
+finally, if the login succeeds, executes the user's login shell.
+.PP
+When the user logs out,
+.B ngetty
+restarts the corresponding virtual console terminal.
+.PP
+.PP
+Actually almost the whole work is done by a
+.B ngetty-helper
+program.
+It makes
+.IR /var/run/utmp ,
+.IR /var/log/wtmp
+records, prints
+.IR /etc/issue ,
+hostname, login prompt,
+waits for user name.
+.B ngetty
+invokes the
+.B ngetty-helper
+by need.
+.
+.SH HISTORY
+.
+The traditional way to enable logins on virtual console terminals is
+to start a bunch of
+.BR getty (8)
+programs, one for each virtual console terminal, from
+.BR init (8).
+As most users rarely login on virtual console terminals nowadays, preferring
+graphical logins instead, it seems wasteful to have all those
+.BR getty (8)
+processes doing nothing but wasting memory.
+Alternatively,
+.B ngetty
+manages logins on any number of virtual console terminals from a single,
+light, process.
+.
+.SH INVOCATION
+.
+.B ngetty
+does not use stdin, stdout or stderr and closes them.
+.PP
+When running
+.B ngetty
+in the background, remember to disassociate it from the current controlling
+terminal by making it the process group leader of a new session, e.g.:
+.PP
+.RS 4
+setsid ngetty tty... &
+.br
+ngetty-argv :-D:-S:-e:--:/sbin/ngetty::1:2:3:4
+.RE
+.PP
+To start
+.B ngetty
+from
+.BR init (8),
+add something like this to
+.IR /etc/inittab :
+.PP
+.RS
+ng:2345:respawn:/sbin/ngetty tty1 tty2 ... tty6
+.RE
+.PP
+If
+.B ngetty-argv
+is available use it to start ngetty from
+.IR /etc/inittab .
+See the example bellow.
+.
+.SH DIAGNOSTICS
+.
+If
+.B ngetty
+can not open one of the virtual console terminals specified in the
+.I tty...
+arguments, most likely because that
+.I tty
+device node does not exist, no greeting message will be displayed on
+that terminal, obviously, and
+.B ngetty
+will simply go on, ignoring the offending terminal.
+Create the missing
+.I tty
+device and send SIGCHLD to ngetty.
+Then it will reopen the new
+.IR tty .
+Instead of sending SIGCHLD you can login and logout on some
+working
+.IR tty .
+This also forces ngetty to reopen the new
+.IR tty .
+
+.
+.PP
+.B ngetty
+uses
+.B ngetty-helper
+program.
+It's path is hard-coded in
+.BR ngetty .
+Never remove
+.B ngetty-helper
+program nor move it to other location.
+.PP
+If, on user action,
+.B ngetty-helper
+can not execute
+.BR login (1),
+in all likelihood because the compiled-in
+.B LOGIN
+path does not match your system's
+.BR login (1)
+path,
+.B ngetty
+restarts the terminal and redisplays the greeting message.
+.PP
+In any case,
+.B ngetty
+does not output error messages.
+.PP
+
+.SH OPTIONS
+It's possible to set different options for
+.B ngetty\-helper
+program in file
+.IR /etc/ngetty/Conf .
+If the option begin with "=" it's applied for
+all tty. If it start with a tty name it's applied only
+on current tty.
+Examples:
+.PP
+.RS
+.B # options format:
+.br
+.B # [ttyX]=option[=value]
+.br
+.B #=debug
+.br
+=environ=,TERM=linux
+.br
+tty3=long-hostname
+.br
+tty1=clear=\e033c
+.br
+=newline=
+.br
+=timeout=180
+.br
+tty1=timeout=60
+.br
+tty1=delay=1
+.RE
+.PP
+For security reasons
+.B ngetty-helper
+evaluate the file
+.IR /etc/ngetty/Conf
+only if it has mode:
+.PP
+.RS
+-rw------- root root /etc/ngetty/Conf
+.RE
+.
+.PP
+.B ngetty-helper
+recognizes the following options which might be embedded in the
+.I /etc/ngetty/Conf
+file:
+.TP
+.B # tty5=login-prog=/bin/login.test
+If a line starts with
+.BR # ,
+.B space
+or
+.B tab
+it is a comment.
+.TP
+.B debug
+If debug is set
+.B ngetty-helper
+write on terminal
+all successfully applied options. Set this on the fist line of
+.IR /etc/ngetty/Conf
+file.
+.TP
+.B date-string
+Escape
+\fB\\d\fP (current day)
+in
+.IR /etc/issue
+as:
+.br
+\fBFri Jun 01 2007\fP.
+Default is:
+\fB2007-06-01\fP.
+.TP
+.B days=string
+Abbreviation for week days (21 bytes). Default is:
+.br
+.B =days=SunMonTueWedThuFriSat
+.TP
+.B months=string
+Abbreviation for months (36 bytes). Default is:
+.br
+.B =months=JanFebMarAprMayJunJulAugSepOctNovDec
+.TP
+.B tz=string
+Change the timezone offset. If the string starts
+with slash it's the name of tzfile.
+The string is positive number if the local
+time zone is east of the Prime Meridian
+and negative if it is west.
+Default is
+.IR /etc/localtime .
+Examples:
+.br
+\fB=tz=-18000\fP -0500
+.br
+\fB=tz=7200\fP +0200
+.br
+\fB=tz=/etc/localtime\fP
+.br
+\fB=tz=AUTO\fP
+.TP
+.B echo-off
+Turn the echo off just before starting /bin/login. It's similar
+to \fBstty -echo\fP.
+.TP
+.B newline=string
+Print this \fBstring\fP before writing out
+.IR /etc/issue .
+(default is \fB\e012\fP).
+Example:
+.br
+.B tty3=newline=\e012I am \el\e012
+.TP
+.B clear=string
+Clear the screen before prompting for the login name with the
+\fBstring\fP (default is \fP\e033c\fP). Examples:
+.br
+.B tty1=clear=
+.br
+.B tty3=clear=\e033[H\e033[J
+.TP
+.B noclear-first=/etc/ngetty/.noclear
+Do not clear the screen before prompting for the login name the
+first time after reboot. Example:
+.br
+.B tty1=noclear-first=/etc/ngetty/.noclear.tty1
+.TP
+.B nohangup
+Do not call vhangup() to disable writing to this tty by
+other applications.
+.TP
+.B long\-hostname
+By default the hostname is only printed until the first dot.
+With this option enabled, the full text from gethostname() is shown.
+.
+.TP
+.B nousername
+Do not ask for user name. Exec login(1) immediately. Example:
+.br
+.B =nousername
+.br
+\fB=login-prompt= Press ENTER to activate \el\bP
+.
+.TP
+.B deny=,black,list,users...
+Disable login process for some users. The first char after "deny="
+is split char. Example:
+.br
+.B tty1=deny=,root,nobody,guest
+.TP
+.B allow=,white,list,users...
+Enable login process only for the users.
+The first char after "allow=" is split char. Example:
+.br
+.B =clear=
+.br
+.B =allow=,root,operator
+.
+.TP
+.B print=an:CM:PY:04:69
+Accept only these chars in user name. Default is to
+accept only "\fB,-._ 0-9 a-z A-Z\fP".
+It's possible to insert here the output of
+.br
+.B printf 'tty3=print=az:AZ:\eABC\eXYZ:__'
+.br
+Here \fBABC\fP and \fBXYZ\fP are octal numbers. Examples:
+.br
+.B tty1=print=az:AZ
+.br
+.B tty2=print=az:AZ:__:,.:09
+.TP
+.B issue-file=/etc/issue
+Change the issue file. Disable printing of the issue file with:
+.br
+.B =issue-file=
+.TP
+.B login-prog=/bin/login
+Change the login app. It's possible to use fgetty's
+.IR /bin/login1
+application with:
+.br
+.B =echo-off
+.br
+.B =login-prog=/bin/login1
+.TP
+.B login-buffer=string
+Read login name over the \fBstring\fP.
+Default string is 40 bytes long. Example:
+.br
+.B =login-buffer=12345678901234567
+.TP
+.B login-prompt=\en login:
+Change the login prompt string. Example:
+.br
+\fB=login-prompt=\e033[1;33m\el\e033[0;39m \en login: \fP
+.TP
+.B nice=10
+Change the priority by calling nice().
+.TP
+.B delay=5
+Sleep this many seconds before printing the file /etc/issue.
+.TP
+.B timeout=180
+Wait at most this many seconds for user name.
+.TP
+.B chdir=/home
+Change into this directory before calling the login prog.
+.TP
+.B chroot=/chroot
+Call chroot() with this directory name.
+.TP
+.B autologin-name=username
+Log the specified user automatically in without asking for
+a login name and password. Check the \-f option from
+.B /bin/login
+for this.
+Example:
+.br
+.B tty1=autologin-name=maria
+.TP
+.B autologin-first=/etc/ngetty/.autologin
+Log in automatically only the first time after reboot without asking for
+a login name and password.
+Example:
+.br
+.B tty1=autologin-name=maria
+.br
+.B tty1=autologin-first=/etc/ngetty/.autologin
+.TP
+.B environ=,TERM=linux
+Replace the environ. The first char after "environ="
+is split char. Examples:
+.br
+.B =environ=,TERM=vt100,PATH=/bin:/usr/bin,HOME=/
+.br
+.B tty3=environ=,TERM=linux,TTY=/dev/tty3
+.TP
+.B sh-A=line
+Exec this line before printing
+.IR /etc/issue .
+The line is executed using
+.B /bin/sh -c
+.IR line .
+It's good idea
+to use the full paths here. Example:
+.br
+.B tty4=sh-A=exec /bin/ps e -u root
+.br
+.B tty4=delay=8
+.TP
+.B sh-B=line
+Similar to option
+.B sh-A.
+This is executed before asking for username.
+.TP
+.B login-argv=any_string
+Ngetty starts login application with options
+.br
+\fBlogin -- XYZ\fP # default
+.br
+\fBlogin -f XYZ\fP # if autologin-name=XYZ
+.br
+With this option it's possible to start login appl
+with \fBany_string\fP instead of \fB\--\fP or \fB-f\fP.
+Using the program \fBngetty-argv\fP(8) one can start
+arbitrary program with different arguments. Two very
+dangerous examples are (never try them):
+.br
+.B tty4=login-prog=/sbin/ngetty-argv
+.br
+.B tty5=login-prog=/sbin/ngetty-argv
+.br
+.B tty4=login-argv=,/bin/login,,-f,%U
+.br
+.B tty5=login-argv=:-C:/bin/bash:-bash
+.
+.PP
+.SH "WARNING"
+If ngetty-helper finds stdout or stderr open it exits immediately
+with error 100. Ngetty invokes it correctly. See also
+the program test-helper.c in source package.
+.PP
+Do not edit the file
+.IR /etc/ngetty/Conf
+directly.
+Put the configurations in
+.IR /etc/ngetty/Conf.sed
+(the same syntax and permissions as
+.IR /etc/ngetty/Conf )
+and after editing it, execute:
+.PP
+.RS
+.B cd /etc/ngetty && ./setup
+.RE
+.PP
+The script
+.I /etc/ngetty/setup
+removes comments, merges lines ending with a backslash and
+expands the string \fB=tz=AUTO\fP to numeric number.
+Then it updates
+.IR /etc/ngetty/Conf .
+.PP
+.SH "SIGNALS"
+If ngetty receives SIGTERM it kill all child's PID (first with SIGTERM
+and then with SIGKILL) and exit immediately. It does not change UID,
+GID and mode of the controlling tty devices.
+It does not catch the other signals.
+Sending SIGCHLD to ngetty forces it
+to reread his internal cache tables
+and to restart failed tty devices.
+.
+.PP
+.SH "ISSUE ESCAPES"
+.B ngetty-helper
+recognizes the following escapes sequences which might be embedded
+after \fBlogin-prompt=\fP, \fBnewline=\fP, \fBclear=\fP
+or in the
+.I /etc/issue
+file:
+.IP \fB\ed\fP
+insert current day (localtime),
+.IP \fB\el\fP
+insert line on which
+.B ngetty
+is running,
+.IP \fB\em\fP
+inserts machine architecture (uname -m),
+.IP \fB\en\fP
+inserts machine's network node hostname (uname -n),
+.IP \fB\eo\fP
+inserts domain name,
+.IP \fB\er\fP
+inserts operating system release (uname -r),
+.IP \fB\et\fP
+insert current time (localtime),
+.IP \fB\es\fP
+inserts operating system name,
+.IP \fB\eu\fP
+insert the number of users which are currently logged in,
+.IP \fB\eU\fP
+insert the string "1 user" or "<n> users", where <n> is
+the number of users currently logged in,
+.IP \fB\ev\fP
+inserts operating system version (uname -v).
+.IP \fB\eXYZ\fP
+inserts a letter with octal code XYZ.
+.PP
+.SH EXAMPLE
+"\fBLinux\ eos\ i386\ #1\ Tue\ Mar\ 19\ 21:54:09\ MET\ 1996\fP" was produced
+by putting "\fB\\s\ \\n\ \\m\ \\v\fP" into
+.IR /etc/issue .
+.
+.PP
+.SH "NGETTY-ARGV"
+The program \fBngetty-argv\fP(8) splits argv[1] on strings,
+expands \fB%U\fP and \fB%T\fP to username and tty and then
+start the
+the application. The first char after "login-argv="
+is split char. In the examples above every user logs on tty4
+without password and tty5 is always root. To understand better
+how \fBngetty-argv\fP works try as non-root:
+.br
+.PP
+.B ngetty-argv ':/bin/echo:echo:%U: on %T' usr tty3
+.br
+.B ngetty-argv ':/bin/sleep:-hacker:39:I am %U on %T' 123 X
+.PP
+.TP
+One can put also options for ngetty-argv at the beginning.
+.IP
+\fB--\fP last option
+.IP
+\fB-u503\fP setuid to 503
+.IP
+\fB-g230\fP setgid to 230
+.IP
+.br
+\fB-a120\fP exec alarm(120) before starting child
+.IP
+\fB-s10\fP sleep 10 secs before starting child
+.IP
+\fB-d/X/YZ\fP chdir(/X/YZ) before starting child
+.IP
+\fB-r/A/BC\fP chroot(/A/BC) before starting child
+.IP
+\fB-D\fP start the child in background and exit
+.IP
+\fB-N -C\fP NOTTY | SCTTY controlling tty
+.IP
+\fB-S\fP like \fBsetsid\fP(8)
+.IP
+\fB-e,HOME=/,TERM=linux\fP same as \fBenviron=\fP above
+.IP
+\fB-p/path/to/pid.file\fP write the child pid here
+.
+.PP
+One possible example for \fB/etc/ngetty/Conf\fP is:
+.RS 4
+.br
+tty9=clear=
+.br
+tty9=issue-file=
+.br
+tty9=login-prompt=\en \ed \et qmail-qread:
+.br
+tty9=login-prog=/sbin/ngetty-argv
+.br
+tty9=login-argv=:-u106:-g503:-d/var/qmail:--
+.br
+ :./bin/qmail-qread:qread
+.RE
+.PP
+Another example is setting the TTY environ automatically:
+.RS 4
+=login-prog=/sbin/ngetty-argv
+.br
+=login-argv=:-e,TTY=/dev/%T,TERM=linux:--
+.br
+ :/bin/login:login-%T:--:%U
+.RE
+.
+.PP
+I recommend using \fBngetty-argv \fP in
+.IR /etc/inittab
+also.
+Put as last argument runlevel string. Then ps will
+show \fBngetty-2345\fP instead of \fBngetty\fP. Next
+start tty1 ... tty6 on runlevels 2345.
+.RS 4
+ng:\fB2345\fP:respawn:/sbin/ngetty-argv
+.br
+ .-e.-S.-d/.-s1.--./sbin/%U.%U-%T.1.2.3.4.5.6
+.br
+ ngetty \fB2345\fP
+.RE
+.
+.PP
+On a terminal (in scripts) start ngetty with
+.RS 4
+ngetty-argv .-N.-S.-e./sbin/%U.%U.8.9.10 ngetty
+.br
+ngetty-argv .-D.-S.-e./sbin/%U.%U.8.9.10 ngetty
+.RE
+.PP
+This program is a hack written for \fBngetty-helper\fP.
+There is no additional code in ngetty-helper and
+it's possible to start a program with any args.
+It is like a filter between ngetty-helper and login application.
+One can easy modify it without touching ngetty-helper.
+It's similar to DJB well known \fBargv0\fP(1) and
+\fBsetuidgid\fP(8).
+You can write own such programs
+and use them instead of ngetty-argv.
+.
+.SH FILES
+.TS
+tab (@);
+l l.
+/etc/ngetty/Conf@ \fBngetty-helper\fP configuration file
+/etc/ngetty/Conf.sed@ private setup file
+/etc/ngetty/setup@ updates \fBConf.sed -> Conf\fP
+/etc/issue@ printed before the login prompt
+/var/run/utmp@ the system status file
+/var/log/wtmp@ the system logging file
+/etc/inittab@ \fBinit\fP(8) configuration file
+.TE
+.
+.PP
+.SH SEE ALSO
+.
+.BR getty (8)
+.BR fgetty (8)
+.BR mingetty (8)
+.br
+.BR login (1)
+.BR nlogin (1)
+.BR argv0 (1)
+.BR setuidgid (8)
+.BR stty (1)
+.br
+http://sites.google.com/site/anbadeol/logind
+.
+.SH AUTHOR
+.
+Nikola Vladov
+.br
+http://riemann.fmi.uni-sofia.bg/ngetty/
+.
+.SH COPYRIGHT
+.
+Copyright 2007,2008,2010 Nikola Vladov
+.PP
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+.PP
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.c
new file mode 100644
index 0000000..926e904
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/ngetty.c
@@ -0,0 +1,278 @@
+/*
+ * ngetty.c - daemon for virtual console terminals
+ *
+ * Copyright 2007 Andre Oliveira
+ * Copyright 2007,2008 Nikola Vladov
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * Synopsis: ngetty tty...
+ *
+ * ngetty open()s the virtual console terminals specified as arguments and
+ * poll()s them for user input. Once input is available on one of the
+ * terminals, it fork()s and exec()s the ngetty-helper programs with that
+ * terminal set up as the controlling terminal. ngetty-helper make
+ * utmp/wtmp records, print /etc/issue, ask for user name and then
+ * exec()s login(1) program. When a ngetty session terminates,
+ * the sig_handler() restarts the corresponding terminal.
+ */
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <poll.h>
+#include <alloca.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include "lib.h"
+#include "sig_action.h"
+
+#ifdef NEED_HELPER_OPTION
+static char *helper;
+#else
+#define helper NGETTY_HELPER
+#endif
+
+struct tty_name {
+ char *tty; /* original ttyname */
+ char tmp[23]; /* expanded ttyname; /dev/ttyX or /dev/vc/X */
+ char st;
+};
+typedef struct tty_name tty_name_;
+typedef struct pollfd pollfd_;
+
+static tty_name_ *tty;
+
+/* Number of managed terminals (argc - 1). */
+static int npfd;
+
+/*
+ * Poll data for the terminals.
+ * When polling for input on a terminal, the fd field stores its
+ * file descriptor, as customary. After fork()ing, though, the parent
+ * process closes the terminal and stores the child's _negative_ pid
+ * in the fd field, so that poll() ignores that entry and
+ * main() knows every child's pid.
+ */
+static pollfd_ *pfd;
+
+static void nano_sleep(int n) { /* sleep n.5 secs */
+ struct timespec ts = { n, 500111222 };
+ nanosleep(&ts, 0);
+}
+
+static void max_copy(char *out,const char *in) {
+ int len;
+ for (len=0; len<10; len++) { if (!(out[len]=in[len])) break; }
+ out[len] = 0;
+}
+
+/*
+ * Exec NGETTY_HELPER.
+ */
+static void exechelper(int i, char *login) {
+ pollfd_ *xx = pfd + i;
+ int pid;
+ while ((pid=fork()) < 0)
+ nano_sleep(0);
+
+ if (pid==0) {
+ tty_name_ *tt = tty + i;
+ char *a1 = (tt->tmp[0]) ? tt->tmp : tt->tty;
+ char *arg[4] = { helper, a1, login, 0 };
+
+#ifndef NGETTY_SELFPIPE
+ if (xx->fd)
+#endif
+ dup2(xx->fd, 0);
+ i = npfd + 8;
+ while (--i) close(i);
+
+ execve(*arg, arg, environ);
+ nano_sleep(5);
+ _exit(127);
+ }
+ close(xx->fd);
+ xx->fd = -pid;
+}
+
+/*
+ * Open virtual console terminal i.
+ *
+ * In case of failure, most likely because the device node does not exist,
+ * poll() will simply ignore this entry and users get a blank screen and
+ * locked keyboard on this console. That's enough error reporting. ;-)
+ * No need to add code to check all syscalls' return values.
+ *
+ * Linux does not implement revoke(); the *BSD do.
+ */
+void opentty(int k) {
+ tty_name_ *tt = tty + k;
+ char *path = tt->tty, *m = tt->tmp, st;
+ int fd;
+
+ if (*path != '/') {
+ max_copy(m, "/dev/vc/");
+ if ('0'<=*path && *path<='9') {
+ max_copy(m+8, path);
+ if (chown(m,0,0))
+ { m[5]='t'; m[6]='t'; m[7]='y'; }
+ } else {
+ if (path[0]==0) { fd = -1; goto do_it; }
+ max_copy(m+5, path);
+ }
+ path = m;
+ } else
+ m[0] = 0;
+
+ chown(path, 0, 0);
+ chmod(path, 0600);
+#ifdef HAVE_REVOKE
+ revoke(path);
+#endif
+
+ fd = open(path, O_RDWR | O_NOCTTY);
+ if (fd > npfd + 4) _exit(100);
+ do_it:
+ pfd[k].fd = fd;
+ if (fd < 0) st = 0;
+ else {
+ st = tt->st ^ 1;
+ if (st) exechelper(k,0);
+ }
+ tt->st = st;
+}
+
+#ifndef NGETTY_SELFPIPE
+static int volatile poll_timeout;
+#endif
+/*
+ * SIG handler.
+ */
+static void sig_handler(int sig) {
+ if (sig == SIGTERM) {
+ int k;
+ again:
+ for (k = 0; k < npfd; k++) {
+ int pid = -pfd[k].fd;
+ if (pid > 1) kill(pid, sig);
+ }
+ nano_sleep(0);
+ if (sig == SIGKILL) _exit(0);
+ sig = SIGKILL;
+ goto again;
+ }
+#ifdef NGETTY_SELFPIPE
+ write(1,"",1);
+#else
+ poll_timeout = 1;
+#endif
+}
+
+static void set_handler() {
+ struct sigaction sa;
+ sigset_t *mask = &sa.sa_mask;
+ sigemptyset(mask);
+ sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
+ sa.sa_handler = sig_handler;
+ sigaction(SIGTERM, &sa, 0);
+ sigaction(SIGCHLD, &sa, 0);
+}
+
+#ifdef NGETTY_SORT
+#include "sortpfd.h"
+#define SORT_x_PFD k = sortpfd()
+#define KK_selfpipe k+1
+#define KK k
+#else
+#define SORT_x_PFD
+#define KK_selfpipe argc
+#define KK npfd
+#endif
+
+#ifdef NGETTY_SELFPIPE
+#define DO_x_POLL poll(pfd-1, KK_selfpipe, -1)
+#else
+#define DO_x_POLL poll(pfd, KK, poll_timeout); poll_timeout = 512*1024
+#endif
+
+/*
+ * Synopsis: ngetty tty...
+ *
+ * Since each terminal's struct pollfd only takes up 8 bytes, just
+ * alloca()te the array on the stack, instead of using the bloated malloc().
+ */
+int main(int argc, char **argv) {
+ int i,k;
+#ifdef NGETTY_SELFPIPE
+ int pi[6];
+#endif
+
+#ifdef NEED_HELPER_OPTION
+ if ((helper=argv[1]) && helper[0] == '-' && helper[1] == 'H') {
+ argv++; argc--; helper += 2;
+ } else helper = NGETTY_HELPER;
+#endif
+
+ npfd = argc - 1;
+ tty = alloca(npfd * sizeof(tty_name_)); if (tty==0) _exit(111);
+ pfd = alloca(argc * sizeof(pollfd_)); if (pfd==0) _exit(111);
+
+#ifdef NGETTY_SELFPIPE
+ pfd->fd = 0;
+ pfd->events = POLLIN;
+ pfd++;
+#endif
+
+ for (k = 0; k < npfd; k++) {
+ tty[k].tty = *++argv;
+ tty[k].st = 0;
+ pfd[k].fd = -1;
+ pfd[k].events = POLLIN;
+ }
+ for (k = 0; k < 127; k++) close(k);
+
+#ifdef NGETTY_SELFPIPE
+ if (pipe(pi) || pi[0] != 0 || pi[1] != 1) _exit(111);
+ for (k=0; k<2; k++)
+ fcntl(k, F_SETFL, fcntl(k,F_GETFL,0) | O_NONBLOCK);
+#endif
+
+ set_handler();
+
+ again:
+ while ((i = waitpid(-1, NULL, WNOHANG)) > 1)
+ for (k = 0; k < npfd; k++)
+ if (pfd[k].fd == -i)
+ { pfd[k].fd = -1; break; }
+
+ for (k = 0; k < npfd; k++)
+ if (pfd[k].fd == -1) opentty(k);
+
+ SORT_x_PFD;
+ i = DO_x_POLL;
+
+ if (i==-1) {
+ if (errno != EINTR)
+ sig_handler(SIGTERM); /* poll failed, what to do? */
+ } else {
+ for (i = 0; i < KK; i++)
+ if (pfd[i].revents)
+ exechelper(i,"login");
+ }
+
+#ifdef NGETTY_SELFPIPE
+ read(0, pi, sizeof pi);
+#endif
+ goto again;
+ return 1;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nv_gmtime.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nv_gmtime.c
new file mode 100644
index 0000000..048600b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nv_gmtime.c
@@ -0,0 +1,36 @@
+#include <time.h>
+
+struct tm *nv_gmtime(const time_t *t) /*EXTRACT_INCL*/{
+ static struct tm tm;
+ unsigned long day, mon, year, yday=0, tod;
+
+ tod = (unsigned long)(*t) % 86400;
+ day = (unsigned long)(*t) / 86400;
+ tm.tm_wday = ((day+4) % 7);
+ tm.tm_sec = tod%60; tod /= 60;
+ tm.tm_min = tod%60;
+ tm.tm_hour = tod/60;
+
+ year = 4*day + 2;
+ year /= 1461;
+
+ day += 671;
+ day %= 1461; /* day 0 is march 1, 1972 */
+ if (day < 306) yday = 1;
+ if (day == 1460) { day = 365; yday = 59; }
+ else { day %= 365; yday += (day + 59) % 365; }
+
+ day *= 10;
+ mon = (day + 5) / 306;
+ day = day + 5 - 306 * mon;
+ day /= 10;
+ if (mon >= 10) mon -= 10;
+ else mon += 2; /* day 0,1,30, mon 0..11, year 1970=0,1,2 */
+
+ tm.tm_year = year+70;
+ tm.tm_mon = mon;
+ tm.tm_mday = day+1;
+ tm.tm_yday = yday;
+ return &tm;
+}
+
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nwho.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nwho.c
new file mode 100644
index 0000000..731e77b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/nwho.c
@@ -0,0 +1,131 @@
+/* nwho.c */
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include "lib.h"
+
+#define S(a,b) str_copy(a,b)
+#define SN(a,b,c) str_copynz(a,b,c)
+#define SF(a,b,c) fmt_str_(a,b,c)
+#define N(a,b,c,d) fmt_nmb_(a,b,c,d)
+
+void usage(char *buf) {
+ write(1,buf,str_copy(buf, "usage: nwho [-alpquw] [file]\n"));
+ _exit(1);
+}
+
+int main(int argc, char **argv) {
+ struct tm *tm;
+ struct stat st;
+ char *montab = "JanFebMarAprMayJunJulAugSepOctNovDec";
+ char buf[1024];
+ time_t id;
+ char *ipasc, mesg, *p;
+ unsigned char flagaddr = 0;
+ char flagpid = 0;
+ char flagcheck = 1;
+ char flagup = 0;
+ char flagmesg = 0;
+#ifdef USE_LIBC_UTMP
+ struct utmp_type *ut;
+#else
+ struct utmp_type ut[1];
+ int fd;
+#endif
+
+ argc--; argv++;
+ while (argc>0) {
+ p = argv[0];
+ if (*p != '-') break;
+ for (++p; *p; ++p)
+ switch (*p) {
+ case 'q': flagcheck = 0; break;
+ case 'l': ++flagaddr; break;
+ case 'p': flagpid = 1; break;
+ case 'u': flagup = 1; break;
+ case 'w': flagmesg = 1; break;
+ case 'a': flagup=1; flagpid=1; ++flagaddr; flagmesg=1; break;
+ default: usage(buf);
+ }
+ argc--; argv++;
+ }
+
+#ifdef USE_LIBC_UTMP
+ if (argc>0) f_utmpname(argv[0]);
+ setutent();
+#else
+ if (argc>0) p = argv[0];
+ else p = Utmp_File;
+
+ fd = open(p, O_RDONLY);
+ if (fd == -1) {write(1,"error open input\n",17); _exit(1);}
+#endif
+
+ while (f_getutent()) {
+ if (ut->ut_type != USER_PROCESS) continue;
+ if (flagcheck)
+ if (kill(ut->ut_pid, 0) && errno == ESRCH) continue;
+
+ id = ut->ut_tv.tv_sec;
+ id += get_tz(id);
+ tm = nv_gmtime(&id);
+
+ mesg = '?';
+ id = -1;
+
+ S(buf, "/dev/");
+ buf[5 + SN(buf+5, ut->ut_line, sizeof(ut->ut_line))] = '\0';
+
+ if (!stat(buf, &st)) {
+ if ((st.st_mode & 0020) == 0020) mesg = '+';
+ else mesg = '-';
+ id = (time(0) - st.st_mtime)/60;
+ }
+
+ /*----------------------------------------------*/
+ p = buf;
+ p += SF(p, ut->ut_user,12);
+
+ if (flagmesg) {
+ *p++ = mesg; *p++ = ' ';}
+
+ p += SF(p, ut->ut_line, 7); *p++ = ' ';
+ if (flagpid) {
+ p += N(p, ut->ut_pid, 5,0); *p++ = ' ';}
+
+ p += SN(p, montab + (tm->tm_mon)*3, 3); *p++ = ' ';
+ p += N(p, tm->tm_mday, 2,0); *p++ = ' ';
+ p += N(p, tm->tm_hour, 2,0); *p++ = ':';
+ p += N(p, tm->tm_min, 2,1); *p++ = ' ';
+
+ if (flagup) {
+ if (id >= 24*60) {
+ id /= 60;
+ p += N(p, id/24, 3,0); p += S(p,"d+");
+ p += N(p, id%24, 2,1); p += S(p,"h ");
+ } else if (id > 0) {
+ p += N(p, id/60, 2,0); *p++ = ':';
+ p += N(p, id%60, 2,1); *p++ = ' ';
+ } else if (id == 0) {
+ p += SF(p," .",6);
+ } else
+ p += SF(p," ?",6);
+ }
+
+ *p++ = '(';
+ ipasc = p;
+ p += fmt_utmp_ip(p, (char *)ut->ut_addr_v6);
+
+ if (flagaddr>1 ||
+ (flagaddr && str_diffn(ipasc, ut->ut_host, sizeof(ut->ut_host)))) {
+ *p++ = '=';
+ p += SN(p,ut->ut_host,90);
+ }
+ *p++ = ')'; *p++ = '\n';
+
+ write(1,buf, p-buf);
+ }
+ f_endutent();
+ return 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/opts_make.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/opts_make.c
new file mode 100644
index 0000000..e4fe31f
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/opts_make.c
@@ -0,0 +1,106 @@
+#include <unistd.h>
+#include "str_defs.h"
+#include "fmt_defs.h"
+#include "vhangup_defs.h"
+
+struct xx { char *a,*b,*c; };
+char buf[8192], *p = buf;
+unsigned char opt_len[512];
+
+#define s(X) p += str_copy(p, X)
+#define f(X) p += fmt_ulong(p, X)
+#define sfs(a,b,c) s(a); f(b); s(c)
+
+#define X(a,b,c) {#a,#b,#c}
+
+struct xx o[] = {
+ X(pri,nt,=),
+ X(cl,ear,=),
+ X(all,ow,=),
+ X(de,ny,=),
+ X(env,iron,=),
+ X(new,line,=),
+ X(sh,-A,=),
+ X(sh,-B,=),
+ X(t,z,=),
+ X(day,s,=),
+ X(month,s,=),
+ X(ni,ce,=),
+ X(ch,dir,=),
+ X(de,lay,=),
+ X(ch,root,=),
+ X(time,out,=),
+ X(issue,-file,=),
+ X(login,-buffer,=),
+ X(login,-prog,=),
+ X(login,-argv,=),
+ X(login,-prompt,=),
+ X(noclear,-first,=),
+ X(autologin,-name,=),
+ X(autologin,-first,=),
+
+ X(de,bu,g),
+ X(echo,-o,ff),
+#ifdef HAVE_SYSTEM_VHANGUP
+ X(no,han,gup),
+#endif
+ X(no,user,name),
+ X(date,-str,ing),
+ X(long,-host,name),
+ {0,0,0}
+};
+
+int main() {
+ struct xx *x = o;
+ int n,k, o_len;
+
+ s("/* this file is auto generated. do not edit! */\n\n"
+ "#ifndef NGETTY_opts_defs_h\n"
+ "#define NGETTY_opts_defs_h\n\n");
+#ifdef HAVE_SYSTEM_VHANGUP
+ s("#define HAVE_SYSTEM_VHANGUP\n\n");
+#endif
+
+ for (o_len=0, n=0, k=0, x=o; x->a; x++, n++) {
+ char *t = x->b;
+ int m = str_len(x->a) + str_len(x->b);
+
+ if (*t=='-') t++;
+ s("#define O"); s(x->a); s(t);
+
+ if (x->c[0] != '=') { s(x->c); m += str_len(x->c); }
+ else k++;
+
+ opt_len[n] = m;
+ o_len += m;
+ sfs("\t", n, "\n");
+ }
+
+ sfs("\n#define MAX_equal\t", k, "\n");
+ sfs("#define MAX_options\t", n, "\n");
+ s("\nstatic char *o[MAX_options];\n"
+ "extern char ** Oo;\n\n");
+
+ sfs("const char P_opt[", o_len, "] = {\n");
+ for (x=o,n=0; x->a; x++, n++) {
+ char *t = "\"\t/* =";
+ s("\t\""), s(x->a); s(x->b);
+ if (x->c[0] != '=') { s(x->c); t = "\"\t/* "; }
+ sfs(t, n, " */\n");
+ }
+ s("};\n\n");
+
+ s("const unsigned char P_len[MAX_options] = {\n");
+ for (k=0; k<n; k++) {
+ sfs("\t/* ", k, " */ ");
+ sfs(" ", opt_len[k], ",\n");
+ }
+
+ p -= 2;
+ s("\n};\n\n");
+ s("#endif\n\n");
+
+ n = p-buf;
+ if (n != write(1, buf, n)) return 1;
+ return 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/out_put.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/out_put.c
new file mode 100644
index 0000000..f39cd2a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/out_put.c
@@ -0,0 +1,23 @@
+#include <unistd.h>
+#include "str_defs.h"
+
+static char buf_space[256];
+static int buf_pos;
+
+void out_flush() /*EXTRACT_INCL*/ {
+ const_io((int(*)())write, 1, buf_space, buf_pos);
+ buf_pos=0;
+}
+
+void out_char(char ch) /*EXTRACT_INCL*/ {
+ if (buf_pos == sizeof(buf_space)) out_flush();
+ buf_space[buf_pos] = ch;
+ buf_pos++;
+}
+
+void out_puts(char *s) /*EXTRACT_INCL*/ {
+ while (*s) {
+ out_char(*s);
+ ++s;
+ }
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sample.Conf b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sample.Conf
new file mode 100644
index 0000000..b93bec7
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sample.Conf
@@ -0,0 +1,53 @@
+# Do not edit /etc/ngetty/sample.Conf! Next install/update overwrite it.
+# Create private /etc/ngetty/Conf.sed with:
+# cd /etc/ngetty
+# echo '# private ngetty setup' > Conf.sed
+# chown root.root Conf.sed
+# chmod 600 Conf.sed
+# After editing Conf.sed exec:
+# cd /etc/ngetty && ./setup
+# less /etc/ngetty/Conf
+# Next install/update overwrite the file /etc/ngetty/setup also.
+#
+# See ngetty(8) for the syntax of Conf. The file Conf.sed have
+# the same syntax as Conf. It supports also continuation of the lines
+# ending with backslash (\) like bash.
+# The program ./setup converts Conf.sed to Conf.
+#----------------------------------------------------------------
+# options format:
+# [ttyX]=option[=value]
+#=debug
+#=environ=,TERM=linux
+#tty5=environ=,TERM=linux,TTY=/dev/tty5
+#tty1=sh-A=/etc/ngetty/tty1-A
+#=sh-B=/etc/ngetty/ttyX-B
+#=date-string
+#=nousername
+#=long-hostname
+#=clear=\033c
+#=newline=
+#tty1=noclear-first=/etc/ngetty/.noclear
+#=echo-off
+#=nohangup
+#=autologin-first=/etc/ngetty/.autologin
+#=autologin-name=username
+#=print=az:AZ:09:,.:__
+#=deny=:root:mail:nobody
+#=allow=,root,operator
+#=login-prog=/bin/login
+#=login-argv=:options:--:program:name:args
+#=login-prompt=\n login:
+#=login-prompt=\d \t (\l)\012\n login:
+#=timeout=180
+#=delay=3
+#=nice=5
+#=issue-file=/etc/issue
+#=chdir=/home
+#=chroot=/chroot
+#=tz=-7200
+#=tz=/etc/localtime
+#=tz=AUTO
+#=months=JanFebMarAprMayJunJulAugSepOctNovDec
+#=days=SunMonTueWedThuFriSat
+#=login-buffer=1234567890123456
+
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sig_action.h b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sig_action.h
new file mode 100644
index 0000000..29d9d6a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sig_action.h
@@ -0,0 +1,30 @@
+#include <signal.h>
+
+#ifdef NGETTY_TINY
+#if defined(__linux__) && defined(__dietlibc__)
+
+#ifdef NGETTY_i386
+extern int system__errno;
+#define errno system__errno
+#endif
+
+#if defined(__i386__) || defined(__x86_64__)
+
+#define sigemptyset(set) \
+do { \
+ set->sig[0]=0; \
+ if (_NSIG_WORDS>1) set->sig[1]=0; \
+ if (_NSIG_WORDS>2) { \
+ set->sig[2]=0; \
+ set->sig[3]=0; \
+ } \
+} while(0)
+
+int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, long nr);
+
+#define sigaction(signum, act, oldact) \
+ __rt_sigaction(signum, act, oldact, _NSIG/8)
+
+#endif
+#endif
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sortpfd.h b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sortpfd.h
new file mode 100644
index 0000000..7f3ec73
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/sortpfd.h
@@ -0,0 +1,21 @@
+static void swap_bytes(void *a, void *b, int len) {
+ char *x = a, *y = b, z;
+ while (len--) {
+ z = *x; *x = *y; *y = z;
+ ++x; ++y;
+ }
+}
+
+static int sortpfd() {
+ int l=0, r=npfd-1;
+ again:
+ while (l <= r && pfd[l].fd >= 0) ++l;
+ while (l <= r && pfd[r].fd < 0) --r;
+
+ if (l < r) {
+ swap_bytes(pfd+l, pfd+r, sizeof(pollfd_));
+ swap_bytes(tty+l, tty+r, sizeof(tty_name_));
+ goto again;
+ }
+ return l;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/splitmem.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/splitmem.c
new file mode 100644
index 0000000..1800664
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/splitmem.c
@@ -0,0 +1,16 @@
+unsigned int splitmem(char **v, char *s, char c) /*EXTRACT_INCL*/ {
+ char **w=v;
+ unsigned int n=1;
+
+ if (w) *w++=s;
+ while (*s) {
+ ++s;
+ if (s[-1] != c) continue;
+ ++n;
+ if (w==0) continue;
+ *w++=s;
+ s[-1]=0;
+ }
+ if (w) *w=0;
+ return n;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_add.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_add.c
new file mode 100644
index 0000000..a030d4a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_add.c
@@ -0,0 +1,5 @@
+unsigned int str_add(char *d, const char *s, unsigned int u) /*EXTRACT_INCL*/ {
+ unsigned int l=0;
+ for (l=0; s[l] && l<u; l++) d[l] = s[l];
+ return(l);
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copy.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copy.c
new file mode 100644
index 0000000..90d2da6
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copy.c
@@ -0,0 +1,5 @@
+unsigned int str_copy(char *out,const char *in) /*EXTRACT_INCL*/ {
+ unsigned int len=0;
+ while ((out[len]=in[len])) len++;
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copynz.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copynz.c
new file mode 100644
index 0000000..5b9be45
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_copynz.c
@@ -0,0 +1,7 @@
+#include "str_defs.h"
+
+unsigned int str_copynz(char *dest, const char *src, unsigned int n) /*EXTRACT_INCL*/ {
+ unsigned int k=str_add(dest, src, n);
+ while (k<n) dest[--n] = 0;
+ return k;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_diffn.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_diffn.c
new file mode 100644
index 0000000..934040f
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_diffn.c
@@ -0,0 +1,11 @@
+int str_diffn(const char* a, const char* b, unsigned int limit) /*EXTRACT_INCL*/ {
+ unsigned int u=0;
+ char ch=0;
+
+ for (; u<limit; u++) {
+ ch = a[u] - b[u];
+ if (ch) break;
+ if (a[u]==0) break;
+ }
+ return ch;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_len.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_len.c
new file mode 100644
index 0000000..9ce761a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/str_len.c
@@ -0,0 +1,5 @@
+unsigned int str_len(const char * s) /*EXTRACT_INCL*/ {
+ unsigned int len=0;
+ while (s[len]) ++len;
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/system-i386.S b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/system-i386.S
new file mode 100644
index 0000000..9e92cd4
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/system-i386.S
@@ -0,0 +1,123 @@
+.comm system__errno,4,4
+.comm environ,4,4
+
+.text
+.global _start
+_start:
+ popl %ecx /* %ecx = argc */
+ movl %esp,%esi /* %esi = argv */
+ pushl %ecx
+ leal 4(%esi,%ecx,4),%eax /* %eax = envp = (4*ecx)+%esi+4 */
+
+ pushl %eax
+ pushl %esi
+ pushl %ecx
+ movl %eax,environ
+
+ call main
+ pushl %eax
+ call exit
+ hlt /* die now ! will ya ... */
+.size _start,.-_start
+
+/* ------------------------------------------------------- */
+.text
+.weak exit
+exit:
+.global _exit
+.type _exit,@function
+_exit:
+ movb $1,%al
+.size _exit,.-_exit
+
+.global __unified_syscall
+.type __unified_syscall,@function
+__unified_syscall:
+ movzbl %al, %eax
+.size __unified_syscall,.-__unified_syscall
+
+.global __unified_return
+.type __unified_return,@function
+__unified_return:
+ push %edi
+ push %esi
+ push %ebx
+ movl %esp,%edi
+ /* we use movl instead of pop because otherwise a signal would
+ destroy the stack frame and crash the program, although it
+ would save a few bytes. */
+ movl 0x10(%edi),%ebx
+ movl 0x14(%edi),%ecx
+ movl 0x18(%edi),%edx
+ movl 0x1c(%edi),%esi
+ movl 0x20(%edi),%edi
+ int $0x80
+
+ cmp $-124,%eax
+ jb .Lnoerror
+ neg %eax
+ mov %eax,system__errno
+ sbb %eax,%eax # eax = eax - eax - CY = -1
+.Lnoerror:
+ pop %ebx
+ pop %esi
+ pop %edi
+ ret
+.size __unified_return,.-__unified_return
+
+/* ------------------------------------------------------- */
+#define do_it(name,sym) \
+.type sym,@function; \
+.global sym; \
+sym: \
+.ifle __NR_##name-255; \
+ movb $__NR_##name,%al; \
+ jmp __unified_syscall; \
+.else; \
+ movw $__NR_##name,%ax; \
+ jmp __unified_syscall_256; \
+.endif; \
+.size sym,.-sym
+
+
+#define syscall(name,sym) \
+.text; \
+do_it(name,sym)
+
+
+#define syscall_weak(name,wsym,sym) \
+.text; \
+.type wsym,@function; \
+.weak wsym; \
+wsym:; \
+do_it(name,sym)
+
+/* ------------------------------------------------------- */
+#include <asm/unistd.h>
+
+#define S(x) syscall(x,x)
+#define S__(x) syscall(x,__##x)
+
+S(nanosleep)
+S(fork)
+S(dup2)
+S(close)
+S(execve)
+S(chown)
+S(chmod)
+S(open)
+S(kill)
+S(waitpid)
+S(poll)
+S__(rt_sigaction)
+
+/* ------------------------------------------------------- */
+#if 0
+.text
+.global __unified_syscall_256
+.type __unified_syscall_256,@function
+__unified_syscall_256:
+ movzwl %ax,%eax
+ jmp __unified_return
+.size __unified_syscall_256,.-__unified_syscall_256
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/test-helper.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/test-helper.c
new file mode 100644
index 0000000..326612d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/test-helper.c
@@ -0,0 +1,37 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/ioctl.h>
+/*
+ A) $0 ./ngetty-helper /dev/ttyX [login]
+ B) $0 "-H" /dev/ttyX
+ C) $0 "-O" /dev/ttyX
+*/
+
+int main(int argc , char **argv, char **env) {
+ int k;
+ char *x;
+ if (argc<3) _exit(100);
+ ioctl(0, TIOCNOTTY, 0);
+ for (k=0; k<6; k++) close(k);
+ if (0 != open(argv[2], O_RDWR | O_NOCTTY)) _exit(111);
+
+ x = argv[1];
+ if (x[0] != '-') {
+ argv++;
+ execve(*argv, argv, env);
+ _exit(127);
+ }
+
+ ++x;
+ switch (*x) {
+ case 'O':
+ if (fork()) _exit(0);
+ case 'H':
+ setsid();
+ ioctl(0, TIOCSCTTY, 0);
+ sleep(15);
+ vhangup();
+ }
+ _exit(0);
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryboottime.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryboottime.c
new file mode 100644
index 0000000..dd5c6e5
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryboottime.c
@@ -0,0 +1,17 @@
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <time.h>
+
+int main() {
+#if defined(CTL_KERN) && defined(KERN_BOOTTIME)
+ /* FreeBSD specific: fetch sysctl "kern.boottime". */
+ struct timeval res = { 0, 0 };
+ int req[2] = { CTL_KERN, KERN_BOOTTIME };
+ size_t res_len = sizeof res;
+ if (sysctl(req, 2, &res, &res_len, 0, 0) >= 0 && res.tv_sec > 0)
+ return 0;
+#else
+ return -1;
+#endif
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/trysysinfo.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/trysysinfo.c
new file mode 100644
index 0000000..58148fd
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/trysysinfo.c
@@ -0,0 +1,5 @@
+#include <sys/sysinfo.h>
+int main() {
+ struct sysinfo info;
+ return sysinfo(&info);
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryvhangup.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryvhangup.c
new file mode 100644
index 0000000..197677d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tryvhangup.c
@@ -0,0 +1,5 @@
+#include <unistd.h>
+int main() {
+ vhangup();
+ _exit(0);
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tzmap.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tzmap.c
new file mode 100644
index 0000000..8db6cb2
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/tzmap.c
@@ -0,0 +1,84 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+// #define TZ_MMAP
+
+static unsigned char *T;
+static int L=-1;
+static time_t left, right, tz;
+
+static time_t parse(unsigned char *x)
+ {return (x[0]<<24) | (x[1]<<16) | (x[2]<<8) | x[3];}
+
+static time_t parse_localtime(time_t t) {
+ unsigned char *tmp,*x,tzh_typecnt;
+ int i,tzh_timecnt;
+
+ if (!T || L<44 || parse(T) != 1415211366) goto ready;
+ tzh_timecnt = parse(T+32) & 0xfff;
+ tzh_typecnt = parse(T+36);
+ i = 44 + 4*tzh_timecnt;
+ if (i + tzh_timecnt + 6*tzh_typecnt > L) goto ready;
+
+ x =T +i;
+ tmp =x;
+ for (i=tzh_timecnt; 0<i;) {
+ i--;
+ tmp -= 4;
+ left =parse(tmp);
+ if (t < left) {
+ right = left;
+ continue;
+ }
+ if (x[i] >= tzh_typecnt) goto ready;
+ tz = parse(x +tzh_timecnt +6*x[i]);
+ return tz;
+ }
+ ready:
+ right=left;
+ return 0;
+}
+
+#ifndef TZ_MMAP
+#include <alloca.h>
+#include <sys/stat.h>
+#include "scan_defs.h"
+#include "opts__defs.h"
+
+time_t get_tz(time_t t) /*EXTRACT_INCL*/{
+ struct stat st;
+ int fd;
+ char *tzfile = Oo[Otz];
+ if (*tzfile != '/') return x_atoi(tzfile);
+ if (left <= t && t < right) return tz;
+ fd=open(tzfile,O_RDONLY);
+ if (fd>=0) {
+ if (fstat(fd, &st)) goto error;
+ L = st.st_size;
+ T = alloca(L);
+ if (!T) goto error;
+ if (const_io((int(*)())read,fd,T,L))
+ { error: close(fd); return 0; }
+ close(fd);
+ }
+ return parse_localtime(t);
+}
+
+#else
+#include <sys/mman.h>
+time_t get_tz(time_t t) {
+ int fd;
+ if (left <= t && t < right) return tz;
+ if (!T) {
+ char *map;
+ if ((fd=open("/etc/localtime",O_RDONLY))>=0) {
+ L=lseek(fd,0,SEEK_END);
+ map=mmap(0,L,PROT_READ,MAP_SHARED,fd,0);
+ if (map==(char*)-1) map=0;
+ close(fd);
+ T=(unsigned char *)map;
+ }
+ }
+ return parse_localtime(t);
+}
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_do.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_do.c
new file mode 100644
index 0000000..2ac0acb
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_do.c
@@ -0,0 +1,98 @@
+#include "lib.h"
+
+#define SD(A,B) !str_diffn(A, B, sizeof(A))
+#define SC(A,B) str_copynz(A, B, sizeof(A))
+
+#if 0
+/*EXTRACT_START*/
+SC(u.ut_line, line);
+if (u.ut_id[0]==0) SC(u.ut_id, p);
+
+if (login) {
+ u.ut_type=LOGIN_PROCESS;
+ u.ut_pid=getpid();
+ p="LOGIN";
+} else {
+ if (u.ut_type == DEAD_PROCESS) do_wtmp =0;
+ u.ut_type=DEAD_PROCESS;
+ p="";
+}
+
+SC(u.ut_user,p);
+SC(u.ut_host,"");
+u.ut_tv.tv_sec = time(0);
+/*EXTRACT_END*/
+#endif
+
+#ifdef USE_LIBC_UTMP
+void utmp_do(int login, char *line) {
+ struct utmp_type u, *ut;
+ char foundone=0, do_wtmp=1;
+ char *p;
+
+ p=line;
+ while (str_len(p) > sizeof u.ut_id) p++;
+
+ str_copynz((char *)&u,"",sizeof(u));
+ f_setutent();
+ while (f_getutent())
+ if ((INIT_PROCESS <= ut->ut_type &&
+ ut->ut_type <= DEAD_PROCESS &&
+ SD(ut->ut_id, p)) || SD(ut->ut_line, line))
+ { u = *ut; foundone=1; break; }
+
+#include "utmp_defs.h"
+
+ if (foundone || login) {
+ f_setutent(); /* comment this ? */
+ f_pututline(&u);
+ }
+ f_endutent();
+
+ if (do_wtmp)
+ f_updwtmp(Wtmp_File, &u);
+}
+
+#else
+#include <unistd.h>
+#include <fcntl.h>
+
+/* line tty5 */
+void utmp_do(int login, char *line) /*EXTRACT_INCL*/{
+ struct utmp_type u;
+ char foundone=0, do_wtmp=1;
+ int fd=open(Utmp_File, O_RDWR);
+ off_t pos=0;
+ char *p;
+
+ p=line;
+ while (str_len(p) > sizeof u.ut_id) p++;
+
+ while (utmp_io(fd, &u, F_RDLCK)) {
+ if ((INIT_PROCESS <= u.ut_type &&
+ u.ut_type <= DEAD_PROCESS &&
+ SD(u.ut_id, p)) || SD(u.ut_line, line)) { foundone=1; break; }
+ pos += UTMP_SIZE;
+ }
+
+ if (!foundone) {
+ str_copynz((char *)&u,"",sizeof(u));
+ pos = lseek(fd,0,SEEK_END);
+ if (pos<0) pos =0;
+ pos = pos - (pos % (UTMP_SIZE));
+ }
+
+#include "utmp_defs.h"
+
+ if (foundone || login)
+ if (lseek(fd,pos,SEEK_SET) == pos)
+ utmp_io(fd,&u,F_WRLCK);
+ close(fd);
+
+ if (do_wtmp) {
+ fd=open(Wtmp_File, O_WRONLY|O_APPEND);
+ write(fd, &u, UTMP_SIZE);
+ close(fd);
+ }
+}
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_io.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_io.c
new file mode 100644
index 0000000..9470909
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_io.c
@@ -0,0 +1,27 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include "lib.h"
+
+/* type: F_RDLCK or F_WRLCK */
+struct utmp_type *utmp_io(int fd, struct utmp_type *ut, int type) /*EXTRACT_INCL*/ {
+ struct flock fl;
+ int len;
+
+ fl.l_whence = SEEK_CUR;
+ fl.l_start = 0;
+ fl.l_len = UTMP_SIZE;
+ fl.l_pid = 0;
+ fl.l_type = type;
+
+ if (fcntl(fd, F_SETLKW, &fl)) return 0;
+ len = const_io((type==F_WRLCK) ? (int(*)())write : (int(*)())read,
+ fd, ut, UTMP_SIZE);
+
+ fl.l_start = -UTMP_SIZE;
+ fl.l_type = F_UNLCK;
+
+ fcntl(fd, F_SETLK, &fl);
+
+ return (len) ? 0 : ut;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_struct.h b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_struct.h
new file mode 100644
index 0000000..07e9cdb
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_struct.h
@@ -0,0 +1,50 @@
+#ifndef UTMP_STRUCT_H
+#define UTMP_STRUCT_H
+#include "lib.h"
+
+#if defined(HAVE_C_UTMP) && defined(HAVE_C_UTMPX)
+#error define olny one of HAVE_C_UTMP, HAVE_C_UTMPX in lib.h
+#endif
+
+#undef USE_LIBC_UTMP
+#if defined(HAVE_C_UTMP) || defined(HAVE_C_UTMPX)
+#define USE_LIBC_UTMP
+#endif
+
+#ifndef USE_LIBC_UTMP
+#define f_endutent() close(fd)
+#define f_getutent() utmp_io(fd, ut, F_RDLCK)
+#endif
+
+#ifndef HAVE_C_UTMPX
+#include <utmp.h>
+#define utmp_type utmp
+#define Utmp_File _PATH_UTMP
+#define Wtmp_File _PATH_WTMP
+#endif
+
+#ifdef HAVE_C_UTMP
+#define f_setutent setutent
+#define f_endutent endutent
+#define f_getutent() (ut = getutent())
+#define f_pututline pututline
+#define f_updwtmp updwtmp
+#define f_utmpname utmpname
+#endif
+
+#ifdef HAVE_C_UTMPX
+#define __USE_GNU
+#include <utmpx.h>
+#define Utmp_File _PATH_UTMPX
+#define Wtmp_File _PATH_WTMPX
+#define utmp_type utmpx
+#define f_setutent setutxent
+#define f_endutent endutxent
+#define f_getutent() (ut = getutxent())
+#define f_pututline pututxline
+#define f_updwtmp updwtmpx
+#define f_utmpname utmpxname
+#endif
+
+#define UTMP_SIZE sizeof(struct utmp_type)
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_users.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_users.c
new file mode 100644
index 0000000..0904ae8
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/utmp_users.c
@@ -0,0 +1,18 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include "lib.h"
+
+unsigned long utmp_users() /*EXTRACT_INCL*/ {
+ unsigned long u=0;
+#ifdef USE_LIBC_UTMP
+ struct utmp_type *ut;
+ f_setutent();
+#else
+ struct utmp_type ut[1];
+ int fd = open(Utmp_File, O_RDONLY);
+#endif
+ while (f_getutent())
+ if (ut->ut_type == USER_PROCESS) u++;
+ f_endutent();
+ return u;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c
new file mode 100644
index 0000000..d45282e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1/x_atoi.c
@@ -0,0 +1,12 @@
+
+int x_atoi(const char *src) /*EXTRACT_INCL*/ {
+ register const char *s;
+ register int dest=0;
+ register unsigned char c;
+
+ s=src;
+ if (*s=='-' || *s=='+') ++s;
+
+ while ((c=*s-'0')<10) { ++s; dest=dest*10 + c; }
+ return (*src=='-') ? -dest : dest;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ngetty.man b/riemann.fmi.uni-sofia.bg/ngetty/ngetty.man
new file mode 100644
index 0000000..a54e9dd
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ngetty.man
@@ -0,0 +1,452 @@
+
+
+NGETTY(8) NGETTY(8)
+
+
+NAME
+ ngetty - daemon for virtual console terminals
+
+SYNOPSIS
+ ngetty [ tty1 | vc/1 | 1 ] [ /dev/tty2 | vc/2 | 2 ] ...
+ ngetty-helper /dev/ttyX [ login ]
+ ngetty-argv :options:child:[name]:args [user [tty]]
+
+
+DESCRIPTION
+ ngetty is a daemon that starts login sessions on virtual
+ console terminals, on demand. It opens the virtual con-
+ sole terminals specified by the tty... arguments, dis-
+ plays a /etc/issue message, prints the login prompt on
+ each terminal and waits for user name. On user action,
+ ngetty executes login(1) in a new process with the termi-
+ nal the user is typing in as the controlling terminal.
+
+ login(1) then prompts for a password to login with the
+ system and finally, if the login succeeds, executes the
+ user's login shell.
+
+ When the user logs out, ngetty restarts the corresponding
+ virtual console terminal.
+
+
+ Actually almost the whole work is done by a ngetty-helper
+ program. It makes /var/run/utmp, /var/log/wtmp records,
+ prints /etc/issue, hostname, login prompt, waits for user
+ name. ngetty invokes the ngetty-helper by need.
+
+HISTORY
+ The traditional way to enable logins on virtual console
+ terminals is to start a bunch of getty(8) programs, one
+ for each virtual console terminal, from init(8). As most
+ users rarely login on virtual console terminals nowadays,
+ preferring graphical logins instead, it seems wasteful to
+ have all those getty(8) processes doing nothing but wast-
+ ing memory. Alternatively, ngetty manages logins on any
+ number of virtual console terminals from a single, light,
+ process.
+
+INVOCATION
+ ngetty does not use stdin, stdout or stderr and closes
+ them.
+
+ When running ngetty in the background, remember to disas-
+ sociate it from the current controlling terminal by making
+ it the process group leader of a new session, e.g.:
+
+ setsid ngetty tty... &
+ ngetty-argv :-D:-S:-e:--:/sbin/ngetty::1:2:3:4
+
+ To start ngetty from init(8), add something like this to
+ /etc/inittab:
+
+ ng:2345:respawn:/sbin/ngetty tty1 tty2 ... tty6
+
+ If ngetty-argv is available use it to start ngetty from
+ /etc/inittab. See the example bellow.
+
+DIAGNOSTICS
+ If ngetty can not open one of the virtual console termi-
+ nals specified in the tty... arguments, most likely
+ because that tty device node does not exist, no greeting
+ message will be displayed on that terminal, obviously, and
+ ngetty will simply go on, ignoring the offending terminal.
+ Create the missing tty device and send SIGCHLD to ngetty.
+ Then it will reopen the new tty. Instead of sending
+ SIGCHLD you can login and logout on some working tty.
+ This also forces ngetty to reopen the new tty.
+
+
+ ngetty uses ngetty-helper program. It's path is hard-
+ coded in ngetty. Never remove ngetty-helper program nor
+ move it to other location.
+
+ If, on user action, ngetty-helper can not execute
+ login(1), in all likelihood because the compiled-in LOGIN
+ path does not match your system's login(1) path, ngetty
+ restarts the terminal and redisplays the greeting message.
+
+ In any case, ngetty does not output error messages.
+
+
+
+OPTIONS
+ It's possible to set different options for ngetty-helper
+ program in file /etc/ngetty/Conf. If the option begin
+ with "=" it's applied for all tty. If it start with a tty
+ name it's applied only on current tty. Examples:
+
+ # options format:
+ # [ttyX]=option[=value]
+ #=debug
+ =environ=,TERM=linux
+ tty3=long-hostname
+ tty1=clear=\033c
+ =newline=
+ =timeout=180
+ tty1=timeout=60
+ tty1=delay=1
+
+ For security reasons ngetty-helper evaluate the file
+ /etc/ngetty/Conf only if it has mode:
+
+ -rw------- root root /etc/ngetty/Conf
+
+ ngetty-helper recognizes the following options which might
+ be embedded in the /etc/ngetty/Conf file:
+
+ # tty5=login-prog=/bin/login.test
+ If a line starts with #, space or tab it is a com-
+ ment.
+
+ debug If debug is set ngetty-helper write on terminal all
+ successfully applied options. Set this on the fist
+ line of /etc/ngetty/Conf file.
+
+ date-string
+ Escape \d (current day) in /etc/issue as:
+ Fri Jun 01 2007. Default is: 2007-06-01.
+
+ days=string
+ Abbreviation for week days (21 bytes). Default is:
+ =days=SunMonTueWedThuFriSat
+
+ months=string
+ Abbreviation for months (36 bytes). Default is:
+ =months=JanFebMarAprMayJunJulAugSepOctNovDec
+
+ tz=string
+ Change the timezone offset. If the string starts
+ with slash it's the name of tzfile. The string is
+ positive number if the local time zone is east of
+ the Prime Meridian and negative if it is west.
+ Default is /etc/localtime. Examples:
+ =tz=-18000 -0500
+ =tz=7200 +0200
+ =tz=/etc/localtime
+ =tz=AUTO
+
+ echo-off
+ Turn the echo off just before starting /bin/login.
+ It's similar to stty -echo.
+
+ newline=string
+ Print this string before writing out /etc/issue.
+ (default is \012). Example:
+ tty3=newline=\012I am \l\012
+
+ clear=string
+ Clear the screen before prompting for the login
+ name with the string (default is \033c). Examples:
+ tty1=clear=
+ tty3=clear=\033[H\033[J
+
+ noclear-first=/etc/ngetty/.noclear
+ Do not clear the screen before prompting for the
+ login name the first time after reboot. Example:
+ tty1=noclear-first=/etc/ngetty/.noclear.tty1
+
+ nohangup
+ Do not call vhangup() to disable writing to this
+ tty by other applications.
+
+ long-hostname
+ By default the hostname is only printed until the
+ first dot. With this option enabled, the full text
+ from gethostname() is shown.
+
+ nousername
+ Do not ask for user name. Exec login(1) immedi-
+ ately. Example:
+ =nousername
+ =login-prompt= Press ENTER to activate \l
+
+ deny=,black,list,users...
+ Disable login process for some users. The first
+ char after "deny=" is split char. Example:
+ tty1=deny=,root,nobody,guest
+
+ allow=,white,list,users...
+ Enable login process only for the users. The first
+ char after "allow=" is split char. Example:
+ =clear=
+ =allow=,root,operator
+
+ print=an:CM:PY:04:69
+ Accept only these chars in user name. Default is
+ to accept only ",-._ 0-9 a-z A-Z". It's possible
+ to insert here the output of
+ printf 'tty3=print=az:AZ:\ABC\XYZ:__'
+ Here ABC and XYZ are octal numbers. Examples:
+ tty1=print=az:AZ
+ tty2=print=az:AZ:__:,.:09
+
+ issue-file=/etc/issue
+ Change the issue file. Disable printing of the
+ issue file with:
+ =issue-file=
+
+ login-prog=/bin/login
+ Change the login app. It's possible to use
+ fgetty's /bin/login1 application with:
+ =echo-off
+ =login-prog=/bin/login1
+
+ login-buffer=string
+ Read login name over the string. Default string is
+ 40 bytes long. Example:
+ =login-buffer=12345678901234567
+
+ login-prompt=\n login:
+ Change the login prompt string. Example:
+ =login-prompt=\033[1;33m\l\033[0;39m \n login:
+
+ nice=10
+ Change the priority by calling nice().
+
+ delay=5
+ Sleep this many seconds before printing the file
+ /etc/issue.
+
+ timeout=180
+ Wait at most this many seconds for user name.
+
+ chdir=/home
+ Change into this directory before calling the login
+ prog.
+
+ chroot=/chroot
+ Call chroot() with this directory name.
+
+ autologin-name=username
+ Log the specified user automatically in without
+ asking for a login name and password. Check the -f
+ option from /bin/login for this. Example:
+ tty1=autologin-name=maria
+
+ autologin-first=/etc/ngetty/.autologin
+ Log in automatically only the first time after
+ reboot without asking for a login name and pass-
+ word. Example:
+ tty1=autologin-name=maria
+ tty1=autologin-first=/etc/ngetty/.autologin
+
+ environ=,TERM=linux
+ Replace the environ. The first char after "envi-
+ ron=" is split char. Examples:
+ =environ=,TERM=vt100,PATH=/bin:/usr/bin,HOME=/
+ tty3=environ=,TERM=linux,TTY=/dev/tty3
+
+ sh-A=line
+ Exec this line before printing /etc/issue. The
+ line is executed using /bin/sh -c line. It's good
+ idea to use the full paths here. Example:
+ tty4=sh-A=exec /bin/ps e -u root
+ tty4=delay=8
+
+ sh-B=line
+ Similar to option sh-A. This is executed before
+ asking for username.
+
+ login-argv=any_string
+ Ngetty starts login application with options
+ login -- XYZ # default
+ login -f XYZ # if autologin-name=XYZ
+ With this option it's possible to start login appl
+ with any_string instead of -- or -f. Using the
+ program ngetty-argv(8) one can start arbitrary pro-
+ gram with different arguments. Two very dangerous
+ examples are (never try them):
+ tty4=login-prog=/sbin/ngetty-argv
+ tty5=login-prog=/sbin/ngetty-argv
+ tty4=login-argv=,/bin/login,,-f,%U
+ tty5=login-argv=:-C:/bin/bash:-bash
+
+
+WARNING
+ If ngetty-helper finds stdout or stderr open it exits
+ immediately with error 100. Ngetty invokes it correctly.
+ See also the program test-helper.c in source package.
+
+ Do not edit the file /etc/ngetty/Conf directly. Put the
+ configurations in /etc/ngetty/Conf.sed (the same syntax
+ and permissions as /etc/ngetty/Conf) and after editing it,
+ execute:
+
+ cd /etc/ngetty && ./setup
+
+ The script /etc/ngetty/setup removes comments, merges
+ lines ending with a backslash and expands the string
+ =tz=AUTO to numeric number. Then it updates
+ /etc/ngetty/Conf.
+
+
+SIGNALS
+ If ngetty receives SIGTERM it kill all child's PID (first
+ with SIGTERM and then with SIGKILL) and exit immediately.
+ It does not change UID, GID and mode of the controlling
+ tty devices. It does not catch the other signals. Send-
+ ing SIGCHLD to ngetty forces it to reread his internal
+ cache tables and to restart failed tty devices.
+
+
+ISSUE ESCAPES
+ ngetty-helper recognizes the following escapes sequences
+ which might be embedded after login-prompt=, newline=,
+ clear= or in the /etc/issue file:
+
+ \d insert current day (localtime),
+
+ \l insert line on which ngetty is running,
+
+ \m inserts machine architecture (uname -m),
+
+ \n inserts machine's network node hostname (uname -n),
+
+ \o inserts domain name,
+
+ \r inserts operating system release (uname -r),
+
+ \t insert current time (localtime),
+
+ \s inserts operating system name,
+
+ \u insert the number of users which are currently
+ logged in,
+
+ \U insert the string "1 user" or "<n> users", where
+ <n> is the number of users currently logged in,
+
+ \v inserts operating system version (uname -v).
+
+ \XYZ inserts a letter with octal code XYZ.
+
+
+EXAMPLE
+ "Linux eos i386 #1 Tue Mar 19 21:54:09 MET 1996" was pro-
+ duced by putting "\s \n \m \v" into /etc/issue.
+
+
+NGETTY-ARGV
+ The program ngetty-argv(8) splits argv[1] on strings,
+ expands %U and %T to username and tty and then start the
+ the application. The first char after "login-argv=" is
+ split char. In the examples above every user logs on tty4
+ without password and tty5 is always root. To understand
+ better how ngetty-argv works try as non-root:
+
+ ngetty-argv ':/bin/echo:echo:%U: on %T' usr tty3
+ ngetty-argv ':/bin/sleep:-hacker:39:I am %U on %T' 123 X
+
+
+ One can put also options for ngetty-argv at the beginning.
+
+ -- last option
+
+ -u503 setuid to 503
+
+ -g230 setgid to 230
+
+ -a120 exec alarm(120) before starting child
+
+ -s10 sleep 10 secs before starting child
+
+ -d/X/YZ chdir(/X/YZ) before starting child
+
+ -r/A/BC chroot(/A/BC) before starting child
+
+ -D start the child in background and exit
+
+ -N -C NOTTY | SCTTY controlling tty
+
+ -S like setsid(8)
+
+ -e,HOME=/,TERM=linux same as environ= above
+
+ -p/path/to/pid.file write the child pid here
+
+ One possible example for /etc/ngetty/Conf is:
+ tty9=clear=
+ tty9=issue-file=
+ tty9=login-prompt=\n \d \t qmail-qread:
+ tty9=login-prog=/sbin/ngetty-argv
+ tty9=login-argv=:-u106:-g503:-d/var/qmail:--
+ :./bin/qmail-qread:qread
+
+ Another example is setting the TTY environ automatically:
+ =login-prog=/sbin/ngetty-argv
+ =login-argv=:-e,TTY=/dev/%T,TERM=linux:--
+ :/bin/login:login-%T:--:%U
+
+ I recommend using ngetty-argv in /etc/inittab also. Put
+ as last argument runlevel string. Then ps will show
+ ngetty-2345 instead of ngetty. Next start tty1 ... tty6
+ on runlevels 2345.
+ ng:2345:respawn:/sbin/ngetty-argv
+ .-e.-S.-d/.-s1.--./sbin/%U.%U-%T.1.2.3.4.5.6
+ ngetty 2345
+
+ On a terminal (in scripts) start ngetty with
+ ngetty-argv .-N.-S.-e./sbin/%U.%U.8.9.10 ngetty
+ ngetty-argv .-D.-S.-e./sbin/%U.%U.8.9.10 ngetty
+
+ This program is a hack written for ngetty-helper. There
+ is no additional code in ngetty-helper and it's possible
+ to start a program with any args. It is like a filter
+ between ngetty-helper and login application. One can easy
+ modify it without touching ngetty-helper. It's similar to
+ DJB well known argv0(1) and setuidgid(8). You can write
+ own such programs and use them instead of ngetty-argv.
+
+FILES
+ /etc/ngetty/Conf ngetty-helper configuration file
+ /etc/ngetty/Conf.sed private setup file
+ /etc/ngetty/setup updates Conf.sed -> Conf
+ /etc/issue printed before the login prompt
+ /var/run/utmp the system status file
+ /var/log/wtmp the system logging file
+ /etc/inittab init(8) configuration file
+
+
+SEE ALSO
+ getty(8) fgetty(8) mingetty(8)
+ login(1) nlogin(1) argv0(1) setuidgid(8) stty(1)
+ http://sites.google.com/site/anbadeol/logind
+
+AUTHOR
+ Nikola Vladov
+ http://riemann.fmi.uni-sofia.bg/ngetty/
+
+COPYRIGHT
+ Copyright 2007,2008,2010 Nikola Vladov
+
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation;
+ either version 2 of the License, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more
+ details.
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/pr_other.html b/riemann.fmi.uni-sofia.bg/ngetty/pr_other.html
new file mode 100644
index 0000000..6b6b0b6
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/pr_other.html
@@ -0,0 +1,103 @@
+<html>
+<title>ngetty suite</title>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>other programs</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ngetty - other programs</h1>
+<div class="endtop"></div>
+</div>
+
+<a name="Memory">
+On my boxes I build ngetty with:</a>
+<pre>
+ make CC='diet -Os gcc -W'
+ rm ngetty
+ make CC='diet -Os gcc -W' LDFLAGS='-s -Wl,-N'
+ make ngetty.i386 # on i386 hosts
+</pre>
+It uses then only two pages memory; one for text + data and one for stack.
+<pre>
+riemann$ size /sbin/ngetty
+ text data bss dec hex filename
+ 1072 0 24 1096 448 /sbin/ngetty
+</pre>
+
+
+<hr>
+
+<h2>ngetty-helper.tiny</h2>
+This is the same as ngetty-helper. It does not support
+only escapes
+<a href=ngetty.man>\d \t \U \u</a>.
+<br>
+You can make it default with:
+<pre>
+ cd /sbin
+ cp ngetty-helper ngetty-helper.large
+ install ngetty-helper.tiny ngetty-helper
+ ls -la ngetty*
+</pre>
+
+<h2>dumputmp</h2>
+This program dumps a file in human readable format on stdout.
+Examples:
+<pre>
+ dumputmp /var/run/utmp
+ dumputmp /var/log/wtmp
+</pre>
+<font color=red>WARNING</font>:
+There is a program utmpdump in sysvinit package.
+My used different name to avoid conflicts.
+
+<h2>nwho</h2>
+This is my who. Try
+<pre>
+ who
+ nwho -a
+ nwho -aq
+ nwho -a /var/log/wtmp
+ nwho -aq /var/log/wtmp
+</pre>
+<font color=red>WARNING</font>:
+I wrote nwho from scratch. May be its options
+are deffernt from the options of the standard who.
+
+<h2>cleanutmp</h2>
+This program clean the file <tt>/var/run/utmp</tt>. If last file
+contains an utmp-record (type USER_PROCESS) and there isn't
+a program on the box with the
+same PID as in the record, then cleanutmp changes the
+record to DEAD_PROCESS.
+
+<h2>cleanutmp permition</h2>
+If your <tt>/var/run/utmp</tt> file has permition
+<pre>
+ -rw-rw-r-- root utmp 4224 Dec 19 08:53 /var/run/utmp
+</pre>
+install cleanutmp with the same UID:GID and mode 2711.
+Then every user can execute cleanutmp before who, finger...
+Cron daemon can also start cleanutmp on every six hours.
+
+<p>
+On my box I can make/test bad utmp-entries with:
+<pre>
+ xterm &
+ kill -9 %1
+ sleep 1
+ --- see the result ---
+ dumputmp /var/run/utmp
+ cleanutmp
+ dumputmp /var/run/utmp
+</pre>
+Try to start who, finger before/after cleanutmp to see the difference.
+
+<p>
+Last modified: 25 May 2008
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/ps_tree b/riemann.fmi.uni-sofia.bg/ngetty/ps_tree
new file mode 100644
index 0000000..503f392
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/ps_tree
@@ -0,0 +1,20 @@
+
+ninit-+-ngetty-+-bash
+ | |-bash
+ | `-bash
+ |
+.............
+
+
+If the login application forks pstree looks like:
+
+ninit-+-ngetty-+-login.fork---bash
+ | |-login.fork---bash
+ | `-login.fork---bash
+ |
+.............
+
+
+In avove examples I strated: ngetty 1 2 3 4 5 8 9 10 11 12
+and loged on tty1 tty2 tty3 terminals.
+
diff --git a/riemann.fmi.uni-sofia.bg/ngetty/style.css b/riemann.fmi.uni-sofia.bg/ngetty/style.css
new file mode 100644
index 0000000..51e1a52
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ngetty/style.css
@@ -0,0 +1,83 @@
+body {
+ background-color: #FFFFFF;
+ color: #000000;
+}
+
+.top {
+ border: 1px solid #000000;
+ background-color: #66FF66;
+ margin-bottom: 2ex;
+}
+
+.nav {
+ background-color: #FFFFFF;
+ list-style-type: none;
+ margin: 0 0 1px 0;
+ padding-left: 0;
+ float: right;
+ border-left: 1px solid #000000;
+}
+
+.nav li {
+ border-bottom: 1px solid #000000;
+ padding: 1px 2px;
+}
+
+.nav a {
+ text-decoration: none;
+}
+
+h1 {
+ margin: 0.5ex 0.5em;
+}
+
+h2 {
+ background-color: #9999FF;
+ border: 1px solid #000000;
+ padding: 0.25ex 0.5em;
+}
+
+.endtop {
+ clear: both;
+}
+
+.column {
+ float: left;
+ width: 48%;
+ max-width: 28em;
+ min-width: 22em;
+ margin-right: 1ex;
+}
+
+.block {
+ border: 1px solid #000000;
+ margin-bottom: 2ex;
+}
+
+.block h2 {
+ border-top: 0;
+ border-left: 0;
+ border-right: 0;
+ margin: 0;
+}
+
+.block p {
+ margin: 1ex 0.5em;
+}
+
+pre {
+ border: 1px dashed #000000;
+ background-color: #CCCC99;
+ margin-top: 1ex;
+ margin-bottom: 2ex;
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ padding: 2px;
+}
+
+.paypal {
+ float: left;
+ clear: left;
+ margin-right: 2px;
+ border: 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ninit/CHANGES b/riemann.fmi.uni-sofia.bg/ninit/CHANGES
new file mode 100644
index 0000000..f19e9d8
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/CHANGES
@@ -0,0 +1,129 @@
+0.14: 2010-01-19 00:27:01
+ added nkillall.8
+ gid is not default anymore. see ninitfeatures.h
+ uid supports 22:33:100:200:300
+ nkillall: \e escape
+ shutdown: set cron off
+ nkillall: signals with letters like nsvc
+ shutdown and nkillall: makes more sync(2), flag -q
+ added THANKS ;-)
+ added helpers: remove procfs; thanks to them snvc is smaller
+ nsvc options -onumber -unumber; option -E
+ Cron has option -C
+ /etc/ninit/.nsvc_help
+ nsvc, shutdown, reload uses variables NINIT_MEMORY and NINIT_HOME
+ nsvc: option -S
+ shutdown: option -s
+ manpages for all programs in /sbin ;-)
+ update manpages (Boris Grozev)
+ Makefile: man_txt
+ serdo.c: read only one file again
+ better sleep in open_inout.h
+ serdo.c improvments; buildin: killall5, simple echo
+ nsvc.c: -C+number
+ scripts/conf
+ ninit.8: NONROOT USAGE, using /sbin/init with ninit
+ ninit-scan: (Wayne Marshall)
+
+0.13.7: 2009-12-16 10:47:50
+ bootlog.c (flush_root)
+ 0.13.1.4 renamed to 0.13.2
+ service start 'end' (if it exixts; X_OK) after finishing
+ fixed a bug in shutdown.c (thx to Jan)
+ With flag -s ninit-shutdown don't start halt and reboot services
+ shutdown.c: improvements; flags -S -q
+ shutdown.c: removed flags -s -q; new flags -E -v -T
+ added nkillall
+ shutdown.c: options -m and -E work together
+ nkillall print escape like echo
+
+0.13.1: 2009-06-27 12:59:38
+ updated bootlog
+ Makefile logs 'make tests' in tests_log using boolog
+ fixing quotes in serdo
+
+0.13: 2009-01-10 18:11:42
+ it's possible to set parameters in wait. example: some_service:180:3
+ install-bin print help and string errors
+ better sync mode. maxsync is removed. echo 200 > sync
+ updated scripts/ninit_test.sh
+ comments (#) in depends, params, environ, wait, softlimit
+ install-bin (verbose mode)
+ nsvc -V
+ errmsg_put.c; buffer_*.c
+ setup, rsetup, sys-rsetup starts with args: $1=service $2=service_pid
+ EXTRACT_* trick (automatic create header files)
+ stuct process is 20 bytes on x86_64 (see struct_root.h)
+ changed BIFFER_INIT macro
+ utmp_io.c
+ Makefile: install_other
+ serdo is intslled only with: make install_other
+ t_write.h uses PIPE_BUF (thx Laurent Bercot)
+ nsvc.8 improvements
+ ninit_test.sh creates services in ./etc/ninit/
+ ninit-huge
+ added printf.c and ninit.spec
+ make FLAG_DEBUG=no
+ removed flag X_OK in some syscalls access.
+ better addprocess
+
+0.12.1: 2008-01-03 17:15:08
+ ninit-depends. convert directory to file (depends.dir -> depends)
+ removed unused stat.h in headers
+ updated serdo (static)
+ two environ vars: NINIT_HOME, INIT_HOME. (Thanks to Stamatis Mitrofanis)
+ ninit logo: /etc/ninit/.sync
+ install-bin uses chown32 instead chown on some systems
+ err.c and err_b.c uses the macros va_start and va_arg
+ fu.c (u &= 0xffffffff)
+
+0.12:
+ almost all arrays are moved in stack. small data and bss sections.
+ assembler functions (i386) for some DJB functions.
+ modifications in Makefile.
+ 100 Euro security guarantee.
+
+0.11.2:
+ ninit-reload accept agument -e (change environ) -E file_env
+ program ~/sys/update
+ service flags: pause, pause-wait
+ service flag cron: a:b[:c]
+ can contain many lines.
+ flag -K for nsvc.
+ pidfilehack --> ninit-pidfile.
+ make i386 -- build static daemons (don't use dietlibc)
+ Makefile is smaller and simpler
+ gcc-4.1.2 works now.
+ install-bin
+ stuct mem in initialized in the main program.
+
+0.11.1:
+ ninit-reload accepts args (-r3 -r5 -r33 ...)
+ ninit-inittab sets the variables NINIT_RUNLEVEL, INIT_VERSION
+ if /etc/minit/{in|out} FIFO's exist then make symbolic links.
+ new run flags: sys-rsetup, pidfile
+ if the service sysvinit exist, ninit create /dev/initctl
+ ninit-reload and nsvc checks for environ NINIT_HOME
+ nsvc -[drR] ALL - change all services.
+ Change service ALL with: nsvc -[drR] ops ALL
+ new program: ninit-sysvinit. configuration file: sysvinit-timeout
+ fimeout[:fork-mode]. example: echo 600:0 > sysvinit-timeout
+ ninit catch signal SIGPWR
+ new run flags: alarm, maxsync
+ nsvc output is different
+ shell script ninit-service
+ new program run-wait
+
+0.11:
+ Sun Jun 17 22:08:22 EEST 2007
+ I decided to rename all without changes.
+ The name ninit must be spelled nano-init.
+
+0.9.11:
+ rewritten by Nikola Vladov
+
+0.9.1:
+ fix embarassing typo in msvc (Gelu G. Lupas)
+
+0.9:
+ See minit CHANGES - http://www.fefe.de/minit
diff --git a/riemann.fmi.uni-sofia.bg/ninit/Donations.html b/riemann.fmi.uni-sofia.bg/ninit/Donations.html
new file mode 100644
index 0000000..9a91b01
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/Donations.html
@@ -0,0 +1,40 @@
+<html>
+<title>Donations</title>
+
+</body>
+<a href="/vladov/">Nikola Vladov</a>
+
+<h2>Donations for my software</h2>
+
+ My software are totally free
+ <a href="/COPYING.txt">GPL</a>
+ products. You can download and use
+ it at no charge. However, if you like it so much and want to donate a
+ few Euro's feel free to do so.
+
+<p>
+ If you are student or poor don't send money. Write me an e-mail and
+ describe there how you find my products - that's enough.
+
+<p>
+ Note that donations do not grant you any service support or product
+ improvements. The donations are only for the product as is.
+
+
+<h2>Donations of equipment</h2>
+
+I have also problems with hardware. My newest PC is 1998.
+If you have an old PC or printer they are welcome.
+I need to change my old monitor and printer soon.
+
+<p>
+<hr>
+ If you understand Bulgarian language read the song for
+ <a href=/song_money.html>money</a> before sending donation.
+<br>
+ Write me first <a href=/email.html>here</a> to arrange a donation.
+
+<p>
+Last modified: 24 February 2008
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/FAQ.html b/riemann.fmi.uni-sofia.bg/ninit/FAQ.html
new file mode 100644
index 0000000..0105374
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/FAQ.html
@@ -0,0 +1,361 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>FAQ for ninit</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>FAQ for ninit</h1>
+<div class="endtop"></div>
+</div>
+
+<!--
+Useful srings for copy/paste
+
+<table><td><a name=q2><font color=red>Q:</font></a><td><b>
+</td><tr><td><td><b>
+</b></td></table>
+-->
+
+<ul>
+<li><a href="#q1">Why another init?</a></li>
+<li><a href="#q2">What's the difference between minit and ninit?</a></li>
+<li><a href="#q3">Your pidfilehack doesn't work with minit.</a></li>
+<li><a href="#q4">Why do you split ninit in separate programs - ninit and helpers?</a></li>
+<li><a href="#q5">Is there web interface for creating services?</a></li>
+<li><a href="#q6">How about security? Is ninit reliable?</a></li>
+<li><a href="#q7">Why documentation is in a separate file?</a></li>
+<!--
+ <li><a href="#q8">There is a program env in package.
+ Why it is not installed?</a></li>
+-->
+<li><a href="#q9">Your documentation is bad!</a></li>
+<!--
+ <li><a href="#q10">When I try to compile I receive:
+ "misc/tryprocess.c:2:20: error: unistd.h: No such file
+ or directory"</a></li>
+-->
+<li><a href="#q10a">Should I start the service sysvinit at boot time?</a></li>
+<li><a href="#q11">Halt and reboot doesn't work clean with ninit.</a></li>
+<li><a href="#q12">Which are the new files in <tt>ninit</tt>
+which are missing in <tt>minit</tt>?</a></li>
+<li><a href="#q13">Why my ninit uses more than 36k RAM?</a></li>
+<li><a href="#q14">Why serdo doesn't start script in current dir?</a></li>
+<li><a href="#q15">How to see which version I use?</a></li>
+<li><a href="#qlast">How can I ask a new question?</a></li>
+
+
+<!--
+<li><a href="#q1"> </a></li>
+11 - counter now.
+-->
+</ul>
+
+
+
+<table><td><a name=q1><font color=red>Q:</font></a></a><td>
+<b>Why another init?</b></td>
+<tr><td><td>
+ Hm-mmm!
+ I offer <a href=guarantee.html>security</a> guarantee.
+ On my boxes ninit uses minimal resources - only 8K RAM.
+ I was looking for the name and my friend
+ Pencho Marinov suggested me: "Ninit is a good name
+ since it's small. The people will spell it <b>nano</b>-init!"
+</td>
+</table>
+
+
+<table><td><a name=q2><font color=red>Q:</font></a><td><b>
+What's the difference between
+<a href=http://www.fefe.de/minit/>minit</a> and ninit?
+</b></td><tr><td><td>
+ ninit is a fork from minit. On user level ninit support all
+ features of minit. There is one difference. Ninit doesn't
+ support unnamed pipes between a service and a log-service.
+ It does logging with named pipes. I decided to remove
+ unnamed pipes. This saves code.
+<p>
+ Ninit create the links and named pipes for log services alone.
+ There is one restriction only. The service dir must be writable.
+ One have to start such services after mount, or create links
+ manually before starting the service. Example
+<pre>
+ mkfifo -m 600 log/in
+ ln -s log/in out
+</pre>
+</td></table>
+
+
+<table><td><a name=q3><font color=red>Q:</font></a><td><b>
+Your pidfilehack doesn't work with
+<a href=http://www.fefe.de/minit/>minit</a>.
+</b></td><tr><td><td>
+In recent versions I decided to rename pidfilehack to
+<a href=man/pidfile.man>ninit-pidfile</a>.
+
+With ninit you can prepare a service and if it forks and
+writes the PID
+in some file then type in the service directory:
+<pre>
+ echo /path/to/deamon.pidfile > pidfile
+</pre>
+<!--
+If you have running minit do before reboot
+<pre>
+ OAcd /etc/ninit && rm -f in out
+ ln /etc/minit/in in
+ ln /etc/minit/out out
+</pre>
+ Above checks are included in version 0.12-pre.
+ See misc/update_pipes.sh there.
+<p>
+ The problem is: my pidfilehack and nsvc have hard-coded
+ /etc/ninit/{in|out} pipes. After above links are made
+ ninit's pidfilehack will work with minit also.
+-->
+</td></table>
+
+<table><td><a name=q4><font color=red>Q:</font></a><td><b>
+Why do you split ninit in separate programs -- ninit and helpers?
+</b></td><tr><td><td>
+I have to write a separate page for this question.
+</td></table>
+
+
+<table><td><a name=q5><font color=red>Q:</font></a><td><b>
+Is there web interface for creating services?
+</b></td><tr><td><td>
+Not yet. Who do this?
+</td></table>
+
+
+<table><td><a name=q6><font color=red>Q:</font></a><td><b>
+How about security? Is ninit reliable?
+</b></td><tr><td><td>
+ I wrote all following Daniel
+ <a href=http://cr.yp.to>Bernstein</a>
+ and Felix von
+ <a href=http://www.fefe.de/>Leitner</a>.
+ I'm not so great like them, bath I try to
+ write similar code to their.
+
+ Since I believe that the programs are secure ninit comes
+ with a <a href=guarantee.html>guarantee</a>.
+</td></table>
+
+
+<table><td><a name=q7><font color=red>Q:</font></a><td><b>
+Why documentation is in a separate file?
+</b></td><tr><td><td>
+ So I can change and keep it up to date easy.
+ You can also install
+ <a href=ninit-html.tar.bz2>HTML-docs</a>
+ on your box. They are public.
+</td></table>
+
+
+<!--
+<table><td><a name=q8><font color=red>Q:</font></a><td><b>
+There is a program env in package. Why it is not installed?
+</b></td><tr><td><td>
+ It does the same as /bin/env from core utils. My is small and
+ works with less RAM on my box. If you want use it. If you want
+ to change the environ of some service use the file
+ service/environ or this env.
+<pre>
+ mkdir /etc/ninit/bin
+ cp ./env /etc/ninit/bin
+</pre>
+</td></table>
+-->
+
+<table><td><a name=q9><font color=red>Q:</font></a><td><b>
+Your documentation is bad!
+</b></td><tr><td><td>
+ I know. May be you will help to make it better.
+ See also
+ <a href=man/README>this</a>.
+</td></table>
+
+<!--
+<table><td><a name=q10><font color=red>Q:</font></a><td><b>
+When I try to compile I receive: <br>"misc/tryprocess.c:2:20: error:
+unistd.h: No such file or directory"</b></td><tr><td><td>
+ You haven't install headers files of C libraries.
+ Try first to build next program:
+<pre>
+ #include &lt;unistd.h&gt;
+ int main() { write(1, "I like C\n", 9); return 0; }
+</pre>
+</td></table>
+-->
+
+<table><td><a name=q10a><font color=red>Q:</font></a><td><b>
+Should I start the service sysvinit at boot time?
+</b></td><tr><td><td>
+No! Five minutes after boot time ninit try to start
+this service. If such service exists it open the fifo
+<tt>/dev/initctl</tt>. If there is any activity
+on the fifo it invokes the emulator
+<a href=man/sysvinit.man>ninit-sysvinit</a>.
+If you don't plan to start the commands
+<tt>halt, reboot, shutdown, telinit</tt>, then you can do:
+<pre>
+ cd /etc/ninit
+ mv sysvinit sysvinit_
+ nsvc -o update
+</pre>
+Some scripts in <tt>/etc/init.d/</tt> uses the above sysvinit commands.
+</td></table>
+
+
+<table><td><a name=q11><font color=red>Q:</font></a><td><b>
+Halt and reboot doesn't work clean with ninit.
+</b></td><tr><td><td>
+ How to stop the system running ninit see
+ <a href=ninit.html#HaltReboot>here</a>.
+ If you have a servive <b>sysvinit</b> then
+ all must be fine. See also
+ <a href=man/sysvinit.man>ninit-sysvinit</a>.
+
+<p>
+ If you have again problems with
+ <tt>nsvc -o {halt|reboot|_l0|_l6}</tt>
+ the problem is probably
+ <tt>init.d/halt</tt> script.
+ For example on FEDORA last script ends with:
+<pre>
+ [ -n "$kexec_command" ] && $kexec_command -e >&amp; /dev/null
+
+ HALTARGS="-i -d"
+ [ -f /poweroff -o ! -f /halt ] && HALTARGS="$HALTARGS -p"
+
+ exec $command $HALTARGS
+</pre>
+
+You have to include the following lines before the text above.
+<pre>
+ if [ -n "$NINIT_RUNLEVEL" ] ; then
+ # use ninit-reboot instead of halt|reboot|poweroff
+ NINIT_HALT=HALT
+ [ -f /poweroff -o ! -f /halt ] && NINIT_HALT=POWER_OFF
+ [ "$command" = "/sbin/reboot" ] && NINIT_HALT=RESTART
+ exec /sbin/ninit-reboot $NINIT_HALT
+ fi
+</pre>
+
+See also the manpages halt(8), poweroff(8), reboot(8),
+<a href=man/reboot.man>ninit-reboot</a> and
+<a href=man/sysvinit.man>ninit-sysvinit</a>.
+The commands
+<tt>halt, reboot, poweroff</tt> belongs to the
+<a href=ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/>sysvinit</a>
+package.
+
+<!--
+<p>
+After version ninit-0.11 the converter
+<a href=man/inittab.man>ninit-inittab</a> sets also
+the <a href="files.html#Environ">environ</a> variable
+NINIT_RUNLEVEL.
+-->
+</td></table>
+
+
+<table><td><a name=q12><font color=red>Q:</font></a><td><b>
+Which are the new files in <tt>ninit</tt>
+which are missing in <tt>minit</tt>?
+</b></td><tr><td><td>
+They are: &nbsp;
+<a href="files.html#Environ">environ</a>,
+<a href="files.html#Wait">wait</a>,
+<a href="files.html#Maxwait">maixwait</a>,
+<a href="files.html#Softlimit">softlimit</a>,
+<a href="files.html#Sleep">sleep</a>,
+<a href="files.html#End">end</a>,
+<a href="files.html#Uid">uid</a>,
+<a href="files.html#Setup">setup</a>,
+<a href="files.html#Rsetup">rsetup</a>,
+<a href="files.html#Sys-rsetup">sys-rsetup</a>,
+<a href="files.html#Pidfile">pidfile</a>,
+<a href="files.html#Alarm">alarm</a>,
+<a href="files.html#Pause">pause</a>,
+<a href="files.html#Pause-wait">pause-wait</a>,
+<a href="files.html#Cron">cron</a>.
+
+Ninit start services using the helper programs
+from <tt>/etc/ninit/<a href=man/run.html>sys/</a></tt>
+dierctory. It aslo have
+<a href=man/sysvinit.man>sysvinit</a> emulator.
+</td></table>
+
+
+<table><td><a name=q13><font color=red>Q:</font></a><td><b>
+Why my ninit uses more than 36k RAM?
+</b></td><tr><td><td>
+ You have build ninit with glibc. Read
+<a href=install.html>here</a> how to make small static binaries.
+</td></table>
+
+
+<table><td><a name=q14><font color=red>Q:</font></a><td><b>
+Why serdo doesn't start script in current dir?
+</b></td><tr><td><td>
+ See my comments in serdo.c source after main. If you still
+ want uncomment one line there to support this feature.
+ It's not a <b>security whole</b>, but I personally find
+ it <b>too dangerous</b>.
+</td></table>
+
+
+
+<table><td><a name=q15><font color=red>Q:</font></a><td><b>
+How to see which version I use?
+</b></td><tr><td><td>
+ In the recent versions it's coded in the file
+ <tt>/etc/init/.sync</tt><br>
+ <tt>cat /etc/ninit/.sync</tt>
+</td></table>
+
+
+
+<table><td><a name=qlast><font color=red>Q:</font></a><td><b>
+How can I ask a new question?
+</b></td><tr><td><td>
+ Read first this file and documentation carefully.
+ Look also the package
+ <a href=README>README</a>.
+<br>
+There is a
+&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#32;&#108;&#105;&#115;&#116;
+for ninit. To &#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#44;
+send an empty &#109;&#101;&#115;&#115;&#97;&#103;&#101;
+to <font size=+1><br> <a href=
+&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+>
+&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+</a></font>.
+
+Some delay is posstible due to
+<a href=http://en.wikipedia.org/wiki/Greylisting>
+&#103;&#114;&#101;&#121;&#108;&#105;&#115;&#116;&#105;&#110;&#103;</a>.
+
+Send me private &#101;&#109;&#97;&#105;&#108;&#115;
+using <a href=&#47;&#101;&#109;&#97;&#105;&#108;&#46;&#104;&#116;&#109;&#108;>qform</a>.
+</td></table>
+
+<p>
+Last updated: 15 Jan 2010
+
+
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+
+Gratuitious blank lines added so that FAQ.html#link works.
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/LK/Abstract b/riemann.fmi.uni-sofia.bg/ninit/LK/Abstract
new file mode 100644
index 0000000..644e6ec
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/LK/Abstract
@@ -0,0 +1,57 @@
+Ninit is a very small program written as alternative init for
+UNIX-like OS. It is a fork from minit.
+
+SysVinit control the boot process and running daemons little. It set
+default runlevel and start only gettys (ttyX are used rarely). The
+hard work is done by hundreds of shell-scripts in /etc/rc.d/. Maybe
+the right name of the program is "shell-init". Since there are
+special tools to manage init-scripts all seems perfect.
+
+Shell scripts are executed serially and as a result the boot process
+is slowly. Maybe the big problems are lacking of dependences and
+monitoring of the daemons. Who restart syslogd/sshd if they exit?
+Which PID has sshd? DJB have a package daemontools which solves most
+of the problems of init. Runit is another init which is based on
+deamontools.
+
+Ninit try to solve above problems. If compiled with dietlic
+/sbin/ninit is only 4K and uses 16K memory. The program is mudular
+like qmail. By needs ninit invokes some helper program to make a
+task. All helpers uses approximately the same resources like ninit.
+Only PID 1 is long-running daemon.
+
+The main daemon start/stop/restart and monitor different programs.
+Each program is a service which has a subdir in /etc/ninit/. The
+configuration of a service are different files like qmail (not like
+/etc/inittab). It stores all information for services in his memory.
+
+Some of the benefits of ninit are:
+ start services and take dependencies (soft and hard) into account.
+ (re)start services (parallel).
+ start services in sync mode (serial).
+ wait services to finish (parallel).
+ boot on a completely read-only system (don't use /proc/ FS).
+ can start services without using any bash/sh interpreter!
+ easy stdin/stdout/stderr redirection to other service (log) or file.
+ does not use malloc/mmap/sbr (does all in stack space).
+ easy and reliable logging system (uses multilog or svlogd).
+ easy to restart/stop a service.
+ easy to get the service PID.
+ easy to change the service mode (respawn or not).
+ easy to list all services.
+ easy to add/remove a service.
+ easy to send signals to service.
+ easy to change UID/GID and environ of a service.
+ built-in softlimit (like in daemontools).
+ built-in simple cron (can restart service like cron).
+ automatic converter: /etc/inttab to services /etc/ninit/.
+ SysVinit emulator (ninit can listen on /dev/initctl).
+ small code size (the main daemon is 336 lines).
+ security guarantee (100 Euro).
+
+There is a companion utility nsvc to comunicate with ninit over two
+fifos. Ninit is compatible with minit and has many other features!
+An ordinay user can use ninit to start/monitor his own services. It
+have to set the variable NINIT_HOME and prepare a service directory.
+
+In my opinion ninit is small, reliable, ready for production use.
diff --git a/riemann.fmi.uni-sofia.bg/ninit/LK/Author b/riemann.fmi.uni-sofia.bg/ninit/LK/Author
new file mode 100644
index 0000000..20d32d4
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/LK/Author
@@ -0,0 +1,14 @@
+I am working on Sofia University, Bulgaria. All software I write is
+under GPL license or "Public Domain". I like embedded systems and try
+to use dietlibc and libowfat libraries. All is written to be secure
+and reliable as possible. Last year I made as experience an
+introduction to C and Linux based on dietlibc and DJB like software.
+The students are excited and accepted the small library very well.
+Some of them began to use it already. I use UNIX/Linux since 1992
+as a student in Stuttgart.
+
+I am the author of different packages and patches. Some of them are:
+ninit, ngetty, xinit, ucspi-loggers, hash-auth, lzmatools, nlogin,
+popmaildir, malloc, exacttime (ntp client/server), v7_sh (current port
+of original 1978 Bourne shell), qq-filters (qmail anti SPAM filters).
+More important patches: qmail+djbdns, djbdns-dumpcache.
diff --git a/riemann.fmi.uni-sofia.bg/ninit/LK/Commment b/riemann.fmi.uni-sofia.bg/ninit/LK/Commment
new file mode 100644
index 0000000..3259a78
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/LK/Commment
@@ -0,0 +1,15 @@
+I work in Sofia University, Bulgaria. If you accept my talk my
+employer will not cover the travel ticket. It is approx 200 Euro. If
+you can cover it (also partially), it is welcome. If you do not have
+possibility to support my travel cost it is not a big problem. Then I
+will pay with my private money and come to Dresden.
+Resume: please, cover my travel ticket only if you have possibilities!
+
+I uploaded all files from this html-form on:
+http://riemann.fmi.uni-sofia.bg/ninit/LK/
+
+If my abstract is too large, please remove the paragraph with:
+Some of the benefits of ninit are:
+ start services and take dependencies (soft and hard) into account.
+ ...
+
diff --git a/riemann.fmi.uni-sofia.bg/ninit/LK/index.html b/riemann.fmi.uni-sofia.bg/ninit/LK/index.html
new file mode 100644
index 0000000..20ad06f
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/LK/index.html
@@ -0,0 +1,13 @@
+<html>
+<head><title>Index</title></head>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<h2>Index</h2>
+<font>
+Parent <a href=../>directory</a>
+<pre>mode size last-change name<hr>
+-r-- 2.8k Jun 1 07:59 <a href="Abstract">Abstract</a>
+-r-- 835 Aug 26 18:29 <a href="Author">Author</a>
+-r-- 666 Aug 26 18:29 <a href="Commment">Commment</a>
+
+index genereted on <b>Jun 1 2010 08:00 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/README b/riemann.fmi.uni-sofia.bg/ninit/README
new file mode 100644
index 0000000..b48ee4b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/README
@@ -0,0 +1,213 @@
+See also: http://riemann.fmi.uni-sofia.bg/ninit/
+
+Each service gets its own directory under /etc/ninit (change this in the
+source, it's a #define right at the start of ninitfeatures.h).
+
+
+Each service directory can contain the following files/symlinks:
+
+ depends
+
+ a plain text file containing a service name per line.
+ Example: /etc/ninit/sshd/depends could contain "network".
+ Each of these services will be started before this service is
+ started. If you need to wait for static initializations to
+ complete, use the sync flag. See also the wait flag below.
+
+ run
+
+ a symbolic link to the program name. No hard link, because argv[0]
+ for the programs is created by extracting the part after the last
+ slash in the contents of the symbolic link.
+ Example: "/usr/bin/sshd" would be run with argv[0]="sshd".
+
+ end
+
+ similar to run. After the service finish "end" will be executed.
+ The helper does not set environ, softlimit, uid/gid restrictions.
+ You can put there for example:
+ #!/bin/sh
+ exec /bin/nsvc -o service_name
+ Use this option instead of sync or wait mode. Let for example
+ services B,C,D must be started after A finish. There are two
+ possible solutions:
+ Bad: start A in sync mode
+ Good: start A i normal mode and put in "end"
+ #!/bin/sh
+ exec /bin/nsvc -o B C D
+
+ params
+
+ a plain text file containing command line parameters for the
+ service, one parameter per line. No shell expansion is done. If
+ you need shell expansion, have run point to a shell script instead
+ of the real daemon. Note: Have the shell script exec the daemon
+ instead of simply running it to save system resources.
+
+ environ
+
+ similar to params. run appends contents of this file to the environ.
+ If the first line has zero length, unset all environ.
+ If a line does not have '=' (HOME), unset this variable.
+
+ wait
+
+ similar to params. /etc/inint/run waits for services included in
+ this file to finish and after that start a current service.
+ Include wait services also in depends. This is different from sync.
+ Let a service B must be started after a service A finish.
+ One can sync A. This will block all other services.
+ In this case it's better to use wait instead of sync.
+ It's possible to set wait parameters (see maxwait) at the end of
+ each entry. Example: some_service:180:3
+
+ maxwait
+
+ a plain text file containing the values n1:n2. Wait no more
+ than n1 sec a service for finish. See wait. Default is 600 sec.
+ The value n1=0 means -- wait until the service finish.
+
+
+ softlimit
+
+ see DJB program softlimit. Similar to params. Lines
+ with the same options as softlimit (skip leading '-'). Example:
+ echo m300000 > softlimit; echo o30 >> softlimit
+
+ respawn
+
+ touch this file to make ninit respawn the process when it dies.
+ This should be touched for getty and network servers.
+
+ sync
+
+ touch this file to make ninit wait until the service ends. sync is
+ mutually exclusive with respawn. This is meant for static
+ initializations like "ifconfig". See also wait.
+ If sync contains a nonzero number n ninit will wait max n sec
+ the service to finish. If it does not ends until n secs then
+ ninit continues to work. Example: echo 600 > sync
+
+ log
+
+ if this directory exists, it is taken as service and ninit creates
+ a named pipe log/in and soft link of log/in to out. If the log
+ service can not be started, this service will block if it writes
+ to stdout.
+
+ nice
+
+ a plain text file containing the value to add to the nice level
+ via the nice system call.
+
+ sleep
+
+ a plain text file containing the value n. sleep n secs after fork
+ before running child.
+
+ in
+
+ this file(named pipe) is used for stdin.
+
+ out
+
+ this file(named pipe) is used for stdout and stderr.
+ e.g. a symlink to /dev/null
+
+ gid
+
+ a plain text file containing a number.
+ Exec the program with this GID. Example echo -n 234 > gid
+ To activate this feature edit the file ninitfeatures.h
+ and install the package again.
+
+ uid
+
+ exec the program with this UID. It can contain also UID:GID
+ It is possible to write here also the supplementary groups.
+ For example echo 23:99:240:320:100 > uid start the service with:
+ UID=23, GID=99, GROUPS=99,240,320,100.
+
+ setup
+
+ if this file exist it is started just before run in sync mode.
+ If uid/gid or softlimit exist they are applied first and
+ after that setup is executed.
+
+ rsetup
+
+ similar to setup. It is executed before setup as root and
+ not softlimit, uid/gid, in/out restrictions. If you
+ want to create/modify params, wait, depends... see sys-rsetup flag.
+
+ sys-rsetup
+
+ similar to setup. It is executed first as root.
+ It can be used to create/modify params, wait, depends...
+
+ pidfile
+
+ easy method to setup services which run in background.
+ Prepare them as ordinary services and write the name of the pidfile.
+ Don't use link here!
+ Example: echo -n /var/run/gpm.pid > pidfile
+
+ alarm
+
+ a plain text file containing a number n.
+ Do alarm(n) before starting the child.
+
+ pause
+
+ if this file exist run selfkills with SIGSTOP signal.
+
+ pause-wait
+
+ if this file exist run-wait selfkills with SIGSTOP signal.
+
+ cron
+
+ a plain text file containing lines with numbers a:b[:c]
+ for each line run wait find a solution of
+ cron = 60 * (a*x+b) > now (x is integer)
+ The smallest cron is next cron-start for this service.
+ The number a=10080 (24*60*7) is special. For example 10080:25
+ means: Sunday 00:25:00 UTC
+
+ninit will try to run the command line arguments as services. The
+kernel passes its arguments to init. That means you can for example
+have a service /etc/ninit/sos-shell that starts a /bin/sh and then use
+LILO to boot "bzImage sos-shell". ninit will then run that service.
+If none of the services worked (or none were given), ninit will spawn
+the service "default". The normal way to configure ninit is to have
+default be an empty service and just list all the services you want
+ninit to start at boot time in default/depends.
+
+Other special services (besides "default") are "ctrlaltdel" and "kbreq".
+ctrlaltdel will be run when the console user presses ctrl-alt-del and is
+meant to reboot the computer. kbreq is the keyboard request, which
+can be mapped using loadkeys. On my box, it is on Alt+Arrow-Up. I use
+it to shut down the computer.
+
+--------------------------
+Memory allocation in NINIT. ninit uses only alloca for RAM.
+
+One service = 21 + strlen(service_name). Example getty/1 is 28 bytes.
+If you need to load more than 50 services then use at boot process
+something like:
+ /sbin/ninit -M3200
+
+after reload/reboot ninit will work with 3200 bytes buffer.
+default buffer is 1536. Good for 50-60 services.
+If someone uses more than 50 services let me know.
+
+--------------------------
+After building a new ninit test/install it with:
+ ninit-reload -v -u /path/to/new/ninit [-M2000]
+ cp /path/to/new/ninit /sbin/ninit
+ ninit-reload -v -u /sbin/ninit [argv1 argv2 ...]
+some of argvs can be -M2000 or -M3200 ...
+
+There is no need of reboot! Dump memory buffer with:
+ ninit-reload -m > /tmp/ninit.mem
+ less /tmp/ninit.mem
diff --git a/riemann.fmi.uni-sofia.bg/ninit/all.html b/riemann.fmi.uni-sofia.bg/ninit/all.html
new file mode 100644
index 0000000..57304d7
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/all.html
@@ -0,0 +1,34 @@
+<html>
+<title>Index of /ninit/</title>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<b><font size=+2>Index of /ninit/</font></b>
+<br>sorted by
+<a href=all.html>name</a>
+<a href=all_time.html>time</a>
+<font>
+<pre>mode size last-change name<hr>
+-r-- 4.3k Jan 19 00:30 <a href="CHANGES">CHANGES</a>
+lrwx Feb 9 2008 <a href="Donations.html">Donations.html</a> -&gt; =/vladov/donations.html
+-r-- 11k Jan 15 18:38 <a href="FAQ.html">FAQ.html</a>
+dr-x Jun 1 08:00 <a href="LK/index.html">LK/</a>
+-r-- 7.2k Jan 16 19:53 <a href="README">README</a>
+-r-- 1.5k Jul 20 2007 <a href="boot.html">boot.html</a>
+-r-- 13k Jun 1 17:55 <a href="files.html">files.html</a>
+-r-- 1.4k Dec 2 2007 <a href="guarantee.html">guarantee.html</a>
+lrwx Jul 18 2007 <a href="index.html">index.html</a> -&gt; ninit.html
+-r-- 2.8k Jan 17 12:08 <a href="install.html">install.html</a>
+-r-- 1.0k Jan 14 09:40 <a href="links.html">links.html</a>
+-r-- 2.3k Jan 20 14:49 <a href="ls-R.txt">ls-R.txt</a>
+dr-x Feb 18 15:07 <a href="man/index.html">man/</a>
+lrwx Jul 20 2007 <a href="ngetty.html">ngetty.html</a> -&gt; =/ngetty/index.html
+-r-- 70k Jan 19 00:30 <a href="ninit-0.14.tar.bz2">ninit-0.14.tar.bz2</a>
+-r-- 53 Jan 19 00:30 <a href="ninit-0.14.tar.bz2.md5">ninit-0.14.tar.bz2.md5</a>
+-r-- 7.8k Jan 20 14:49 <a href="ninit-data.tar.gz">ninit-data.tar.gz</a>
+-r-- 26k Jun 1 17:53 <a href="ninit-html.tar.bz2">ninit-html.tar.bz2</a>
+dr-x Jan 16 20:01 <a href="old/index.html">old/</a>
+dr-x Jan 15 19:26 <a href="packages/index.html">packages/</a>
+-r-- 6.1k Jan 15 18:30 <a href="subdirs.html">subdirs.html</a>
+dr-x May 25 12:57 <a href="test/index.html">test/</a>
+
+index genereted on <b>Jun 1 2010 17:56 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/all_time.html b/riemann.fmi.uni-sofia.bg/ninit/all_time.html
new file mode 100644
index 0000000..1f3c51a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/all_time.html
@@ -0,0 +1,34 @@
+<html>
+<title>Index of /ninit/</title>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<b><font size=+2>Index of /ninit/</font></b>
+<br>sorted by
+<a href=all.html>name</a>
+<a href=all_time.html>time</a>
+<font>
+<pre>mode size last-change name<hr>
+-r-- 13k Jun 1 17:55 <a href="files.html">files.html</a>
+-r-- 26k Jun 1 17:53 <a href="ninit-html.tar.bz2">ninit-html.tar.bz2</a>
+dr-x Jun 1 08:00 <a href="LK/index.html">LK/</a>
+dr-x May 25 12:57 <a href="test/index.html">test/</a>
+dr-x Feb 18 15:07 <a href="man/index.html">man/</a>
+-r-- 2.3k Jan 20 14:49 <a href="ls-R.txt">ls-R.txt</a>
+-r-- 7.8k Jan 20 14:49 <a href="ninit-data.tar.gz">ninit-data.tar.gz</a>
+-r-- 4.3k Jan 19 00:30 <a href="CHANGES">CHANGES</a>
+-r-- 53 Jan 19 00:30 <a href="ninit-0.14.tar.bz2.md5">ninit-0.14.tar.bz2.md5</a>
+-r-- 70k Jan 19 00:30 <a href="ninit-0.14.tar.bz2">ninit-0.14.tar.bz2</a>
+-r-- 2.8k Jan 17 12:08 <a href="install.html">install.html</a>
+dr-x Jan 16 20:01 <a href="old/index.html">old/</a>
+-r-- 7.2k Jan 16 19:53 <a href="README">README</a>
+dr-x Jan 15 19:26 <a href="packages/index.html">packages/</a>
+-r-- 11k Jan 15 18:38 <a href="FAQ.html">FAQ.html</a>
+-r-- 6.1k Jan 15 18:30 <a href="subdirs.html">subdirs.html</a>
+-r-- 1.0k Jan 14 09:40 <a href="links.html">links.html</a>
+lrwx Feb 9 2008 <a href="Donations.html">Donations.html</a> -&gt; =/vladov/donations.html
+-r-- 1.4k Dec 2 2007 <a href="guarantee.html">guarantee.html</a>
+-r-- 1.5k Jul 20 2007 <a href="boot.html">boot.html</a>
+lrwx Jul 20 2007 <a href="ngetty.html">ngetty.html</a> -&gt; =/ngetty/index.html
+lrwx Jul 18 2007 <a href="index.html">index.html</a> -&gt; ninit.html
+
+index genereted on <b>Jun 1 2010 17:56 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/boot.html b/riemann.fmi.uni-sofia.bg/ninit/boot.html
new file mode 100644
index 0000000..e1d4d3a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/boot.html
@@ -0,0 +1,75 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>boot ninit</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>Replacing init</h1>
+<div class="endtop"></div>
+</div>
+
+This file is copy/edit from
+<pre>
+http://www.fbunet.de/minit.shtml
+</pre>
+
+
+<p>
+If you have set up all needed services, you can try to boot your
+system with ninit the first time.
+<p>
+You should _not_ replace <tt>/sbin/init</tt>
+with <tt>/sbin/ninit</tt> because if your system doesn't boot correctly,
+you probably won't be able to change back to init.
+
+<p>
+That's why you
+should create an own entry in
+<tt>/etc/lilo.conf</tt> (or <tt>/etc/grub.conf</tt>) that
+is identical with your standard entry except one point: You pass
+<tt>init=/sbin/ninit</tt> to the kernel.
+
+My <tt>/etc/lilo.conf</tt> looks like:
+
+<pre>
+prompt
+timeout=50
+default=ninit
+boot=/dev/hda
+map=/boot/map
+lba32
+compact
+
+image=/boot/vmlinuz-2.4.17
+ label=linux
+ read-only
+ root=/dev/hda2
+
+image=/boot/vmlinuz-2.4.17
+ label=ninit
+ read-only
+ root=/dev/hda2
+ append="init=/sbin/ninit"
+</pre>
+After that exec <tt>/sbin/lilo</tt> and reboot the box.
+
+<p>
+The same for grub:
+</p>
+<pre>
+default=0
+timeout=10
+title Linux (2.4.17)
+ root (hd1,0)
+ kernel /vmlinuz-2.4.17 ro root=/dev/hda2
+title Linux (ninit) (2.4.17)
+ root (hd1,0)
+ kernel /vmlinuz-2.4.17 ro root=/dev/hda2 init=/sbin/ninit
+</pre>
+I don't use grub. Don't ask me quetions about grub!
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/files.html b/riemann.fmi.uni-sofia.bg/ninit/files.html
new file mode 100644
index 0000000..b819cf6
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/files.html
@@ -0,0 +1,500 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>files</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+<div class="endtop"></div>
+</div>
+
+
+<h2>/etc/ninit/ global special files</h2>
+<table>
+<td><ul><li><a href=#Gin>~/in</a><li></ul>
+<td><ul><li><a href=#Gin>~/out</a><li></ul>
+<td><ul><li><a href=#Grun>~/sys/</a><li></ul>
+<td><ul><li><a href=#Gbin>~/bin/</a><li></ul>
+</td>
+</table>
+
+<h2>Special files in a service directory</h2>
+
+
+<table>
+<td>
+<ul>
+<li><a href="#In">in</a></li>
+<li><a href="#Out">out</a></li>
+<li><a href="#Run">run</a></li>
+<li><a href="#Log">log/</a></li>
+</ul>
+
+<td>
+<ul>
+<li><a href="#Depends">depends</a></li>
+<li><a href="#Params">params</a></li>
+<li><a href="#Respawn">respawn</a></li>
+<li><a href="#Sync">sync</a></li>
+</ul>
+
+
+<td>
+<ul>
+<li><a href="#Environ">environ</a></li>
+<li><a href="#Softlimit">softlimit</a></li>
+<li><a href="#End">end</a></li>
+<li><a href="#Uid">uid</a></li>
+</ul>
+
+<td>
+<ul>
+<!-- <li><a href="#Gid">gid</a></li> -->
+<li><a href="#Nice">nice</a></li>
+<li><a href="#Sleep">sleep</a></li>
+<li><a href="#Alarm">alarm</a></li>
+<li><a href="#Pidfile">pidfile</a></li>
+<td>
+
+
+<td>
+<ul>
+<li><a href="#Wait">wait</a></li>
+<li><a href="#Maxwait">maixwait</a></li>
+<li><a href="#Pause">pause</a></li>
+<li><a href="#Pause">pause-wait</a></li>
+</ul>
+</td>
+
+<td>
+<ul>
+<li><a href="#Cron">cron</a></li>
+<li><a href="#Setup">setup</a></li>
+<li><a href="#Rsetup">rsetup</a></li>
+<li><a href="#Sys-rsetup">sys-rsetup</a></li>
+</ul>
+</td>
+</table>
+
+
+
+<h2><a name=Gin>~/{in|out}</a></h2>
+<tt>in</tt> and <tt>out</tt>
+are the FIFOs ninit communicates with its helper programs.
+Those have to exist before ninit is started and
+they should be owned by root and have mode 600.
+<pre>
+~$ ls -l /etc/ninit/in /etc/ninit/out
+prw------- 1 root root 0 Jan 15 11:14 /etc/ninit/in|
+prw------- 1 root root 0 Jan 15 11:14 /etc/ninit/out|
+</pre>
+
+<h2><a name=Grun>~/sys/</a></h2>
+This is the default home for ninit helpers.
+<pre>
+~$ ls -lf /etc/ninit/sys
+-rwxr-xr-x 1 root root 2340 Jan 12 22:28 procfs*
+-rwxr-xr-x 1 root root 1688 Jan 12 22:28 remove*
+-rwxr-xr-x 1 root root 3796 Jan 12 22:28 run*
+-rwxr-xr-x 1 root root 4428 Jan 12 22:28 run-wait*
+-rwxr-xr-x 1 root root 1924 Jan 12 22:28 update*
+</pre>
+The most important program here is <b>run</b>. It start a service
+checking different files in the service subdirectory.
+Never start these files!
+Please,
+<b><font color=magenta>don't remove/rename/replace</font></b>
+the files here, unless you know what are you doing!
+They are helpers for
+<b>ninit</b>
+and
+<b>nsvc</b>.
+
+<!--
+Helper program - it's ninit's right-hand.
+<font size=+1 color=red>Never remove it !!!</font>
+You can replace it with a test version using:
+<pre>
+ install /path/to/run.test /etc/ninit/run
+</pre>
+-->
+
+<h2><a name=Gbin>~/bin/</a></h2>
+Here I put some programs which are useful for something.
+Ninit daemons don't need to start any of them.
+If you dislike this directory, simply
+<b><font color=magenta>remove</font></b> it!
+
+One <b>good idea</b>
+is to make a symbolic link:
+<pre>
+ln -s /bin/dash /etc/ninit/bin/sh
+</pre>
+Then in all shell scripts in /etc/ninit/ three use on the first
+line
+<pre>
+#!/etc/ninit/bin/sh
+...
+</pre>
+You can replace also <b>dash</b> with <b>bash</b> or <b>sh</b>
+above.
+Since your scripts in <b>/etc/ninit/</b> are simple (I suppose),
+any fast, small, non-interactive shell is welcome.
+One such candidate is the original Steve Bourne
+<b>sh</b> from 1978.
+A new port is available
+<a href=/sh/>here</a>.
+Install it under the name <b>bsh</b> in /bin/.
+I recommend to build it using
+<a href=http://www.fefe.de/dietlibc/>dietlibc</a>.
+
+<p> Why I suggest the symbolic link above? I suppose that
+in the future someone can write a better shell. Then
+we will update only the link - there is no need to edit each
+script.
+
+<p>
+<hr>
+<p>
+
+Below all files <tt>{in|out}</tt>
+are differnt from <tt>/etc/ninit/{in|out}</tt>
+repectively.
+
+<h2><a name="Depends">depends</a></h2>
+ A plain text file containing a service name per line.
+ Example: <tt>/etc/ninit/dnscache/depends</tt>
+ could contain <tt>tinydns</tt>.
+ Each of these services will be started before this service is
+ started. If you need to wait for static initializations to
+ complete, use the
+ <a href=#Sync>sync</a> flag.
+ See also the
+ <a href=#Wait>wait</a>
+ flag.
+
+<h2><a name="Run">run (service's executable)</a></h2>
+
+ A symbolic link to the program name. No hard link, because
+ <tt>argv[0]</tt>
+ for the programs is created by extracting the part after the last
+ slash in the contents of the symbolic link.
+ <br>
+ Example: <tt>/usr/bin/sshd</tt>
+ would be run with <tt>argv[0]=sshd</tt>.
+
+<h2><a name="Params">params</a></h2>
+
+ A plain text file containing command line parameters for the
+ service, one parameter per line. No shell expansion is done. If
+ you need shell expansion, have run point to a shell script instead
+ of the real daemon. Note: Have the shell script exec the daemon
+ instead of simply running it to save system resources.
+
+
+<h2><a name="Environ">environ</a></h2>
+ Similar to depends. The helper
+ <tt>/etc/ninit/run</tt> adds
+ the contents of this file
+ to the system's environ. Example:
+<pre>
+TERM=linux
+PATH=/bin:/usr/bin:/usr/local/bin
+UID=321
+GID=432
+BOOT_IMAGE
+</pre>
+Since BOOT_IMAGE does not have "<b>=</b>" this variable is removed.
+If the first line is empty then the system's environ is deleted first.
+
+
+<h2><a name="Wait">wait</a></h2>
+ Similar to depends.
+ The helper <tt>/etc/inint/run</tt>
+ waits for services included in
+ this file to finish and after that start a current service.
+ Include wait services also in depends.
+ <p>
+ This is different from
+ <a href=#Sync>sync</a> flag.
+ Let the service B must be started after the service A finish.
+ One can sync A. This will block all other services.
+ In this case it's better to use wait instead of sync.
+ <p>
+ It's possible to set wait parameters
+ (see <a href=#Maxwait>maxwait</a>) at the end of
+ each entry. Example:
+<pre>
+some_service:180:3</tt>
+other_service:300:5</tt>
+</pre>
+
+<h2><a name="Maxwait">maxwait</a></h2>
+
+ A plain text file containing the values n1[:n2]. Wait no more
+ than n1 sec the services to finish. See also
+ <a href="#Wait">wait</a>. Default is 600 sec. The value n1=0
+ means - wait until the service finish.
+
+<h2><a name="Alarm">alarm</a></h2>
+
+ A plain text file containing the value n.
+ Execs alarm(n) before starting the child. It's timeout like.
+ Don't use this for services which catch SIGALRM signal.
+
+<h2><a name="Softlimit">softlimit</a></h2>
+ Similar to depends.
+ See Daniel Bernstein
+ <a href=http://cr.yp.to/daemontools/softlimit.html>softlimit</a>
+ program.
+ <br>
+ Lines with the same options as
+ <a href=http://cr.yp.to/daemontools/softlimit.html>softlimit</a>
+ (skip leading '-').
+ Example:
+<pre>
+ echo m3000000 > softlimit
+ echo o30 >> softlimit
+ echo f200000 >> softlimit
+</pre>
+The helper
+<tt>/etc/ninit/run</tt> execs the service with this restrictions.
+
+<h2><a name="Respawn">respawn</a></h2>
+
+ Touch this file to make ninit respawn the process when it dies.
+ This should be touched for getty and network servers.
+
+<h2><a name="Sync">sync</a></h2>
+
+ Touch this file to make ninit wait until the service ends. sync is
+ mutually exclusive with
+ <a href=#Respawn>respawn</a>. This is meant for static
+ initializations like <tt>ifconfig</tt>. See also
+ <a href="#Wait">wait</a>.
+<!--
+ If sync contains a nonzero number n ninit will wait max n sec
+ the service to finish. If it does not ends until n secs then
+ ninit continues to start the other services.
+-->
+
+<h2><a name="Log">log/</a></h2>
+
+ If this directory exists, it is taken as service and ninit creates
+ a FIFO <tt>log/in</tt> and soft link of
+ <tt>log/in</tt> to <tt>out</tt>. It's equivalent to:
+<pre>
+ test -d log && mkfifo -m 600 log/in && ln -s log/in out
+</pre>
+ If the log
+ service can not be started, the service will block if it writes
+ to stdout. See also
+ <a href="subdirs.html#Log">log</a>.
+
+<h2><a name="Nice">nice</a></h2>
+
+ A plain text file containing the value to add to the nice level
+ via the nice system call.
+
+<h2><a name="Sleep">sleep</a></h2>
+
+ A plain text file containing the value n. Sleep n secs after fork
+ before running child. Useful if respawning is very fast.
+
+<h2><a name="In">in</a> (service's input)</h2>
+
+ This file (named pipe) is used for stdin.
+
+<h2><a name="Out">out</a> (service's output)</h2>
+
+ This file (named pipe) is used for stdout and stderr.
+ e.g. a symlink to /dev/null
+<p>
+It's possible to send the output of many services to one logger.
+Let for example create one service with:
+<pre>
+ cd /etc/ninit
+ mkdir logger && cd logger
+ mkfifo logger/in
+ ln -s /path/to/multilog run
+ echo -n 721 > uid
+ # setup: params, softlimit, depends, environ, uid, ...
+</pre>
+Then in other service dir we can do:
+<pre>
+ echo logger >> depends
+ cd /path/to/sevirce-dir
+ ln -s ../logger/in out
+</pre>
+
+<!--
+</pre>
+<h2><a name="Gid">gid</a></h2>
+
+ A plain text file containing a number.
+ Exec the program with this GID.
+-->
+
+<h2><a name="Uid">uid</a></h2>
+ A plain text file containing a number.
+ Exec the program with this UID. It's possible to write
+ also UID:GID. It's better to use UID, GID smaller than 65530.
+ It is possible to write here also the supplementary groups.
+ For example:
+<pre>
+ echo 23:99:240:320:100 > uid
+</pre>
+ start the service with:
+ UID=23, GID=99, GROUPS=99,240,320,100.
+
+<h2><a name="End">end (service's executable)</a></h2>
+
+ Similar to <a href=#Run>run</a>.
+ After the service finish "end" will be executed.
+ The helper does not set environ, softlimit, uid restrictions.
+ You can put there for example:
+<pre>
+ #!/bin/sh
+ exec /bin/nsvc -C+3 service_name
+</pre>
+ Use this option instead of
+ <a href=#Sync>sync</a> or
+ <a href=#Wait>wait</a> mode. Let for example
+ services B,C,D must be started after A finish. There are two
+ possible solutions:
+<br>
+<font color=red>Bad</font>: &nbsp; start A in sync mode
+<br>
+<font color=green>Good</font>: start A i normal mode and put in "end"
+<pre>
+ #!/bin/sh
+ exec /bin/nsvc -o B C D
+</pre>
+<b>end</b> is started with arguments:
+<pre>
+ $1=service_name $2=ninit_home $3=ninit_sysdir
+</pre>
+Example:
+<pre>
+ #!/bin/sh
+ x=`echo $1 | tr '/' ':'`
+ rm -f /var/run/ninit-$x.pid
+</pre>
+
+<h2><a name="Setup">setup</a></h2>
+
+ If this file exist it is started just before
+ <tt>/etc/ninit/service/run</tt> in
+ sync mode.
+ If
+ <a href="#Uid">uid</a>
+ or
+ <a href="#Softlimit">softlimit</a> exist they are applied first and
+ after that setup is executed. Example:
+<pre>
+ #!/bin/sh
+ PATH=/bin:/usr/bin
+ id; env
+</pre>
+ <b>setup</b> is started with arguments:
+<pre>
+ $1=service_name $2=ninit_home $3=ninit_sysdir $4=service_pid
+</pre>
+
+<h2><a name="Rsetup">rsetup</a></h2>
+ Similar to
+ <a href="#Setup">setup</a>. It is executed before setup as root and
+ not softlimit, uid, in/out restrictions.
+ <br>
+ If you want
+ to modify some special files see the flag
+ <a href="#Sys-rsetup">sys-rsetup</a>. Next create pidfile
+ before the service start. Remove the pidfile with
+ <a href=#End>end</a> after it finish.
+<pre>
+ #!/bin/sh
+ x=`echo $1 | tr '/' ':'`
+ echo $4 > /var/run/ninit-$x.pid
+</pre>
+I really don't know why we need such
+<font color=magenta>nonsense</font> in <i>/var/run/</i>.
+In my opinion pids in <i>/var/run/</i> are outdated and
+unreliable thinks!
+
+
+<h2><a name="Sys-rsetup">sys-rsetup</a></h2>
+ Similar to
+ <a href="#Setup">setup</a>.
+ It is executed first (before rsetup and setup) as root.
+<br>
+ It can even modify special files like
+ params, depends, wait, uid...
+<br> Example:
+<pre>
+ #!/bin/sh
+
+ export PATH=/bin:/usr/bin
+ umask 022
+
+ if test -f "uid-gid" ; then
+ a=`read name < uid-gid`
+ echo -n `id -u $name` > uid
+ echo -n :`id -g $name` >> uid
+ fi
+</pre>
+
+<h2><a name="Pidfile">pidfile</a></h2>
+ This is an easy method to setup a service which run in background.
+ Prepare it as ordinary service and write only
+ the name of the pidfile. Don't use links for pidfile!
+ Example:
+<pre>
+ cd /etc/ninit/gpm
+ echo -n /var/run/gpm.pid > pidfile
+</pre>
+ See also the helper
+ <a href=man/pidfile.man>ninit-pidfile</a>.
+
+<h2><a name="Pause">pause</a></h2>
+ If this file exist then <tt>/etc/ninit/sys/run</tt>
+ wait for SIGCONT before starting the service's run.
+
+<h2><a name="Pause-wait">pause-wait</a></h2>
+ If this file exist then <tt>/etc/ninit/sys/run-wait</tt>
+ helper wait for SIGCONT before starting the service's run.
+ Example:
+<pre>
+x=/tmp/__test; mkdir $x; cd $x
+ln -s `which date` run
+touch pause; touch pause-wait
+nsvc -o $x
+
+nsvc $s; sleep 3; nsvc -c $x
+nsvc $x; sleep 3; nsvc -c $x
+nsvc $x
+</pre>
+
+<h2><a name="Cron">cron</a></h2>
+A plain text file containing two or three numbers per line.
+Example:
+<pre>
+echo 1d:2h7:0 > cron
+</pre>
+The service will be started on 02:07:00 UTC every day.
+If the third number is nonzero the service will be started
+first time immediately (not waiting for cron timestamp).
+
+
+<p>
+Last modified: 17 December 2009
+
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+
+Gratuitious blank lines added so that files.html#link works.
+
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/guarantee.html b/riemann.fmi.uni-sofia.bg/ninit/guarantee.html
new file mode 100644
index 0000000..a1d42b0
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/guarantee.html
@@ -0,0 +1,48 @@
+<html>
+<body>
+<a href="/ninit/index.html">ninit</a>
+<h1>The ninit security guarantee</h1>
+
+I offer <b><font size=+1 color=red>100 Euro</font></b>
+to the first person
+who publish a verifiable security hole in the latest stable
+version of ninit (0.12): for example,
+a way for a user to exploit ninit to take over another account.
+
+<p>
+Don't change the permition of files.<br>
+<pre>
+Execs + Dirs: root:root 755
+Ninit in/out pipes: root:root 600
+Man pages: root:root 644
+Files in /etc/ninit: root:root 644
+</pre>
+
+My judgment is final as to what constitutes a security hole in
+ninit. Any disputes will be reported here.
+
+<p>
+<b>Remark <tt>/etc/ninit</tt> config subdirs</b><br>
+Ninit uses system functions like setuid, setgid, open, close.
+On some UNIX-like OS they are different. For example
+uid_t is uint16_t or uint32_t. There are also setuid32, setgid32, ...
+analogs of the above functions. Try to use for UID:GID
+numbers smaller than 65530.
+Who uses daemons with UID bigger than 65530?
+If somebody really needs such numbers let me know. How to use
+UID:GID see <a href=files.html#Gid>here</a>.
+Don't make config files (for example depends 12G, environ 5G)
+too big also. I have set limits in the code.
+
+<p>
+2 November 2007, Sofia
+<br>
+Nikola Vladov
+<p>
+
+see also
+<a href=http://cr.yp.to/qmail/guarantee.html>here</a>
+<br>
+Last modifed: Tue, 27 Nov 2007 09:08:30
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/index.html b/riemann.fmi.uni-sofia.bg/ninit/index.html
new file mode 100644
index 0000000..708382e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/index.html
@@ -0,0 +1,395 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>ninit - small Linux/UNIX init</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ninit - a small replacement of init</h1>
+<div class="endtop"></div>
+</div>
+
+Release: &nbsp;
+<!--
+<a href=ninit-0.12.1.tar.bz2>ninit-0.12.1.tar.bz2</a> (stable) &nbsp;
+-->
+<a href=ninit-0.14.tar.bz2>ninit-0.14.tar.bz2</a>
+<br> Author's private <i>/etc/ninit/</i> &nbsp;
+<a href=ninit-data.tar.gz>ninit-data.tar.gz</a> ::
+<a href=http://gitorious.org/arch-ninit/ninit-scripts>archlinux</a>
+<br>
+<p>
+
+<table align=top>
+<td>
+<ul>
+<li><a name='toc0' href='#HowItWorks'>How it works</a></li>
+<li><a name='toc1' href='#Install'>Install</a></li>
+<li><a name='toc2' href='#PostInstall'>Post install</a></li>
+<li><a name='toc4' href=man/>Manpages</a></li>
+</ul>
+</td>
+
+<td>
+<ul>
+<li><a name='toc5' href=all.html>Download</a></li>
+<li><a name='toc3' href='#Updating'>Updating <tt>ninit</tt></a></li>
+<li><a name='toc6' href=FAQ.html>FAQ</a></li>
+<li><a name='toc10' href=ninit-html.tar.bz2>HTML</a></li>
+</ul>
+</td>
+
+<td>
+<ul><li><a name='toc11' href='#HaltReboot'>Halt &amp; Reboot</a></li>
+<li><a name='toc8' href=subdirs.html>Subdirs</a> -
+<font color=magenta>read me!</font></li>
+<li><a name='toc888' href=files.html>Files</a> -
+<font color=magenta>read me!</font></li>
+
+<li><a name='toc9' href="subdirs.html#Services">Creating</a> services</li>
+</ul>
+</td>
+<!--
+11
+-->
+</table>
+
+<p>
+<a href=/ninit/guarantee.html>The ninit security guarantee</a>
+<!--
+<br>
+<a href=LK/>Linux-Kongress 2009 submission</a>
+-->
+
+<h2><a name="New">What's new</a></h2>
+<ul>
+<li> 20100116 - version
+ <a href=ninit-0.14.tar.bz2>ninit-0.14.tar.bz2</a> uploaded.
+</li>
+<li> 20090110 - version
+ <a href=old/ninit-0.13.tar.bz2>ninit-0.13.tar.bz2</a> uploaded.
+</li>
+<!--
+<li> 20080103 - version
+ <a href=old/ninit-0.12.1.tar.bz2>ninit-0.12.1.tar.bz2</a> uploaded.
+</li>
+<li> 20071102 - version
+ <a href=old/>ninit-0.12.tar.bz2</a> uploaded.
+</li>
+<li> 20071025 - version
+ <a href=old/>ninit-0.11.2.tar.bz2</a> uploaded.
+ Ninit have buildin cron and uses only 8K RAM (two pages).
+</li>
+-->
+<li> 20071010 - mailing lists for ninit.</li>
+</ul>
+
+<h2><a name="About">About</a></h2>
+<b>ninit</b> is a fork from Felix von Leitner's
+<a href=http://www.fefe.de/minit/>minit</a>.
+Some other related <a href=links.html>links</a>.
+<br>
+<!--
+Like any other piece of software (and information generally),<br>
+ninit comes with NO WARRANTY.
+<p>
+-->
+<a name=List>
+There is a
+&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#32;&#108;&#105;&#115;&#116;
+for ninit. To &#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#44;
+send an empty &#109;&#101;&#115;&#115;&#97;&#103;&#101;
+to <br>
+<font size=+1>
+<a href=
+&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+>
+&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+</a>
+</font>
+</a>
+<br>
+Some delay is possible due to
+&#103;&#114;&#101;&#121;&#108;&#105;&#115;&#116;&#105;&#110;&#103;&#46;
+
+<p>
+<b>ninit</b> uses minimal resources (arch: i386; kernel: 2.4.37):
+<pre>
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
+ root 1 0.0 0.0 8 8 ? S Oct08 0:03 /sbin/ninit
+
+ text data bss dec hex filename
+ 3642 20 56 3718 e86 /sbin/ninit
+</pre>
+
+<h2><a name="Install">Install</a></h2>
+You have to build and install ninit first. I prefer to do this
+with Fefe's <a href=http://www.fefe.de/dietlibc/>dietlibc</a>.
+<br>
+Download the latest stabe
+ <a href=http://riemann.fmi.uni-sofia.bg/ninit/ninit-0.14.tar.bz2>
+ ninit-0.14.tar.bz2</a> release. Then:
+
+<pre>
+ bzip2 -dc ninit-0.14.tar.bz2 | tar -xvf -
+ cd ninit-0.14
+
+Case-A: If you have dietlibc already working do:
+ $ make withdiet; make tests
+ # make install
+
+Case-B: If you do not have dietlibc do:
+ $ make dietbuild; make tests
+ # make install
+</pre>
+To compile <tt>ninit</tt> with glibc do:
+<pre>
+ $ make nodiet; make tests
+ # make install
+</pre>
+Only <tt>make install</tt> must be started as root!
+Other install instructions are <a href=install.html>here</a>.
+You can type also <tt>make strip</tt> before <tt>make install</tt>.
+The distributions
+<b><font color=magenta>should read</font></b>
+this <a href=install.html#Warning>warning</a>.
+
+<h2><a name="PostInstall">Post install</a></h2>
+
+You have to prepare service directory <tt>/etc/ninit</tt>
+and to setup
+<br>
+boot loader (grub or lilo) to start
+<tt>/sbin/ninit</tt> instead of <tt>/sbin/init</tt>
+<p>
+
+<h4>Preparing directory <tt>/etc/ninit</tt></h4>
+
+<b>Case A.</b>
+
+If you already have <tt>ninit</tt> running, then you
+already have this directory and can skip to
+<a href='#Updating'>updating</a> ninit.
+<p>
+<b>Case B.</b> If you already have
+<tt><a href="http://www.fefe.de/minit/">minit</a></tt> running do
+simply:
+<a name="SamePipes">
+<pre>
+ cd /etc && cp -p -R minit/* ninit
+</pre>
+</a>
+
+<b>Case C.</b> If your default init is <tt>/sbin/init</tt> it's also
+easy.
+<br>
+I wrote a simple converter
+<tt><a href=man/inittab.man>ninit-inittab</tt></a>.
+Try it with:
+<pre>
+ /sbin/ninit-inittab /etc/inittab /etc/ninit /tmp/ninit.sh
+ /tmp/ninit.sh
+</pre>
+Last two commands are equivalent to:
+<pre>
+ make ser_vi_ces
+</pre>
+<hr>
+
+<h4>Setup lilo/grub to boot <tt>/sbin/ninit</tt></h4>
+
+To use <tt>ninit</tt> as system init add the parameter
+<tt>init=/sbin/ninit</tt>
+<br>
+to your kernel command line.
+See some short instructions <a href=boot.html>here</a>.
+<br>
+After that you have to reboot the system.
+
+<h2><a name="Updating">Updating <tt>ninit</tt></a></h2>
+If <tt>ninit</tt> is already running your boot loader is
+already prepared to start <tt>/sbin/ninit</tt>. After
+installation all is done automatically. Simply do nothing more!
+<p>
+You can test the new executable (before <tt>make install</tt>)
+also with:
+<pre>
+ /sbin/ninit-reload -v -u /path/to/new/ninit
+ cp /path/to/new/ninit /sbin
+ cp /path/to/new/ninit-reload /sbin
+ /sbin/ninit-reload -v -u /sbin/ninit
+</pre>
+
+<h2><a name="HowItWorks">How it works</a></h2>
+
+For ninit, everything is a service, which should either be started
+once or respawned. Ninit expects its configuration in the
+<tt>/etc/ninit</tt> directory.
+You have to create
+all services in this directory
+manually or using the program
+<tt><a href=man/inittab.man>ninit-inittab</tt></a>.
+My private <a href=ninit-data.tar.gz>ninit-data.tar.gz</a>
+and <a href=ls-R.txt>ls-R</a> are also public.
+
+<p>
+Ninit searches for a file called
+<tt><a href="files.html#Depends">depends</a></tt> in the subdirectory
+<tt><a href="subdirs.html#Default">default</a></tt>.
+This file tells ninit which services should be
+started by default (in fact it tells ninit that the service
+<tt>default</tt>
+depends on other services, but <tt>default</tt> is the directory ninit
+starts to search in). Instead of the file <tt>default/depends</tt> it is
+possible to start services with
+<a href=man/scan.man>ninit-scan</a>.
+
+<!--
+Special subdirectories and files are described
+<a href="#Special">here</a>.
+-->
+
+<p>
+Ninit doesn't start services alone. It uses the helper program
+<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt>
+to start a service. On this way ninit doesn't parse
+the service instructions in the corresponding directory.
+This keeps ninit small and it's easy to change
+<tt>/etc/ninit/sys/run</tt>.
+
+<p>
+There is a companion utility
+<tt>/bin/<a href=man/nsvc.man>nsvc</a></tt>
+that can be used much in the same
+way as the
+<tt><a href=http://cr.yp.to/daemontools/svc.html>svc</a></tt>
+from daemontools.
+Communication works over two fifos,
+<tt>/etc/ninit/{in|out}</tt>.
+Those have to exist before ninit is
+started and they should be owned by root and have mode 600.
+<!--
+<br>
+If on box also exist
+<a href=http://www.fefe.de/minit/>minit</a> then ninit must
+use minit's
+<a href="#SamePipes">fifos</a>.
+-->
+
+<p>
+While <tt>sys/run</a></tt> is the main
+<tt><a href=man/ninit.man>ninit</a></tt> helper,
+there are
+also four auxiliary helpers
+<tt><a href=man/pidfile.man>ninit-pidfile</a></tt>,
+<tt><a href=man/pututmpid.man>pututmpid</a></tt>,
+<tt><a href=man/runlevel.man>ninit-runlevel</a></tt> and
+<tt><a href=man/sysvinit.man>ninit-sysvinit</a></tt>
+used to start services.
+<pr>The last three helpers
+emulate <tt>/sbin/init</tt> behavior.
+
+<!--
+<h2><a name="Programs">Programs</a></h2>
+<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt> - ninit helpler
+-->
+
+
+<h2><a name="HaltReboot">Shutdown and reboot</a></h2>
+On a box running
+<b>ninit</b> as process no 1 it is better to avoid using the SysVinit
+programs shutdown, reboot, and halt. First, check the directory
+<tt>/etc/ninit</tt>. Assuming you have the services
+<tt>{_l0|halt}</tt> and
+<tt>{_l6|reboot}</tt>, you can try
+<pre>
+ nsvc -o halt
+ nsvc -o reboot
+</pre>
+If you have service <a href="subdirs.html#Ctrlaltdel">ctrlaltdel</a> then
+<tt>CTRL-ALT-DELETE</tt> halts the hox.
+<p>
+
+
+The converter
+<tt><a href=man/inittab.man>ninit-inittab</a></tt>
+can
+usually create these services for you. If they are still missing, the
+last choice is to use the program
+<tt><a href=man/shutdown.man>ninit-shutdown</a></tt>,
+or alternatively
+the SysVinit programs <i>shutdown, reboot, halt</i>.
+Other problems with halt are described
+<a href="FAQ.html#q11">here</a>..
+
+<h2>Future</h2>
+
+<ul>
+<li>explain why I decide to fork from Felix's <tt>minit</tt>
+<li>write this page better (see also <a href=man/README>here<a>)
+<li>tutorial for
+<a href="subdirs.html#Services">creating</a> services (partially done)
+<!--
+<li>explain the entries <tt>update_links</tt>,
+<tt>ser_vi_ces</tt> and <tt>distro</tt> in Makefile
+<li>explain why I decide to make one daemon as two separate programs:
+<br>
+<tt>/sbin/<a href=man/ninit.man>ninit<a></tt>
+and <tt>/etc/ninit/<a href=man/run.html>run</a></tt>. Last program
+only start a service and exit.</li>
+-->
+<li>explain better some new features of <tt>ninit</tt> which
+are missing in <tt>minit</tt> (see also
+<a href=FAQ.html#q12>here</a>).
+<li>explain all compile options included in the file
+<tt>ninitfeatures.h</tt>
+</ul>
+
+<!--
+<h2>Translation table</h2>
+between minit and ninit programs:
+<pre>
+ /bin/msvc -> /bin/nsvc
+ /sbin/minit -> /sbin/ninit
+ /sbin/minit-update -> /sbin/ninit-reload
+ /sbin/hard-reboot -> /sbin/ninit-reboot
+ /sbin/mshutdown -> /sbin/ninit-shutdown
+</pre>
+It's possible to make a link
+<pre>
+ cd /bin && ln -s nsvc msvc
+</pre>
+and continue to use <tt>msvc</tt> in shell scripts.
+How to use <tt>pidfilehack</tt> see also
+<a href="FAQ.html#q3">here</a>.
+-->
+
+<h2>See also</h2>
+Here are the package <a href=README>README</a>
+and <a href=CHANGES>CHANGES</a>.
+Almost all for <b>minit</b> is true for <b>ninit</b> also.
+<br>
+Other related <a href=links.html>links</a>.
+
+
+<h2>Author: Nikola Vladov</h2>
+If you like <b>ninit</b>, try also my
+<a href=/ngetty/>
+ngetty</a> - single daemon for all virtual consoles.
+<br>
+Send comments and suggestions using ninit
+<a href=#List>&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#45;&#108;&#105;&#115;&#116;</a> or
+<a href=&#47;&#101;&#109;&#97;&#105;&#108;&#46;&#104;&#116;&#109;&#108;>
+qform</a>.
+<br>
+<b><font color=red>WARNING</font></b>:
+ninit is tested only on i386 and x86_64 arch.
+
+<p>
+Last modified: Feb 11 2010
+<br><br><br><br><br><br><br><br>
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/install.html b/riemann.fmi.uni-sofia.bg/ninit/install.html
new file mode 100644
index 0000000..3676c55
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/install.html
@@ -0,0 +1,115 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>install instructions</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ninit - install instructions</h1>
+<div class="endtop"></div>
+</div>
+
+It's possible to install ninit using glibc and system commands
+included here. On my box the executable are smaller than these
+compiled with dietlibc. I prepared the directories
+<pre>
+ system/i386
+ system/x64_86
+</pre>
+
+In each make program builds the file system.a. Using this library
+and ninit.a the linker create executable in bin-$(ARCH) dir.
+It don't use any other functions. If one have dietlibc installed
+already the linker uses it instead of
+<tt>system/$(ARCH)/system.a</tt>
+
+<p> Try this with:
+<pre>
+ $ make clean
+ $ make i386
+ $ make tests
+
+ $ cp bin-i386/* .
+ $ make tests
+</pre>
+
+On x86_64 replace i386 with x86_64 above. On my box
+ninit compiled with above command uses only 12K RAM. There
+are 3 pages = text + data + stack.
+
+<p>
+The ".data + .bss" page is very small. It is less than 120 bytes.
+One can merge it with ".text" and then ninit will run with 8K only.
+Test this with
+
+<pre>
+ $ rm bin-i386/*
+ $ make i386 TINY_LDFLAGS=-Wl,-N
+
+ $ cp bin-i386/* .
+ $ make tests
+</pre>
+The option <tt>-Wl,-N</tt> is for the linker. It is possible to use
+also other flags. For example <tt>-Wl,-znoexecstack</tt>.
+Last is coded in Makefile. Simple try
+<pre>
+ $ make x86_64
+</pre>
+to see the results.
+
+<pre>
+vladov@riemann:0 ~/public_html/ninit$ ps axuw | head -3
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
+ root 1 0.0 0.0 8 8 ? S Oct08 0:03 /sbin/ninit
+ root 2 0.0 0.0 0 0 ? S Oct08 0:02 [keventd]
+</pre>
+
+<p>
+On the other architectures you need to use dietlibs, or prepare
+subdirs in system.
+
+<a name="HowItWorks">
+<h2><a name="Warning">Warning</a></h2>
+Some distros make precompiled binaries.
+Let we assume the following scenario. The OS process no 1 is
+<i>/sbin/ninit</i>. The install instructions overwrite
+<i>/sbin/ninit</i>. The old
+<a href=man/ninit.man>ninit</a> continues to work,
+<a href=man/nsvc.man>nsvc</a> is updated already.
+It is even <b>impossible</b> to halt clean, since
+<pre>
+ /bin/mount -o remount,ro /
+</pre>
+fails (device busy). It is better to use somethinig like:
+<pre>
+ #!/bin/sh
+ data=/tmp/ninit-$$.data
+ grep ninit /proc/1/cmdline
+ ninit=$?
+
+ if test $ninit -eq 0 ; then
+ rm -f $data
+ /sbin/ninit-reload -d &gt; $data
+ fi
+
+ # apply the distro install instructions here
+ # they <b>should</b> overwrite /sbin/ninit, /sbin/ninit-reload
+
+ if test $ninit -eq 0 ; then
+ /sbin/ninit-reload -f $data -v -u /sbin/ninit
+ rm -f $data
+ fi
+</pre>
+See also <b>scripts/update.sh</b> in the source.
+
+<br>
+Some shell related questions are discussed
+<a href=files.html#Gbin>here</a>.
+
+<p>
+Last updated: 17 Jan 2010
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/links.html b/riemann.fmi.uni-sofia.bg/ninit/links.html
new file mode 100644
index 0000000..0a321eb
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/links.html
@@ -0,0 +1,32 @@
+<html>
+<body>
+
+<h2>Related to ninit links</h2>
+<ul>
+<li><a href=http://cr.yp.to/daemontools.html>daemontools</a> -
+ D. J. Bernstein</li>
+<li><a
+href=ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/>sysvinit</a> -
+source code</li>
+<li><a href=http://www.fefe.de/minit/>minit</a> - the parent of
+ <b>ninit</tt></b>
+<li><a href=http://b0llix.net/perp/>perpetrator</a> - Wayne Marshall</li>
+<!--
+<li><a href=http://linux.softpedia.com/get/System/Boot/myinit-31857.shtml>
+ myinit</a> - Stamatis Mitrofanis's init</li>
+-->
+<li><a href=http://smarden.org/runit/>runit</a> - Gerit Pape's init</li>
+<li>Paul Jarc's init
+ <a href=http://multivac.cwru.edu/svscan-1/>system</a></li>
+<li><a href=http://unix.schottelius.org/cinit/>cinit</a> -
+ Nico Schottelius's init</li>
+<li>Nico Schottelius's
+<a href=http://nico.schotteli.us/papers/linux/howto/minit-howto/index.html>
+documentation</a> for minit</li>
+<li>Fridtjof Busse's
+<a href=http://www.fbunet.de/minit.shtml>
+documentation</a> for minit</li>
+</ul>
+Please let me know about other related sites.
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/ls-R.txt b/riemann.fmi.uni-sofia.bg/ninit/ls-R.txt
new file mode 100644
index 0000000..5fad403
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/ls-R.txt
@@ -0,0 +1,306 @@
+backup/
+bin/
+cron/
+ctrlaltdel_/
+default/
+default.old/
+dnscache/
+getty/
+gpm/
+halt/
+http/
+https/
+identd/
+ilian/
+in|
+kbreq_/
+klogd/
+level0@
+level6@
+logger/
+netlogd/
+ngetty/
+out|
+pop3/
+pppd/
+qmail/
+qmaild/
+reboot/
+run*
+sh/
+smtp/
+sntpclockd/
+sshd/
+sys/
+syslogd/
+sysvinit_/
+talkd/
+time/
+tinydns/
+tinydom/
+update/
+xdm/
+
+/etc/ninit/default:
+params
+run@
+run_me*
+
+/etc/ninit/halt:
+run*
+
+/etc/ninit/reboot:
+run*
+stop_all
+
+/etc/ninit/kbreq_:
+run@
+
+/etc/ninit/tinydom:
+environ
+out@
+run@
+softlimit
+
+/etc/ninit/getty:
+1/
+2/
+3/
+4/
+5/
+6/
+
+/etc/ninit/sh:
+run@
+
+/etc/ninit/dnscache:
+depends
+environ
+in@
+out@
+params
+respawn
+run@
+setup*
+softlimit
+
+/etc/ninit/cron:
+cron
+depends
+run@
+wait
+
+/etc/ninit/ctrlaltdel_:
+run@
+
+/etc/ninit/backup:
+run*
+
+/etc/ninit/gpm:
+params
+params.msc
+pidfile
+run@
+
+/etc/ninit/pppd:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/klogd:
+environ
+in@
+out@
+params
+run@
+softlimit
+uid
+
+/etc/ninit/syslogd:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/logger:
+environ
+in|
+params
+respawn
+run@
+setup*
+uid
+
+/etc/ninit/qmail:
+depends
+environ
+out@
+params
+run@
+setup*
+
+/etc/ninit/tinydns:
+environ
+out@
+run@
+softlimit
+
+/etc/ninit/sshd:
+environ
+out@
+params@
+params.P
+params.p
+respawn
+run@
+
+/etc/ninit/pop3:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/smtp:
+environ
+out@
+params
+respawn
+run@
+softlimit
+
+/etc/ninit/http:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/update:
+params
+run@
+
+/etc/ninit/identd:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/https:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/sntpclockd:
+environ
+out@
+params
+respawn
+run@
+softlimit
+
+/etc/ninit/netlogd:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/xdm:
+params
+run@
+
+/etc/ninit/ngetty:
+environ
+params
+run@
+
+/etc/ninit/sys:
+procfs*
+remove*
+run*
+run-wait*
+update*
+
+/etc/ninit/time:
+cron@
+cron.3
+cron.4
+cron.6
+run*
+
+/etc/ninit/sysvinit_:
+run@
+sysvinit-timeout
+
+/etc/ninit/qmaild:
+depends@
+environ
+params
+run@
+
+/etc/ninit/talkd:
+environ
+out@
+params
+run@
+softlimit
+
+/etc/ninit/bin:
+argv0*
+conditional-init*
+env*
+install-bin*
+ninit-conf*
+ninit-huge*
+ninit-scan*
+serdo*
+sh@
+sleeprun*
+softlimit*
+
+/etc/ninit/ilian:
+end*
+out@
+run*
+uid
+z@
+
+/etc/ninit/default.old:
+depends
+run@
+
+/etc/ninit/getty/2:
+params
+respawn
+run@
+
+/etc/ninit/getty/3:
+params
+respawn
+run@
+
+/etc/ninit/getty/4:
+params
+respawn
+run@
+
+/etc/ninit/getty/5:
+params
+respawn
+run@
+
+/etc/ninit/getty/6:
+params
+respawn
+run@
+
+/etc/ninit/getty/1:
+respawn
+run*
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/README b/riemann.fmi.uni-sofia.bg/ninit/man/README
new file mode 100644
index 0000000..1c23ead
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/README
@@ -0,0 +1,3 @@
+
+WARNING: The documentation for ninit is in preparation now.
+If someone wants to help, let me know, please!
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/bootlog.man b/riemann.fmi.uni-sofia.bg/ninit/man/bootlog.man
new file mode 100644
index 0000000..ad62025
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/bootlog.man
@@ -0,0 +1,75 @@
+bootlog(8) bootlog(8)
+
+
+
+NAME
+ bootlog - write stdout/stderr of a program to file
+
+SYNOPSIS
+ bootlog [-12ctar] logsize logfile program [arguments]
+
+
+DESCRIPTION
+ bootlog is used to start a program and write stdout/stderr to a disk
+ file. This works also before mouning any file systems.
+
+ bottlog is designed to log the output of scripts/services at boot time,
+ before mounting any file system. This is typical for system init.
+
+ bootlog expects that when the program exits, the logfile is writable!
+
+
+OPTIONS
+ -1 log only stdout
+
+ -2 log only stderr; default is to log stdout and stderr
+
+ -c create logfile
+
+ -t truncate logfile
+
+ -a append to logfile
+
+ -r replace old logfile with logfile~
+
+ logsize
+ maximal size of output to be logged
+
+ logfile
+ disk file name
+
+ program
+ the name of the program to start
+
+ arguments
+ additional arguments for program
+
+
+WARNING
+ Use the option -c to force creating of the logfile.
+
+ Actually the options -c, -a, -t add O_CREAT, O_APPEND, O_TRUNC flags to
+ open(2) for logfile
+
+
+EXAMPLE
+ bootlog -ctr 120000 /tmp/.sysinit.log /etc/rc.d/rc.sysinit
+
+ You will have the files /tmp/.sysinit.log and /tmp/.sysinit.log~
+
+
+ENVIRON
+ bootlog uses the variable PATH to start program
+ If PATH is undefined it uses PATH=/bin:/usr/bin
+
+
+AUTHOR
+ bootlog is part of ninit package written by Nikola Vladov
+
+
+SEE ALSO
+ ninit(8), open(2)
+
+
+
+ Dec 28, 2009 bootlog(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/index.html b/riemann.fmi.uni-sofia.bg/ninit/man/index.html
new file mode 100644
index 0000000..169dd70
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/index.html
@@ -0,0 +1,26 @@
+<html>
+<head><title>Index</title></head>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<h2>Index</h2>
+<font>
+Parent <a href=../>directory</a>
+<pre>mode size last-change name<hr>
+-r-- 109 Feb 18 14:56 <a href="README">README</a>
+-r-- 1.6k Jan 19 00:29 <a href="bootlog.man">bootlog.man</a>
+-r-- 1.8k Jan 19 00:29 <a href="inittab.man">inittab.man</a>
+-r-- 4.2k Jan 19 00:29 <a href="ninit.man">ninit.man</a>
+-r-- 3.1k Jan 19 00:29 <a href="nkillall.man">nkillall.man</a>
+-r-- 4.8k Jan 19 00:29 <a href="nsvc.man">nsvc.man</a>
+-r-- 1.5k Jan 19 00:29 <a href="pidfile.man">pidfile.man</a>
+-r-- 1.5k Jan 19 00:29 <a href="pututmpid.man">pututmpid.man</a>
+-r-- 1.3k Jan 19 00:29 <a href="reboot.man">reboot.man</a>
+-r-- 2.1k Jan 19 00:29 <a href="reload.man">reload.man</a>
+-r-- 1.4k Jan 16 17:43 <a href="run.html">run.html</a>
+-r-- 2.3k Jan 19 00:29 <a href="runlevel.man">runlevel.man</a>
+-r-- 2.2k Jan 19 00:29 <a href="scan.man">scan.man</a>
+-r-- 892 Jan 19 00:29 <a href="service.man">service.man</a>
+-r-- 1.8k Jan 19 00:29 <a href="shutdown.man">shutdown.man</a>
+-r-- 3.2k Jan 19 00:29 <a href="sysvinit.man">sysvinit.man</a>
+
+index genereted on <b>Feb 18 2010 15:07 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/inittab.man b/riemann.fmi.uni-sofia.bg/ninit/man/inittab.man
new file mode 100644
index 0000000..28455b4
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/inittab.man
@@ -0,0 +1,77 @@
+ninit-inittab(8) ninit-inittab(8)
+
+
+
+NAME
+ ninit-inittab - convert /etc/inittab to service directory
+
+SYNOPSIS
+ ninit-inittab inittab_file home_directory output_script
+
+
+DESCRIPTION
+ ninit-inittab creates a script using /etc/inittab file. This script
+ can be used to create a service directory easy.
+
+
+OPTIONS
+ inittab_file
+ input source file
+
+ home_directory
+ home directory for ninit
+
+ output_script
+ name of the output script
+
+
+USAGE
+ Case A. If you don't have services in /etc/ninit you can start:
+
+
+ cd /tmp
+ ninit-inittab /etc/inittab /etc/ninit services.sh
+ less services.sh
+ /tmp/services.sh
+
+
+ Then check what the script has done in /etc/ninit
+
+ Case B. If you already have a /etc/ninit directory with services, and
+ don't want to make any changes there you can type:
+
+
+ cd /tmp; cp /etc/inittab /tmp; vi inittab
+ ninit-inittab /tmp/inittab /tmp/srv services.sh
+ less services.sh
+ /tmp/services.sh
+
+
+ Then check what the script has done in /tmp/srv. If you find something
+ interesting there you can copy it to /etc/ninit
+
+
+AUTHOR
+ ninit-inittab was written by Nikola Vladov.
+
+ The aim was to easily convert a host running SysVinit to ninit. In my
+ opinion creating services is very easy. Maybe you have to look in some
+ already prepared service directory first.
+
+ Ask google for "ninit archlinux" and you will find an excellent git
+ repository with services for /etc/ninit
+
+
+
+FILES
+ /etc/inittab
+ /etc/ninit/
+
+
+SEE ALSO
+ ninit(8), ninit-runlevel(8), ninit-sysvinit(8), pututmpid(8)
+ init(8), inittab(5), runlevel(8)
+
+
+
+ Dec 28, 2009 ninit-inittab(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/ninit.man b/riemann.fmi.uni-sofia.bg/ninit/man/ninit.man
new file mode 100644
index 0000000..5dba61b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/ninit.man
@@ -0,0 +1,130 @@
+ninit(8) ninit(8)
+
+
+
+NAME
+ ninit - a UNIX process no 1
+
+SYNOPSIS
+ ninit [-Mnumber] [-Hhome] [-Ssystem] [service] ...
+
+
+DESCRIPTION
+ ninit is a possible first process the kernel starts. It can
+ start/stop/monitor all services the OS needs.
+
+ To use ninit as system init, first read available documentation in
+ http://riemann.fmi.uni-sofia.bg/ninit/ and then add the parameter
+ init=/sbin/ninit to your kernel command line.
+
+ If you want to use ninit only to start/monitor services and continue to
+ use the default init(8) then put in /etc/inittab
+ NI:12345:respawn:/sbin/ninit
+ In this case you should remove the service sysvinit and don't use the
+ programs: ninit-runlevel(8), ninit-sysvinit(8). Similarly it is possi-
+ ble to start ninit using /etc/init.d/ninit script.
+
+
+
+USAGE
+ ninit will by default do nothing except start the ninit service defined
+ in /etc/ninit/default which usually contains a file named depends spec-
+ ifying which services are to be started at bootup.
+
+ To control ninit use the companion program nsvc. Do not make it SUID
+ unless you know what are you doing!
+
+ The program ninit-sysvinit listens to the fifo /dev/initctl and allows
+ SysVinit programs shutdown, halt, reboot, telinit to work properly. If
+ there is a service /etc/ninit/sysvinit it starts ninit-sysvinit.
+
+
+ To stop the box running ninit use the programs ninit-shutdown or nsvc.
+
+
+NONROOT USAGE
+ Any nonroot user can use /sbin/ninit to start/monitor own services.
+ First make private ninit directory with
+ /etc/ninit/bin/ninit-conf ~/.ninit
+ and put somewhere in shell profile: export NINIT_HOME=~/.ninit
+
+ Then create some services in $NINIT_HOME and start
+ /sbin/ninit -H$NINIT_HOME
+
+
+OPTIONS
+ -Mnumber
+ Tells ninit to use number bytes for memory buffer. One service
+ uses approximately 30 bytes.
+
+ -Hhome Changes the ninit home. Default: /etc/ninit
+
+ -Ssystem
+ Changes the ninit system directory. Default: sys
+
+
+SIGNALS
+ On receiving of some signals ninit starts appropiate service.
+
+
+ SIGINT Normally the kernel sends this signal to ninit when CTRL-ALT-DEL
+ is pressed. It activates the ctrlaltdel action and ninit starts
+ the service ctrlaltdel
+
+ SIGWINCH
+ The kernel sends this signal when the KeyboardSignal key is hit.
+ It activates the kbrequest action and ninit starts the service
+ kbreq
+
+ SIGHUP Has the same effect as telinit q. Ninit restarts the service
+ levelQ
+
+ SIGUSR1
+ On receipt of this signal, ninit closes and re-opens its control
+ fifo, /dev/initctl. Useful for bootscripts when /dev is
+ remounted.
+
+ SIGPWR Ninit starts the service powerS. This service starts the pro-
+ gram ninit-sysvinit with one argument: powerS.
+
+
+SERVICES
+ Each service has own subdirectory in /etc/ninit/ three. There are lots
+ of config files for a service. The main daemon ninit check only the
+ files depends, sync, respawn, end to start a service. Check olso the
+ link:
+ http://riemann.fmi.uni-sofia.bg/ninit/files.html
+
+ If the servive name start with '#' or '-' it is blacklisted. You can
+ now blacklist services temporarily by passing it on the kernel command
+ line. The first time they are to be started will then be skipped. Use
+ this, for example, to not start the dhcp client when your notebook is
+ not plugged in a network. Look in ninitfeatures.h if ninit is compiled
+ to use this option.
+
+
+FILES
+ NINIT_HOME/in
+ NINIT_HOME/out
+ NINIT_HOME/sys/
+ /dev/initctl
+
+
+
+AUTHOR
+ ninit was written by Nikola Vladov and can be downloaded from
+ http://riemann.fmi.uni-sofia.bg/ninit/
+
+
+SEE ALSO
+ nsvc(8), ninit-service(8), ninit-reload(8)
+ ninit-shutdown(8), ninit-reboot(8), nkillall(8)
+ ninit-sysvinit(8), ninit-runlevel(8)
+ minit(8), http://www.fefe.de/minit/
+ init(8), shutdown(8), halt(8), reboot(8)
+
+ Part of this manpage was written by Erich Schubert.
+
+
+
+ Jan 15, 2010 ninit(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/nkillall.man b/riemann.fmi.uni-sofia.bg/ninit/man/nkillall.man
new file mode 100644
index 0000000..d094da3
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/nkillall.man
@@ -0,0 +1,110 @@
+nkillall(8) nkillall(8)
+
+
+
+NAME
+ nkillall - send signals to all processes; write messages to users
+
+SYNOPSIS
+ nkillall -[vq] [-s secs] [-M|W mesg] [-signum] [-E prog [arg[s]]
+
+DESCRIPTION
+ nkillall sends signals to all processes skipping it's own PID. It is a
+ simple program that does not use /proc FS. It uses kill(2) and
+ execve(2) syscalls. It is designed as a replacement of the SysVinit
+ killall5(8) command.
+
+
+USAGE
+ It is not allowed to use -h (signal SIGHUP) as first option! If you
+ really want this then start: nkillall -s0 -hup ...
+
+
+ -v verbose mode; -vv means more verbose
+
+ -q quiet mode; ignores SIGINT signal; Ctrl-C does't work!
+
+ -s secs
+ sleep secs
+
+ -M mesg
+ write mesg to stdout. The message can include escape symbols:
+ \NNN, \a, \b, \e, \c, \f, \n, \r, \t, \v, \\ like in C language.
+ Last message can be written again with -M% or -W%. Example:
+
+ nkillall -M'\n\aPlease logout! The system is going down...' \
+ -W% -s2 -W% -s4 -W% -s12 \
+ -M'\tSending TERM signal' -term ...
+
+ -W mesg
+ write mesg to all logged users. The syntax is the same as -M.
+ nkillall determines logged users by looking at /var/run/utmp.
+
+ In my opinion /var/run/utmp is unreliable! Other programs like
+ who(1), wall(1), login(1) also use this file. If you feel that
+ yours is insecure, better don't use the -W option.
+
+
+ -signum
+ send all processes the singal signum. Some important signals
+ can be encodded. For example SIGTERM can be typed with -15 or
+ -term. Only the first letter is important! The command kill -l
+ lists the signal numbers.
+
+ -E /path/to/program [arg[s]]
+ execve(2) the program with some arguments. This option must be
+ last! The program will have the same PID as nkillall.
+
+
+NOTE
+ The options are applied immediately. Their position is important. The
+ next two examples work differently:
+
+ nkillall -q -s2 -M'sending signal SIGTERM' -15 ...
+ nkillall -s2 -M'sending signal SIGTERM' -15 -q ...
+
+ Use the options -v[v] -q after nkillall immediately.
+
+
+WARNING
+ nkillall also kills the script in which it is included. Use it in
+ scripts like:
+
+ #!/bin/sh
+ before commands
+ exec nkillall [options] -E/path/to/prog prog_opt(s)
+
+ An example of wrong usage is the following:
+
+ #!/bin/sh
+ before commands
+ nkillall ...
+ after commands
+
+
+EXAMPLES
+ nkillall -M'Sending all processes SIGTERM ...' -s2 -15 \
+ -M'Sending all processes SIGKILL ...' -s6 -9 \
+ -s1 -E /path/to/program arg1 arg2 ...
+
+ nkillall -v -s1 -15 -cont -s6 -kill -s1 -E/path/to/prog arg(s) ...
+
+ nkillall -vv -pause -s59 -continue -M'Hello world!'
+
+
+FILES
+ /var/run/utmp
+
+
+AUTHOR
+ nkillall is included in ninit package and can be downloaded from
+ http://riemann.frmi.uni-sofia.bg/ninit/
+
+
+SEE ALSO
+ ninit(8), kill(1), kill(2), execve(2), utmp(5)
+ init(8), killall5(8)
+
+
+
+ Dec 28, 2009 nkillall(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/nsvc.man b/riemann.fmi.uni-sofia.bg/ninit/man/nsvc.man
new file mode 100644
index 0000000..557056a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/nsvc.man
@@ -0,0 +1,151 @@
+nsvc(8) nsvc(8)
+
+
+
+NAME
+ nsvc - control ninit
+
+SYNOPSIS
+ nsvc [ -Sservice ] [ -[uodgpchaitkorRDCLHVWZE] ] service [...]
+ nsvc -Ppid service
+
+DESCRIPTION
+ nsvc is the management interface to ninit. service is the service
+ directory name relative to /etc/ninit. You can also include
+ /etc/ninit/ in the service name.
+
+ Each service directory contains control files. They are described on
+ http://riemann.fmi.uni-sofia.bg/ninit/
+
+
+ It is possible to make nsvc SUID.
+
+ chown root.root /bin/nsvc
+ chmod 4711 /bin/nsvc
+
+ Then nsvc opens the pipes /etc/ninit/in, /etc/ninit/out and switches to
+ real UID. If UID is nonzero only limited set of operation are allowed.
+
+OPTIONS
+ If no options are given, nsvc will just print a diagnostic message to
+ stdout, saying if the service is up, down or finished, which PID it has
+ if it is up, and for how long it has been in this state.
+
+ Only the service name ALL means all services.
+
+
+ -Sservice
+ Skip service. Apply this option immediately after nsvc. Don't
+ insert space between S and service. Examples:
+ nsvc -Sngetty -Ssshd -Slogger -d ALL
+ nsvc -Sngetty -W3 ALL || nsvc -Sngetty -k ALL
+
+
+ -u -uNumber
+ Up. If the service is not running, start it. If the service
+ stops, restart it. If Number is nonzero and the service is down
+ start it after Number seconds.
+
+ -o -oNumber
+ Once. If the service is down, start it. If the service stops,
+ do not restart it. If Number is nonzero and the service is
+ down, start it after Number seconds; if it is up, restart it
+ later.
+
+ -d Down. If the service is running, send it a TERM signal and then
+ a CONT signal. After it stops, do not restart it.
+
+ -r Stop respawn. Set respawn flag to OFF. This does not
+ start/stop the service.
+
+ -R Start respawn. Set respawn flag to ON. This does not
+ start/stop the service.
+
+ -p Pause. Send the service a STOP signal.
+
+ -c Continue. Send the service a CONT signal.
+
+ -h Hangup. Send the service a HUP signal.
+
+ -a Alarm. Send the service an ALRM signal.
+
+ -i Interrupt. Send the service an INT signal.
+
+ -t Terminate. Send the service a TERM signal.
+
+ -k Terminate. Send the service a KILL signal.
+
+ -g Get. Output just the PID.
+
+ -Ppid service
+ Set pid of service.
+
+ -D service
+ Print dependencies. This will print all the names of all the
+ services that were started because this services depended on
+ them. Example:
+ nsvc -D default
+
+ -D Print ninit memory usage statistics.
+
+ -H Print history. This will print the names of some recently
+ spawned processes. This is useful if you see a process looping
+ (initialization fails and ninit is restarting it all the time).
+
+ -L Print all services loaded in memory.
+
+ -V Print version
+
+ -Wnumber
+ Wait at most number seconds service(s) to finish. Example:
+ nsvc -d qmail
+ nsvc -W180 qmail || nsvc -k qmail
+
+ -Cnumber -C+number
+ Tell ninit that the service is in CRON mode. If number is zero
+ it disables CRON mode. Let now=`date +%s`. If number < now
+ then ninit starts the service immediately, otherwise ninit will
+ start it latter. The flag -C+number (if the number is positive)
+ is equaivalent to the following:
+ t=`expr now + number`
+ nsvc -C$t ...
+
+ To stop foo, which is in CRON mode do:
+ nsvc -C0 foo
+ nsvc -d foo
+
+ -Z -Znumber
+ Zero (free) a service. This is done with the ninit-reload pro-
+ gram. Example:
+ nsvc -Z30 foo
+ This removes foo (if such a service exists) and prepares ninit
+ to accept 30 new services approximately.
+
+ -E -Enumber
+ Update ninit environ. This is done by ninit-reload program.
+ Example:
+ nsvc -E36 ABC=12 UVW
+ This updates the variable ABC and removes UVW. It prepares
+ ninit to accept 36 new services approximately. See the environ
+ with:
+ tr '\000' '\012' < /proc/1/environ
+
+
+RETURN CODES
+ Generally, nsvc returns zero if everything is OK or 1 on error (could
+ not open /etc/ninit/in or /etc/ninit/out or there is no process with
+ the given name). In diagnostic mode, it will exit 0 if the service is
+ up, 2 if it is down or 3 if it is finished.
+
+
+ENVIRON
+ nsvc uses the variables NINIT_MEMORY and NINIT_HOME.
+
+
+SEE ALSO
+ ninit(8), ninit-scan(8)
+ ninit-shutdown(8), nkillall(8), svc(8), msvc(8)
+
+
+
+ Jan 19, 2010 nsvc(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/pidfile.man b/riemann.fmi.uni-sofia.bg/ninit/man/pidfile.man
new file mode 100644
index 0000000..107e8b5
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/pidfile.man
@@ -0,0 +1,65 @@
+ninit-pidfile(8) ninit-pidfile(8)
+
+
+
+NAME
+ ninit-pidfile - work around daemons that always fork
+
+SYNOPSIS
+ ninit-pidfile servicename pidfile [ -H home ] command [parameters]
+
+
+DESCRIPTION
+ ninit-pidfile is used to work around daemons that insist on forking
+ into the background, but that do write a correct pid file.
+
+ ninit-pidfile forks the actual service, then waits for the pidfile to
+ be written. Once it can read the pid from the pidfile it will tell
+ ninit the real pid and quit.
+
+
+OPTIONS
+ servicename
+ the name of the service ninit-pidfile is installed for
+
+ pidfile
+ the filename to read the pid from
+
+ command
+ the real command to start
+
+ parameters
+ additional parameters for the command
+
+ -H home
+ the home of ninit. Default: /etc/ninit
+
+
+USAGE
+ With ninit you can prepare a service and if it forks and writes the PID
+ in some file then type in the service directory:
+
+ echo /path/to/deamon.pidfile > pidfile
+
+ For apache this looks like:
+
+ cd /etc/ninit/apache
+ echo /var/run/apache.pid > pidfile
+
+ Don't use hard or soft links here!
+ Then ninit will start apache using ninit-pidfile
+
+
+AUTHOR
+ pidfilehack was written by Felix von Leitner.
+
+ This manpage was written by Erich Schubert <[email protected]> for the
+ Debian GNU/Linux operating system.
+
+
+SEE ALSO
+ ninit(8), nsvc(8), pidfilehack(8)
+
+
+
+ Dec 28, 2009 ninit-pidfile(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/pututmpid.man b/riemann.fmi.uni-sofia.bg/ninit/man/pututmpid.man
new file mode 100644
index 0000000..6ac909d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/pututmpid.man
@@ -0,0 +1,63 @@
+pututmpid(8) pututmpid(8)
+
+
+
+NAME
+ pututmpid - write utmp/wtmp records and exec command
+
+SYNOPSIS
+ putupmpid [-w] ut_id command [parameters]
+ pututmpid reboot
+ pututmpid halt
+
+
+
+DESCRIPTION
+ pututmpid is used to write records in utmp/wtmp files for running
+ getty/agetty/fgetty. pututmpid writes the record and then execve()s a
+ command. The commands login and getty use the records written from
+ pututmpid.
+
+ After reboot it is possible to set pututmpid reboot in init scripts.
+ This will update /var/run/utmp with BOOT_TIME record. This must be
+ done after /var/run/utmp is writable. The usage of pututmpid halt is
+ similar. It sets wtmp record (in /var/log/wtmp file).
+
+
+OPTIONS
+ usually pututmpid is symlinked as run command of a service.
+
+ -w debug mode -- write more info in /var/log/wtmp
+
+ ut_id string at most 4 bytes long. examples: tty1,tty2,
+ vc1,vc2,vc3... Use different names for each virtual console!
+
+ command
+ the real command to start
+
+ parameters
+ additional parameters for the command
+
+
+EXAMPLE
+ A typical use of this command will look like this:
+
+ /etc/ninit/getty/2
+
+ /etc/ninit/getty/2/params
+ tty2
+ /sbin/fgetty
+ tty2
+
+ /etc/ninit/getty/2/run
+ -> /sbin/pututmpid
+
+
+SEE ALSO
+ ninit(8), ninit-runlevel(8)
+ getty(8), {n|f|a|min}getty(8),
+ login(1), utmp(5), runlevel(8)
+
+
+
+ Dec 28, 2009 pututmpid(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/reboot.man b/riemann.fmi.uni-sofia.bg/ninit/man/reboot.man
new file mode 100644
index 0000000..7f61861
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/reboot.man
@@ -0,0 +1,56 @@
+ninit-reboot(8) ninit-reboot(8)
+
+
+
+NAME
+ ninit-reboot - reboot your system immediately
+
+SYNOPSIS
+ ninit-reboot RESTART
+ niniy-reboot HALT
+ ninit-reboot POWER_OFF
+ ninit-reboot ENABLE_CAD
+ ninit-reboot DISABLE_CAD
+
+
+DESCRIPTION
+ ninit-reboot is used to reboot your system.
+
+ It will not shut down services, unmount filesystems or notify your
+ users, but expects that this has already been done when it is called.
+
+
+USAGE
+ To prevent accidential use of this application the parameters have to
+ be written in uppercase letters.
+
+ RESTART restart (reboot) the system
+
+ HALT halt the kernel
+
+ POWER_OFF power off the system if possible (supported by hardware)
+
+ ENABLE_CAD
+ halt the system. Enable CTRL-ALT-DEL key to restart the sys-
+ tem after halt.
+
+ DISABLE_CAD
+ halt the system. Disable CTRL-ALT-DEL key to restart the
+ system after halt.
+
+
+
+
+AUTHOR
+ ninit-reboot was contributed by Tommi Virtanen.
+
+ This manpage was partially written by Erich Schubert <[email protected]>
+ for the Debian GNU/Linux operating system.
+
+
+SEE ALSO
+ ninit(8), nsvc(8), ninit-shutdown(8), nkillall(8)
+
+
+
+ Dec 28, 2009 ninit-reboot(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/reload.man b/riemann.fmi.uni-sofia.bg/ninit/man/reload.man
new file mode 100644
index 0000000..ced3ab4
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/reload.man
@@ -0,0 +1,82 @@
+ninit-reload(8) ninit-reload(8)
+
+
+
+NAME
+ ninit-relaod - replace running ninit with a new version
+
+SYNOPSIS
+ ninit-reload [options] [/path/to/ninit] [ninit_options]
+
+
+DESCRIPTION
+ ninit-reload is used to replace a running ninit with a new version.
+
+ It tries to retrieve the state information about running services from
+ ninit, then have ninit replace itself with the new version and restore
+ the stored state information.
+
+
+OPTIONS
+ Unless the -u option is given, ninit-reload assumes you are running in
+ test mode.
+
+ -v verbose operation
+
+ -u update mode
+
+ -m dump ninit memory buffer to stdout
+
+ -d dump services data to stdout
+
+ -R service
+ remove service from active list
+
+ -r number
+ remove service with number from active list. Example:
+ ninit-reload -v /sbin/ninit
+ ninit-reload -v -r 3 -R qmail -u /sbin/ninit
+
+ -e string
+ update ninit environ. Example:
+ ninit-reload -v -e ABC=12 -e UVW -u /sbin/ninit
+ This updates the variable ABC and removes UVW. See the environ
+ after that with: tr '\000' '\012' < /proc/1/environ
+
+ -E file
+ update ninit environ using file. The syntax for file is the
+ same as in the file environ for services.
+
+ -a number
+ reload ninit and calculate memory buffer to number additional
+ services. Check the result with: ps axww.
+
+ -t time_diff
+ add time_diff seconds to each service. Useful if you change the
+ time with hwclock. time_diff can also be a negative number.
+
+ -f data_file
+ don't retrieve services from ninit. Use this file instead. For
+ example you can start:
+
+ ninit-reload -d > /tmp/ninit.data
+ ninit-reload -v -u -f /tmp/ninit.data /sbin/ninit
+
+
+
+ENVIRON
+ ninit-reload uses the variables NINIT_MEMORY and NINIT_HOME.
+
+
+
+AUTHOR
+ This manpage was partially written by Erich Schubert <[email protected]>
+ for the Debian GNU/Linux operating system.
+
+
+SEE ALSO
+ ninit(8), nsvc(8)
+
+
+
+ Dec 28, 2009 ninit-reload(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/run.html b/riemann.fmi.uni-sofia.bg/ninit/man/run.html
new file mode 100644
index 0000000..30c004a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/run.html
@@ -0,0 +1,53 @@
+<html>
+<title>run</title>
+<body>
+
+<h1>~/sys/run - ninit main helper</h1>
+
+
+The program <i>/etc/ninit/sys/</i><b>run</b>
+is the main ninit helper.
+Ninit uses it to start services.
+
+Each service has own subdirectory in
+<i>/etc/ninit/</i> three.
+
+
+<i>/etc/ninit/sys/</i><b>run</b> read instructions how to start a service
+in the corresponding service directory.
+
+<p>
+All instructions are plain text
+<a href=../files.html>files</a>.
+<i>/etc/ninit/sys/</i><b>run</b>
+ read them each time before starting a service.
+The main daemon <i>/sbin/</i><b>ninit</b> check
+only the files: <b>depends</b>, <b>respawn</b>, <b>sync</b>, <b>end</b>.
+
+<br>
+The file
+<a href=../files.html#End>end</a>
+must be executale. It is started immediately after
+the service finish.
+
+<p>
+The output of the command
+<b>ls -R /etc/ninit/</b> is <a href=../ls-R.txt>here</a>.
+<br>
+A typical service directory look like:
+<pre>
+ls -l /etc/ninit/dnscache/:
+
+-rw-r--r-- 1 root root 8 Jan 18 2007 depends
+-rw-r--r-- 1 root root 131 Jan 17 2007 environ
+lrwxrwxrwx 1 root root 18 Jan 18 2007 in -> /etc/dnscache/seed@
+lrwxrwxrwx 1 root root 12 Dec 20 2006 out -> ../logger/in@
+-rw-r--r-- 1 root root 42 May 21 18:54 params
+-rw-r--r-- 1 root root 0 Dec 21 2006 respawn
+lrwxrwxrwx 1 root root 23 Jan 17 2007 run -> /usr/local/bin/dnscache@
+-rw-r--r-- 1 root root 32 May 20 23:55 softlimit
+</pre>
+
+<br>
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/runlevel.man b/riemann.fmi.uni-sofia.bg/ninit/man/runlevel.man
new file mode 100644
index 0000000..8907aef
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/runlevel.man
@@ -0,0 +1,71 @@
+ninit-runlevel(8) ninit-runlevel(8)
+
+
+
+NAME
+ ninit-runlevel - set runlevels for compatibility with SysVinit
+
+SYNOPSIS
+ ninit-runlevel LEVEL [OPTION]... [-] [NAME=VALUE]... [PROGRAM [ARG]...]
+ ninit-runlevel
+
+DESCRIPTION
+ ninit-runlevel is a helper program to start service (script, program)
+ with the same environ as SysVinit. It also modifies the files
+ /var/run/utmp and /var/log/wtmp writing runlevel records in them. It
+ is used mainly in ninit-inittab(8) output script.
+
+ It sets the following variables: INIT_VERSION=2.86, CONSOLE=/dev/con-
+ sole, RUNLEVEL, PREVLEVEL, PATH=/bin:/usr/bin:/sbin:/usr/sbin. The
+ variable NINIT_RUNLEVEL always has the same value as RUNLEVEL. The
+ program does not modify or reset the variable INIT_HALT.
+
+
+OPTIONS
+ Actually ninit-runlevel has the same syntax between LEVEL and PROGRAM
+ as the command env(1).
+
+ If ninit-runlevel is started as a service you can use environ file to
+ set some environment variables. However in this case ninit-runlevel
+ overwrites the variables: INIT_VERSION, CONSOLE, RUNLEVEL, PREVLEVEL,
+ PATH and NINIT_RUNLEVEL. You can reset some of them, for example PATH.
+
+ -i start with an empty environment
+ a mere - implies -i
+
+ -u variable
+ remove the variable from the environment
+
+
+EXAMPLES
+ In the next examples we modify PATH, INIT_HALT and CONSOLE
+
+ ninit-runlevel S PATH=/sbin:/bin /etc/rc.d/rc.single
+ ninit-runlevel 0 INIT_HALT=POWERDOWN -u CONSOLE /etc/rc.d/rc.halt
+
+ See the environ with (don't start it as root - the program will then
+ modify /var/run/utmp )
+
+ ninit-runlevel 5 /usr/bin/env
+
+
+WARNING
+ Don't remove the file /var/run/utmp if you want correct PREVLEVEL and
+ RUNLEVEL variables. ninit-runlevel stores the info about levels there.
+ ninit does not use the /var/run/utmp file, nor PREVLEVEL, RUNLEVEL,
+ NINIT_RUNLEVEL.
+
+
+FILES
+ /var/run/utmp
+ /var/log/wtmp
+
+
+SEE ALSO
+ utmp(5), env(1), runlevel(8)
+ ninit(8), ninit-sysvinit(8), ninit-shutdown(8), ninit-inittab(8)
+ init(1), shutdown(8), reboot(8), halt(8)
+
+
+
+ Jan 16, 2010 ninit-runlevel(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/scan.man b/riemann.fmi.uni-sofia.bg/ninit/man/scan.man
new file mode 100644
index 0000000..225fbe7
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/scan.man
@@ -0,0 +1,78 @@
+ninit-scan(8) ninit-scan(8)
+
+
+
+NAME
+ ninit-scan - scan directory and start/stop services
+
+SYNOPSIS
+ ninit-scan [ -[uod] ] services_directory ninit_home
+
+DESCRIPTION
+ ninit-scan scans a directory to start/stop a collection of services.
+
+ Service definitions are installed, configured and activated as subdi-
+ rectories of the services_directory. As ninit-scan sequentially scans
+ the services_directory, it looks for subdirectory names not beginning
+ with `.'. If ninit-scan then finds the `sticky' bit set on the subdi-
+ rectory, it considers the service definition ``active'' and attempts to
+ start/stop the corrsponding service.
+
+
+
+
+OPTIONS
+ If no option is given ninit-scan try to start the service in respawn ON
+ or OFF mode depending on the existence of the file respawn in the ser-
+ vice subdirectory.
+
+
+ -u Up. If the service is not running, start it. If the service
+ stops, restart it.
+
+ -o Once. If the service is down, start it. If the service stops,
+ do not restart it.
+
+ -d Down. If the service is running, send it a TERM signal and then
+ a CONT signal. After it stops, do not restart it.
+
+
+EXAMPLES
+ ninit-scan -u net /etc/ninit
+ start all services /etc/ninit/net/* which have `sticky' bit set in
+ respawn mode.
+
+ ninit-scan etc /etc/ninit
+ start all services /etc/ninit/etc/* which have `sticky' bit set.
+
+ ninit-scan -d '' /etc/ninit
+ stop all services /etc/ninit/* which have `sticky' bit set.
+
+
+USAGE
+ This is similar to the file depends. Put in rsetup the following:
+
+ #!/bin/sh
+ exec $2/bin/ninit-scan $1 $2
+
+
+ The program is shell script. See the code to understand how it works.
+ ninit-scan is designed to permit easy service activation/deactivation
+ using the chmod(1) utility. You can set/unset `sticky' bit with
+
+
+ chmod +t myservice
+ chmod -t myservice
+
+
+AUTHOR
+ Nikola Vladov. Thanks to Wayne Marshall for the `sticky' bit idea.
+ http://b0llix.net/perp/
+
+
+SEE ALSO
+ ninit(8), nsvc(8), perpd(8), chmod(1)
+
+
+
+ Jan 19, 2010 ninit-scan(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/service.man b/riemann.fmi.uni-sofia.bg/ninit/man/service.man
new file mode 100644
index 0000000..2884b25
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/service.man
@@ -0,0 +1,43 @@
+ninit-service(8) ninit-service(8)
+
+
+
+NAME
+ ninit-service - print info about a service
+
+SYNOPSIS
+ ninit-service [-OPTIONS] service(s)
+ ninit-service -E service file
+
+DESCRIPTION
+ ninit-service is a shell script which prints info about service(s). It
+ only looks in the service directory. Use nsvc to obtain info about
+ services loaded in ninit memory.
+
+
+OPTIONS
+ -A ascii output
+
+ -C show end of lines; for cat
+
+ -L print long lines; for ls
+
+ -E service file
+ edit service/file; default editor: /bin/vi; change it with:
+ echo /usr/bin/emacs -nw > /etc/ninit/.editor
+
+ -H/other/home
+ default home: /etc/ninit
+
+
+EXAMPLE
+ ninit-service ngetty
+ ninit-service `find /etc/ninit/ -type d`
+
+
+SEE ALSO
+ ninit(8), nsvc(8), ngetty(8)
+
+
+
+ Dec 28, 2009 ninit-service(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/shutdown.man b/riemann.fmi.uni-sofia.bg/ninit/man/shutdown.man
new file mode 100644
index 0000000..040f420
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/shutdown.man
@@ -0,0 +1,71 @@
+ninit-shutdown(8) ninit-shutdown(8)
+
+
+
+NAME
+ ninit-shutdown - shutdown the ninit init system.
+
+SYNOPSIS
+ ninit-shutdown -[rhoqvstmST] [-E /path/to/program [arg1 arg2 ...]]
+
+
+DESCRIPTION
+ ninit-shutdown tries to properly shutdown your system with ninit.
+
+
+USAGE
+ -r reboot after shutdown
+
+ -h halt after shutdown
+
+ -o power-off after shutdown (default)
+
+ -q quiet mode; ignores SIGINT signal; Ctrl-C does't work!
+
+ -v be verbose
+
+ -m only shutdown the ninit-part and exit
+
+ -s secs starting delay
+
+ -t secs delay between SIGTERM and SIGKILL
+
+ -E prog execute prog after KILLALL; must be the last option!
+
+ -T secs if secs is nonzero shutdown twice ninit part
+
+ -S abcd skip to shutdown the service abcd
+
+
+NOTES
+ If the flags -m and -E are off then the program starts the service halt
+ or reboot depending of the flags -h -o and -r respectively.
+
+ If the flags -E and -m are on then ninit-shutdown execve(2)s the prog
+ after shutting down the ninit-part.
+
+ If the flag -E is on and the flag -m is off then ninit-shutdown
+ execve(2)s the prog after sending SIGTERM and SIGKILL to all processes.
+
+ ninit-shutdown clears respawn/cron flags on all services including
+ those skipped with -S flag.
+
+
+ENVIRON
+ ninit-shutdown uses the variables NINIT_MEMORY and NINIT_HOME.
+
+
+AUTHOR
+ ninit was written by Nikola Vladov and can be downloaded from
+ http://riemann.frmi.uni-sofia.bg/ninit/
+
+ Parts of ninit-shutdown were contributed by Bernd Wachter.
+ Parts of this manpage was written by Erich Schubert.
+
+
+SEE ALSO
+ ninit(8), nsvc(8), execve(2), nkillall(8)
+
+
+
+ Dec 28, 2009 ninit-shutdown(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/man/sysvinit.man b/riemann.fmi.uni-sofia.bg/ninit/man/sysvinit.man
new file mode 100644
index 0000000..7433d9e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/man/sysvinit.man
@@ -0,0 +1,102 @@
+ninit-sysvinit(8) ninit-sysvinit(8)
+
+
+
+NAME
+ ninit-sysvinit - SysVinit emulator listening on /dev/initctl
+
+SYNOPSIS
+ ninit-sysvinit
+ ninit-sysvinit powerS
+
+
+DESCRIPTION
+ ninit does not use the /dev/initctl fifo. As a result the SysVinit
+ commands telinit, reboot, halt, shutdown do not work. Some of them
+ need to write to /dev/initctl to work properly.
+
+ ninit-sysvinit is a SysVinit emulator which listens on /dev/initctl and
+ starts some services if there is any activity on the fifo.
+
+
+USAGE
+ Five seconds after starting all services ninit tries to start the
+ sysvinit service. If the last service exists then ninit opens and lis-
+ tens on /dev/initctl. Never include the service sysvinit in
+ /etc/ninit/default nor start it at boot time.
+
+
+OPTIONS
+ ninit-sysvinit reads the control file sysvinit-timeout in the service
+ directory. It must contain two numbers n1:n2. If there is not any
+ activity on /dev/initctrl for more than n1 seconds the program exits.
+ If the number n1 is zero ninit-sysvinit wait forever.
+
+ If needed, ninit can start ninit-sysvinit later again.
+
+
+RUNLEVELS
+ SysVinit has runlevels 0123456S. The command
+ telinit S
+ writes the request to /dev/initctl and ninit-sysvinit starts the ser-
+ vice levelS. It works similarly with telinit 5, telinit Q or telinit
+ U. Then ninit-sysvinit starts the level5, levelQ or levelU service if
+ it exists.
+
+
+POWER ACTIONS
+ ninit-sysvinit also starts the services powerF, powerO or powerL. The
+ letters come from F(AIL), O(K) or L(OW). The program can obtain the
+ power request from /dev/initctl or from a SIGPWR signal and the file
+ /etc/powerstatus. See the manual page init(8) for more info.
+
+
+SIGNALS
+ Don't send signal SIGPWR to ninit-sysvinit. Manpage init(8) says:
+
+
+ Usage of SIGPWR and /etc/powerstatus is discouraged. Someone wanting to
+ interact with init should use the /dev/initctl control channel.
+
+ If some program still needs to use signal SIGPWR it must send it
+ dirrectly to ninit.
+
+
+ENVIRON
+ SysVinit shutdown sets the variable INIT_HALT=POWERDOWN or
+ INIT_HALT=HALT depending on the options -r -h -H -P. You can (re)set
+ this variable using:
+
+ nsvc -E INIT_HALT
+ nsvc -E INIT_HALT=POWERDOWN
+
+
+AUTHOR
+ If you don't plan to use SysvInit's shutdown, reboot, halt or telninit
+ commands, you can do:
+
+ cd /etc/ninit
+ mv sysvinit sysvinit_
+ ninit-reload -v -u /sbin/ninit
+
+ Why did I write this SysVinit emulator? This is a good question.
+ Ninit has the ninit-shutdown, nkillall and ninit-reboot programs.
+ There is no need to use SysVinit halt, reboot... to stop the box clean.
+ See the code of the emulator. Maybe you will find the answer there.
+
+ Nikola Vladov
+
+
+FILES
+ /dev/initctl
+ /etc/powerstatus
+ NINIT_HOME/sysvinit/sysvinit-timeout
+
+
+SEE ALSO
+ nsvc(8), ninit-shutdown(8), ninit-runlevel(8)
+ init(8), shutdown(8), halt(8), reboot(8), telinit(8)
+
+
+
+ Dec 28, 2009 ninit-sysvinit(8)
diff --git a/riemann.fmi.uni-sofia.bg/ninit/ngetty.html b/riemann.fmi.uni-sofia.bg/ninit/ngetty.html
new file mode 100644
index 0000000..4e53767
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/ngetty.html
@@ -0,0 +1,307 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>ngetty</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ngetty - one daemon for all virtual consoles</h1>
+<div class="endtop"></div>
+</div>
+
+<table>
+<ul>
+<td>
+<li>
+ <a href=/ngetty/old/ngetty-1.0.tar.gz>
+ ngetty-1.0.tar.gz</a> (old)
+</li><li>
+ <a href=/ngetty/ngetty-1.1.tar.gz>
+ ngetty-1.1.tar.gz</a> (stable)
+</li><li>
+ <a href=all.html>Index</a>
+</li>
+</ul>
+
+</td><td>
+<ul>
+<li>
+ Manual <a href=/ngetty/ngetty.man> page</a>
+</li><li>
+ Other <a href=/ngetty/pr_other.html> programs</a>
+</li><li>
+ Binary <a href=/ngetty/binary/> packages</a>
+</li>
+</ul>
+
+</td><td>
+<ul>
+<li>
+ Recent <a href=News.txt>news</a>
+</li><li>
+ Security <a href=guarantee.html>guarantee</a>
+</li>
+</ul>
+</td>
+
+</table>
+
+<h2>About</h2>
+<b>ngetty</b> is a daemon that starts login sessions on virtual console
+terminals, on demand. It is a good replacement for all those getty
+processes started from init that, most of the time, are only taking up
+memory. When compiled statically with dietlibc, the ngetty binary
+size is only about 2k and uses considerably less
+<a href="pr_other.html#Memory">memory</a>
+than a getty. See pstree <a href=ps_tree>here</a>.
+<a name="Resources">
+<pre>
+riemann$ ps uww -C ngetty
+USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
+root 145 0.0 0.0 8 8 ? Ss Jan05 0:00 ngetty 1 2 3 4
+</pre>
+</a>
+
+Ngetty is designed to stop including <b>getty-like</b> code
+in init programs.
+<br>
+I used source and ideas from
+<a href=http://sites.google.com/site/anbadeol/logind>logind</a>.
+Many thanks, Andre!
+
+<p>
+<a name=List>
+There is a
+&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#32;&#108;&#105;&#115;&#116;
+for ngetty. To &#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#44;
+send an empty &#109;&#101;&#115;&#115;&#97;&#103;&#101;
+to <br>
+<font size=+1>
+<a href=
+&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#110;&#103;&#101;&#116;&#116;&#121;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+>
+&#110;&#103;&#101;&#116;&#116;&#121;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+</a>
+</font>
+</a>
+<br>
+Some delay is possible due to
+&#103;&#114;&#101;&#121;&#108;&#105;&#115;&#116;&#105;&#110;&#103;&#46;
+
+<h2>Benefits</h2>
+<ul>
+<li>
+ one process (instead of many) using
+ minimal <a href="#Resources">resources</a>
+</li><li>
+ work with different <a href="#Login">login</a> applications
+<br>
+ can start any program with arbitrary arguments
+</li><li>
+ easy to start by
+ <a href="#Init_d"><tt>init.d</tt></a>
+or
+ <a href="#Inittab"><tt>/etc/inittab</tt></a><br>
+ easy to start by other <a href="#Init">init</a> systems
+</li><li>
+ makes <b>utmp/wtmp</b> records<br>
+ no need of <b>ngetty</b>-monitoring by some other process
+</li><li>
+ easy to setup modifying <tt>/etc/ngetty/Conf[.sed]</tt>
+</li><li>
+ modular (<tt>ngetty-helper</tt> and
+ <tt>ngetty-argv</tt>)
+</li><li>
+ easy to upgrade <tt>ngetty-helper</tt><br>
+ <tt>cp /path/to/new/ngetty-helper /sbin</tt>
+</li><li>
+ uses minimal <tt>libc</tt> library functions<br>
+ easy to build by
+ <a href=http://www.fefe.de/dietlibc/>dietlibc</a> -
+ <tt>make CC='diet -Os gcc'</tt>
+</li><li>
+ small code size with <a href=guarantee.html>security</a> guarantee
+<li>
+</ul>
+
+<h2>Install</h2>
+Ready to use binary packages are
+<a href=binary/>here</a>.
+I prepared them using
+<pre>
+ make package CC='diet -Os gcc -W'
+ make rpm
+</pre>
+
+If you have
+<a href=http://www.fefe.de/dietlibc/>
+dietlibc</a> already installed do
+<pre>
+ wget http://riemann.fmi.uni-sofia.bg/ngetty/ngetty-1.1.tar.gz
+ gzip -dc ngetty-1.1.tar.gz | tar -xv
+ cd ngetty-1.1
+ # Read the ngetty.8 manual page (man ./ngetty.8)
+ # Browse lib.h (check if the LOGIN path is correct!)
+ # Edit Makefile to taste
+ make CC='diet -Os gcc -W'
+ make install
+ # If you want to install some additional programs do:
+ make install_other
+</pre>
+To compile <tt>ngetty</tt> with glibc skip <tt>CC=...</tt> above.
+<pre>
+ make
+ make install
+</pre>
+It is possible to do also
+<pre>
+ make dietbuild
+ make install
+</pre>
+Last download and install dietlibc in current dir and then
+compile ngetty. It takes
+1-2 minutes to build dietlibc (depends on how fast ist your CPU).
+See also <a href=pr_other.html>here</a>.
+
+<h2>Post install</h2>
+Browse the files: <tt>/etc/ngetty/Conf[.sed], /etc/ngetty/sample.Conf</tt>
+<br>
+<a name="Init_d">
+Execute <tt>./init.d/ngetty start</tt></a>
+<br>
+If all is right you'll have working terminals on
+<br>
+<tt>/dev/tty{8|9|10}</tt> or <tt>/dev/vc/{8|9|10}</tt>
+<br>
+Try to login/logout on some of them.
+<p>
+ Some logins requires the TTY variable. Set it in
+ <tt>/etc/ngetty/Conf</tt>.
+ How to do this see the
+<a href=ngetty.man>manual</a> page of ngetty. Examples:
+<pre>
+ tty4=environ=,TERM=linux,TTY=/dev/tty4
+ tty5=environ=,TERM=linux,TTY=/dev/tty5
+ tty6=environ=,TERM=linux,TTY=/dev/tty6
+</pre>
+If you can login in the system then
+you can make ngetty default.
+</br>
+You have to edit
+<tt>/etc/inittab</tt> file.
+<p>
+Do this in two steps. Fist comment default getty on
+<tt>tty{4|5|6}</tt>
+<br>
+and edit
+<tt>/etc/inittab</tt> like next:
+<pre>
+ 1:2345:respawn:/sbin/mingetty tty1
+ 2:2345:respawn:/sbin/mingetty tty2
+ 3:2345:respawn:/sbin/mingetty tty3
+ # 4:2345:respawn:/sbin/mingetty tty4
+ # 5:2345:respawn:/sbin/mingetty tty5
+ # 6:2345:respawn:/sbin/mingetty tty6
+
+ # Run ngetty in standard run-levels
+ ng:2345:respawn:/sbin/ngetty 4 5 6
+</pre>
+If your <tt>/etc/inittab</tt> have different entries only comment
+the last three of them and add two lines for ngetty as above.
+Now it's time to reboot the computer. After the reboot
+try to login/logout on <tt>tty{4|5|6}</tt>.
+<p>
+<a name=Inittab>
+If it is successful change <tt>/etc/inittab</tt></a>
+like:
+<pre>
+ # 1:2345:respawn:/sbin/mingetty tty1
+ # 2:2345:respawn:/sbin/mingetty tty2
+ # 3:2345:respawn:/sbin/mingetty tty3
+ # 4:2345:respawn:/sbin/mingetty tty4
+ # 5:2345:respawn:/sbin/mingetty tty5
+ # 6:2345:respawn:/sbin/mingetty tty6
+
+ # Run ngetty in standard run-levels
+ ng:2345:respawn:/sbin/ngetty 1 2 3 4 5 6
+</pre>
+and reboot again.
+<br>
+That's all. You will have one ngetty instead of six
+<tt>{a|f|min}getty</tt>.
+<br>
+If <tt>ngetty</tt> is compiled with dietlibc it will use 16k RAM only.
+<p>
+<font color=red>WARNING</font>:
+May be it's possible to make all without reboot. I don't use
+<tt>/sbin/init</tt> and don't know how to do this. The manual page
+<b>init</b>(8) says to use <tt>kill -HUP 1</tt>
+
+
+<h2><a name="Init">Using ngetty with other init systems</a></h2>
+If you use
+<a href=http://www.fefe.de/minit/>minit</a> or
+<a href=/ninit/>ninit</a> you have
+to make one new service <tt>ngetty</tt>, include it in
+<br>
+<tt>default/depends</tt> and comment running <tt>getty</tt>
+there.
+<p>
+The preparation of service <tt>ngetty</tt> is simple:
+<pre>
+ mkdir /etc/ninit/ngetty
+ cd /etc/ninit/ngetty
+ ( echo '' ; echo TERM=linux ) > environ
+ ( for f in 1 2 3 4 5 6 ; do echo $f ; done ) > params
+ ln -s /sbin/ngetty run
+</pre>
+You can use ngetty also with <a href=http://smarden.org/runit/>runit</a>.
+Start it as ordinary service. Since ngetty does utmp/wtmp records there
+is no need ot any additional setup.
+
+<h2><a name="Login">Using ngetty with other logins</a></h2>
+Ngetty uses the deafult <tt>/bin/login</tt> program.
+It's easy to use another login also.
+<br>
+My login program is
+<a href=/programs/nlogin-0.3-pre.tar.gz>here</a>.
+Copy it to <tt>/bin/nlogin</tt> and add in
+<tt>/etc/ngetty/Conf</tt>
+<pre>
+=login-prog=/bin/nlogin
+</pre>
+
+It's possible to start any program with arbitrary arguments using
+<tt>ngetty-argv</tt> helper.
+<br>
+To use ngetty with <a href=http://www.fefe.de/fgetty/>fgetty</a>
+logins add in <tt>/etc/ngetty/Conf</tt>
+<pre>
+=echo-off
+=login-prog=/bin/login1
+ on debian system replace login1 with fgetty-login
+</pre>
+
+I still use
+startx script with my <a href=/programs/xinit.c>xinit.c</a>.
+
+<p>
+<hr>
+
+Author: Nikola Vladov
+<p>
+Send comments and suggestions using
+ngetty
+<a
+href=#List>&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#45;&#108;&#105;&#115;&#116;</a>
+or
+<a href=/email.html>qform</a>.
+<p>
+Last modified: 26 May 2010.
+<br>
+Some <a href=comments.txt>comments</a> about ngetty.
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/ninit.html b/riemann.fmi.uni-sofia.bg/ninit/ninit.html
new file mode 100644
index 0000000..708382e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/ninit.html
@@ -0,0 +1,395 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>ninit - small Linux/UNIX init</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ninit - a small replacement of init</h1>
+<div class="endtop"></div>
+</div>
+
+Release: &nbsp;
+<!--
+<a href=ninit-0.12.1.tar.bz2>ninit-0.12.1.tar.bz2</a> (stable) &nbsp;
+-->
+<a href=ninit-0.14.tar.bz2>ninit-0.14.tar.bz2</a>
+<br> Author's private <i>/etc/ninit/</i> &nbsp;
+<a href=ninit-data.tar.gz>ninit-data.tar.gz</a> ::
+<a href=http://gitorious.org/arch-ninit/ninit-scripts>archlinux</a>
+<br>
+<p>
+
+<table align=top>
+<td>
+<ul>
+<li><a name='toc0' href='#HowItWorks'>How it works</a></li>
+<li><a name='toc1' href='#Install'>Install</a></li>
+<li><a name='toc2' href='#PostInstall'>Post install</a></li>
+<li><a name='toc4' href=man/>Manpages</a></li>
+</ul>
+</td>
+
+<td>
+<ul>
+<li><a name='toc5' href=all.html>Download</a></li>
+<li><a name='toc3' href='#Updating'>Updating <tt>ninit</tt></a></li>
+<li><a name='toc6' href=FAQ.html>FAQ</a></li>
+<li><a name='toc10' href=ninit-html.tar.bz2>HTML</a></li>
+</ul>
+</td>
+
+<td>
+<ul><li><a name='toc11' href='#HaltReboot'>Halt &amp; Reboot</a></li>
+<li><a name='toc8' href=subdirs.html>Subdirs</a> -
+<font color=magenta>read me!</font></li>
+<li><a name='toc888' href=files.html>Files</a> -
+<font color=magenta>read me!</font></li>
+
+<li><a name='toc9' href="subdirs.html#Services">Creating</a> services</li>
+</ul>
+</td>
+<!--
+11
+-->
+</table>
+
+<p>
+<a href=/ninit/guarantee.html>The ninit security guarantee</a>
+<!--
+<br>
+<a href=LK/>Linux-Kongress 2009 submission</a>
+-->
+
+<h2><a name="New">What's new</a></h2>
+<ul>
+<li> 20100116 - version
+ <a href=ninit-0.14.tar.bz2>ninit-0.14.tar.bz2</a> uploaded.
+</li>
+<li> 20090110 - version
+ <a href=old/ninit-0.13.tar.bz2>ninit-0.13.tar.bz2</a> uploaded.
+</li>
+<!--
+<li> 20080103 - version
+ <a href=old/ninit-0.12.1.tar.bz2>ninit-0.12.1.tar.bz2</a> uploaded.
+</li>
+<li> 20071102 - version
+ <a href=old/>ninit-0.12.tar.bz2</a> uploaded.
+</li>
+<li> 20071025 - version
+ <a href=old/>ninit-0.11.2.tar.bz2</a> uploaded.
+ Ninit have buildin cron and uses only 8K RAM (two pages).
+</li>
+-->
+<li> 20071010 - mailing lists for ninit.</li>
+</ul>
+
+<h2><a name="About">About</a></h2>
+<b>ninit</b> is a fork from Felix von Leitner's
+<a href=http://www.fefe.de/minit/>minit</a>.
+Some other related <a href=links.html>links</a>.
+<br>
+<!--
+Like any other piece of software (and information generally),<br>
+ninit comes with NO WARRANTY.
+<p>
+-->
+<a name=List>
+There is a
+&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#32;&#108;&#105;&#115;&#116;
+for ninit. To &#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#44;
+send an empty &#109;&#101;&#115;&#115;&#97;&#103;&#101;
+to <br>
+<font size=+1>
+<a href=
+&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+>
+&#110;&#105;&#110;&#105;&#116;&#45;&#115;&#117;&#98;&#115;&#99;&#114;&#105;&#98;&#101;&#64;&#114;&#105;&#101;&#109;&#97;&#110;&#110;&#46;&#102;&#109;&#105;&#46;&#117;&#110;&#105;&#45;&#115;&#111;&#102;&#105;&#97;&#46;&#98;&#103;
+</a>
+</font>
+</a>
+<br>
+Some delay is possible due to
+&#103;&#114;&#101;&#121;&#108;&#105;&#115;&#116;&#105;&#110;&#103;&#46;
+
+<p>
+<b>ninit</b> uses minimal resources (arch: i386; kernel: 2.4.37):
+<pre>
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
+ root 1 0.0 0.0 8 8 ? S Oct08 0:03 /sbin/ninit
+
+ text data bss dec hex filename
+ 3642 20 56 3718 e86 /sbin/ninit
+</pre>
+
+<h2><a name="Install">Install</a></h2>
+You have to build and install ninit first. I prefer to do this
+with Fefe's <a href=http://www.fefe.de/dietlibc/>dietlibc</a>.
+<br>
+Download the latest stabe
+ <a href=http://riemann.fmi.uni-sofia.bg/ninit/ninit-0.14.tar.bz2>
+ ninit-0.14.tar.bz2</a> release. Then:
+
+<pre>
+ bzip2 -dc ninit-0.14.tar.bz2 | tar -xvf -
+ cd ninit-0.14
+
+Case-A: If you have dietlibc already working do:
+ $ make withdiet; make tests
+ # make install
+
+Case-B: If you do not have dietlibc do:
+ $ make dietbuild; make tests
+ # make install
+</pre>
+To compile <tt>ninit</tt> with glibc do:
+<pre>
+ $ make nodiet; make tests
+ # make install
+</pre>
+Only <tt>make install</tt> must be started as root!
+Other install instructions are <a href=install.html>here</a>.
+You can type also <tt>make strip</tt> before <tt>make install</tt>.
+The distributions
+<b><font color=magenta>should read</font></b>
+this <a href=install.html#Warning>warning</a>.
+
+<h2><a name="PostInstall">Post install</a></h2>
+
+You have to prepare service directory <tt>/etc/ninit</tt>
+and to setup
+<br>
+boot loader (grub or lilo) to start
+<tt>/sbin/ninit</tt> instead of <tt>/sbin/init</tt>
+<p>
+
+<h4>Preparing directory <tt>/etc/ninit</tt></h4>
+
+<b>Case A.</b>
+
+If you already have <tt>ninit</tt> running, then you
+already have this directory and can skip to
+<a href='#Updating'>updating</a> ninit.
+<p>
+<b>Case B.</b> If you already have
+<tt><a href="http://www.fefe.de/minit/">minit</a></tt> running do
+simply:
+<a name="SamePipes">
+<pre>
+ cd /etc && cp -p -R minit/* ninit
+</pre>
+</a>
+
+<b>Case C.</b> If your default init is <tt>/sbin/init</tt> it's also
+easy.
+<br>
+I wrote a simple converter
+<tt><a href=man/inittab.man>ninit-inittab</tt></a>.
+Try it with:
+<pre>
+ /sbin/ninit-inittab /etc/inittab /etc/ninit /tmp/ninit.sh
+ /tmp/ninit.sh
+</pre>
+Last two commands are equivalent to:
+<pre>
+ make ser_vi_ces
+</pre>
+<hr>
+
+<h4>Setup lilo/grub to boot <tt>/sbin/ninit</tt></h4>
+
+To use <tt>ninit</tt> as system init add the parameter
+<tt>init=/sbin/ninit</tt>
+<br>
+to your kernel command line.
+See some short instructions <a href=boot.html>here</a>.
+<br>
+After that you have to reboot the system.
+
+<h2><a name="Updating">Updating <tt>ninit</tt></a></h2>
+If <tt>ninit</tt> is already running your boot loader is
+already prepared to start <tt>/sbin/ninit</tt>. After
+installation all is done automatically. Simply do nothing more!
+<p>
+You can test the new executable (before <tt>make install</tt>)
+also with:
+<pre>
+ /sbin/ninit-reload -v -u /path/to/new/ninit
+ cp /path/to/new/ninit /sbin
+ cp /path/to/new/ninit-reload /sbin
+ /sbin/ninit-reload -v -u /sbin/ninit
+</pre>
+
+<h2><a name="HowItWorks">How it works</a></h2>
+
+For ninit, everything is a service, which should either be started
+once or respawned. Ninit expects its configuration in the
+<tt>/etc/ninit</tt> directory.
+You have to create
+all services in this directory
+manually or using the program
+<tt><a href=man/inittab.man>ninit-inittab</tt></a>.
+My private <a href=ninit-data.tar.gz>ninit-data.tar.gz</a>
+and <a href=ls-R.txt>ls-R</a> are also public.
+
+<p>
+Ninit searches for a file called
+<tt><a href="files.html#Depends">depends</a></tt> in the subdirectory
+<tt><a href="subdirs.html#Default">default</a></tt>.
+This file tells ninit which services should be
+started by default (in fact it tells ninit that the service
+<tt>default</tt>
+depends on other services, but <tt>default</tt> is the directory ninit
+starts to search in). Instead of the file <tt>default/depends</tt> it is
+possible to start services with
+<a href=man/scan.man>ninit-scan</a>.
+
+<!--
+Special subdirectories and files are described
+<a href="#Special">here</a>.
+-->
+
+<p>
+Ninit doesn't start services alone. It uses the helper program
+<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt>
+to start a service. On this way ninit doesn't parse
+the service instructions in the corresponding directory.
+This keeps ninit small and it's easy to change
+<tt>/etc/ninit/sys/run</tt>.
+
+<p>
+There is a companion utility
+<tt>/bin/<a href=man/nsvc.man>nsvc</a></tt>
+that can be used much in the same
+way as the
+<tt><a href=http://cr.yp.to/daemontools/svc.html>svc</a></tt>
+from daemontools.
+Communication works over two fifos,
+<tt>/etc/ninit/{in|out}</tt>.
+Those have to exist before ninit is
+started and they should be owned by root and have mode 600.
+<!--
+<br>
+If on box also exist
+<a href=http://www.fefe.de/minit/>minit</a> then ninit must
+use minit's
+<a href="#SamePipes">fifos</a>.
+-->
+
+<p>
+While <tt>sys/run</a></tt> is the main
+<tt><a href=man/ninit.man>ninit</a></tt> helper,
+there are
+also four auxiliary helpers
+<tt><a href=man/pidfile.man>ninit-pidfile</a></tt>,
+<tt><a href=man/pututmpid.man>pututmpid</a></tt>,
+<tt><a href=man/runlevel.man>ninit-runlevel</a></tt> and
+<tt><a href=man/sysvinit.man>ninit-sysvinit</a></tt>
+used to start services.
+<pr>The last three helpers
+emulate <tt>/sbin/init</tt> behavior.
+
+<!--
+<h2><a name="Programs">Programs</a></h2>
+<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt> - ninit helpler
+-->
+
+
+<h2><a name="HaltReboot">Shutdown and reboot</a></h2>
+On a box running
+<b>ninit</b> as process no 1 it is better to avoid using the SysVinit
+programs shutdown, reboot, and halt. First, check the directory
+<tt>/etc/ninit</tt>. Assuming you have the services
+<tt>{_l0|halt}</tt> and
+<tt>{_l6|reboot}</tt>, you can try
+<pre>
+ nsvc -o halt
+ nsvc -o reboot
+</pre>
+If you have service <a href="subdirs.html#Ctrlaltdel">ctrlaltdel</a> then
+<tt>CTRL-ALT-DELETE</tt> halts the hox.
+<p>
+
+
+The converter
+<tt><a href=man/inittab.man>ninit-inittab</a></tt>
+can
+usually create these services for you. If they are still missing, the
+last choice is to use the program
+<tt><a href=man/shutdown.man>ninit-shutdown</a></tt>,
+or alternatively
+the SysVinit programs <i>shutdown, reboot, halt</i>.
+Other problems with halt are described
+<a href="FAQ.html#q11">here</a>..
+
+<h2>Future</h2>
+
+<ul>
+<li>explain why I decide to fork from Felix's <tt>minit</tt>
+<li>write this page better (see also <a href=man/README>here<a>)
+<li>tutorial for
+<a href="subdirs.html#Services">creating</a> services (partially done)
+<!--
+<li>explain the entries <tt>update_links</tt>,
+<tt>ser_vi_ces</tt> and <tt>distro</tt> in Makefile
+<li>explain why I decide to make one daemon as two separate programs:
+<br>
+<tt>/sbin/<a href=man/ninit.man>ninit<a></tt>
+and <tt>/etc/ninit/<a href=man/run.html>run</a></tt>. Last program
+only start a service and exit.</li>
+-->
+<li>explain better some new features of <tt>ninit</tt> which
+are missing in <tt>minit</tt> (see also
+<a href=FAQ.html#q12>here</a>).
+<li>explain all compile options included in the file
+<tt>ninitfeatures.h</tt>
+</ul>
+
+<!--
+<h2>Translation table</h2>
+between minit and ninit programs:
+<pre>
+ /bin/msvc -> /bin/nsvc
+ /sbin/minit -> /sbin/ninit
+ /sbin/minit-update -> /sbin/ninit-reload
+ /sbin/hard-reboot -> /sbin/ninit-reboot
+ /sbin/mshutdown -> /sbin/ninit-shutdown
+</pre>
+It's possible to make a link
+<pre>
+ cd /bin && ln -s nsvc msvc
+</pre>
+and continue to use <tt>msvc</tt> in shell scripts.
+How to use <tt>pidfilehack</tt> see also
+<a href="FAQ.html#q3">here</a>.
+-->
+
+<h2>See also</h2>
+Here are the package <a href=README>README</a>
+and <a href=CHANGES>CHANGES</a>.
+Almost all for <b>minit</b> is true for <b>ninit</b> also.
+<br>
+Other related <a href=links.html>links</a>.
+
+
+<h2>Author: Nikola Vladov</h2>
+If you like <b>ninit</b>, try also my
+<a href=/ngetty/>
+ngetty</a> - single daemon for all virtual consoles.
+<br>
+Send comments and suggestions using ninit
+<a href=#List>&#109;&#97;&#105;&#108;&#105;&#110;&#103;&#45;&#108;&#105;&#115;&#116;</a> or
+<a href=&#47;&#101;&#109;&#97;&#105;&#108;&#46;&#104;&#116;&#109;&#108;>
+qform</a>.
+<br>
+<b><font color=red>WARNING</font></b>:
+ninit is tested only on i386 and x86_64 arch.
+
+<p>
+Last modified: Feb 11 2010
+<br><br><br><br><br><br><br><br>
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/packages/index.html b/riemann.fmi.uni-sofia.bg/ninit/packages/index.html
new file mode 100644
index 0000000..0c91cc5
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/packages/index.html
@@ -0,0 +1,12 @@
+<html>
+<head><title>Index</title></head>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<h2>Index</h2>
+<font>
+Parent <a href=../>directory</a>
+<pre>mode size last-change name<hr>
+lrwx Mar 4 07:27 <a href="archlinux">archlinux</a> -&gt; =http://aur.archlinux.org/packages.php?ID=24404
+lrwx Jan 15 19:25 <a href="archlinux-services">archlinux-services</a> -&gt; =http://gitorious.com/arch-ninit
+
+index genereted on <b>Jan 15 2010 19:26 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/style.css b/riemann.fmi.uni-sofia.bg/ninit/style.css
new file mode 100644
index 0000000..51e1a52
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/style.css
@@ -0,0 +1,83 @@
+body {
+ background-color: #FFFFFF;
+ color: #000000;
+}
+
+.top {
+ border: 1px solid #000000;
+ background-color: #66FF66;
+ margin-bottom: 2ex;
+}
+
+.nav {
+ background-color: #FFFFFF;
+ list-style-type: none;
+ margin: 0 0 1px 0;
+ padding-left: 0;
+ float: right;
+ border-left: 1px solid #000000;
+}
+
+.nav li {
+ border-bottom: 1px solid #000000;
+ padding: 1px 2px;
+}
+
+.nav a {
+ text-decoration: none;
+}
+
+h1 {
+ margin: 0.5ex 0.5em;
+}
+
+h2 {
+ background-color: #9999FF;
+ border: 1px solid #000000;
+ padding: 0.25ex 0.5em;
+}
+
+.endtop {
+ clear: both;
+}
+
+.column {
+ float: left;
+ width: 48%;
+ max-width: 28em;
+ min-width: 22em;
+ margin-right: 1ex;
+}
+
+.block {
+ border: 1px solid #000000;
+ margin-bottom: 2ex;
+}
+
+.block h2 {
+ border-top: 0;
+ border-left: 0;
+ border-right: 0;
+ margin: 0;
+}
+
+.block p {
+ margin: 1ex 0.5em;
+}
+
+pre {
+ border: 1px dashed #000000;
+ background-color: #CCCC99;
+ margin-top: 1ex;
+ margin-bottom: 2ex;
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+ padding: 2px;
+}
+
+.paypal {
+ float: left;
+ clear: left;
+ margin-right: 2px;
+ border: 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/ninit/subdirs.html b/riemann.fmi.uni-sofia.bg/ninit/subdirs.html
new file mode 100644
index 0000000..06d2dcd
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/subdirs.html
@@ -0,0 +1,219 @@
+<html>
+<link rel="stylesheet" type="text/css" href="style.css">
+<title>subdirs</title>
+<body>
+
+<div class="top">
+<ul class="nav">
+ <li><a href="all.html">All files</a>
+</ul>
+
+<h1>ninit special subdirs</h1>
+<div class="endtop"></div>
+</div>
+
+<table>
+<td>
+<ul>
+<li><a href=#Default>~/default/</a></li>
+<li><a href=#Ctrlaltdel>~/ctrlaltdel/</a></li>
+<li><a href=#Kbreq>~/kbreq/</a></li>
+</ul>
+
+<td>
+<ul>
+<li><a href=#Log>log/</a></li>
+<li><a href=#Halt>~/halt/</a></li>
+<li><a href=#Reboot>~/reboot/</a></li>
+</ul>
+</td>
+
+<td>
+<ul>
+<li><a href="#Services">How to create services</a></li>
+<li><a href="#Examples">Examples</a></li>
+<li><a href="#Converter"><tt>/etc/inittab</tt> -> services</li>
+</ul>
+</td>
+</table>
+
+<h2>/etc/ninit</h2>
+This is ninit HOME.
+Everything else is below this directory.
+See also <a href=man/ninit.man>ninit</a> options.
+
+<h2><a name=Run>~/sys/</a></h2>
+This is the default home of ninit helpers.
+<tt>/etc/ninit/sys/<a href=man/run.html>run</a></tt> is a
+helper program which start
+<a href="files.html#Run">service's</a> <tt>run</tt>.
+
+
+<h2><a name=Ctrlaltdel>~/ctrlaltdel/</a></h2>
+What should be done if <tt>Ctrl+Alt+Del</tt> is pressed?
+If this directory does not exist,
+nothing will happen when you press <tt>Ctrl+Alt+dDel</tt>.
+Usually this is a link to <a href='#Halt'>halt</a> service.
+
+<h2><a name=Kbreq>~/kbreg/</a></h2>
+What should be done if <tt>alt+up-arrow</tt> is pressed. If this
+directory does not exist, nothing will happen when pressing the
+<tt>keyboard-request</tt> (<tt>Alt+UP-Arrow</tt> under x86).
+Usually this is a link to <a href='#Reboot'>reboot</a> service.
+
+<h2><a name="Default">~/default/</a></h2>
+The services ninit starts when booting the system. If this directory
+does not exist, nothing will happen at system startup. Quite bad.
+<p>
+You can start services also from ninit's command line. For example
+if you add to <tt>lilo/grub</tt>
+<pre>
+init=/sbin/ninit srv1 srv2
+</pre>
+then ninit starts <tt>srv1</tt> and <tt>srv2</tt> instead of
+<tt>default</tt>.
+<br>
+See also <a href=man/ninit.man>ninit</a> options.
+
+
+<h2><a name=Halt>~/halt/</a></h2>
+The service must halt the system. If this directory does not
+exist, nothing will happen when halting the system.
+See also <a href=man/shutdown.man>ninit-shutdown</a>.
+
+<h2><a name=Reboot>~/reboot/</a></h2>
+The service must reboot the system. If this directory does not exist,
+nothing will happen at reboot.
+See also <a href=man/shutdown.man>ninit-shutdown</a>.
+
+<h2><a name="Log">log/</a></h2>
+
+If this directory exists (within another service directory), it is
+taken as a log service and ninit start it before the service.
+
+If the log service can not be
+started, current service will block if it writes to stdout.
+<p>
+See also
+<a href=files.html#In>in</a>,
+<a href=files.html#Out>out</a> and
+<a href=files.html#Log>log/</a>.
+
+<br>
+Please, see
+<a href=http://cr.yp.to/daemontools/multilog.html>daemontools</a>
+ for a very good logging tool.
+
+
+<h2><a name="Services">How to create services</a></h2>
+You know already the commands
+<a name=Shell>sh</a>, echo, mkdir, rmdir, ln, id, mkfifo,
+rm, ls, cat?
+<font color=red>If not - very sorry, ninit in not for you yet!</font>
+Continue to use /sbin/init!
+<p>
+The files depends, params, environ, wait, soflimit, pidfile
+can be creted with <tt>echo</tt> or a text editor like <tt>vi/emacs</tt>.
+See also <a href=files.html>here</a>. The program
+<a href=man/service.man>ninit-service</a> displays a service dir nice.
+
+<ul>
+<li>the first letter of a service must be [a-z|A-Z]</li>
+<li>what start the service <tt>aW2Ute-Po</tt>? avoid such names!</li>
+<li>don't use very long names</li>
+<li>avoid symbolic/hard links. See the scenario:
+<pre>
+ test -d srv && ln -s srv srv_double
+ nsvc -u srv
+ nsvc -u srv_double
+ nsvc -L
+</pre>
+ What happen? Both are running :-)
+ </li>
+<!--
+<li>don't make service <tt>poweroff</tt>.
+ In the future I will catch the signal SIGPWR
+ and it will start this service.
+-->
+<li>avoid also names <tt>/etc/ninit/{etc|usr|bin|var|tmp|sys}</tt>
+</li>
+<li>I will use for system services only the letters [a-z]. So
+ <tt>sys-test</tt> is good name.
+ </li>
+</ul>
+
+<h2><a name=Examples>Examples</h2>
+Not ready yet! See my private tar-ed
+<a href=ninit-data.tar.gz>directory</a>
+and <a href=ls-R.txt>list</a>.
+<br>
+I will show only one dnscache service.
+<pre>
+ ls -l /etc/dnscache
+ -rw-r--r-- root root 8 Jan 18 2007 depends
+ -rw-r--r-- root root 131 Jan 17 2007 environ
+ lrwxrwxrwx root root 18 Jan 18 2007 in -> /etc/dnscache/seed@
+ lrwxrwxrwx root root 12 Dec 20 2006 out -> ../logger/in@
+ -rw-r--r-- root root 0 Dec 21 2006 respawn
+ lrwxrwxrwx root root 23 Jan 17 2007 run -> /usr/local/bin/dnscache@
+ -rw-r--r-- root root 32 May 20 23:55 softlimit
+</pre>
+
+<pre>
+ cat /etc/ninit/dnscache/depends
+ tynydns
+</pre>
+
+<pre>
+ cat /etc/ninit/dnscache/environ
+ UID=208
+ GID=502
+ ROOT=/etc/dnscache/root
+ IP=127.0.0.1
+ IPSEND=0.0.0.0
+ CACHESIZE=286600
+ DUMPCACHE=7200:dump/data
+ SLURPCACHE=dump/data
+</pre>
+
+<pre>
+ cat /etc/ninit/dnscache/softlimit
+ o250
+ m1500000
+ d3000000
+ f1000000
+</pre>
+
+The variable DUMPCACHE is defined in my
+<a href=http://riemann.fmi.uni-sofia.bg/docs/djbdns-dumpcache.html>
+djbdns-dumpcache</a> patch.
+
+
+
+<h2><a name=Converter><tt>/etc/inittab</tt> -> services</h2>
+
+The conveter
+<a href=man/inittab.man>ninit-inittab</a> make a service
+using the first field in <tt>/etc/inittab</tt>. In most cases
+gettys are _1,_2,_3,_4,_5,_6. You can do
+<pre>
+ sed -e '/getty/s/^/T/' /etc/inittab > /tmp/inittab
+ ninit-inittab /tmp/inittab /etc/ninit /tmp/ninit.sh
+ /tmp/ninit.sh
+</pre>
+Then your services for gettys will be _T1,_T2,_T3,_T4,_T5,_T6.
+<p>
+Similarly you can edit first a copy of <tt>/etc/inittab</tt>
+and obtain a shell script creating services.
+You can copy/exec only parts of the output script.
+<p>
+
+See also
+<a href=http://smarden.org/ipsvd/examples.html>here</a> for some
+network services. The greatest rule is
+<a href=#Shell>here</a>!
+
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
+</body>
+</html>
diff --git a/riemann.fmi.uni-sofia.bg/ninit/test/index.html b/riemann.fmi.uni-sofia.bg/ninit/test/index.html
new file mode 100644
index 0000000..5d64521
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/ninit/test/index.html
@@ -0,0 +1,31 @@
+<html>
+<head><title>Index</title></head>
+<body bgcolor="#99cc99" text="#000000" link="#2020ff" vlink="red">
+<h2>Index</h2>
+<font>
+Parent <a href=../>directory</a>
+<pre>mode size last-change name<hr>
+-r-- 59k Jul 4 2009 <a href="ninit-0.13.1.1.tar.bz2">ninit-0.13.1.1.tar.bz2</a>
+-r-- 59k Jul 4 2009 <a href="ninit-0.13.1.2.tar.bz2">ninit-0.13.1.2.tar.bz2</a>
+-r-- 59k Jul 5 2009 <a href="ninit-0.13.1.3.tar.bz2">ninit-0.13.1.3.tar.bz2</a>
+-r-- 59k Jul 6 2009 <a href="ninit-0.13.1.4.tar.bz2">ninit-0.13.1.4.tar.bz2</a>
+-r-- 59k Dec 2 2009 <a href="ninit-0.13.5.tar.bz2">ninit-0.13.5.tar.bz2</a>
+-r-- 60k Dec 11 2009 <a href="ninit-0.13.6.tar.bz2">ninit-0.13.6.tar.bz2</a>
+-r-- 60k Dec 16 2009 <a href="ninit-0.13.7.tar.bz2">ninit-0.13.7.tar.bz2</a>
+-r-- 61k Dec 16 2009 <a href="ninit-0.14-rc1.tar.bz2">ninit-0.14-rc1.tar.bz2</a>
+-r-- 61k Dec 18 2009 <a href="ninit-0.14-rc2.tar.bz2">ninit-0.14-rc2.tar.bz2</a>
+-r-- 62k Dec 23 2009 <a href="ninit-0.14-rc3.tar.bz2">ninit-0.14-rc3.tar.bz2</a>
+-r-- 63k Dec 24 2009 <a href="ninit-0.14-rc4.tar.bz2">ninit-0.14-rc4.tar.bz2</a>
+-r-- 67k Dec 30 2009 <a href="ninit-0.14-rc5.tar.bz2">ninit-0.14-rc5.tar.bz2</a>
+-r-- 68k Jan 13 2010 <a href="ninit-0.14-rc6.tar.bz2">ninit-0.14-rc6.tar.bz2</a>
+-r-- 70k Feb 10 2010 <a href="ninit-0.14.1.tar.bz2">ninit-0.14.1.tar.bz2</a>
+-r-- 70k Nov 30 15:32 <a href="ninit-0.14.2.tar.bz2">ninit-0.14.2.tar.bz2</a>
+-r-- 70k Dec 17 00:57 <a href="ninit-0.14.3.tar.bz2">ninit-0.14.3.tar.bz2</a>
+-r-- 71k Dec 23 22:16 <a href="ninit-0.15-rc1.tar.bz2">ninit-0.15-rc1.tar.bz2</a>
+-r-- 71k Dec 28 21:02 <a href="ninit-0.15-rc2.tar.bz2">ninit-0.15-rc2.tar.bz2</a>
+-r-- 71k Dec 31 06:57 <a href="ninit-0.15-rc3.tar.bz2">ninit-0.15-rc3.tar.bz2</a>
+-r-- 72k Jan 24 12:36 <a href="ninit-0.15-rc4.tar.bz2">ninit-0.15-rc4.tar.bz2</a>
+-r-- 72k Feb 2 07:41 <a href="ninit-0.15-rc5.tar.bz2">ninit-0.15-rc5.tar.bz2</a>
+
+index genereted on <b>Feb 2 2011 07:41 GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a></pre>
+</font></body></html>
diff --git a/riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c b/riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c
new file mode 100644
index 0000000..1f3ed6a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c
@@ -0,0 +1,521 @@
+/*
+ mkhtmlindex.c
+ gcc -O2 -s -o mkhtmlindex mkhtmlindex.c -Wall -W
+ diet -Os gcc -nostdinc -O2 -s -o mkhtmlindex mkhtmlindex.c -Wall -W
+
+ large file support:
+ gcc -O2 -DSUPPORT_64BIT_FILESIZE -s -o mkhtmlindex mkhtmlindex.c -Wall -W
+ diet -Os gcc -nostdinc -O2 -DSUPPORT_64BIT_FILESIZE -s -o mkhtmlindex mkhtmlindex.c -Wall -W
+
+ source: http://riemann.fmi.uni-sofia.bg/programs/
+ binary: http://riemann.fmi.uni-sofia.bg/utils/
+*/
+
+#ifdef SUPPORT_64BIT_FILESIZE
+#define _FILE_OFFSET_BITS 64
+typedef unsigned long long humank_t;
+#else
+typedef unsigned long humank_t;
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include <dirent.h>
+#include <alloca.h>
+#include <stdlib.h>
+#include <stdio.h> /* gcc rename */
+#define INC_HEADER ".#header"
+#define INC_TAILER ".#tailer"
+#define EXCLUDE ".#exclude"
+#define IDX_TMP ".#index.html"
+#define IDX_DENY ".#deny"
+
+#ifndef __dietlibc__
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0200000 /* must be a directory */
+#endif
+#endif
+
+typedef struct stralloc {
+ char* s;
+ unsigned long int len;
+ unsigned long int a;
+} stralloc;
+
+unsigned int fmt_ulong(register char *s, register unsigned long u) {
+ register unsigned int len; register unsigned long q;
+ len = 1; q = u;
+ while (q > 9) { ++len; q /= 10; }
+ if (s) {
+ s += len;
+ do { *--s = '0' + (u % 10); u /= 10; } while(u); /* handles u == 0 */
+ }
+ return len;
+}
+
+unsigned int fmt_humank(char* dest, humank_t l) {
+ char unit;
+ int i;
+ if (l<1000) return fmt_ulong(dest,l);
+#ifdef SUPPORT_64BIT_FILESIZE
+ if (l>1024*1024*1024*1024ull) {
+ l=(l+(1024*1024*1024*1024ull/20))/(1024*1024*1024*1024ull/10);
+ unit='T';
+ } else
+#endif
+ if (l>1024*1024*1024) {
+ l=(l+(1024*1024*1024/20))/(1024*1024*1024/10);
+ unit='G';
+ } else if (l>1024*1024) {
+ l=(l+(1024*1024/20))/(1024*1024/10);
+ unit='M';
+ } else {
+ l=(l+(1024/20))/(1024/10);
+ unit='k';
+ }
+ i=fmt_ulong(dest,l/10);
+ if (i<2) {
+ if (dest) dest[i]='.'; i++;
+ if (dest) dest[i]=(l%10)+'0'; i++;
+ }
+ if (dest) dest[i]=unit; i++;
+ return i;
+}
+
+struct tm *gmtime_r(const time_t *t, struct tm *tm) {
+ unsigned long day, mon, year, yday=0, tod;
+
+ tod = (unsigned long)(*t) % 86400;
+ day = (unsigned long)(*t) / 86400;
+ tm->tm_wday = ((day+4) % 7);
+ tm->tm_sec = tod%60; tod /= 60;
+ tm->tm_min = tod%60;
+ tm->tm_hour = tod/60;
+
+ year = 4*day + 2;
+ year /= 1461;
+
+ day += 671;
+ day %= 1461; /* day 0 is march 1, 1972 */
+ if (day < 306) yday = 1;
+ if (day == 1460) { day = 365; yday = 59; }
+ else { day %= 365; yday += (day + 59) % 365; }
+
+ day *= 10;
+ mon = (day + 5) / 306;
+ day = day + 5 - 306 * mon;
+ day /= 10;
+ if (mon >= 10) mon -= 10;
+ else mon += 2; /* day 0,1,30, mon 0..11, year 1970=0,1,2 */
+
+ tm->tm_year = year+70;
+ tm->tm_mon = mon;
+ tm->tm_mday = day+1;
+ tm->tm_yday = yday;
+ return tm;
+}
+
+static int fmt_hour(char *dest, unsigned int h, unsigned int m) {
+ dest[0] = '0' + (h/10);
+ dest[1] = '0' + (h%10);
+ dest[2] = ':';
+ dest[3] = '0' + (m/10);
+ dest[4] = '0' + (m%10);
+ return 5;
+}
+
+typedef struct buffer {
+ char *x; /* actual buffer space */
+ unsigned int p; /* current position */
+ unsigned int n; /* string postition */
+ unsigned int a; /* allocated buffer size */
+ int fd;
+ int (*op)(int,char *,unsigned int);
+} buffer;
+
+extern int safe_write(int fd,char *s,unsigned int len);
+char out_space[4096];
+buffer out_buf = { out_space,0,0,sizeof(out_space),1,safe_write };
+buffer dir_buf = { out_space,0,0,sizeof(out_space),-1,safe_write };
+
+static int buffer_flush(buffer* b) {
+ register int p;
+ if (!(p=b->p)) return 0; /* buffer already empty */
+ b->p=0;
+ if (p != b->op(b->fd,b->x,p)) return -1;
+ return 0;
+}
+
+int buffer_put(buffer* b,char* buf,unsigned int len) {
+ if (len>b->a-b->p) { /* doesn't fit */
+ if (buffer_flush(b)==-1) return -1;
+ if (len>b->a) {
+ if (len != (unsigned int)b->op(b->fd,buf,len)) return -1;
+ return 0;
+ }
+ }
+ memcpy(b->x+b->p, buf, len);
+ b->p+=len;
+ return 0;
+}
+
+int out(char *s) {return buffer_put(&out_buf,s, strlen(s));}
+int outb(char* s,unsigned int len) {return buffer_put(&out_buf,s,len);}
+
+int fd=-1,fd_err=1;
+static char *months = "JanFebMarAprMayJunJulAugSepOctNovDec";
+static char *hex = "0123456789abcdef";
+
+void err(char *s)
+ {write(fd_err,"error: ",7); write(fd_err,s,strlen(s)); _exit(1);}
+int safe_write(int fd,char *s, unsigned int len) {
+ int r;
+ unsigned int u=len;
+ while (u) {
+ if ((r=write(fd,s,u))==0) break;
+ if (r==-1) {if (errno==EINTR) continue; break;}
+ s += r; u -= r;
+ }
+ if (u) err("write output\n");
+ return len-u;
+}
+void outh(char *s) {
+ for (; *s; s++)
+ switch (*s) {
+ case '\"': out("&quot;"); break;
+ case '&': out("&amp;"); break;
+ case '>': out("&gt;"); break;
+ case '<': out("&lt;"); break;
+ default: outb(s,1);
+ }
+}
+void outu(char *s) {
+ char c, x[3];
+ x[0] = '%';
+ for (; *s; s++) {
+ if ((c=*s)!='"' && c!='%' && c>=' ' && c!='+') {
+ outb(s,1);
+ } else {
+ x[1] = hex[c>>4];
+ x[2] = hex[c&15];
+ outb(x,3);
+ }
+ }
+}
+
+int include_fd(int fd) {
+ char buf[1024];
+ int r;
+ for (;;) {
+ if ((r=read(fd,buf,sizeof buf))==0) break;
+ if (r==-1) {if (errno==EINTR) continue; break;}
+ outb(buf,r);
+ }
+ return r;
+}
+
+struct d {
+ struct d *next;
+ humank_t size;
+ time_t time;
+ char mode[4];
+};
+
+int byname(struct d** a,struct d** b) {
+ return strcmp((char*)(*a)+sizeof(struct d),
+ (char*)(*b)+sizeof(struct d));
+}
+
+int bysize(struct d** a,struct d** b) {
+ if ((*a)->size>(*b)->size) return 1;
+ else if ((*a)->size<(*b)->size) return -1;
+ else return byname(a,b);
+}
+
+int bytime(struct d** a,struct d** b) {
+ int res=(*b)->time-(*a)->time;
+ if (res) return res;
+ return byname(a,b);
+}
+
+int (*compare)(const void *a,const void *b)=(int (*)(const void *,const void *))byname;
+
+void fmt_mode(char *x, mode_t mode) {
+ memset(x,'-',4);
+ if (S_ISLNK(mode)) x[0]='l';
+ else if (S_ISDIR(mode)) x[0]='d';
+ if ((mode&0444) == 0444) x[1]='r';
+ if (mode&2) x[2]='w';
+ if (mode&1) x[3]='x';
+}
+
+mode_t do_chmod(char *s, mode_t mode) {
+ mode_t m=0644;
+ if (S_ISDIR(mode)) m = 0755;
+ else {
+ char *x = strrchr(s, '.');
+ if (x && !strcmp(x,".cgi")) m = 0711;
+ }
+ if ((mode & 07777) != m) {
+ chmod(s, m);
+ mode = (mode & ~07777) | m;
+ }
+ return mode;
+}
+
+void print_link(char *s) {
+ char link[512];
+ int r=readlink(s,link,sizeof(link)-1);
+ outh(" -> ");
+ if (r > 0) { link[r] = 0; outh(link); }
+}
+
+struct dirent* read_dir(buffer *d) {
+ if (d->p >= d->n ||
+ (d->p += ((struct dirent*)(d->x+d->p))->d_reclen) >= d->n) {
+#ifdef __dietlibc__
+ int res = getdents(d->fd, (struct dirent *)d->x, d->a-1);
+#else
+ off_t x;
+ int res = getdirentries(d->fd, d->x, d->a-1, &x);
+#endif
+ if (res<=0) return 0;
+ d->n=res; d->p=0;
+ }
+ return (struct dirent*)(d->x+d->p);
+}
+
+struct d *do_qsort(struct d *root) {
+ unsigned int k;
+ struct d **x, **map, *tmp;
+ if (!root) return root;
+
+ for (k=0,tmp=root; tmp; tmp=tmp->next) k++;
+ if (!(map = alloca((k+1)*sizeof(struct d*)))) err("alloca");
+ for (x=map,tmp=root ;; tmp=tmp->next) { *x++ = tmp; if (!tmp) break; }
+
+ qsort(map,k,sizeof(struct d*),compare);
+
+ for (x=map; *x;) { tmp = *x++; tmp->next = *x; }
+ return map[0];
+}
+
+static stralloc mem_block;
+static void *alloc_a(stralloc *sa, unsigned long len) {
+ len = (len + 3) & (~3);
+ if (!sa->s || sa->len < len) return 0;
+ sa->len -= len;
+ return (void *)sa->s + sa->len;
+}
+
+int main(int argc, char **argv) {
+ struct stat st;
+ int ifd,i=0;
+ struct tm *tm, tm_;
+ time_t now;
+ int flagdir;
+ int flaglink;
+ int flagmode=0;
+ int flagdirent=0;
+ int flagsort = 1;
+ char x[16],*p;
+ char *title=0;
+ char **ee, **exclude=argv;
+ int excl_len=0;
+ struct dirent *de;
+ struct d *tmp, *root_last=0, *root=0;
+
+ for (optind=1; argv[optind] && argv[optind][0]=='-'; optind++) {
+ switch (argv[optind][1]) {
+ case 'm': flagmode=1; break;
+ case 'o': fd=1; fd_err=2; break;
+ case 't': title=argv[optind]+2; break;
+ case 'e': exclude[excl_len++]=argv[optind]+2; break;
+ case 'd': flagdirent=1;
+ case 's':
+ switch (argv[optind][2]) {
+ case 'n': compare=(int (*)(const void *,const void *))byname; break;
+ case 't': compare=(int (*)(const void *,const void *))bytime; break;
+ case 's': compare=(int (*)(const void *,const void *))bysize; break;
+ case 'r': flagsort=0; break;
+ }
+ break;
+ case 'h':
+ default: goto usage;
+ }
+ }
+
+ argc -= (optind);
+ if (!argc && !flagdirent) {
+ usage:
+ err("usage: mkhtmlindex [-m] [-o] [-d] [-tTitle] [-sntsr] [-eName] [file(s)]\n"
+ "\t-m chmod 644/711; -o write to stdout; "
+ "-d read files from disk\n"
+ "\t-sx sort by Name Time Size Raw\n"
+ "\t-ex.gz exclude x.gz; "
+ "similary if file '" EXCLUDE "' exists\n"
+ "\tif file '" INC_HEADER "' exists it is included for header\n"
+);
+ }
+
+ exclude[excl_len] = 0;
+ if (!stat(EXCLUDE, &st)) {
+ int fd,r;
+ char *map,*p;
+ if ((fd=open(EXCLUDE, O_RDONLY)) >= 0) {
+ if (!(map = alloca(st.st_size + 1))) err("alloca");
+ r=read(fd,map,st.st_size);
+ close(fd);
+ if (r>0) {
+ map[r]=0;
+ for (r=excl_len + 4, p=map; *p; ++p) if (*p == '\n') r++;
+ if (!(exclude = alloca(i*sizeof(char *)))) err("alloca");
+
+ memcpy(exclude , argv, excl_len*sizeof(char*));
+ for (ee=exclude+excl_len,*ee=map,p=map; *p; p++)
+ if (*p == '\n') { *p=0; ++ee, *ee = p+1; }
+ ee[1]=0;
+ }
+ }
+ }
+
+ argv += (optind);
+
+ if (flagdirent &&
+ (dir_buf.fd=open(".", O_RDONLY | O_DIRECTORY))==-1) err("open '.'");
+ for (i=0;;) {
+ char *name=0;
+ unsigned int len;
+ if (flagdirent) {if ((de = read_dir(&dir_buf))) name = de->d_name;}
+ else name = *argv++;
+ if (name==0) break;
+ if (name[0]=='.') continue;
+ if (fd != 1 && !strcmp(name, "index.html")) continue;
+ if (lstat(name,&st)) continue;
+ for (ee=exclude; *ee; ee++)
+ if (!strcmp(*ee,name)) break;
+ if (*ee) continue;
+
+ len = strlen(name) +1+ sizeof(struct d);
+ if (!(tmp = alloc_a(&mem_block, len))) {
+ mem_block.a = len + 2000;
+ if (!(mem_block.s = alloca(mem_block.a))) err("alloca");
+ mem_block.len = mem_block.a;
+ tmp = alloc_a(&mem_block,len); /* already allocated */
+ }
+
+ tmp->next = 0;
+ if (!root) root = tmp;
+ else root_last->next = tmp;
+ root_last = tmp;
+
+ strcpy((char*)tmp + sizeof(struct d), name);
+ tmp->time = st.st_mtime;
+ tmp->size = st.st_size;
+ if (flagmode && (S_ISLNK(st.st_mode) == 0))
+ st.st_mode = do_chmod(name, st.st_mode);
+ fmt_mode(tmp->mode, st.st_mode);
+ if (tmp->mode[0] == 'd') tmp->size=0;
+ }
+ if (flagdirent) close(dir_buf.fd);
+ if (flagsort) root = do_qsort(root);
+
+ if (fd == -1) {
+ fd = open(IDX_TMP, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ if (fd == -1) err(IDX_TMP "\n");
+ out_buf.fd=fd;
+ }
+ ifd=open(INC_HEADER,O_RDONLY);
+
+ if (title || ifd==-1) {
+ if (title && !title[0]) title = 0;
+ out("<html>\n<head><title>Index");
+ if (title) {out(" of "); out(title);}
+ out("</title></head>\n");
+ out("<body bgcolor=\"#99cc99\" text=\"#000000\" link=\"#2020ff\" vlink=\"red\">");
+ out("\n<h2>Index");
+ if (title) {out(" of "); out(title);}
+ out("</h2>\n<font>\n");
+ out("Parent <a href=../>directory</a>\n");
+ } else {
+ if (include_fd(ifd)==-1) err("read " INC_HEADER);
+ close(ifd);
+ }
+
+ out("<pre>mode size last-change name<hr>\n");
+
+ for (now=time(0),tmp=root; tmp; tmp=tmp->next) {
+ flaglink= (tmp->mode[0] == 'l');
+ flagdir = (tmp->mode[0] == 'd');
+
+ outb(tmp->mode,4);
+
+ memset(x,' ',sizeof x);
+ if (!flaglink && !flagdir) {
+ i = fmt_humank(0, tmp->size);
+ fmt_humank(x+7-i, tmp->size);
+ }
+ outb(x,9);
+
+ tm = gmtime_r((time_t*)&tmp->time, &tm_);
+ memset(x,' ',sizeof x);
+ p = x+1;
+
+ outb(months +3*tm->tm_mon, 3);
+ if (tm->tm_mday<10) p++;
+ p += fmt_ulong(p, tm->tm_mday) + 1;
+
+ if (now - tmp->time >= 330*86400)
+ p += 1 + fmt_ulong(p+1, 1900+tm->tm_year);
+ else
+ p += fmt_hour(p, tm->tm_hour, tm->tm_min);
+ outb(x,11);
+
+ p = (char*)tmp + sizeof(struct d);
+ out("<a href=\"");
+ outu(p);
+ if (flagdir) out("/index.html");
+ out("\">");
+
+ outh(p);
+ if (flagdir) out("/");
+ out("</a>");
+
+ if (flaglink) print_link(p);
+ out("\n");
+ }
+
+ ifd = open(INC_TAILER,O_RDONLY);
+ if (ifd != -1) {
+ if (include_fd(ifd)==-1) err("read " INC_TAILER);
+ close(ifd);
+ } else {
+ char date[32];
+ out("\nindex genereted on <b>");
+ tm = gmtime_r(&now, &tm_);
+ outb(months +3*tm->tm_mon,3);
+ p=date+1;
+ memset(date,' ',32);
+ if (tm->tm_mday <10) ++p;
+ p += 1+fmt_ulong(p, tm->tm_mday);
+ p += 1+fmt_ulong(p, 1900+tm->tm_year);
+ p += fmt_hour(p, tm->tm_hour, tm->tm_min);
+ outb(date,p-date+1);
+ out("GMT</b> by <a href=http://riemann.fmi.uni-sofia.bg/programs/mkhtmlindex.c>mkhtmlindex</a>");
+ out("</pre>\n</font></body></html>\n");
+ }
+
+ buffer_flush(&out_buf);
+ if (close(fd)) err("close\n");
+ if (fd!=1) {
+ if (chmod(IDX_TMP,0644)) err("chmod\n");
+ if (open(IDX_DENY, O_RDONLY)==-1)
+ if (rename(IDX_TMP, "index.html")) err("rename\n");
+ }
+ return(0);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/CHANGES b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/CHANGES
new file mode 100644
index 0000000..b9e06b3
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/CHANGES
@@ -0,0 +1,5 @@
+added ~/.hushlogin checking for /etc/motd
+added /var/log/faillog support
+
+added nlogin-tiny
+
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/COPYING b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/COPYING
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Makefile b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Makefile
new file mode 100644
index 0000000..be7a581
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Makefile
@@ -0,0 +1,103 @@
+SHELL=/bin/sh
+
+CC=gcc
+CFLAGS=-O2 -Wall -W
+LDFLAGS=-s
+
+CCC = $(CC) $(CFLAGS)
+CCL = $(CC) $(CFLAGS) $(LDFLAGS)
+STR = strip -R .comment -R .note
+
+ALL = nlogin nlogin-auth nlogin-tiny
+
+default: $(ALL)
+
+nlogin: nlogin.c lib.a
+ ${CCL} -o $@ $^
+ @$(STR) $@
+nlogin-%: nlogin-%.c lib.a
+ ${CCL} -o $@ $^
+ @$(STR) $@
+clean:
+ rm -f $(ALL) *.o *.a *.s a.out *_defs.h
+
+install: $(ALL)
+ install -d $(DESTDIR)/bin
+ install -m755 $^ $(DESTDIR)/bin
+
+g_h = ./get_headers
+
+%_defs.h: %_*.c
+ $(g_h) $@ -Gsys/types.h $^ > $@
+str_defs.h: str_*.c
+ $(g_h) $@ -Lbyte_defs.h -Lfmt_defs.h -Lscan_defs.h $^ > $@
+time_defs.h: get_tz.c nv_ctime.c write_dev*.c
+ $(g_h) $@ -Lstr_defs.h $^ > $@
+parse_defs.h: __*.c
+ $(g_h) $@ -Lstr_defs.h $^ > $@
+utmp_defs.h: utmp_*.c safe_io.c log_do.c lastlog_do.c
+ $(g_h) $@ -Ltime_defs.h $^ > $@
+prot_defs.h: prot_*.c read_pass*.c pass_check.c
+ $(g_h) $@ -Gsys/types.h -Lmd5.h $^ > $@
+md5_defs.h: md5*.c
+ $(g_h) $@ $^ > $@
+pw_%_defs.h: nv_*%*.c
+ $(g_h) $@ $^ > $@
+pw_defs.h:
+ $(g_h) $@ -Lstr_defs.h -Lpw_pw_defs.h -Lpw_gr_defs.h \
+ -Lpw_sp_defs.h $^ > $@
+
+%.o: %.c config.h
+ ${CCC} -c $<
+
+STR_O = $(patsubst %.c,%.o,$(wildcard str_*.c))
+BYTE_O = $(patsubst %.c,%.o,$(wildcard byte_*.c))
+SCAN_O = $(patsubst %.c,%.o,$(wildcard scan_*.c))
+FMT_O = $(patsubst %.c,%.o,$(wildcard fmt_*.c))
+PARSE_O = $(patsubst %.c,%.o,$(wildcard __*.c))
+UTMP_O = $(patsubst %.c,%.o,$(wildcard *_io.c *_do.c *_devlog.c))
+TIME_O = $(patsubst %.c,%.o,$(wildcard *ctime.c *_tz.c))
+PASS_O = $(patsubst %.c,%.o,$(wildcard *pass*.c prot_*.c))
+MD5_O = $(patsubst %.c,%.o,$(wildcard md5*.c))
+PW_PW_O = $(patsubst %.c,%.o,$(wildcard nv_*pw*.c))
+PW_GR_O = $(patsubst %.c,%.o,$(wildcard nv_*gr*.c))
+PW_SP_O = $(patsubst %.c,%.o,$(wildcard nv_*sp*.c))
+PW_O = $(PW_PW_O) $(PW_GR_O) $(PW_SP_O)
+
+str_%.o: str_defs.h
+fmt_%.o: fmt_defs.h
+scan_%.o: scan_defs.h
+byte_%.o: byte_defs.h
+nv_%gr%.o: pw_gr_defs.h
+nv_%pw%.o: pw_pw_defs.h
+nv_%sp%.o: pw_sp_defs.h
+md5%.o: md5_defs.h
+__%.o: parse_defs.h
+
+ALL_O = $(STR_O) $(BYTE_O) $(SCAN_O) $(FMT_O) $(PARSE_O) $(PW_O) \
+ $(PASS_O) $(MD5_O) $(UTMP_O) $(TIME_O)
+
+ALL_H = str_defs.h byte_defs.h scan_defs.h fmt_defs.h parse_defs.h \
+ pw_defs.h pw_pw_defs.h pw_gr_defs.h pw_sp_defs.h \
+ utmp_defs.h time_defs.h prot_defs.h md5_defs.h
+
+lib.a: $(ALL_H) $(ALL_O)
+ ar cr lib.a $(ALL_O)
+
+MYARCH:=$(shell uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6]t\?e\?[lb]/arm/')
+dietlibc/bin-$(MYARCH)/diet:
+ cvs -d :pserver:[email protected]:/cvs -z9 co dietlibc
+ cd dietlibc && make
+dietbuild: dietlibc/bin-$(MYARCH)/diet
+ DIETHOME=$(CURDIR)/dietlibc make \
+ CC="$(CURDIR)/$< -Os gcc -nostdinc -I$(CURDIR)/dietlibc/include"
+
+TAR=tar
+TAR_OPT=
+MY_NAME=$(notdir $(CURDIR))
+tar:
+ cd .. && $(TAR) -cvzf $(MY_NAME).tar.gz $(TAR_OPT) \
+ --owner=root --group=root --exclude dietlibc $(MY_NAME)
+packit:
+ ( echo $(MY_NAME); date -u -R ) > Version
+ make clean tar TAR=tar.f TAR_OPT=--sort
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/README b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/README
new file mode 100644
index 0000000..3c5f3c9
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/README
@@ -0,0 +1,22 @@
+http://riemann.fmi.uni-sofia.bg/programs/
+This is the login which I wrote for me.
+
+Build:
+ make
+
+ To compile with dietlibc use
+ make CC='diet -Os gcc -nostdinc'
+
+ It's possible to use also
+ make dietbuild
+
+Install:
+ make install
+ or
+ cp nlogin /bin/
+ cp nlogin-tiny /bin/
+ cp nlogin-auth /bin/nlogin-auth <-- do not change the location !!!
+
+Look also the file config.h included here.
+
+Enjoy, Nikola Vladov
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Version b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Version
new file mode 100644
index 0000000..02c5575
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/Version
@@ -0,0 +1,2 @@
+nlogin-0.3-pre
+Tue, 17 Jun 2008 10:35:26 -0000
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__end_parse.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__end_parse.c
new file mode 100644
index 0000000..03e458d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__end_parse.c
@@ -0,0 +1,10 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include "parselib.h"
+
+void __end_parse(struct state* s) /*EXTRACT_INCL*/{
+ munmap((void*)(s->buffirst),s->buflen);
+ s->buffirst=0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_feed.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_feed.c
new file mode 100644
index 0000000..66b6791
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_feed.c
@@ -0,0 +1,14 @@
+#include <sys/types.h>
+#include "parselib.h"
+
+int __parse_feed(struct state *s, char *buf, unsigned int len) /*EXTRACT_INCL*/{
+ char *p;
+ unsigned int u;
+ again:
+ p = (char *)(s->buffirst) + s->cur;
+ if (!(u = __parse_getline(s,'\n'))) return 0;
+ if (u >= len) goto again; /* very long line; skip it */
+ byte_copy(buf,u,p);
+ buf[u++]=0;
+ return u;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_getline.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_getline.c
new file mode 100644
index 0000000..ed2b53a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_getline.c
@@ -0,0 +1,14 @@
+#include <sys/types.h>
+#include "parselib.h"
+
+size_t __parse_getline(struct state *s, int c) /*EXTRACT_INCL*/ {
+ size_t n;
+
+ for (n=s->cur; n < s->buflen && s->buffirst[n] != c; ++n);
+ n = n-s->cur;
+ s->cur += n;
+
+ /* skip 'c' or emty lines: ^c$ */
+ for (;s->cur < s->buflen && s->buffirst[s->cur] == c;) s->cur++;
+ return n;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_split.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_split.c
new file mode 100644
index 0000000..54e15cf
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__parse_split.c
@@ -0,0 +1,15 @@
+
+int __parse_split(char *p,int buf_len,int c,int maxarg,char *arg[]) /*EXTRACT_INCL*/{
+ int i = 0;
+ char *end = p + buf_len;
+ for (arg[0]=p; p<end; p++) {
+ if (*p == c || *p == 0) {
+ *p = 0;
+ ++i;
+ if (i >= maxarg) break;
+ arg[i] = p+1;
+ }
+ }
+ arg[i] = 0;
+ return i;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__prepare_parse.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__prepare_parse.c
new file mode 100644
index 0000000..1cf86a4
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/__prepare_parse.c
@@ -0,0 +1,22 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include "parselib.h"
+
+void __prepare_parse(const char* filename,struct state* s) /*EXTRACT_INCL*/{
+ int fd;
+ s->cur=0;
+ if (s->buffirst) return; /* already mapped */
+ fd=open(filename,O_RDONLY);
+ if (fd>=0) {
+ s->buflen=lseek(fd,0,SEEK_END);
+ s->buffirst=mmap(0,s->buflen,PROT_READ,MAP_PRIVATE,fd,0);
+ if (s->buffirst==(const char*)-1)
+ s->buffirst=0;
+ close(fd);
+ } else {
+ s->buflen=0;
+ s->buffirst=0;
+ }
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_copy.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_copy.c
new file mode 100644
index 0000000..3d25769
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_copy.c
@@ -0,0 +1,6 @@
+void byte_copy(void *to, unsigned long n, const void *from) /*EXTRACT_INCL*/ {
+ char *d=(char*)to;
+ char *s=(char*)from;
+ unsigned long k=0;
+ for (; k<n; k++) d[k] = s[k];
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_diff.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_diff.c
new file mode 100644
index 0000000..a0bc17e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_diff.c
@@ -0,0 +1,11 @@
+int byte_diff(const void* a, unsigned long len, const void* b) /*EXTRACT_INCL*/ {
+ char *x=(char *)a;
+ char *y=(char *)b;
+ unsigned long u=0;
+ char ch=0;
+ for (; u<len; u++) {
+ ch = x[u] - y[u];
+ if (ch) break;
+ }
+ return ch;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_set.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_set.c
new file mode 100644
index 0000000..33b3d77
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_set.c
@@ -0,0 +1,7 @@
+void byte_set(const void* dst, unsigned long len, char ch) /*EXTRACT_INCL*/ {
+ char *d=(char*)dst;
+ while (len) {
+ --len;
+ d[len] = ch;
+ }
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_zero.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_zero.c
new file mode 100644
index 0000000..0813e05
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/byte_zero.c
@@ -0,0 +1,4 @@
+void byte_zero(const void *a, unsigned long len) /*EXTRACT_INCL*/ {
+ char *x=(char *)a;
+ while (len > 0) x[--len] = 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/config.h b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/config.h
new file mode 100644
index 0000000..50086ea
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/config.h
@@ -0,0 +1,54 @@
+/* feel free to change */
+
+#ifndef CONFIG__H__
+#define CONFIG__H__
+
+#ifdef NV_SETPWENT
+#define DONT_NEED_GECOS
+#define __PASSWD_BUFFER 128
+#define __PASSWD_FILE "/etc/passwd"
+#endif
+
+#ifdef NV_SETGRENT
+#define __GROUP_BUFFER 128
+#define __GROUP_FILE "/etc/group"
+#define SCAN_GROUPS 16
+#endif
+
+#ifdef NV_SETSPENT
+#define DONT_NEED_ALL_SHADOW
+#define __SHADOW_BUFFER 128
+#define __SHADOW_FILE "/etc/shadow"
+#endif
+
+#ifdef LOGIN_PROGRAM
+#define LOGIN_AUTHORITY "/bin/nlogin-auth"
+
+
+/* uncomment some lines to use build-in C functions */
+// #define nv_getpwnam getpwnam
+// #define nv_getspnam getspnam
+// #define nv_gergrnam getgrnam
+// #define nv_initgroups initgroups
+#endif
+
+#ifdef PASS_CHECK_C
+/* define next to use build-in (/lib/libcrypt.so) shared crypt()
+ build with: make ... LDFLAGS='-s -lcrypt' */
+
+// #define USE_BUILDIN_C_CRYPT
+
+#ifndef USE_BUILDIN_C_CRYPT
+#define pass_crypt_appl md5crypt
+#include "md5.h"
+
+#else
+#define pass_crypt_appl crypt
+#include <unistd.h>
+#ifndef __dietlibc__
+#include <crypt.h>
+#endif
+#endif
+#endif
+
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/faillog_do.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/faillog_do.c
new file mode 100644
index 0000000..84e2f83
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/faillog_do.c
@@ -0,0 +1,70 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/types.h>
+#include "str_defs.h"
+#include "utmp_defs.h"
+
+struct faillog {
+ short fail_cnt; /* failures since last success */
+ short fail_max; /* failures before turning account off */
+ char fail_line[12]; /* last failure occured here */
+ time_t fail_time; /* last failure occured then */
+ /*
+ * If nonzero, the account will be re-enabled if there are no
+ * failures for fail_locktime seconds since last failure.
+ */
+ long fail_locktime;
+};
+
+#ifndef NV_PATH_FAILLOG
+#define NV_PATH_FAILLOG "/var/log/faillog"
+#endif
+
+#define FL_SIZE sizeof(struct faillog)
+#define SC(A,B) str_copynz(A, B, sizeof(A))
+
+/*
+ OK==0 failure; 1 good password; -1 only check
+ if return is nonzero login is disabled !!!
+*/
+int faillog_do(unsigned int uid, char *line, int OK) /*EXTRACT_INCL*/{
+ struct faillog fl;
+ off_t offset = uid * FL_SIZE;
+ int fd, ret=0;
+ time_t now;
+
+ fd = open(NV_PATH_FAILLOG, O_RDWR);
+ if (fd<0) return 0;
+
+ if (lseek(fd,offset,SEEK_SET) ==offset && read(fd,&fl,FL_SIZE)==FL_SIZE) {
+ switch (OK) {
+ case 1: fl.fail_cnt = 0; break;
+ case 0:
+ if (fl.fail_max == 0 ||
+ fl.fail_cnt <= fl.fail_max) fl.fail_cnt += 1;
+ }
+ } else
+ byte_zero(&fl, FL_SIZE);
+
+ now = time(0);
+ if (fl.fail_locktime &&
+ fl.fail_time &&
+ (now < fl.fail_time || /* barery failed */
+ now - fl.fail_time > fl.fail_locktime))
+ fl.fail_cnt = 0; /* unlock account */
+
+ if (fl.fail_max > 0 &&
+ fl.fail_cnt > fl.fail_max) ret = -1; /* disable logging */
+
+ fl.fail_time = now;
+ SC(fl.fail_line, line);
+
+ if (lseek(fd, offset, SEEK_SET) ==offset)
+ SAFE_IO(write, fd, &fl, FL_SIZE);
+
+ fsync(fd);
+ close(fd);
+
+ return (OK==1) ? 0 : ret;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/fmt_ulong.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/fmt_ulong.c
new file mode 100644
index 0000000..12ff9f9
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/fmt_ulong.c
@@ -0,0 +1,10 @@
+unsigned int fmt_ulong(register char *s,register unsigned long u) /*EXTRACT_INCL*/ {
+ register unsigned int len; register unsigned long q;
+ len = 1; q = u; /* DJB */
+ while (q > 9) { ++len; q /= 10; }
+ if (s) {
+ s += len;
+ do { *--s = '0' + (u % 10); u /= 10; } while(u); /* handles u == 0 */
+ }
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_headers b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_headers
new file mode 100755
index 0000000..a18b474
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_headers
@@ -0,0 +1,25 @@
+#!/bin/sh
+[ $# -lt 2 ] && exit 1
+
+export PATH=/bin:/usr/bin
+name=`echo $1 | sed -e 's/\./__DOT__/g' -e 's/\//__SLASH__/g'`
+shift
+
+echo '#ifndef' AUTO_FILE__$$__$name
+echo '#define' AUTO_FILE__$$__$name
+echo '/* '`date`' */'
+
+while test $# -gt 0; do
+ case $1 in
+ -L*) echo $1 | sed -e 's/^../#include "/' -e 's/$/"/' ; shift;;
+ -G*) echo $1 | sed -e 's/^../#include </' -e 's/$/>/' ; shift;;
+ -I*) echo $1 | sed -e 's/^../#include /'; shift;;
+ *) break;;
+ esac
+done
+
+if [ $# -gt 0 ] ; then
+ sed -n -e 's/\(.*\) \/\*EXTRACT_INCL\*\/.*/extern \1;/p' \
+ -e 's/ \/\*EXTRACT_UNMOD\*\/.*//p' $@
+fi
+echo '#endif'
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_tz.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_tz.c
new file mode 100644
index 0000000..94b42e1
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/get_tz.c
@@ -0,0 +1,42 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include "parselib.h"
+
+static struct state s;
+
+static int parse(unsigned char *x)
+ {return (x[0]<<24) | (x[1]<<16) | (x[2]<<8) | x[3];}
+
+static time_t time_offset(time_t *t, int forward) {
+ unsigned char *T = (unsigned char *)s.buffirst, *tmp,*x;
+ size_t L = s.buflen;
+ time_t i, k, res, tzh_timecnt;
+ if (!T || L<44) return 0;
+ tzh_timecnt = parse(T+32);
+ tmp=T+44;
+ x=tmp+tzh_timecnt*4;
+ for (i=tzh_timecnt-1; 0<=i; --i) {
+ k = parse(tmp+i*4);
+ if (forward) if (*t < k) continue;
+
+ res = parse(x +tzh_timecnt +6*(unsigned char)x[i]);
+
+ if (forward) return res;
+ else
+ if (k+res <= *t) return -res;
+ }
+ return 0;
+}
+
+time_t get_tz(time_t *t, int forward) /*EXTRACT_INCL*/{
+ if (forward==-1) {
+ __end_parse(&s);
+ s.cur=0;
+ return 0;
+ }
+ if (!s.cur) {
+ __prepare_parse("/etc/localtime",&s);
+ s.cur=1;
+ }
+ return time_offset(t,forward);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/lastlog_do.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/lastlog_do.c
new file mode 100644
index 0000000..f840ea1
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/lastlog_do.c
@@ -0,0 +1,43 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <utmp.h>
+#include <time.h>
+#include "time_defs.h"
+#include "utmp_defs.h"
+#include "prot_defs.h"
+
+#ifndef LASTLOG_FILE
+#define LASTLOG_FILE "/var/log/lastlog"
+#endif
+
+#define SC(A,B) str_copynz(A, B, sizeof(A))
+
+void lastlog_do(char *buf, unsigned int uid, char *line) /*EXTRACT_INCL*/{
+ int fd = open(LASTLOG_FILE, O_RDWR);
+ struct lastlog ll;
+ off_t offset = uid * sizeof ll;
+ char *p=buf;
+
+ p[0] = 0;
+ if (fd<0 || lseek(fd, offset, SEEK_SET) != offset) goto do_close;
+ if (read(fd, &ll, sizeof ll) == sizeof ll && ll.ll_time) {
+ p += str_copy(p, "Last login: ");
+ p += nv_ctime(p, ll.ll_time, 24);
+ p += str_copy(p, " on ");
+ p += str_add(p, ll.ll_line, sizeof ll.ll_line);
+ if (ll.ll_host[0]) {
+ p += str_copy(p, " from ");
+ p += str_add(p, ll.ll_host, 40);
+ }
+ *p++ = '\n';
+ *p = 0;
+ }
+
+ if (lseek(fd, offset, SEEK_SET) != offset) goto do_close;
+ byte_zero(&ll, sizeof ll);
+ ll.ll_time=time(0);
+ SC(ll.ll_line, line);
+ SAFE_IO(write, fd, &ll, sizeof ll);
+ do_close:
+ close(fd);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/log_do.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/log_do.c
new file mode 100644
index 0000000..01e8e01
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/log_do.c
@@ -0,0 +1,21 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include "time_defs.h"
+
+void log_do(char *buf,int OK, char *program, char *username, char *tty) /*EXTRACT_INCL*/{
+ char *p=buf;
+ *p++ ='<';
+ p += fmt_ulong(p, (10<<3) | (4+2*OK)); /* 4 warn, 5 notice, 6 info */
+ *p++ = '>';
+ nv_ctime(p,time(0), 26);
+ p += str_add(p,p+4,16);
+ p += str_add(p,program,32); *p++='[';
+ p += fmt_ulong(p,getpid());
+ p += str_copy(p,"]: ");
+ p += str_add(p,username,32);
+ p += str_copy(p, (OK) ? " logged on " : " fail on ");
+ p += str_add(p,tty,32);
+ *p++ = '\n';
+ write_devlog(buf, p-buf);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.c
new file mode 100644
index 0000000..abeb93d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.c
@@ -0,0 +1,177 @@
+/*
+md5.c
+small size MD5 20080116
+public domain
+written by Nikola Vladov
+inspired by ditlibc, libtomcrypt, bglibs
+*/
+
+#include <stdint.h>
+#include <endian.h>
+#include "md5.h"
+
+#ifndef __BYTE_ORDER
+#error __BYTE_ORDER is undefined
+#endif
+
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+/*
+ Block copy and convert byte order to little-endian.
+ dst must be 32bit aligned.
+ Length is the number of 32bit words
+*/
+static void load_lendian (uint32_t *dst, const uint8_t *src, int length) {
+ while (length--) {
+ *dst=(((uint32_t)src[3])<<24) |
+ (((uint32_t)src[2])<<16) |
+ (((uint32_t)src[1])<< 8) |
+ (uint32_t)src[0];
+ src+=4;
+ dst++;
+ }
+}
+
+#define STORE32L(buf,s,len) \
+ load_lendian((uint32_t *)(buf), (const uint8_t *)(s), len)
+#else
+#define STORE32L(buf,s,len) byte_copy(buf,len*4,s)
+#endif
+
+#define ROL(a,s) ((a<<s)|(a>>(32-s)))
+#define F(x,y,z) (z^(x&(y^z)))
+#define G(x,y,z) (y^(z&(y^x)))
+#define H(x,y,z) (x^y^z)
+#define I(x,y,z) (y^(x|(~z)))
+
+#define SET4(A,B,C,D,a,b,c,d) A =a; B =b; C =c; D =d
+#define PLUS4(A,B,C,D,a,b,c,d) A+=a; B+=b; C+=c; D+=d
+
+static const unsigned char Worder[64] = {
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+ 1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,
+ 5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,
+ 0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9
+};
+
+static const unsigned char Rorder[64] = {
+ 7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,
+ 5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,
+ 4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,
+ 6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21
+};
+
+static const uint32_t Korder[64] = {
+ 0xd76aa478UL, 0xe8c7b756UL, 0x242070dbUL, 0xc1bdceeeUL, 0xf57c0fafUL,
+ 0x4787c62aUL, 0xa8304613UL, 0xfd469501UL, 0x698098d8UL, 0x8b44f7afUL,
+ 0xffff5bb1UL, 0x895cd7beUL, 0x6b901122UL, 0xfd987193UL, 0xa679438eUL,
+ 0x49b40821UL, 0xf61e2562UL, 0xc040b340UL, 0x265e5a51UL, 0xe9b6c7aaUL,
+ 0xd62f105dUL, 0x02441453UL, 0xd8a1e681UL, 0xe7d3fbc8UL, 0x21e1cde6UL,
+ 0xc33707d6UL, 0xf4d50d87UL, 0x455a14edUL, 0xa9e3e905UL, 0xfcefa3f8UL,
+ 0x676f02d9UL, 0x8d2a4c8aUL, 0xfffa3942UL, 0x8771f681UL, 0x6d9d6122UL,
+ 0xfde5380cUL, 0xa4beea44UL, 0x4bdecfa9UL, 0xf6bb4b60UL, 0xbebfbc70UL,
+ 0x289b7ec6UL, 0xeaa127faUL, 0xd4ef3085UL, 0x04881d05UL, 0xd9d4d039UL,
+ 0xe6db99e5UL, 0x1fa27cf8UL, 0xc4ac5665UL, 0xf4292244UL, 0x432aff97UL,
+ 0xab9423a7UL, 0xfc93a039UL, 0x655b59c3UL, 0x8f0ccc92UL, 0xffeff47dUL,
+ 0x85845dd1UL, 0x6fa87e4fUL, 0xfe2ce6e0UL, 0xa3014314UL, 0x4e0811a1UL,
+ 0xf7537e82UL, 0xbd3af235UL, 0x2ad7d2bbUL, 0xeb86d391UL
+};
+
+static void md5_compress(md5_state *md, const unsigned char *buf) {
+ uint32_t i, a, b, c, d, t, *W = (uint32_t *)md->buf;
+ STORE32L(W,buf,16);
+ SET4(a,b,c,d, md->state[0], md->state[1], md->state[2], md->state[3]);
+
+ for (i = 0; i < 64; ++i) {
+ if (i<16) a += F(b,c,d);
+ else if (i<32) a += G(b,c,d);
+ else if (i<48) a += H(b,c,d);
+ else a += I(b,c,d);
+ a += W[Worder[i]] + Korder[i];
+ t = ROL(a, Rorder[i]) + b;
+ SET4(a,d,c,b, d,c,b,t);
+ }
+
+ PLUS4(md->state[0], md->state[1], md->state[2], md->state[3], a,b,c,d);
+}
+
+/**
+ Initialize the hash state
+ @param md The hash state you wish to initialize
+*/
+static const uint32_t init_state[4] = {
+ 0x67452301UL, 0xefcdab89UL, 0x98badcfeUL, 0x10325476UL
+};
+
+void md5_init(md5_state *md) /*EXTRACT_INCL*/{
+ md->length = 0;
+ byte_copy(md->state, sizeof(init_state), init_state);
+}
+
+/**
+ Process a block of memory though the hash
+ @param md The hash state
+ @param in The data to hash
+ @param inlen The length of the data (octets)
+*/
+
+void md5_update(md5_state *md,const unsigned char *vdata,unsigned long data_len) /*EXTRACT_INCL*/{
+ const unsigned char *data = vdata;
+ unsigned use, mlen = md->length % 64;
+
+ md->length += data_len;
+ if (mlen > 0 && data_len >= (use = 64 - mlen)) {
+ byte_copy(md->buf + mlen, use, data);
+ md5_compress(md, md->buf);
+ mlen = 0;
+ data_len -= use;
+ data += use;
+ }
+
+ while (data_len >= 64) {
+ md5_compress (md, data);
+ data_len -= 64;
+ data += 64;
+ }
+
+ byte_copy(md->buf + mlen, data_len, data);
+}
+
+/**
+ Terminate the hash to get the digest
+ @param md The hash state
+ @param out [out] The destination of the hash (16 bytes)
+*/
+void md5_final(md5_state *md, unsigned char *out) /*EXTRACT_INCL*/{
+ uint64_t length = md->length;
+ uint32_t mlen = length % 64;
+
+ /* increase the length of the message */
+ length *= 8;
+
+ /* append the '1' bit */
+ md->buf[mlen++] = (unsigned char)0x80;
+
+ /* if the length is currently above 56 bytes we append zeros
+ * then compress. Then we can fall back to padding zeros and length
+ * encoding like normal.
+ */
+ byte_zero(md->buf + mlen, 64-mlen);
+ if (mlen > 64-8) {
+ md5_compress(md, md->buf);
+ byte_zero(md->buf, 64-8);
+ }
+
+ /* store length */
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+ length = (length<<32)|(length>>32)
+#endif
+ STORE32L(md->buf+56, &length, 2);
+ md5_compress(md, md->buf);
+
+ /* copy output */
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+ STORE32L(md->state, md->state, 4);
+#endif
+ byte_copy(out, 16, md->state);
+ byte_zero(md, sizeof(md5_state));
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.h b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.h
new file mode 100644
index 0000000..0c8a889
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5.h
@@ -0,0 +1,21 @@
+#ifndef MD5_H
+#define MD5_h
+#include <stdint.h>
+
+struct md5_state {
+ unsigned char buf[64];
+ uint32_t state[4];
+ uint64_t length;
+};
+
+typedef struct md5_state md5_state;
+#include "md5_defs.h"
+
+#define MD5_CTX md5_state
+#define MD5_Init md5_init
+#define MD5_Update md5_update
+#define MD5_Final(buf, hash) md5_final(hash, buf)
+
+#include "str_defs.h"
+#include "byte_defs.h"
+#endif
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5crypt.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5crypt.c
new file mode 100644
index 0000000..ab15e8f
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/md5crypt.c
@@ -0,0 +1,140 @@
+/* $OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $ */
+
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <[email protected]> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
+ * ----------------------------------------------------------------------------
+ *
+ * $FreeBSD: crypt.c,v 1.5 1996/10/14 08:34:02 phk Exp $
+ *
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: md5crypt.c,v 1.9 1997/07/23 20:58:27 kstailey Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <unistd.h>
+#include "md5.h"
+
+static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */
+ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+
+static void to64(unsigned char *s, uint32_t v, int n)
+{
+ while (--n >= 0) {
+ *s++ = itoa64[v&0x3f];
+ v >>= 6;
+ }
+}
+
+/*
+ * UNIX password
+ *
+ * Use MD5 for what it is best at...
+ */
+
+#define R(F,P,Q,R) to64(p, (F[P]<<16) | (F[Q]<<8) | F[R], 4); p += 4
+#define magic (unsigned char *)"$1$"
+
+char *md5crypt(const char *pw, const char *salt) /*EXTRACT_INCL*/
+{
+ static char passwd[40];
+ const unsigned char *sp,*ep;
+ unsigned char final[16], *p = (unsigned char *)pw;
+ int sl,i,pw_len = str_len(pw);
+ MD5_CTX ctx,ctx1;
+
+ /* Refine the Salt first */
+ sp = (const unsigned char *)salt;
+
+ /* If it starts with the magic string, then skip that */
+ if (!byte_diff(sp,3,magic))
+ sp += 3;
+
+ /* It stops at the first '$', max 8 chars */
+ for(ep=sp;*ep && *ep != '$' && ep < (sp+8);ep++)
+ continue;
+
+ /* get the length of the true salt */
+ sl = ep - sp;
+
+ MD5_Init(&ctx);
+
+ /* The password first, since that is what is most unknown */
+ MD5_Update(&ctx,p,pw_len);
+
+ /* Then our magic string */
+ MD5_Update(&ctx,magic,3);
+
+ /* Then the raw salt */
+ MD5_Update(&ctx,sp,sl);
+
+ /* Then just as many characters of the MD5(pw,salt,pw) */
+ MD5_Init(&ctx1);
+ MD5_Update(&ctx1,p,pw_len);
+ MD5_Update(&ctx1,sp,sl);
+ MD5_Update(&ctx1,p,pw_len);
+ MD5_Final(final,&ctx1);
+ for (i = pw_len; i > 0; i -= 16)
+ MD5_Update(&ctx,final,(i>16) ? 16 : i);
+
+ /* Don't leave anything around in vm they could use. */
+ byte_zero(final,sizeof(final));
+
+ /* Then something really weird... */
+ for (i = pw_len; i ; i >>= 1)
+ if(i&1)
+ MD5_Update(&ctx, final, 1);
+ else
+ MD5_Update(&ctx, p, 1);
+
+ MD5_Final(final,&ctx);
+
+ /*
+ * and now, just to make sure things don't run too fast
+ * On a 60 Mhz Pentium this takes 34 msec, so you would
+ * need 30 seconds to build a 1000 entry dictionary...
+ */
+ for(i=0;i<1000;i++) {
+ MD5_Init(&ctx1);
+ if(i & 1)
+ MD5_Update(&ctx1,p,pw_len);
+ else
+ MD5_Update(&ctx1,final,16);
+
+ if(i % 3)
+ MD5_Update(&ctx1,sp,sl);
+
+ if(i % 7)
+ MD5_Update(&ctx1,p,pw_len);
+
+ if(i & 1)
+ MD5_Update(&ctx1,final,16);
+ else
+ MD5_Update(&ctx1,p,pw_len);
+ MD5_Final(final,&ctx1);
+ }
+
+ /* Now make the output string */
+ p = (unsigned char *)passwd + 3 + sl;
+ byte_copy(passwd, 3, magic);
+ byte_copy(passwd+3, sl, sp);
+ *p++ = '$';
+
+ R(final, 0, 6,12);
+ R(final, 1, 7,13);
+ R(final, 2, 8,14);
+ R(final, 3, 9,15);
+ R(final, 4,10, 5);
+ to64(p,final[11],2);
+ p[2] = 0;
+
+ /* Don't leave anything around in vm they could use. */
+ byte_zero(final,sizeof(final));
+ pw_len = 0;
+
+ return passwd;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-auth.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-auth.c
new file mode 100644
index 0000000..e275531
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-auth.c
@@ -0,0 +1,125 @@
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+#include <alloca.h>
+#include "md5.h"
+#include "pw_defs.h"
+#include "utmp_defs.h"
+#include "time_defs.h"
+
+#define fdin 3
+#define fdout 4
+
+#define ZZ(A) if (A) byte_zero(A, str_len(A))
+#define FL(X,Var) *p++ = X; p += fmt_ulong(p, Var); ++p
+#define FN(L,Var) p += str_copy(p,L); p += fmt_ulong(p, Var); ++p
+#define FS(L,Var) p += mycat(p,L,Var); ++p
+
+static struct passwd *pw;
+static char *stored, *encrypted;
+static char up[513];
+
+static int z(int n) {
+ byte_zero(up, sizeof(up));
+ ZZ(stored);
+ ZZ(encrypted);
+ if (n==0) return 0;
+ close(fdin);
+ close(fdout);
+ _exit(n);
+}
+
+static void check_pass(char *program, char *tty) {
+ char *password; /* user name is up */
+ int k=0, i=0, uplen;
+
+ close(0); close(1); close(2);
+ errno = 0;
+ uplen = SAFE_IO(read, fdin, up, sizeof(up));
+ if (errno) z(111);
+ if (uplen >= (int)sizeof(up)) z(1);
+ close(fdin);
+
+ if (uplen==0) z(2);
+ while (up[i++]) if (i >= uplen) z(2);
+ password = up + i;
+ if (i >= uplen) z(2);
+ while (up[i++]) if (i >= uplen) z(2);
+
+ pw = nv_getpwnam(up);
+ if (pw) {
+ struct spwd *spw;
+ if (i<uplen &&
+ !str_diff("-autologin", up+i)) { k=1; goto do_it; }
+
+ if (pw->pw_passwd[0]=='*' ||
+ pw->pw_passwd[0]=='!') goto do_it;
+
+ spw = nv_getspnam(up);
+ if (spw) stored = spw->sp_pwdp;
+ }
+
+ if (!stored || str_len(stored) < 12) k=0;
+ else {
+ encrypted = md5crypt(password, stored);
+ k = !str_diff(encrypted, stored); /* 1 good password */
+ }
+
+ do_it:
+ z(0); /* zero buffers */
+ if (pw) log_do(up, k, program, pw->pw_name, tty);
+ z(!k);
+}
+
+int main(int argc, char **argv) {
+ int i, n = NGROUPS_MAX;
+ struct group *ttygr=0;
+ gid_t groups[NGROUPS_MAX+1];
+ char *p, *tty, lastlog[96];
+
+ (void)argc;
+ tty = ttyname(0);
+ if (tty==0) tty="";
+
+ if (tty && !str_diffn(tty, "/dev/", 5)) p = tty + 5;
+ else p = "UNKNOWN";
+
+ check_pass(strip_slash(argv[0]), p);
+
+ utmp_do(pw->pw_name, p, getppid());
+ lastlog_do(lastlog, pw->pw_uid, p);
+ get_tz(0,-1);
+
+ if (nv_getgrouplist(pw->pw_name, pw->pw_gid, groups, &n) ||
+ n > NGROUPS_MAX) z(5);
+ ttygr = nv_getgrnam("tty");
+
+ z(0);
+ for (p=up,i=0; i<n; i++) {
+ FL('g', groups[i]);
+ if (p-up > 440) z(1);
+ }
+
+ if (p-up +
+ str_len(pw->pw_dir) +
+ str_len(pw->pw_name) +
+ str_len(pw->pw_shell) +
+ str_len(tty) +
+ str_len(lastlog) > 400) z(1);
+
+ FL('t', ttygr ? ttygr->gr_gid : (gid_t)pw->pw_gid);
+ FN("UID=", pw->pw_uid);
+ FN("GID=", pw->pw_gid);
+
+ FS("USER=", pw->pw_name);
+ FS("HOME=", pw->pw_dir);
+ FS("SHELL=", pw->pw_shell);
+ FS("TTY=", tty);
+ p += str_copy(p, lastlog);
+
+ n = (p-up)+5;
+ if (n != SAFE_IO(write, fdout, up, n)) z(1);
+ close(fdout);
+ z(0);
+ return 0;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-tiny.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-tiny.c
new file mode 100644
index 0000000..af9fd96
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin-tiny.c
@@ -0,0 +1,175 @@
+/* login.c */
+#define LOGIN_PROGRAM
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <termios.h>
+#include <limits.h>
+#include <grp.h>
+
+#include "config.h"
+#include "str_defs.h"
+#include "utmp_defs.h"
+#include "prot_defs.h"
+
+#define SCAN_env(prefix, len, off, env) \
+ if (str_diffn(p, prefix, len)) goto z_1; \
+ arg[off]=p; env = p+len; p += str_len(p) + 1;
+
+static char up[513], buf[300];
+static char *arg[8], *pw_dir, *pw_shell, *pw_tty, *pw_last, *name;
+static uid_t pw_uid;
+static gid_t pw_gid, tty_gid, gr_list[NGROUPS_MAX], gr_n;
+
+static void z(int n) {
+ byte_zero(up, sizeof up);
+ byte_zero(buf, sizeof buf);
+ if (n==0) return;
+ _exit(n);
+}
+static void myexit(int n,char *s) { write(2,buf, mycat(buf,s,"\n")); z(n); }
+
+int get_userinfo(int pid, int autologin) {
+ char *p = up, *x = buf;
+ int n;
+ dup2(5,3); close(5); close(6);
+ p = up;
+ p += 1 + str_add(p, name, 40);
+ if (autologin) { x = "-autologin"; ++p; }
+ p += str_add(p, x, 120);
+
+ n = p-up+5;
+ if (n != SAFE_IO(write, 4, up, n)) goto z_1;
+ close(4);
+ z(0);
+
+ errno = 0;
+ n=SAFE_IO(read, 3, up, sizeof(up));
+ if (errno || n >= (int)sizeof(up) || n<5 || up[--n] || up[--n]) goto z_1;
+ close(3);
+
+ p=up;
+ for (gr_n=0; gr_n < NGROUPS_MAX;) {
+ if (!(n=scan_uid(p, "g", gr_list + gr_n))) break;
+ gr_n++;
+ p += n;
+ }
+ if (gr_n<1) goto z_1;
+
+ if (!(n=scan_uid(p, "t", &tty_gid))) goto z_1; p+=n;
+ if (!(n=scan_uid(p, "UID=", &pw_uid))) goto z_1; p+=n;
+ if (!(n=scan_uid(p, "GID=", &pw_gid))) goto z_1; p+=n;
+
+ if (str_diffn(p, "USER=", 5) || str_diff(p+5, name)) goto z_1;
+ arg[2] = p; p += 1 + str_len(p);
+
+ SCAN_env("HOME=", 5, 3, pw_dir);
+ SCAN_env("SHELL=", 6, 4, pw_shell);
+ SCAN_env("TTY=", 4, 0, pw_tty);
+
+ if (!str_diffn(p, "Last ", 5)) pw_last = p;
+ return 1; /* good user ;-) */
+ z_1:
+ waitpid(pid,0,0);
+ return 0;
+}
+
+int main(int argc, char **argv, char **env) {
+ char *p;
+ int fd,n, pi[2], OK=0, flag_auto=0;
+ struct termios oldtermios;
+
+ if (ioctl(0, TCGETS, &oldtermios)) _exit(100);
+ oldtermios.c_lflag &= ~(ECHO|ISIG);
+ tcsetattr(0,TCSAFLUSH,&oldtermios);
+
+ argv++;
+ (void)argc;
+ while ((p=argv[0]) && p[0] == '-') {
+ if (p[1]=='f') {
+ if (getuid()) goto do_it;
+
+ if (p[2]) p += 2; /* -fuser */
+ else p = argv[1]; /* -f user */
+
+ if (p && *p && *p != '-') {
+ flag_auto=1;
+ argv[0]=p;
+ break;
+ } else
+ goto do_it;
+ }
+ argv++;
+ }
+
+ if ((name=argv[0])==0 || name[0]==0) goto do_it;
+ if (flag_auto == 0)
+ if (read_password(buf)) goto do_it;
+
+ close(3); close(4); close(5); close(6);
+ if (pipe(pi) || pi[0] != 3 || pi[1] != 4 ||
+ pipe(pi) || pi[0] != 5 || pi[1] != 6)
+ myexit(111, "unable to open pipes");
+
+ switch (n=fork()) {
+ case -1: _exit(11);
+ case 0:
+ z(0);
+ if (prot_uidgid(0, 0, gr_list, 1)) z(21);
+ dup2(6,4); close(5); close(6);
+ arg[0] = LOGIN_AUTHORITY;
+ execve(*arg, arg, 0);
+ _exit(127);
+ default:
+ OK = get_userinfo(n, flag_auto);
+ }
+
+ do_it:
+ byte_zero(buf, sizeof(buf));
+ oldtermios.c_lflag |= ECHO;
+ tcsetattr(0, TCSAFLUSH, &oldtermios);
+
+ if (!OK) { sleep(1); myexit(100,"Sorry :-)"); }
+
+ if (pw_tty || !str_diffn(pw_tty, "/dev/", 5)) {
+ chown(pw_tty, pw_uid, tty_gid);
+ chmod(pw_tty, 0620);
+ }
+
+ p = prot_uidgid(pw_uid, pw_gid, gr_list, gr_n);
+ if (p) {
+ mycat(buf, "unable to set", p);
+ myexit(111, buf);
+ }
+
+ if (chdir(pw_dir)) {
+ n = mycat(buf,"unable to chdir: ", pw_dir); buf[n++] = '\n';
+ write(1,buf,n);
+ chdir("/");
+ }
+
+ if ((fd=open(".hushlogin", O_RDONLY)) >=0) {
+ close(fd);
+ } else {
+ if ((fd=open("/etc/motd", O_RDONLY)) >= -1) {
+ while ((n=read(fd,buf,sizeof buf)) >0) write(1,buf,n);
+ close(fd);
+ }
+ if (pw_last) write(1, pw_last, str_len(pw_last));
+ }
+
+ arg[0] = buf;
+ mycat(buf,"-",strip_slash(pw_shell));
+
+ for (; *env; env++)
+ if (!str_diffn(*env,"TERM=",5)) { arg[5]=*env; break; }
+
+ oldtermios.c_lflag |= ISIG;
+ tcsetattr(0, TCSAFLUSH, &oldtermios);
+ execve(pw_shell,arg,arg+2);
+ return 1;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin.c
new file mode 100644
index 0000000..ab0128b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nlogin.c
@@ -0,0 +1,129 @@
+/* login.c */
+#define LOGIN_PROGRAM
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <termios.h>
+#include "config.h"
+#include "str_defs.h"
+#include "pw_defs.h"
+#include "utmp_defs.h"
+#include "prot_defs.h"
+
+#define SD(A,B) !str_diffn(A, B, sizeof(A))
+#define SC(A,B) str_copynz(A, B, sizeof(A))
+
+static void myexit(int n,char *s)
+ { write(2,s,str_len(s)); write(2,"\n",1); _exit(n); }
+
+int main(int argc, char **argv, char **env) {
+ struct passwd *pw=0;
+ struct spwd *spwd;
+ char buf[1200], lastlog[96];
+ char *tty, *dev_tty=0, *program, *username=0, *p;
+ char *arg[8] = {buf,0,0,0, 0,0,0,0};
+ int fd,r,OK=0,flag_auto=0;
+ struct termios oldtermios;
+
+ if (ioctl(0, TCGETS, &oldtermios)) _exit(100);
+ oldtermios.c_lflag &= ~(ECHO|ISIG);
+ tcsetattr(0,TCSAFLUSH,&oldtermios);
+
+ if ((dev_tty=ttyname(0)) && !str_diffn("/dev/",dev_tty,5)) tty=dev_tty+5;
+ else { dev_tty = 0; tty="UNKNOWN"; }
+
+ program=strip_slash(argv[0]);
+ argv++; (void)argc;
+ while ((p=argv[0]) && p[0] == '-') {
+ if (p[1]=='f') {
+ if (getuid()) goto do_it;
+
+ if (p[2]) p += 2;
+ else p=argv[1];
+
+ if (p && *p && *p != '-') {
+ flag_auto=1;
+ argv[0]=p;
+ break;
+ } else
+ goto do_it;
+ }
+ argv++;
+ }
+
+ if (argv[0] == 0) goto do_it;
+ if (flag_auto == 0)
+ if (read_password(buf)) goto do_it;
+
+ pw = nv_getpwnam(argv[0]);
+ if (pw) {
+ username = pw->pw_name;
+ if (pw->pw_passwd[0]=='*' ||
+ pw->pw_passwd[0]=='!') goto do_it;
+ }
+ if (!username || *username == 0) goto do_it;
+
+ if (flag_auto==1) OK=1;
+ else {
+ if ((spwd = nv_getspnam(username))==0) goto do_it;
+ OK = pass_check(buf, spwd->sp_pwdp);
+ }
+
+ do_it:
+ byte_zero(buf,sizeof(buf));
+ oldtermios.c_lflag |= ECHO;
+ tcsetattr(0, TCSAFLUSH, &oldtermios);
+ if (!username) username="UNKNOWN";
+
+ log_do(buf,OK, program,username,tty);
+
+ if (!OK) { sleep(1); myexit(100,"Sorry :-)"); }
+ utmp_do(username, tty, getpid());
+ lastlog_do(lastlog, pw->pw_uid, tty);
+ get_tz(0,-1);
+
+ if (dev_tty) {
+ struct group *gr = nv_getgrnam("tty");
+ chown(dev_tty, pw->pw_uid, gr ? gr->gr_gid : pw->pw_gid);
+ chmod(dev_tty, 0620);
+ }
+
+ p = 0;
+ if (nv_initgroups(pw->pw_name,pw->pw_gid) == -1) p = "groups";
+ else if (setgid(pw->pw_gid) == -1) p = "gid";
+ else if (setuid(pw->pw_uid) == -1) p = "uid";
+ if (p) {
+ mycat(buf, "unable to set", p);
+ myexit(111, buf);
+ }
+
+ if (chdir(pw->pw_dir)) {
+ r = mycat(buf,"unable to chdir: ",pw->pw_dir); buf[r++] = '\n';
+ write(1,buf,r);
+ chdir("/");
+ }
+
+ if ((fd=open(".hushlogin", O_RDONLY)) >=0) {
+ close(fd);
+ } else {
+ if ((fd=open("/etc/motd", O_RDONLY)) != -1) {
+ while ((r=read(fd,buf,sizeof buf)) >0) write(1,buf,r);
+ close(fd);
+ }
+ write(1, lastlog, str_len(lastlog));
+ }
+
+ p=buf; p += 1 + mycat(p,"-",strip_slash(pw->pw_shell));
+ arg[2]=p; p += 1 + mycat(p,"HOME=",pw->pw_dir);
+ arg[3]=p; p += 1 + mycat(p,"USER=",pw->pw_name);
+ arg[4]=p; p += 1 + mycat(p,"SHELL=",pw->pw_shell);
+ for (; *env; env++)
+ if (!str_diffn(*env,"TERM=",5)) {arg[5]=*env; break;} /* arg[7] */
+
+ oldtermios.c_lflag |= ISIG;
+ tcsetattr(0, TCSAFLUSH, &oldtermios);
+ execve(pw->pw_shell,arg,arg+2);
+ return(1);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_ctime.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_ctime.c
new file mode 100644
index 0000000..b7e497a
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_ctime.c
@@ -0,0 +1,41 @@
+#include <time.h>
+#include "time_defs.h"
+
+void num2str(char *c,int i) /*EXTRACT_INCL*/{c[0]=i/10+'0'; c[1]=i%10+'0';}
+
+unsigned int nv_ctime(char *p, time_t now, int len) /*EXTRACT_INCL*/{
+ char days[] = "SunMonTueWedThuFriSat";
+ char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
+ unsigned long day, mon, year, tod;
+
+ now += get_tz(&now, 1);
+
+ tod = (unsigned long)(now) % 86400;
+ day = (unsigned long)(now) / 86400;
+ byte_set(p, len, ' ');
+ str_add(p, days +3*((day+4) % 7), 3);
+
+ year = 4*day + 2;
+ year /= 1461;
+ day += 671;
+ day %= 1461; /* day 0 is march 1, 1972 */
+ if (day == 1460) { day = 365; }
+ else { day %= 365; }
+
+ day *= 10;
+ mon = (day + 5) / 306;
+ day = day + 5 - 306 * mon;
+ day /= 10;
+ if (mon >= 10) mon -= 10;
+ else mon += 2; /* day 0,1,30, mon 0..11, year 1970=0,1,2 */
+ /* 4 8 11 14 17 20 */
+ /* "Fri Jan 7 21:08:30 2005\n" */
+ str_add(p+4, months+3*mon, 3);
+ num2str(p+8, day+1); if (p[8]=='0') p[8]=' ';
+ num2str(p+17, tod%60); tod /= 60;
+ num2str(p+11, tod/60);
+ num2str(p+14, tod%60);
+ p[20 + fmt_ulong(p+20, 1970 + year)] = '\n';
+ p[13] = ':'; p[16] = ':';
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrent.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrent.c
new file mode 100644
index 0000000..ed14ad5
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrent.c
@@ -0,0 +1,37 @@
+#include <grp.h> /*EXTRACT_UNMOD*/
+#include "parselib.h"
+#define NV_SETGRENT
+#include "config.h"
+
+static struct state S;
+
+void nv_setgrent() /*EXTRACT_INCL*/ {__prepare_parse(__GROUP_FILE,&S);}
+void nv_endgrent() /*EXTRACT_INCL*/ {__end_parse(&S);}
+
+struct group *nv_getgrent() /*EXTRACT_INCL*/ {
+ static struct group gr;
+ static char *arg[SCAN_GROUPS + 2];
+ static char buf[__GROUP_BUFFER];
+ char *p;
+ unsigned long u;
+
+ if (!S.buffirst) nv_setgrent();
+ if (!S.buffirst) return 0;
+
+ again:
+ if ((u = __parse_feed(&S, buf, sizeof(buf)))==0) return 0;
+ if (4 != __parse_split(buf,u,':',4,arg)) goto again;
+
+ gr.gr_name = arg[0];
+#ifndef DONT_NEED_PASSWD
+ gr.gr_passwd = arg[1];
+#endif
+#ifndef DONT_NEED_GID
+ p=arg[2]; if (!*p || p[scan_ulong(p,&u)]) goto again; gr.gr_gid =u;
+#endif
+#ifndef DONT_NEED_MEMBERS
+ __parse_split(arg[3],str_len(arg[3])+1,',',SCAN_GROUPS,arg);
+ gr.gr_mem = arg;
+#endif
+ return(&gr);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrgid.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrgid.c
new file mode 100644
index 0000000..0d2aba3
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrgid.c
@@ -0,0 +1,11 @@
+#include <grp.h>
+#include "pw_defs.h"
+
+struct group *nv_getgrgid(gid_t gid) /*EXTRACT_INCL*/ {
+ struct group *tmp;
+ nv_setgrent();
+ while ((tmp = nv_getgrent()))
+ if (tmp->gr_gid == gid) break;
+ nv_endgrent();
+ return tmp;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrnam.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrnam.c
new file mode 100644
index 0000000..b276c79
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrnam.c
@@ -0,0 +1,11 @@
+#include <grp.h>
+#include "pw_defs.h"
+
+struct group *nv_getgrnam(const char* name) /*EXTRACT_INCL*/ {
+ struct group *tmp;
+ nv_setgrent();
+ while ((tmp = nv_getgrent()))
+ if (!str_diff(tmp->gr_name, name)) break;
+ nv_endgrent();
+ return tmp;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrouplist.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrouplist.c
new file mode 100644
index 0000000..d644cce
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getgrouplist.c
@@ -0,0 +1,33 @@
+#include <grp.h>
+#include "pw_defs.h"
+
+int nv_getgrouplist(const char*user, gid_t group, gid_t*groups, int*ngroups) /*EXTRACT_INCL*/ {
+ long n=0,size=*ngroups;
+ struct group*g;
+ int ret=0;
+
+ if (0<size) { groups[n++]=group; }
+ else { *ngroups=0; return (-1); }
+
+ nv_setgrent();
+ while ((g=nv_getgrent())) {
+ char **duh;
+ if (g->gr_gid==group) continue;
+ duh=g->gr_mem;
+ while (*duh) {
+ if (!str_diff(*duh,user)) {
+ if (n>=size) {
+ ret=~ret;
+ goto err_out;
+ }
+ groups[n++]=g->gr_gid;
+ break;
+ }
+ duh++;
+ }
+ }
+err_out:
+ nv_endgrent();
+ *ngroups=n;
+ return ret;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwent.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwent.c
new file mode 100644
index 0000000..75ce6cb
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwent.c
@@ -0,0 +1,44 @@
+#include <pwd.h> /*EXTRACT_UNMOD*/
+#include "parselib.h"
+#define NV_SETPWENT
+#include "config.h"
+
+static struct state S;
+
+void nv_setpwent() /*EXTRACT_INCL*/ {__prepare_parse(__PASSWD_FILE,&S);}
+void nv_endpwent() /*EXTRACT_INCL*/ {__end_parse(&S);}
+
+struct passwd *nv_getpwent() /*EXTRACT_INCL*/ {
+ static struct passwd pw;
+ static char buf[__PASSWD_BUFFER];
+ char *p,*arg[9];
+ unsigned long u;
+
+ if (!S.buffirst) nv_setpwent();
+ if (!S.buffirst) return 0;
+
+ again:
+ if ((u = __parse_feed(&S, buf, sizeof(buf)))==0) return 0;
+ if (7 != __parse_split(buf,u,':',7,arg)) goto again;
+
+ pw.pw_name = arg[0];
+#ifndef DONT_NEED_PASSWD
+ pw.pw_passwd = arg[1];
+#endif
+#ifndef DONT_NEED_UID
+ p=arg[2]; if (!*p || p[scan_ulong(p,&u)]) goto again; pw.pw_uid =u;
+#endif
+#ifndef DONT_NEED_GID
+ p=arg[3]; if (!*p || p[scan_ulong(p,&u)]) goto again; pw.pw_gid =u;
+#endif
+#ifndef DONT_NEED_GECOS
+ pw.pw_gecos = arg[4];
+#endif
+#ifndef DONT_NEED_DIR
+ pw.pw_dir = arg[5];
+#endif
+#ifndef DONT_NEED_SHELL
+ pw.pw_shell = arg[6];
+#endif
+ return(&pw);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwgid.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwgid.c
new file mode 100644
index 0000000..8e65d56
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwgid.c
@@ -0,0 +1,11 @@
+#include <pwd.h>
+#include "pw_defs.h"
+
+struct passwd *nv_getpwgid(gid_t gid) /*EXTRACT_INCL*/ {
+ struct passwd *tmp;
+ nv_setpwent();
+ while ((tmp = nv_getpwent()))
+ if (tmp->pw_gid == gid) break;
+ nv_endpwent();
+ return tmp;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwnam.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwnam.c
new file mode 100644
index 0000000..3430550
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwnam.c
@@ -0,0 +1,11 @@
+#include <pwd.h>
+#include "pw_defs.h"
+
+struct passwd *nv_getpwnam(const char* name) /*EXTRACT_INCL*/ {
+ struct passwd *tmp;
+ nv_setpwent();
+ while ((tmp = nv_getpwent()))
+ if (!str_diff(tmp->pw_name, name)) break;
+ nv_endpwent();
+ return tmp;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwuid.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwuid.c
new file mode 100644
index 0000000..5a0e541
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getpwuid.c
@@ -0,0 +1,11 @@
+#include <pwd.h>
+#include "pw_defs.h"
+
+struct passwd *nv_getpwuid(uid_t uid) /*EXTRACT_INCL*/ {
+ struct passwd *tmp;
+ nv_setpwent();
+ while ((tmp = nv_getpwent()))
+ if (tmp->pw_uid == uid) break;
+ nv_endpwent();
+ return tmp;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspent.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspent.c
new file mode 100644
index 0000000..3d6a75c
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspent.c
@@ -0,0 +1,47 @@
+#include <shadow.h> /*EXTRACT_UNMOD*/
+#include "parselib.h"
+#define NV_SETSPENT
+#include "config.h"
+
+static struct state S;
+
+void nv_setspent() /*EXTRACT_INCL*/{__prepare_parse(__SHADOW_FILE,&S);}
+void nv_endspent() /*EXTRACT_INCL*/{__end_parse(&S);}
+
+struct spwd *nv_getspent() /*EXTRACT_INCL*/ {
+ static struct spwd sp;
+ static char buf[__SHADOW_BUFFER];
+ char *arg[12];
+ unsigned int u;
+
+ if (!S.buffirst) nv_setspent();
+ if (!S.buffirst) return 0;
+
+ again:
+ if ((u=__parse_feed(&S, buf, sizeof(buf)))==0) return 0;
+ if ((u=__parse_split(buf,u,':',9,arg)) < 6) goto again;
+
+ sp.sp_namp = arg[0];
+ sp.sp_pwdp = arg[1];
+#ifndef DONT_NEED_ALL_SHADOW
+ {
+ unsigned long i,j,l;
+ for (i=2; i<u; i++) {
+ j=scan_ulong(arg[i],&l);
+ if (arg[i][j]) goto again;
+ if (j==0) l = (unsigned long)-1;
+
+ switch (i) {
+ case 2: sp.sp_lstchg=l; break;
+ case 3: sp.sp_min=l; break;
+ case 4: sp.sp_max=l; break;
+ case 5: sp.sp_warn=l; break;
+ case 6: sp.sp_inact=l; break;
+ case 7: sp.sp_expire=l; break;
+ case 8: sp.sp_flag=l; break;
+ }
+ }
+ }
+#endif
+ return(&sp);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspnam.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspnam.c
new file mode 100644
index 0000000..7790155
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_getspnam.c
@@ -0,0 +1,11 @@
+#include <shadow.h>
+#include "pw_defs.h"
+
+struct spwd *nv_getspnam(const char* name) /*EXTRACT_INCL*/ {
+ struct spwd *tmp;
+ nv_setspent();
+ while ((tmp = nv_getspent()))
+ if (!str_diff(tmp->sp_namp, name)) break;
+ nv_endspent();
+ return tmp;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_initgroups.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_initgroups.c
new file mode 100644
index 0000000..51af879
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/nv_initgroups.c
@@ -0,0 +1,11 @@
+#include <grp.h>
+#include <limits.h>
+#include "pw_defs.h"
+
+int nv_initgroups(const char*user,gid_t group) /*EXTRACT_INCL*/ {
+ int n=NGROUPS_MAX;
+ gid_t grouplist[NGROUPS_MAX];
+ nv_getgrouplist(user,group,grouplist,&n);
+ return setgroups(n,grouplist);
+}
+
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/parselib.h b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/parselib.h
new file mode 100644
index 0000000..600356d
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/parselib.h
@@ -0,0 +1,10 @@
+/* parse lib: parse mmapped text with \n terminated lines */
+
+/* a memory buffer. */
+struct state {
+ const char* buffirst; /* pointer to the buffer */
+ size_t buflen; /* length of the buffer */
+ size_t cur; /* already parsed bytes */
+};
+#include "parse_defs.h"
+#include "pw_defs.h"
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/pass_check.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/pass_check.c
new file mode 100644
index 0000000..6628e99
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/pass_check.c
@@ -0,0 +1,20 @@
+#include "str_defs.h"
+#define PASS_CHECK_C
+#include "config.h"
+
+#define del_str(X) byte_zero(X, str_len(X))
+
+int pass_check(char *buf, char *cr_ps) /*EXTRACT_INCL*/{
+ char *pass;
+ int OK = 0;
+
+ if (str_len(cr_ps) < 10) goto do_it;
+
+ pass = pass_crypt_appl(buf, cr_ps);
+ if (!str_diff(pass, cr_ps)) OK=1;
+ del_str(pass);
+
+ do_it:
+ del_str(cr_ps);
+ return OK; /* return 1 if good password */
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/prot_uidgid.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/prot_uidgid.c
new file mode 100644
index 0000000..e19e9a2
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/prot_uidgid.c
@@ -0,0 +1,11 @@
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
+char *prot_uidgid(uid_t uid, gid_t gid, gid_t *gr_list, int len) /*EXTRACT_INCL*/{
+ char *p=0;
+ if (setgroups(len, gr_list) == -1) p = "groups";
+ else if (setgid(gid) == -1) p = "gid";
+ else if (setuid(uid) == -1) p = "uid";
+ return p;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/read_password.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/read_password.c
new file mode 100644
index 0000000..544e636
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/read_password.c
@@ -0,0 +1,15 @@
+#include <unistd.h>
+
+int read_password(char *buf) /*EXTRACT_INCL*/{
+ int n;
+ alarm(120);
+ write(1, "Password: ", 10);
+ n = read(0, buf, 100);
+ alarm(0);
+ write(1,"\n",1);
+ if (n<0) return -1;
+ while (n && buf[n-1] == '\n') --n;
+ buf[n] = 0;
+ return 0;
+}
+
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/safe_io.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/safe_io.c
new file mode 100644
index 0000000..10d3c95
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/safe_io.c
@@ -0,0 +1,21 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#define SAFE_IO(op,F,B,L) safe_io((int (*)())(op), F,B,L) /*EXTRACT_UNMOD*/
+// #define SAFE_IO(op,F,B,L) op(F,B,L) /*EXTRACT_UNMOD*/
+
+ssize_t safe_io(int (*op)(), int fd, void *x, size_t len) /*EXTRACT_INCL*/{
+ int k = len;
+ while (k > 0) {
+ int ret = op(fd, x, k);
+ if (ret <= 0) {
+ if (ret && errno == EINTR) continue;
+ break;
+ }
+ x += ret;
+ k -= ret;
+ }
+ return len - k;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_uid.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_uid.c
new file mode 100644
index 0000000..da9c85e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_uid.c
@@ -0,0 +1,14 @@
+#include <sys/types.h>
+#include "str_defs.h"
+
+unsigned int scan_uid(char *buf, char *prefix, uid_t *uid) /*EXTRACT_INCL*/{
+ int len = str_len(prefix);
+ char *p = buf + len;
+ unsigned long u;
+
+ if (str_diffn(buf,prefix,len) || !(len = scan_ulong(p, &u))) return 0;
+ p += len;
+ if (*p++ != 0) return 0;
+ *uid = u;
+ return p-buf;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_ulong.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_ulong.c
new file mode 100644
index 0000000..d2a6896
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/scan_ulong.c
@@ -0,0 +1,8 @@
+unsigned int scan_ulong(register char *s, register unsigned long *u) /*EXTRACT_INCL*/ {
+ register unsigned int pos; register unsigned long result;
+ register unsigned long c;
+ pos = 0; result = 0;
+ while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10)
+ { result = result * 10 + c; ++pos; }
+ *u = result; return pos;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_add.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_add.c
new file mode 100644
index 0000000..6450d90
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_add.c
@@ -0,0 +1,5 @@
+unsigned long str_add(char *d, const char *s, unsigned long u) /*EXTRACT_INCL*/ {
+ unsigned long l=0;
+ for (l=0; s[l] && l<u; l++) d[l] = s[l];
+ return(l);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copy.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copy.c
new file mode 100644
index 0000000..90d2da6
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copy.c
@@ -0,0 +1,5 @@
+unsigned int str_copy(char *out,const char *in) /*EXTRACT_INCL*/ {
+ unsigned int len=0;
+ while ((out[len]=in[len])) len++;
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copynz.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copynz.c
new file mode 100644
index 0000000..7a2c8e4
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_copynz.c
@@ -0,0 +1,7 @@
+#include "str_defs.h"
+
+unsigned long str_copynz(char *dest, const char *src, unsigned long n) /*EXTRACT_INCL*/ {
+ unsigned long k=str_add(dest, src, n);
+ while (k<n) dest[--n] = 0;
+ return k;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diff.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diff.c
new file mode 100644
index 0000000..8e03d86
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diff.c
@@ -0,0 +1,4 @@
+#include "str_defs.h"
+int str_diff(const char* a, const char* b) /*EXTRACT_INCL*/ {
+ return str_diffn(a,b,(unsigned long)(-1));
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diffn.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diffn.c
new file mode 100644
index 0000000..6570821
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_diffn.c
@@ -0,0 +1,13 @@
+#include "str_defs.h"
+
+int str_diffn(const char* a, const char* b, unsigned long limit) /*EXTRACT_INCL*/ {
+ unsigned long u=0;
+ char ch=0;
+
+ for (; u<limit; u++) {
+ ch = a[u] - b[u];
+ if (ch) break;
+ if (a[u]==0) break;
+ }
+ return ch;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_len.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_len.c
new file mode 100644
index 0000000..76129ca
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_len.c
@@ -0,0 +1,5 @@
+unsigned long str_len(const char * s) /*EXTRACT_INCL*/ {
+ unsigned long len=0;
+ while (s[len]) ++len;
+ return len;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_lib.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_lib.c
new file mode 100644
index 0000000..96f623e
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_lib.c
@@ -0,0 +1,6 @@
+char *strip_slash(char *s) /*EXTRACT_INCL*/ {
+ char *p, *q;
+ for (p=q=s; *p; p++)
+ if (*p == '/') q=p+1;
+ return q;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_mycat.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_mycat.c
new file mode 100644
index 0000000..b2397e5
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/str_mycat.c
@@ -0,0 +1,9 @@
+#include "str_defs.h"
+
+unsigned long mycat(char *d, char *s1, char *s2) /*EXTRACT_INCL*/ {
+ char *p=d;
+ p += str_add(p, s1, 32);
+ p += str_add(p, s2, 240);
+ *p=0;
+ return p-d;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_do.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_do.c
new file mode 100644
index 0000000..c820b42
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_do.c
@@ -0,0 +1,53 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <time.h>
+#include <sys/stat.h>
+#include "utmp_defs.h"
+#include "str_defs.h"
+
+#define SD(A,B) !str_diffn(A, B, sizeof(A))
+#define SC(A,B) str_copynz(A, B, sizeof(A))
+
+void utmp_do(char *username, char *line, int pid) /*EXTRACT_INCL*/{
+ off_t pos=0;
+ struct utmp u;
+ char *p;
+ int fd=open(_PATH_UTMP,O_RDWR);
+
+ while (utmp_io(fd, &u,F_RDLCK)) {
+ if (u.ut_pid == pid || SD(u.ut_line, line)) goto foundone;
+ pos += UTMP_SIZE;
+ }
+
+ byte_zero(&u,sizeof(u));
+ pos = lseek(fd,0,SEEK_END);
+ if (pos<0) pos =0;
+ pos = pos - (pos % (UTMP_SIZE));
+
+ foundone:
+ if (u.ut_id[0]==0) {
+ p=line;
+ while (str_len(p) > sizeof u.ut_id) p++;
+ SC(u.ut_id, p);
+ }
+ SC(u.ut_line, line);
+
+ SC(u.ut_user,username);
+ u.ut_type=USER_PROCESS;
+ u.ut_pid=pid;
+
+ byte_zero(u.ut_host,sizeof u.ut_host);
+ u.ut_tv.tv_sec = time(0);
+
+ if (fd>=0) {
+ if (lseek(fd,pos,SEEK_SET) == pos)
+ utmp_io(fd,&u,F_WRLCK);
+ close(fd);
+ }
+
+ fd=open(_PATH_WTMP, O_WRONLY|O_APPEND);
+ if (fd>=0) {
+ write(fd, &u, UTMP_SIZE);
+ close(fd);
+ }
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_io.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_io.c
new file mode 100644
index 0000000..ab0a6bc
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/utmp_io.c
@@ -0,0 +1,30 @@
+#include <unistd.h>
+#include <fcntl.h>
+#include <utmp.h> /*EXTRACT_UNMOD*/
+#include "utmp_defs.h"
+
+#define UTMP_SIZE (sizeof(struct utmp)) /*EXTRACT_UNMOD*/
+
+/* type: F_RDLCK or F_WRLCK */
+struct utmp *utmp_io(int fd, struct utmp *ut, int type) /*EXTRACT_INCL*/ {
+ int ret;
+ struct flock fl;
+ int (*op)() = (type==F_WRLCK) ? (int(*)())write : (int(*)())read;
+
+ fl.l_whence = SEEK_CUR;
+ fl.l_start = 0;
+ fl.l_len = UTMP_SIZE;
+ fl.l_pid = 0;
+ fl.l_type = type;
+
+ if (fcntl(fd, F_SETLKW, &fl)) return 0;
+ ret = SAFE_IO(op, fd, ut, UTMP_SIZE);
+
+ fl.l_start = -UTMP_SIZE;
+ fl.l_type = F_UNLCK;
+
+ fcntl(fd, F_SETLK, &fl);
+
+ if (ret != UTMP_SIZE) return 0;
+ return ut;
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/write_devlog.c b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/write_devlog.c
new file mode 100644
index 0000000..103915f
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/nlogin-0.3-pre/write_devlog.c
@@ -0,0 +1,16 @@
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include "str_defs.h"
+
+void write_devlog(void *buf, int len) /*EXTRACT_INCL*/{
+ struct sockaddr_un sa;
+ int fd= socket(AF_UNIX, SOCK_DGRAM, 0);
+ if( fd == -1) return;
+ sa.sun_family = AF_UNIX;
+ str_copynz(sa.sun_path, "/dev/log", 10);
+ if (connect(fd, (struct sockaddr*)&sa, sizeof sa))
+ { close(fd); return; }
+ send(fd, buf, len, 0);
+ close(fd);
+}
diff --git a/riemann.fmi.uni-sofia.bg/programs/xinit.c b/riemann.fmi.uni-sofia.bg/programs/xinit.c
new file mode 100644
index 0000000..369625b
--- /dev/null
+++ b/riemann.fmi.uni-sofia.bg/programs/xinit.c
@@ -0,0 +1,370 @@
+/* xinit.c
+ diet -Os gcc -nostdinc -O2 -s -o xinit xinit.c -Wall -W
+ diet -Os gcc -nostdinc -DUSE_XCLEAN -O2 -s -o xinit xinit.c -Wall -W
+ diet -Os gcc -nostdinc -DXwrapper -O2 -s -o xinit xinit.c -Wall -W
+ -DXwrapper --> try to exec first Xwrapper before X
+
+ -DUSE_XCLEAN
+ If the variable XCLEAN is present, then after
+ finishing of the server xinit execs /bin/sh -c "$XCLEAN".
+ This is useful for cleaning of ~/.Xauthority
+ */
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef __dietlibc__
+#include <time.h>
+extern char **environ;
+#endif
+
+/* A/UX setpgid incorrectly removes the controlling terminal.
+ Per Posix, only setsid should do that. */
+#define setpgrp setpgid
+#define SIGVAL void
+#define killpg(pgrp, sig) kill(-(pgrp), sig)
+
+char *default_server = "X";
+char *displayNum = ":0";
+char *default_client[] ={"xterm", "-geometry", "+1+1", "-n", "login", NULL};
+char *program;
+int serverpid = -1;
+int clientpid = -1;
+volatile int gotSignal = 0;
+volatile int gotAlarm = 0;
+
+static char processTimeout ( int timeout, char *string );
+static int startServer ( char *server[] );
+static int startClient ( char *client[] );
+static void shutDown ( void );
+static void pathexec_run(char *file,char **argv,char **envp);
+static void Fatal(char *msg);
+static void Error(char *s);
+static void Error_n(int n);
+
+static SIGVAL sig_catch(int sig,void (*f)()) {
+ struct sigaction sa;
+ sa.sa_handler = f;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+ sigaction(sig,&sa,(struct sigaction *) 0);
+}
+static SIGVAL sigCatch(int sig) {gotSignal = sig;}
+static SIGVAL sigAlarm(int sig) {gotAlarm = sig;}
+static SIGVAL sigUsr1() {}
+
+static void Execute(char **c) {
+ pathexec_run(*c,c,environ);
+ if (errno != ENOEXEC) return;
+ *--c = "/bin/sh";
+ pathexec_run(*c,c,environ);
+}
+
+static unsigned int env_len;
+static char *path_save;
+
+int main(int argc, char *argv[]) {
+ int pid;
+ char **client, **cptr, **server, **ptr;
+#ifdef USE_XCLEAN
+ char *xclean[] = { "/bin/sh", "-c", 0, 0 };
+#endif
+
+ program = *argv++;
+ /* sh 5 \0 sh X :0 \0 = 11 */
+ client = (char **) alloca((13+argc) * sizeof (char *));
+ if (!client) Fatal("no memory\n");
+ cptr = ++client;
+
+ /* copy the client args. */
+ if (*argv == 0 || (**argv != '/' && **argv != '.'))
+ for (ptr = default_client; *ptr; )
+ *cptr++ = *ptr++;
+ while (*argv && strcmp(*argv, "--")) *cptr++ = *argv++;
+ *cptr++ = NULL;
+ if (*argv) argv++;
+
+ /* Copy the server args. */
+ server = ++cptr;
+ if (*argv == 0 || (**argv != '/' && **argv != '.'))
+ *cptr++ = default_server;
+ else
+ *cptr++ = *argv++;
+
+ if (*argv && (argv[0][0] == ':' && (unsigned int)(argv[0][1] -'0')<10))
+ displayNum = *argv;
+ *cptr++ = displayNum;
+
+ do { *cptr++ = *argv; } while (*argv++);
+
+ /* Start the server and client. */
+ sig_catch(SIGCHLD, SIG_DFL); /* Insurance */
+
+ /* Let those signal interrupt the wait() call in the main loop */
+ sig_catch(SIGQUIT, sigCatch);
+ sig_catch(SIGINT, sigCatch);
+ sig_catch(SIGHUP, sigCatch);
+ sig_catch(SIGPIPE, sigCatch);
+
+ sig_catch(SIGUSR1, sigUsr1);
+
+ /* count number of environment variables */
+ for (ptr = environ; *ptr; ptr++) {
+ char *x = *ptr;
+ if (!memcmp("PATH=", x, 5)) path_save = x + 5;
+
+#ifdef USE_XCLEAN
+ if (!memcmp("XCLEAN=", x, 7)) {
+ xclean[2] = x + 7;
+ x = *environ++;
+ }
+#endif
+ }
+ env_len = ptr - environ;
+
+ if (startServer(server) > 0 && startClient(client) > 0) {
+ pid = -1;
+ while (pid != clientpid && pid != serverpid
+ && gotSignal == 0 ) pid = wait(NULL);
+ }
+ sig_catch(SIGQUIT, SIG_IGN);
+ sig_catch(SIGINT, SIG_IGN);
+ sig_catch(SIGHUP, SIG_IGN);
+ sig_catch(SIGPIPE, SIG_IGN);
+
+ shutDown();
+ if (gotSignal != 0) {
+ Error(program); Error(": unexpected signal: ");
+ Error_n(gotSignal); Error("\n");
+ _exit(1);
+ }
+ if (serverpid < 0 ) Fatal("Server error.\n");
+ if (clientpid < 0 ) Fatal("Client error.\n");
+#ifdef USE_XCLEAN
+ if (xclean[2]) execve(xclean[0], xclean, environ);
+#endif
+ _exit(0);
+}
+
+/* return TRUE if we timeout waiting for pid to exit, FALSE otherwise. */
+static char processTimeout(int timeout, char *string) {
+ int i = 0, pidfound = -1;
+ time_t deadline = time(0) + timeout;
+ for (;;) {
+ if ((pidfound = waitpid(serverpid, 0, WNOHANG)) == serverpid)
+ break;
+ if (i == 0) {
+ Error("\nwaiting for "); Error(string);
+ } else
+ Error(".");
+
+ sleep (1);
+ if (++i > 1024 || time(0) > deadline) break;
+ }
+ if (i>0) Error("\n"); /* tidy up after message */
+ return( serverpid != pidfound );
+}
+
+static int startServer(char *server[]) {
+ sigset_t mask, old;
+
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGUSR1);
+ sigprocmask(SIG_BLOCK, &mask, &old);
+
+ switch((serverpid=fork())) {
+ case 0:
+ sigprocmask(SIG_UNBLOCK, &mask, 0);
+
+ /* don't hang on read/write to control tty */
+ sig_catch(SIGTTIN, SIG_IGN);
+ sig_catch(SIGTTOU, SIG_IGN);
+
+ /*
+ * ignore SIGUSR1 in child. The server
+ * will notice this and send SIGUSR1 back
+ * at xinit when ready to accept connections
+ */
+ (void) sig_catch(SIGUSR1, SIG_IGN);
+ /*
+ * prevent server from getting sighup from vhangup()
+ * if client is xterm -L
+ */
+ setpgrp(0,getpid());
+
+#ifdef Xwrapper
+ if (!strcmp(server[0],default_server)) {
+ server[0] = "Xwrapper";
+ Execute(server);
+ server[0] = default_server;
+ }
+#endif
+ Execute (server);
+ _exit(1);
+ break;
+ case -1:
+ break;
+ default:
+ /* don't nice server */
+ setpriority( PRIO_PROCESS, serverpid, -1 );
+ /* kludge to avoid race with TCP, giving server time to
+ set his socket options before we try to open it,
+ either use the 15 second timeout, or await SIGUSR1.
+
+ If your machine is substantially slower than 15 seconds,
+ you can easily adjust this value. */
+ sig_catch(SIGALRM, sigAlarm);
+ alarm (15);
+ sigsuspend(&old);
+ alarm (0);
+ sigprocmask(SIG_UNBLOCK, &mask, NULL);
+ if (gotAlarm) {Error("unable to connect to X server\n");
+ shutDown(); serverpid=-1; }
+ break;
+ }
+ return(serverpid);
+}
+
+static int startClient(char *client[]) {
+ if ((clientpid = fork()) == 0) {
+ char **newenviron;
+ char **newPtr, **oldPtr, *displaybuf;
+
+ newenviron = (char **) alloca ((env_len + 2) * sizeof(char *));
+ if (!newenviron) Fatal("no memory\n");
+ displaybuf = (char *) alloca(9 + strlen(displayNum));
+ if (!displaybuf) Fatal("no memory\n");
+
+ /* put DISPLAY=displayname as first element */
+ strcpy (displaybuf, "DISPLAY=");
+ strcpy (displaybuf + 8, displayNum);
+ newPtr = newenviron;
+ *newPtr++ = displaybuf;
+
+ /* copy pointers to other variables */
+ for (oldPtr = environ; ; oldPtr++) {
+ *newPtr = *oldPtr;
+ if (*oldPtr == 0) break;
+ if (memcmp (*newPtr, "DISPLAY=", 8))
+ newPtr++;
+ }
+ environ = newenviron;
+
+ setuid(getuid());
+ setpgrp(0, getpid());
+
+ Execute (client);
+ _exit(1);
+ }
+ return (clientpid);
+}
+
+static void shutDown(void) {
+ if (clientpid > 0) {
+ /* HUP all local clients to allow them to clean up */
+ if ((killpg(clientpid, SIGHUP) != 0) && (errno != ESRCH)) {
+ Error("can't send HUP to process group ");
+ Error_n(clientpid); Error("\n");
+ }
+ }
+
+ if (serverpid < 0) return;
+ if (killpg(serverpid, SIGTERM) < 0) {
+ if (errno == EPERM) Fatal("Can't kill X server\n");
+ if (errno == ESRCH) return;
+ }
+ if (! processTimeout(10, "X server to shut down")) {
+ Error("\n");
+ return;
+ }
+
+ Error("X server slow to shut down, sending KILL signal.\n");
+ if (killpg(serverpid, SIGKILL) < 0) {
+ if (errno == ESRCH)
+ return;
+ }
+ if (processTimeout(3, "server to die")) Fatal("Can't kill X server\n");
+ Error("\n");
+ return;
+}
+
+static void Error(char *s) {write(2,s,strlen(s));}
+static void Fatal(char *msg)
+ {Error(program); Error(": "); Error(msg); _exit(1);}
+
+static void Error_n(int k) {
+ char buf[24], *last=buf+24, *p = last;
+ unsigned int u;
+ if (k<0) u=-k;
+ else u=k;
+ do { *--p = '0' + (u % 10); u /= 10; } while(u);
+ if (k<0) *--p = '-';
+ write(2,p,last-p);
+}
+
+static void pathexec_run(char *file,char **argv,char **envp) {
+ char *tmp,*next, *path;
+ int savederrno=0;
+
+ if (strchr((char *)file,'/')) { execve(file,argv,envp); return; }
+
+ path = (path_save) ? path_save : "/bin:/usr/bin";
+ tmp = (char *)alloca(4+strlen(path) + strlen(file));
+ if (!tmp) {errno=ENOMEM; return;}
+
+ for (;;) {
+ size_t len = 1;
+ next = strchr(path,':');
+ if (!next) next=path + strlen(path);
+
+ if (path[0] == 0 || path[0] == ':') tmp[0] = '.';
+ else { len = next-path; memcpy(tmp,path,len); }
+ tmp[len++] = '/';
+ strcpy(tmp+len,file);
+
+ execve(tmp,argv,envp);
+ if (errno != ENOENT) {
+ savederrno = errno;
+ if ((errno != EACCES) && (errno != ENOEXEC) && (errno != ENOTDIR)) return;
+ }
+
+ if (*next==0) {
+ if (savederrno) errno = savederrno;
+ return;
+ }
+ path=next+1;
+ }
+}
+
+
+#if 0
+--- startx.original 2009-08-18 21:27:17.000000000 +0300
++++ startx 2009-08-18 22:07:37.000000000 +0300
+@@ -175,13 +175,18 @@
+ fi
+
+
++XCLEAN=''
++if [ x"$enable_xauth" = x1 ] ; then
++ if [ x"$removelist" != x ]; then
++ XCLEAN="xauth remove $removelist;"
++ fi
++ if [ x"$xserverauthfile" != x ]; then
++ XCLEAN="$XCLEAN""rm -f $xserverauthfile"
++ fi
++fi
+
+-
+-
+-
+-
+-
+-xinit $client $clientargs -- $server $display $serverargs
++[ "$XCLEAN" != "" ] && export XCLEAN
++exec xinit $client $clientargs -- $server $display $serverargs
+
+
+ if [ x"$enable_xauth" = x1 ] ; then
+#endif