From f29d3519ce073ec30f99754d93304324f7f26d65 Mon Sep 17 00:00:00 2001 From: Deposite Pirate Date: Sun, 16 Sep 2018 18:47:05 +0200 Subject: Initial commit. --- base/bin/config/Makefile | 109 ++++ base/bin/config/README | 1 + base/bin/config/common.mk | 11 + base/bin/config/default/useradd | 8 + base/bin/config/login.defs | 261 ++++++++++ base/bin/config/os-release | 7 + base/bin/config/pam.d/Makefile | 17 + base/bin/config/pam.d/chage | 6 + base/bin/config/pam.d/chfn | 6 + base/bin/config/pam.d/chgpasswd | 4 + base/bin/config/pam.d/chpasswd | 6 + base/bin/config/pam.d/chsh | 6 + base/bin/config/pam.d/groupadd | 6 + base/bin/config/pam.d/groupdel | 6 + base/bin/config/pam.d/groupmems | 4 + base/bin/config/pam.d/groupmod | 6 + base/bin/config/pam.d/login | 7 + base/bin/config/pam.d/newusers | 6 + base/bin/config/pam.d/other | 5 + base/bin/config/pam.d/passwd | 4 + base/bin/config/pam.d/shadow | 6 + base/bin/config/pam.d/su | 9 + base/bin/config/pam.d/su-l | 9 + base/bin/config/pam.d/system-auth | 17 + base/bin/config/pam.d/system-local-login | 6 + base/bin/config/pam.d/system-login | 19 + base/bin/config/pam.d/system-remote-login | 6 + base/bin/config/pam.d/system-services | 11 + base/bin/config/pam.d/useradd | 6 + base/bin/config/pam.d/userdel | 6 + base/bin/config/pam.d/usermod | 6 + base/bin/config/security/limits.d/90-nproc.conf | 6 + base/bin/config/system.pc | 8 + base/bin/slackwareutils/Makefile | 75 +++ base/bin/slackwareutils/README | 5 + base/bin/slackwareutils/bban.1 | 45 ++ base/bin/slackwareutils/bban.c | 644 ++++++++++++++++++++++++ base/bin/slackwareutils/diskcopy.1 | 26 + base/bin/slackwareutils/diskcopy.sh | 9 + base/bin/slackwareutils/fromdos.1 | 23 + base/bin/slackwareutils/fromdos.c | 44 ++ base/bin/slackwareutils/getopt.c | 120 +++++ base/bin/slackwareutils/mktemp-bsd.1 | 1 + base/bin/slackwareutils/mktemp.1 | 238 +++++++++ base/bin/slackwareutils/mktemp.c | 201 ++++++++ base/bin/slackwareutils/strings.1 | 96 ++++ base/bin/slackwareutils/strings.c | 212 ++++++++ base/bin/slackwareutils/sysvbanner.1 | 51 ++ base/bin/slackwareutils/sysvbanner.c | 151 ++++++ base/bin/slackwareutils/todos.1 | 23 + base/bin/slackwareutils/todos.c | 47 ++ base/bin/slackwareutils/xx.1 | 40 ++ base/bin/slackwareutils/xx.sh | 21 + 53 files changed, 2673 insertions(+) create mode 100644 base/bin/config/Makefile create mode 100644 base/bin/config/README create mode 100644 base/bin/config/common.mk create mode 100644 base/bin/config/default/useradd create mode 100644 base/bin/config/login.defs create mode 100644 base/bin/config/os-release create mode 100644 base/bin/config/pam.d/Makefile create mode 100644 base/bin/config/pam.d/chage create mode 100644 base/bin/config/pam.d/chfn create mode 100644 base/bin/config/pam.d/chgpasswd create mode 100644 base/bin/config/pam.d/chpasswd create mode 100644 base/bin/config/pam.d/chsh create mode 100644 base/bin/config/pam.d/groupadd create mode 100644 base/bin/config/pam.d/groupdel create mode 100644 base/bin/config/pam.d/groupmems create mode 100644 base/bin/config/pam.d/groupmod create mode 100644 base/bin/config/pam.d/login create mode 100644 base/bin/config/pam.d/newusers create mode 100644 base/bin/config/pam.d/other create mode 100644 base/bin/config/pam.d/passwd create mode 100644 base/bin/config/pam.d/shadow create mode 100644 base/bin/config/pam.d/su create mode 100644 base/bin/config/pam.d/su-l create mode 100644 base/bin/config/pam.d/system-auth create mode 100644 base/bin/config/pam.d/system-local-login create mode 100644 base/bin/config/pam.d/system-login create mode 100644 base/bin/config/pam.d/system-remote-login create mode 100644 base/bin/config/pam.d/system-services create mode 100644 base/bin/config/pam.d/useradd create mode 100644 base/bin/config/pam.d/userdel create mode 100644 base/bin/config/pam.d/usermod create mode 100644 base/bin/config/security/limits.d/90-nproc.conf create mode 100644 base/bin/config/system.pc create mode 100644 base/bin/slackwareutils/Makefile create mode 100644 base/bin/slackwareutils/README create mode 100644 base/bin/slackwareutils/bban.1 create mode 100644 base/bin/slackwareutils/bban.c create mode 100644 base/bin/slackwareutils/diskcopy.1 create mode 100644 base/bin/slackwareutils/diskcopy.sh create mode 100644 base/bin/slackwareutils/fromdos.1 create mode 100644 base/bin/slackwareutils/fromdos.c create mode 100644 base/bin/slackwareutils/getopt.c create mode 100644 base/bin/slackwareutils/mktemp-bsd.1 create mode 100644 base/bin/slackwareutils/mktemp.1 create mode 100644 base/bin/slackwareutils/mktemp.c create mode 100644 base/bin/slackwareutils/strings.1 create mode 100644 base/bin/slackwareutils/strings.c create mode 100644 base/bin/slackwareutils/sysvbanner.1 create mode 100644 base/bin/slackwareutils/sysvbanner.c create mode 100644 base/bin/slackwareutils/todos.1 create mode 100644 base/bin/slackwareutils/todos.c create mode 100644 base/bin/slackwareutils/xx.1 create mode 100644 base/bin/slackwareutils/xx.sh (limited to 'base/bin') diff --git a/base/bin/config/Makefile b/base/bin/config/Makefile new file mode 100644 index 0000000..e070d6a --- /dev/null +++ b/base/bin/config/Makefile @@ -0,0 +1,109 @@ +include common.mk + +all: + +install-filesystem: + $(INSTALLDIR) $(DESTDIR)/boot + $(INSTALLDIR) $(DESTDIR)/dev + $(INSTALLDIR) $(DESTDIR)$(SYSCONFDIR) + $(INSTALLDIR) $(DESTDIR)/home + $(INSTALLDIR) $(DESTDIR)/mnt + $(INSTALLDIR) $(DESTDIR)/opt + $(INSTALLDIR) $(DESTDIR)/proc + $(INSTALLDIR) $(DESTDIR)/root + $(INSTALLDIR) $(DESTDIR)/run + $(INSTALLDIR) $(DESTDIR)/srv + $(INSTALLDIR) $(DESTDIR)/sys + $(INSTALLDIR) $(DESTDIR)/tmp + $(INSTALLDIR) $(DESTDIR)/usr + $(INSTALLDIR) $(DESTDIR)/usr/bin + $(INSTALLDIR) $(DESTDIR)/usr/include + $(INSTALLDIR) $(DESTDIR)/usr/lib + $(INSTALLDIR) $(DESTDIR)/usr/local + $(INSTALLDIR) $(DESTDIR)/usr/local/bin + $(INSTALLDIR) $(DESTDIR)/usr/local/etc + $(INSTALLDIR) $(DESTDIR)/usr/local/include + $(INSTALLDIR) $(DESTDIR)/usr/local/lib + $(INSTALLDIR) $(DESTDIR)/usr/local/sbin + $(INSTALLDIR) $(DESTDIR)/usr/local/share + $(INSTALLDIR) $(DESTDIR)/usr/local/share/doc + $(INSTALLDIR) $(DESTDIR)/usr/local/share/info + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man1 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man2 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man3 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man4 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man5 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man6 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man7 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man8 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/man9 + $(INSTALLDIR) $(DESTDIR)/usr/local/share/man/mann + $(INSTALLDIR) $(DESTDIR)/usr/local/src + $(INSTALLDIR) $(DESTDIR)/usr/sbin + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR) + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/doc + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/info + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man1 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man2 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man3 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man4 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man5 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man6 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man7 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man8 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/man9 + $(INSTALLDIR) $(DESTDIR)$(DATAROOTDIR)/man/mann + $(INSTALLDIR) $(DESTDIR)/usr/src + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR) + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/empty + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat1 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat2 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat3 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat4 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat5 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat6 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat7 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat8 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/cat9 + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/cache/man/catn + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/crash + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/lib + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/log + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/spool + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/spool/mail + $(INSTALLDIR) $(DESTDIR)$(LOCALSTATEDIR)/tmp + $(LINK) /usr/bin $(DESTDIR)/bin + $(LINK) /usr/sbin $(DESTDIR)/sbin + $(LINK) /usr/lib $(DESTDIR)/lib + +install-osrelease: + $(INSTALLDIR) $(DESTDIR)$(SYSCONFDIR) + $(INSTALLDAT) os-release $(DESTDIR)$(SYSCONFDIR) + +install-pkgconfig: + $(INSTALLDIR) $(DESTDIR)$(PKGCONFIGDIR) + $(INSTALLDAT) system.pc $(DESTDIR)$(PKGCONFIGDIR) + +install-logindefs: + $(INSTALLDIR) $(DESTDIR)$(SYSCONFDIR) + $(INSTALLDAT) login.defs $(DESTDIR)$(SYSCONFDIR)/login.defs$(EXT) + +install-useradd: + $(INSTALLDIR) $(DESTDIR)$(SYSCONFDIR)/default + $(INSTALLDAT) default/useradd $(DESTDIR)$(SYSCONFDIR)/default/useradd$(EXT) + +install-limits-policy: + $(INSTALLDIR) $(DESTDIR)$(SYSCONFDIR)/security/limits.d + $(INSTALLDAT) security/limits.d/90-nproc.conf $(DESTDIR)$(SYSCONFDIR)/security/limits.d + +install-pam-package: install-limits-policy + $(MAKE) -C pam.d install-pam-policy-base + +install-bin-package: install-logindefs install-useradd + $(MAKE) -C pam.d install-pam-policy-util + +.PHONY: install-filesystem install-osrelease install-pkgconfig install-logindefs install-useradd install-limits-policy install-pam-package install-bin-package diff --git a/base/bin/config/README b/base/bin/config/README new file mode 100644 index 0000000..f2c454e --- /dev/null +++ b/base/bin/config/README @@ -0,0 +1 @@ +Attempt at forking Slackware because SysVinit sucks. diff --git a/base/bin/config/common.mk b/base/bin/config/common.mk new file mode 100644 index 0000000..04302c0 --- /dev/null +++ b/base/bin/config/common.mk @@ -0,0 +1,11 @@ +INSTALL = /usr/bin/install +INSTALLDIR = $(INSTALL) -m 0755 -d +INSTALLDAT = $(INSTALL) -m 0644 + +LINK = /usr/bin/ln -sf + +SYSCONFDIR = /etc +DATAROOTDIR = /usr/share +LOCALSTATEDIR = /var +PKGCONFIGDIR = $(DATAROOTDIR)/pkgconfig +PAMPOLICYDIR = $(SYSCONFDIR)/pam.d diff --git a/base/bin/config/default/useradd b/base/bin/config/default/useradd new file mode 100644 index 0000000..f3205e4 --- /dev/null +++ b/base/bin/config/default/useradd @@ -0,0 +1,8 @@ +# useradd defaults file +GROUP=100 +HOME=/home +INACTIVE=-1 +EXPIRE= +SHELL=/bin/bash +SKEL=/etc/skel +CREATE_MAIL_SPOOL=yes diff --git a/base/bin/config/login.defs b/base/bin/config/login.defs new file mode 100644 index 0000000..b929796 --- /dev/null +++ b/base/bin/config/login.defs @@ -0,0 +1,261 @@ +# +# /etc/login.defs - settings for user account and group utilities. +# + +# +# Delay in seconds before being allowed another attempt after a login failure +# Note: When PAM is used, some modules may enfore a minimal delay (e.g. +# pam_unix enforces a 2s delay) +# +# This setting affects 'su' and 'login' from util-linux. +# +FAIL_DELAY 3 + +# +# Enable display of unknown usernames when login failures are recorded. +# +# This setting affects 'login' from util-linux. +# +LOG_UNKFAIL_ENAB no + +# +# Enable "syslog" logging of 'sg' activity. +# +# This setting affects 'sg' from shadow. +# +SYSLOG_SG_ENAB yes + +# +# If defined, ":" delimited list of "message of the day" files to +# be displayed upon login. This is better handled by pam_motd.so so the +# declaration here is empty to suppress display by tools which read +# their settings from this file. +# +# This setting affects 'login' from util-linux. +# +MOTD_FILE +#MOTD_FILE /etc/motd:/usr/lib/news/news-motd + +# +# *REQUIRED* +# Directory where mailboxes reside, _or_ name of file, relative to the +# home directory. If you _do_ define both, MAIL_DIR takes precedence. +# +# This setting affects 'useradd', 'userdel' and 'usermod' from shadow. +# +MAIL_DIR /var/spool/mail +#MAIL_FILE .mail +#QMAIL_DIR Maildir + +# +# If defined, file which inhibits all the usual chatter during the login +# sequence. If a full pathname, then hushed mode will be enabled if the +# user's name or shell are found in the file. If not a full pathname, then +# hushed mode will be enabled if the file exists in the user's home directory. +# +# This setting affects 'login' from util-linux. +# +HUSHLOGIN_FILE .hushlogin +#HUSHLOGIN_FILE /etc/hushlogins + +# +# *REQUIRED* The default PATH settings, for superuser and normal users. +# +# (they are minimal, add the rest in the shell startup files) +# +# These settings affects 'login', 'su' and 'runuser' from util-linux. +# +ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin +ENV_PATH PATH=/usr/local/bin:/bin:/usr/bin +#ENV_ROOTPATH PATH=/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin + +# +# If set to yes and --login and --preserve-environment were not specified +# su initializes PATH. +# +# This setting affects 'su' and 'runuser' from util-linux. +# +#ALWAYS_SET_PATH no + +# +# Terminal permissions +# +# TTYGROUP Login tty will be assigned this group ownership. +# TTYPERM Login tty will be set to this permission. +# +# If you have a "write" program which is "setgid" to a special group +# which owns the terminals, define TTYGROUP to the group number and +# TTYPERM to 0620. Otherwise leave TTYGROUP commented out and assign +# TTYPERM to either 622 or 600. +# +# These settings affects 'login' from util-linux. +# +TTYGROUP tty +TTYPERM 0620 + +# +# This is the umask used to set the mode of new user directories. +# +# 022 is the default value, but 027, or even 077, could be considered +# better for privacy. There is no One True Answer here: each sysadmin +# must make up her mind. +# +# This setting affects 'newusers' and 'useradd' from shadow. +# +UMASK 022 + +# +# Password aging controls: +# +# PASS_MAX_DAYS Maximum number of days a password may be used. +# PASS_MIN_DAYS Minimum number of days allowed between password changes. +# PASS_MIN_LEN Minimum acceptable password length. +# PASS_WARN_AGE Number of days warning given before a password expires. +# +# These settings affects 'chpasswd', 'newusers', 'pwck', 'pwconv', 'pwunconv', +# 'useradd' and 'usermod' from shadow. +# +PASS_MAX_DAYS 99999 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 +# +# This setting affects 'passwd' from shadow. +# +PASS_MIN_LEN 5 + +# +# Min/max values for automatic uid selection in useradd from shadow +# +UID_MIN 1000 +UID_MAX 60000 +# System accounts +SYS_UID_MIN 101 +SYS_UID_MAX 999 + +# +# Min/max values for automatic gid selection in groupadd for shadow +# +GID_MIN 1000 +GID_MAX 60000 +# System accounts +SYS_GID_MIN 101 +SYS_GID_MAX 999 + +# +# Max number of login retries if password is bad +# +# This setting affects 'login' from util-linux. +# +LOGIN_RETRIES 5 + +# +# Max time in seconds for login +# +# This setting affects 'login' from util-linux. +# +LOGIN_TIMEOUT 60 + +# +# Maximum number of attempts to change password if rejected (too easy) +# +# This setting affects 'passwd' from shadow. +# +PASS_CHANGE_TRIES 5 + +# +# Warn about weak passwords (but still allow them) if you are root. +# +# This setting affects 'passwd' from shadow. +# +PASS_ALWAYS_WARN yes + +# +# Number of significant characters in the password for crypt(). +# Default is 8, don't change unless your crypt() is better. +# Ignored if MD5_CRYPT_ENAB set to "yes". +# +# This setting affects 'passwd' from shadow. +# +#PASS_MAX_LEN 8 + +# +# Only works if compiled with ENCRYPTMETHOD_SELECT defined: +# If set to MD5 , MD5-based algorithm will be used for encrypting password +# If set to SHA256, SHA256-based algorithm will be used for encrypting password +# If set to SHA512, SHA512-based algorithm will be used for encrypting password +# If set to DES, DES-based algorithm will be used for encrypting password (default) +# Overrides the MD5_CRYPT_ENAB option +# +# Note: If you use PAM, it is recommended to use a value consistent with +# the PAM modules configuration. +# +# This setting affects 'passwd' from shadow. +# +ENCRYPT_METHOD SHA512 + +# +# Only works if ENCRYPT_METHOD is set to SHA256 or SHA512. +# +# Define the number of SHA rounds. +# With a lot of rounds, it is more difficult to brute forcing the password. +# But note also that it more CPU resources will be needed to authenticate +# users. +# +# If not specified, the libc will choose the default number of rounds (5000). +# The values must be inside the 1000-999999999 range. +# If only one of the MIN or MAX values is set, then this value will be used. +# If MIN > MAX, the highest value will be used. +# +# This setting affects 'passwd' from shadow. +# +# SHA_CRYPT_MIN_ROUNDS 5000 +# SHA_CRYPT_MAX_ROUNDS 5000 + +# +# Should login be allowed if we can't cd to the home directory? +# Default in no. +# +# This setting affects 'login' from util-linux. +# +DEFAULT_HOME yes + +# +# If defined, this command is run when removing a user. +# It should remove any at/cron/print jobs etc. owned by +# the user to be removed (passed as the first argument). +# +# This setting affects 'userdel' from shadow. +# +#USERDEL_CMD /usr/sbin/userdel_local + +# +# Enable setting of the umask group bits to be the same as owner bits +# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is +# the same as gid, and username is the same as the primary group name. +# +# This also enables userdel to remove user groups if no members exist. +# +# This setting affects 'useradd' and 'userdel' from shadow. +# +USERGROUPS_ENAB yes + +# +# If set to a non-nul number, the shadow utilities will make sure that +# groups never have more than this number of users on one line. +# This permit to support split groups (groups split into multiple lines, +# with the same group ID, to avoid limitation of the line length in the +# group file). +# +# 0 is the default value and disables this feature. +# +#MAX_MEMBERS_PER_GROUP 0 + +# +# If useradd should create home directories for users by default (non +# system users only) +# This option is overridden with the -M or -m flags on the useradd command +# line. +# +# This setting affects 'useradd' from shadow. +# +#CREATE_HOME yes diff --git a/base/bin/config/os-release b/base/bin/config/os-release new file mode 100644 index 0000000..b79b454 --- /dev/null +++ b/base/bin/config/os-release @@ -0,0 +1,7 @@ +NAME="Tightware" +VERSION"1" +ID=tightware +VERSION_ID=1 +PRETTY_NAME="Tightware GNU/Linux 1.0" +ANSI_COLOR="1;32" + diff --git a/base/bin/config/pam.d/Makefile b/base/bin/config/pam.d/Makefile new file mode 100644 index 0000000..74076ab --- /dev/null +++ b/base/bin/config/pam.d/Makefile @@ -0,0 +1,17 @@ +include ../common.mk + +FILES_BASE = other system-auth system-local-login system-login system-remote-login system-services +FILES_UTIL = chage chfn chgpasswd chpasswd chsh groupadd groupdel groupmems groupmod login newusers passwd shadow su su-l useradd userdel usermod + +# $(INSTALLDAT) $(FILES_BASE) $(DESTDIR)$(PAMPOLICYDIR) + +install-pam-policy-dir: + $(INSTALLDIR) $(DESTDIR)$(PAMPOLICYDIR) + +install-pam-policy-base: install-pam-policy-dir + for file in $(FILES_BASE); do $(INSTALLDAT) $$file $(DESTDIR)$(PAMPOLICYDIR)/$$file$(EXT); done + +install-pam-policy-util: install-pam-policy-dir + for file in $(FILES_UTIL); do $(INSTALLDAT) $$file $(DESTDIR)$(PAMPOLICYDIR)/$$file$(EXT); done + +.PHONY: install-pam-policy-dir install-pam-policy-base install-pam-policy-util diff --git a/base/bin/config/pam.d/chage b/base/bin/config/pam.d/chage new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/chage @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/chfn b/base/bin/config/pam.d/chfn new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/chfn @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/chgpasswd b/base/bin/config/pam.d/chgpasswd new file mode 100644 index 0000000..8f49f5c --- /dev/null +++ b/base/bin/config/pam.d/chgpasswd @@ -0,0 +1,4 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +account required pam_permit.so +password include system-auth diff --git a/base/bin/config/pam.d/chpasswd b/base/bin/config/pam.d/chpasswd new file mode 100644 index 0000000..5d44798 --- /dev/null +++ b/base/bin/config/pam.d/chpasswd @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_unix.so sha512 shadow diff --git a/base/bin/config/pam.d/chsh b/base/bin/config/pam.d/chsh new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/chsh @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/groupadd b/base/bin/config/pam.d/groupadd new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/groupadd @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/groupdel b/base/bin/config/pam.d/groupdel new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/groupdel @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/groupmems b/base/bin/config/pam.d/groupmems new file mode 100644 index 0000000..8f49f5c --- /dev/null +++ b/base/bin/config/pam.d/groupmems @@ -0,0 +1,4 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +account required pam_permit.so +password include system-auth diff --git a/base/bin/config/pam.d/groupmod b/base/bin/config/pam.d/groupmod new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/groupmod @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/login b/base/bin/config/pam.d/login new file mode 100644 index 0000000..1960d94 --- /dev/null +++ b/base/bin/config/pam.d/login @@ -0,0 +1,7 @@ +#%PAM-1.0 + +auth required pam_securetty.so +auth requisite pam_nologin.so +auth include system-local-login +account include system-local-login +session include system-local-login diff --git a/base/bin/config/pam.d/newusers b/base/bin/config/pam.d/newusers new file mode 100644 index 0000000..5d44798 --- /dev/null +++ b/base/bin/config/pam.d/newusers @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_unix.so sha512 shadow diff --git a/base/bin/config/pam.d/other b/base/bin/config/pam.d/other new file mode 100644 index 0000000..08498b4 --- /dev/null +++ b/base/bin/config/pam.d/other @@ -0,0 +1,5 @@ +#%PAM-1.0 +auth required pam_unix.so +account required pam_unix.so +password required pam_unix.so +session required pam_unix.so diff --git a/base/bin/config/pam.d/passwd b/base/bin/config/pam.d/passwd new file mode 100644 index 0000000..ab56da4 --- /dev/null +++ b/base/bin/config/pam.d/passwd @@ -0,0 +1,4 @@ +#%PAM-1.0 +#password required pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3 +#password required pam_unix.so sha512 shadow use_authtok +password required pam_unix.so sha512 shadow nullok diff --git a/base/bin/config/pam.d/shadow b/base/bin/config/pam.d/shadow new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/shadow @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/su b/base/bin/config/pam.d/su new file mode 100644 index 0000000..cf15f40 --- /dev/null +++ b/base/bin/config/pam.d/su @@ -0,0 +1,9 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +# Uncomment the following line to implicitly trust users in the "wheel" group. +#auth sufficient pam_wheel.so trust use_uid +# Uncomment the following line to require a user to be in the "wheel" group. +#auth required pam_wheel.so use_uid +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so diff --git a/base/bin/config/pam.d/su-l b/base/bin/config/pam.d/su-l new file mode 100644 index 0000000..cf15f40 --- /dev/null +++ b/base/bin/config/pam.d/su-l @@ -0,0 +1,9 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +# Uncomment the following line to implicitly trust users in the "wheel" group. +#auth sufficient pam_wheel.so trust use_uid +# Uncomment the following line to require a user to be in the "wheel" group. +#auth required pam_wheel.so use_uid +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so diff --git a/base/bin/config/pam.d/system-auth b/base/bin/config/pam.d/system-auth new file mode 100644 index 0000000..b28a7e9 --- /dev/null +++ b/base/bin/config/pam.d/system-auth @@ -0,0 +1,17 @@ +#%PAM-1.0 + +auth required pam_env.so +auth required pam_unix.so try_first_pass nullok +auth optional pam_permit.so + +account required pam_unix.so +account optional pam_permit.so +account required pam_time.so + +password required pam_unix.so try_first_pass nullok sha512 shadow +password optional pam_permit.so + +session required pam_limits.so +session required pam_env.so +session required pam_unix.so +session optional pam_permit.so diff --git a/base/bin/config/pam.d/system-local-login b/base/bin/config/pam.d/system-local-login new file mode 100644 index 0000000..347b815 --- /dev/null +++ b/base/bin/config/pam.d/system-local-login @@ -0,0 +1,6 @@ +#%PAM-1.0 + +auth include system-login +account include system-login +password include system-login +session include system-login diff --git a/base/bin/config/pam.d/system-login b/base/bin/config/pam.d/system-login new file mode 100644 index 0000000..394419b --- /dev/null +++ b/base/bin/config/pam.d/system-login @@ -0,0 +1,19 @@ +#%PAM-1.0 + +auth required pam_tally2.so onerr=succeed file=/var/log/faillog +auth required pam_shells.so +auth requisite pam_nologin.so +auth include system-auth + +account required pam_access.so +account required pam_nologin.so +account include system-auth + +password include system-auth + +session optional pam_loginuid.so +session required pam_env.so +session include system-auth +session optional pam_motd.so motd=/etc/motd +session optional pam_mail.so dir=/var/spool/mail standard quiet +-session optional pam_systemd.so diff --git a/base/bin/config/pam.d/system-remote-login b/base/bin/config/pam.d/system-remote-login new file mode 100644 index 0000000..347b815 --- /dev/null +++ b/base/bin/config/pam.d/system-remote-login @@ -0,0 +1,6 @@ +#%PAM-1.0 + +auth include system-login +account include system-login +password include system-login +session include system-login diff --git a/base/bin/config/pam.d/system-services b/base/bin/config/pam.d/system-services new file mode 100644 index 0000000..311c0d6 --- /dev/null +++ b/base/bin/config/pam.d/system-services @@ -0,0 +1,11 @@ +#%PAM-1.0 + +auth sufficient pam_permit.so + +account include system-auth + +session optional pam_loginuid.so +session required pam_limits.so +session required pam_env.so +session required pam_unix.so +session optional pam_permit.so diff --git a/base/bin/config/pam.d/useradd b/base/bin/config/pam.d/useradd new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/useradd @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/userdel b/base/bin/config/pam.d/userdel new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/userdel @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/pam.d/usermod b/base/bin/config/pam.d/usermod new file mode 100644 index 0000000..a7bf8a4 --- /dev/null +++ b/base/bin/config/pam.d/usermod @@ -0,0 +1,6 @@ +#%PAM-1.0 +auth sufficient pam_rootok.so +auth required pam_unix.so +account required pam_unix.so +session required pam_unix.so +password required pam_permit.so diff --git a/base/bin/config/security/limits.d/90-nproc.conf b/base/bin/config/security/limits.d/90-nproc.conf new file mode 100644 index 0000000..104dffd --- /dev/null +++ b/base/bin/config/security/limits.d/90-nproc.conf @@ -0,0 +1,6 @@ +# Default limit for number of user's processes to prevent +# accidental fork bombs. +# See rhbz #432903 for reasoning. + +* soft nproc 1024 +root soft nproc unlimited diff --git a/base/bin/config/system.pc b/base/bin/config/system.pc new file mode 100644 index 0000000..94d3272 --- /dev/null +++ b/base/bin/config/system.pc @@ -0,0 +1,8 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name=Tightware GNU/Linux +Description=Operating System +Version: 1.0 diff --git a/base/bin/slackwareutils/Makefile b/base/bin/slackwareutils/Makefile new file mode 100644 index 0000000..1b0538c --- /dev/null +++ b/base/bin/slackwareutils/Makefile @@ -0,0 +1,75 @@ +TARGETS=mktemp strings fromdos todos bban sysvbanner + +INSTALL=/usr/bin/install +INSTALLDIR=$(INSTALL) -m 0755 -d +INSTALLBIN=$(INSTALL) -m 0755 +INSTALLMAN=$(INSTALL) -m 0644 + +PREFIX=/usr +BINDIR=$(PREFIX)/bin +MANDIR=$(PREFIX)/share/man/man1 + +all: $(TARGETS) + +mktemp: mktemp.o +strings: strings.o getopt.o +fromdos: fromdos.o +todos: todos.o +sysvbanner: sysvbanner.o +bban: bban.o + +install: all install-mktemp install-strings install-fromdos install-todos install-sysvbanner install-bban install-diskcopy install-xx + +install-mktemp: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) mktemp $(DESTDIR)$(BINDIR)/mktemp-bsd + ( cd $(DESTDIR)$(BINDIR) ; ln -sf mktemp-bsd mktemp ) + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) mktemp-bsd.1 mktemp.1 $(DESTDIR)$(MANDIR) + +install-strings: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) strings $(DESTDIR)$(BINDIR) + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) strings.1 $(DESTDIR)$(MANDIR) + +install-fromdos: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) fromdos $(DESTDIR)$(BINDIR) + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) fromdos.1 $(DESTDIR)$(MANDIR) + +install-todos: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) todos $(DESTDIR)$(BINDIR) + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) todos.1 $(DESTDIR)$(MANDIR) + +install-sysvbanner: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) sysvbanner $(DESTDIR)$(BINDIR) + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) sysvbanner.1 $(DESTDIR)$(MANDIR) + +install-bban: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) bban $(DESTDIR)$(BINDIR) + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) bban.1 $(DESTDIR)$(MANDIR) + +install-diskcopy: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) diskcopy.sh $(DESTDIR)$(BINDIR)/diskcopy + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) diskcopy.1 $(DESTDIR)$(MANDIR) + +install-xx: + $(INSTALLDIR) $(DESTDIR)$(BINDIR) + $(INSTALLBIN) xx.sh $(DESTDIR)$(BINDIR)/xx + $(INSTALLDIR) $(DESTDIR)$(MANDIR) + $(INSTALLMAN) xx.1 $(DESTDIR)$(MANDIR) + +clean: + rm -f a.out core *~ *.o $(TARGETS) + +.PHONY: clean install install-mktemp install-strings install-fromdos install-todos install-sysvbanner install-bban install-diskcopy install-xx diff --git a/base/bin/slackwareutils/README b/base/bin/slackwareutils/README new file mode 100644 index 0000000..f07849a --- /dev/null +++ b/base/bin/slackwareutils/README @@ -0,0 +1,5 @@ +A collection of command line utilities found in Slackware Linux. + +So far the only differences with what's found in Slackware is that all warnings +and errors found with GCC and LLVM (3.1) have beed fixed. Some manual pages +were also created when they were missing. diff --git a/base/bin/slackwareutils/bban.1 b/base/bin/slackwareutils/bban.1 new file mode 100644 index 0000000..c3e2af6 --- /dev/null +++ b/base/bin/slackwareutils/bban.1 @@ -0,0 +1,45 @@ +.TH bban 1 "June 30, 2012" + +.LO 1 + +.SH NAME +.B bban +\- display an ASCII art banner text + +.SH SYNOPSIS +.B bban +.I [message] + +.SH OPTIONS +Usage: bban [-abcdefghijklmnopqrstuvwx] textarg [-] [...] +[-] interpolate from stdin into command line. +-w# (Width) The page width is set to #. +-i# (Indent) # extra blanks are left-inserted into each output line. +-b# (Blank lines) # extra blank lines will be output before the text +-lrc (Left, Right, Centered) ;justification of output +-jo (Jammed,Open) -j) omit normal 1-space border on top & left +-tv (Tall,Vertically normal) +-fh (Fat,Horizontally normal) +-ms (Mark string,Self) -m) next input arg. forms cyclic banner chars +-s) each text argument character used in forming itself. +-kd (marK,Default mark) use the text argument string to mark itself +-au (Asis,Uppercase) affect marking characters from -s or -k\n +-pn (Positive,Negative) +-ex (Echo,eXpand) +-g (Global) +-q (Quit) +The default flag settings are: -lovhsupxw120i0b0\n +bban -jm # text (Gives results similar to the banner command) +bban -m \\ EST -b-8ils EST \n +bban -jmn NUTS <12 underscores> -tfow72 ____NUTS____ -w72 <12 more>' +bban -j LO VE | bban -j - + +.SH DESCRIPTION +.B bban +takes a string as argument and outputs it as a large ASCII art banner text. + +.SH "SEE ALSO" +.BR banner (1) +.BR sysvbanner (1) +.BR figlet (1) +.BR ascii (7) diff --git a/base/bin/slackwareutils/bban.c b/base/bin/slackwareutils/bban.c new file mode 100644 index 0000000..f692449 --- /dev/null +++ b/base/bin/slackwareutils/bban.c @@ -0,0 +1,644 @@ +/* B B A N - A Better Banner Program - Apr84 IBM-PC version */ +/* The vax version will not work directly on the PC, because the +** UNIX shell metacharacter interpretation caused strings like +** 'one two three' to be passed as a single command line arg, while +** under DOS, it becomes three: "'one", "two", and "three'" +** So, we need a scheme for embedding spaces in arguments. +** One: choose some other character like underscore '_' and after +** command line argument passing, translate it into a space. +** Two: alter the program logic to treat single and double +** quotes as delimiters, and keep concatenating DOS-passed arguments +** until the closing delimiter is detected. +** Two is more elegant, but One is easier. +*/ + +#include +#include + +#if defined(__STDC__) || defined(__cplusplus) +# define P_(s) s +#else +# define P_(s) () +#endif + + +/* banner.c */ +extern int main P_((int argc, char **argv)); +static void doline P_((void)); +static int aqarg P_((void)); +static int redarg P_((void)); +static int gint P_((char **pp)); + +#undef P_ + +/* table of character translation patterns */ +char ctbl[128][7] = +{ /* stolen from banner */ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*below 040*/ + { 0, 000, 000, 000, 000, 000, 000 }, /* */ + { 034, 034, 034, 010, 0, 034, 034 }, /*!*/ + { 0167, 0167, 042, 0, 0, 0, 0 }, /*"*/ + { 024, 024, 0177, 024, 0177, 024, 024 }, /*#*/ + { 076, 0111, 0110, 076, 011, 0111, 076 }, /*$*/ + { 0161, 0122, 0164, 010, 027, 045, 0107 }, /*%*/ + { 030, 044, 030, 070, 0105, 0102, 071 }, /*&*/ + { 034, 034, 010, 020, 0, 0, 0 }, /*'*/ + { 014, 020, 040, 040, 040, 020, 014 }, /*(*/ + { 030, 4, 2, 2, 2, 4, 030 }, /*)*/ + { 0, 042, 024, 0177, 024, 042, 0 }, /***/ + { 0, 010, 010, 076, 010, 010, 0 }, /*+*/ + { 0, 0, 0, 034, 034, 010, 020 }, /*,*/ + { 0, 0, 0, 076, 0, 0, 0 }, /*-*/ + { 0, 0, 0, 0, 034, 034, 034 }, /*.*/ + { 1, 2, 4, 010, 020, 040, 0100 }, /*SLASH*/ + { 034, 042, 0101, 0101, 0101, 042, 034 }, /*0*/ + { 010, 030, 050, 010, 010, 010, 076 }, /*1*/ + { 076, 0101, 1, 076, 0100, 0100, 0177 }, /*2*/ + { 076, 0101, 1, 076, 1, 0101, 076 }, /*3*/ + { 0100, 0102, 0102, 0102, 0177, 2, 2 }, /*4*/ + { 0177, 0100, 0100, 0176, 1, 0101, 076 }, /*5*/ + { 076, 0101, 0100, 0176, 0101, 0101, 076 }, /*6*/ + { 0177, 0102, 04, 010, 020, 020, 020 }, /*7*/ + { 076, 0101, 0101, 076, 0101, 0101, 076 }, /*8*/ + { 076, 0101, 0101, 077, 1, 0101, 076 }, /*9*/ + { 010, 034, 010, 0, 010, 034, 010 }, /*:*/ + { 034, 034, 0, 034, 034, 010, 020 }, /*;*/ + { 020, 010, 4, 2, 4, 010, 020 }, /*<*/ + { 0, 0, 076, 0, 076, 0, 0 }, /*=*/ + { 4, 010, 020, 040, 020, 010, 4 }, /*>*/ + { 076, 0101, 1, 016, 010, 0, 010 }, /*?*/ + { 076, 0101, 0135, 0135, 0136, 0100, 076 }, /*@*/ + { 010, 024, 042, 0101, 0177, 0101, 0101 }, /*A*/ + { 0176, 0101, 0101, 0176, 0101, 0101, 0176 }, /*B*/ + { 076, 0101, 0100, 0100, 0100, 0101, 076 }, /*C*/ + { 0176, 0101, 0101, 0101, 0101, 0101, 0176 }, /*D*/ + { 0177, 0100, 0100, 0174, 0100, 0100, 0177 }, /*E*/ + { 0177, 0100, 0100, 0174, 0100, 0100, 0100 }, /*F*/ + { 076, 0101, 0100, 0117, 0101, 0101, 076 }, /*G*/ + { 0101, 0101, 0101, 0177, 0101, 0101, 0101 }, /*H*/ + { 034, 010, 010, 010, 010, 010, 034 }, /*I*/ + { 1, 1, 1, 1, 0101, 0101, 076 }, /*J*/ + { 0102, 0104, 0110, 0160, 0110, 0104, 0102 }, /*K*/ + { 0100, 0100, 0100, 0100, 0100, 0100, 0177 }, /*L*/ + { 0101, 0143, 0125, 0111, 0101, 0101, 0101 }, /*M*/ + { 0101, 0141, 0121, 0111, 0105, 0103, 0101 }, /*N*/ + { 0177, 0101, 0101, 0101, 0101, 0101, 0177 }, /*O*/ + { 0176, 0101, 0101, 0176, 0100, 0100, 0100 }, /*P*/ + { 076, 0101, 0101, 0101, 0105, 0102, 075 }, /*Q*/ + { 0176, 0101, 0101, 0176, 0104, 0102, 0101 }, /*R*/ + { 076, 0101, 0100, 076, 1, 0101, 076 }, /*S*/ + { 0177, 010, 010, 010, 010, 010, 010 }, /*T*/ + { 0101, 0101, 0101, 0101, 0101, 0101, 076 }, /*U*/ + { 0101, 0101, 0101, 0101, 042, 024, 010 }, /*V*/ + { 0101, 0111, 0111, 0111, 0111, 0111, 066 }, /*W*/ + { 0101, 042, 024, 010, 024, 042, 0101 }, /*X*/ + { 0101, 042, 024, 010, 010, 010, 010 }, /*Y*/ + { 0177, 2, 4, 010, 020, 040, 0177 }, /*Z*/ + { 076, 040, 040, 040, 040, 040, 076 }, /*[*/ + { 0100, 040, 020, 010, 004, 002, 001 }, /*\*/ + { 076, 2, 2, 2, 2, 2, 076 }, /*]*/ + { 010, 024, 042, 0, 0, 0, 0 }, /*^*/ + { 0, 000, 000, 000, 000, 000, 0177 }, /*_*/ + { 034, 034, 010, 04, 0, 0, 0 }, /*`*/ + { 0, 014, 022, 041, 077, 041, 041 }, /*a*/ + { 0, 076, 041, 076, 041, 041, 076 }, /*b*/ + { 0, 036, 041, 040, 040, 041, 036 }, /*c*/ + { 0, 076, 041, 041, 041, 041, 076 }, /*d*/ + { 0, 077, 040, 076, 040, 040, 077 }, /*e*/ + { 0, 077, 040, 076, 040, 040, 040 }, /*f*/ + { 0, 036, 041, 040, 047, 041, 036 }, /*g*/ + { 0, 041, 041, 077, 041, 041, 041 }, /*h*/ + { 0, 004, 004, 004, 004, 004, 004 }, /*i*/ + { 0, 001, 001, 001, 001, 041, 036 }, /*j*/ + { 0, 041, 042, 074, 044, 042, 041 }, /*k*/ + { 0, 040, 040, 040, 040, 040, 077 }, /*l*/ + { 0, 041, 063, 055, 041, 041, 041 }, /*m*/ + { 0, 041, 061, 051, 045, 043, 041 }, /*n*/ + { 0, 036, 041, 041, 041, 041, 036 }, /*o*/ + { 0, 076, 041, 041, 076, 040, 040 }, /*p*/ + { 0, 036, 041, 041, 045, 042, 035 }, /*q*/ + { 0, 076, 041, 041, 076, 042, 041 }, /*r*/ + { 0, 036, 040, 036, 001, 041, 036 }, /*s*/ + { 0, 037, 004, 004, 004, 004, 004 }, /*t*/ + { 0, 041, 041, 041, 041, 041, 036 }, /*u*/ + { 0, 041, 041, 041, 041, 022, 014 }, /*v*/ + { 0, 041, 041, 041, 055, 063, 041 }, /*w*/ + { 0, 041, 022, 014, 014, 022, 041 }, /*x*/ + { 0, 021, 012, 004, 004, 004, 004 }, /*y*/ + { 0, 077, 002, 004, 010, 020, 077 }, /*z*/ + { 034, 040, 040, 0140, 040, 040, 034 }, /*{*/ + { 010, 010, 010, 0, 010, 010, 010 }, /*|*/ + { 034, 2, 2, 3, 2, 2, 034 }, /*}*/ + { 060, 0111, 06, 0, 0, 0, 0 }, /*~*/ + { 0, 000, 000, 000, 000, 000, 000 }, /*DEL*/ +}; + +/* string sizes that fit selected printer widths: + flag/size/-w=> 72 80 81 120 132 158 174 217 225 + -hj 8 9 10 10 15 16 19 21 27 28 + -ho 9 8 8 9 13 14 17 19 24 25 + -fj 15 4 5 5 8 8 10 11 14 15 + -fo 16 4 5 5 7 8 9 10 13 14 + note: -jn "lower case" is similar to -on "CAPS" +*/ + +/* table of parameter default values */ +int dw = 80; /* page width, print positions */ +int di = 0; /* indent, print positions */ +int db = 0; /* print blank lines before arg */ + /* negative numbers require use of col */ +int dnp = 0200; /* contrast: 0200 -> pos, 0 -> neg */ +int doj = 0; /* spacing: 0 -> open, 1 -> jammed */ +int dclr = 8; /* justification: 8 -> left, + 1 -> center, 0 -> right */ +int dtv = 0; /* vert size: 0 -> normal, 7 -> double */ +int dfh = 0; /* hor size: 0 -> normal, 7 -> double */ +int dex = 1; /* echo: 1 -> expand, 0 -> copy thru */ +int dau = 1; /* mark case: 1 -> caps, 0 -> asis */ +int dkd = 0; /* mark string: 0 -> pmark, 1 -> self */ + +char dmark[31] = ""; /* marking chars - used serially */ + +/* parameters to use for current line */ +int pw, pi, pb, pnp, poj, pclr, ptv, pfh, pex, pau, pkd; +char *pms, pmark[31]; + +/* global variables */ +char *arg, ioarg1[121], ioarg2[121]; /* arg pointer, input areas */ +int aargc; +char **aargv; +int vx, strl; +char *chp, *esp, *imk, *mkp, *chh, mk; + +/* e.g: bban -nk " BBAN " +BBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBB +BANBBANBBA BAN ANBBAN BANBB NBBAN BANBBANBBA +ANBBANBBAN BANBB NB ANBBA BBAN B NBBA BANB ANBBANBBAN +NBBANBBANB ANBBA BB NBBAN BAN BAN BAN B NBB NBBANBBANB +BBANBBANBB BBA BAN BANBB NB AN BA BBANBBANBB +BANBBANBBA BBANB AN BANBB NB BB NBB N BANBBANBBA +ANBBANBBAN BANBB NB ANBBA BB NBBAN BA BBAN ANBBANBBAN +NBBANBBANB NBB BBA BBANB AN BANBB NBBANBBANB +BBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBBANBB +*/ + +int +main (int argc, char **argv) +{ + int firstarg, i, ival, xvx, cwd; + char *p, *q, ol[226], *ols; + + /* check for proper usage */ + if (argc < 2) + { + printf ("Usage: bban [-abcdefghijklmnopqrstuvwx] textarg [-] [...]\n"); + printf ("[-] interpolate from stdin into command line.\n"); + printf ("-w# (Width) The page width is set to #.\n"); + printf ("-i# (Indent) # extra blanks are left-inserted into each output line.\n"); + printf ("-b# (Blank lines) # extra blank lines will be output before the text\n"); + printf ("-lrc (Left, Right, Centered) ;justification of output\n"); + printf ("-jo (Jammed,Open) -j) omit normal 1-space border on top & left\n"); + printf ("-tv (Tall,Vertically normal)\n"); + printf ("-fh (Fat,Horizontally normal) \n"); + printf ("-ms (Mark string,Self) -m) next input arg. forms cyclic banner chars\n"); + printf (" -s) each text argument character used in forming itself.\n"); + printf ("-kd (marK,Default mark) use the text argument string to mark itself\n"); + printf ("-au (Asis,Uppercase) affect marking characters from -s or -k\n"); + printf ("-pn (Positive,Negative)\n"); + printf ("-ex (Echo,eXpand)\n"); + printf ("-g (Global) \n"); + printf ("-q (Quit) \n"); + printf ("The default flag settings are: -lovhsupxw120i0b0\n"); + printf ("bban -jm # text (Gives results similar to the banner command)\n"); + printf ("bban -m \\ EST -b-8ils EST \n"); + printf ("bban -jmn NUTS <12 underscores> -tfow72 ____NUTS____ -w72 <12 more>'\n"); + printf ("bban -j LO VE | bban -j -\n"); + exit (1); + } + /* make cmd line args available to other routines */ + aargc = argc; + aargv = argv; + /* set parameters to default values */ + pw = dw; + pi = di; + pb = db; + pnp = dnp; + poj = doj; + pclr = dclr; + ptv = dtv; + pfh = dfh; + pex = dex; + pau = dau; + pkd = dkd; + pms = dmark; + imk = pms; + + /* loop on args from cmd line or std input */ + firstarg = 1; + + while (aqarg () != 0) + { + if (*arg == '-') + { /* analyze flag args */ + p = arg; /* note q flag in loop condition */ + while (*++p != '\0' && *p != 'q' && *p != 'Q') + switch (*p) + { + case 'w': + case 'W': + if ((ival = gint (&p)) >= 1 && ival <= 225) + pw = ival; + else + printf ("W flag needs numeric 1:225, e.g: -w80\n"); + break; + case 'i': + case 'I': + if ((ival = gint (&p)) >= 0) + pi = ival; + else + printf ("I flag needs numeric >= 0, e.g: -i0\n"); + break; + case 'b': + case 'B': + pb = gint (&p); /* extra vertical spacing */ + break; + case 'n': + case 'N': + pnp = 0; /* contrast -> negative */ + break; + case 'p': + case 'P': + pnp = 0200; /* contrast -> positive */ + break; + case 'o': + case 'O': + poj = 0; /* spacing -> open */ + break; + case 'j': + case 'J': + poj = 1; /* spacing -> jammed */ + break; + case 'c': + case 'C': + pclr = 1; /* justification -> center */ + break; + case 'l': + case 'L': + pclr = 8; /* justification -> left */ + break; + case 'r': + case 'R': + pclr = 0; /* justification -> right */ + break; + case 't': + case 'T': + ptv = 7; /* height -> double */ + break; + case 'v': + case 'V': + ptv = 0; /* height -> normal */ + break; + case 'f': + case 'F': + pfh = 7; /* width -> double */ + break; + case 'h': + case 'H': + pfh = 0; /* width -> normal */ + break; + case 'e': + case 'E': + pex = 0; /* echo only - don't expand */ + break; + case 'x': + case 'X': + pex = 1; /* expand to banner size */ + break; + case 'g': + case 'G': + firstarg = 1; /* reset global defaults */ + break; + case 'a': + case 'A': + pau = 0; /* use chars asis for mark */ + break; + case 'u': + case 'U': + pau = 1; /* use upper case for mark */ + break; + case 'k': + case 'K': + pkd = 1; /* use string to mark itself */ + break; + case 'd': + case 'D': + pkd = 0; /* revert to default mark string */ + break; + case 's': + case 'S': + pmark[0] = '\0'; /* mark with self */ + pms = pmark; + pkd = 0; + break; + case 'm': + case 'M': + if (aqarg () == 0) + { + printf ("M flag needs mark string, e.g: -m ABC\n"); + break; + } + for (i = 0; i < 30; i++) + { + if (*arg == '\0') + break; + if ((pmark[i] = *arg++) <= 040 || + pmark[i] == 0177) + i--; + } + pmark[i] = '\0'; + pms = pmark; + imk = pms; + pkd = 0; + break; + default: /* there ain't many left! */ + printf ("Illegal flag \"%c\", ignored\n", *p); + } /*endswitch*/ + + if (firstarg) + { /* reset defaults to first flag arg */ + dw = pw; + di = pi; + db = pb; + dnp = pnp; + doj = poj; + dclr = pclr; + dtv = ptv; + dfh = pfh; + dex = pex; + dau = pau; + dkd = pkd; + p = dmark; + q = pmark; + while ((*p++ = *q++) != '\0') + ; + pms = dmark; + } + } + else + { /* non-flag argument - print it */ + /* determine string length and page positioning */ + cwd = (pex) ? 9 + pfh - poj : 1; + if (pw - pi < cwd) + { + printf ("-i%d and -w%d allow inadequate space\n", pi, pw); + continue; + } + + for (i = 0; i < pb; i++) + printf ("\n"); + + for (i = 0; i > pb; i--) + printf ("7"); /* esc-7 */ + + for (strl = 0; arg[strl]; strl++) + ; + + if (strl * cwd > pw - pi) + strl = (pw - pi) / cwd; + + ols = ol + pi + ((pw - pi - strl * cwd) >> pclr); + + for (p = ol; p < ols; p++) + *p = ' '; /* blank l.h. margin */ + + if (pex) + { /* expand chars to banner size */ + if (pkd) + { /* mark w/string itself */ + p = arg; + for (i = 0; i < 30; i++) + { + if (*p == '\0') + break; + + /* patch to interpret underscores as spaces */ + if (*p == '_') + *p = ' '; + + pmark[i] = *p++; + if (pmark[i] <= 040 || pmark[i] == 0177) + i--; + else if (pau && pmark[i] >= 'a' && pmark[i] + <= 'z') + pmark[i] -= ('a' - 'A'); + } + pmark[i] = '\0'; + pms = pmark; + imk = pms; + } + /* loop for each horizontal slice of chars */ + for (vx = poj; vx <= 8; vx++) + { + for (xvx = 0; xvx <= ((vx & ptv) != 0); xvx++) + { + esp = ol; /* loc of newline */ + chp = ols; /* start of 1st char */ + doline (); /* format one line */ + *esp = '\0'; + printf ("%s\n", ol); /* VOLA!! */ + *esp = ' '; + if (*imk == '\0' || *++imk == '\0') + imk = pms; + } + } + } + else + { /* echo without expansion */ + esp = ol; + chp = ols; + for (i = 0; i < strl; i++) + { + *chp = arg[i]; + if (*chp++ != ' ') + esp = chp; + } + *esp = '\0'; + printf ("%s\n", ol); + } + /* reset parms to defaults */ + pw = dw; + pi = di; + pb = db; + pnp = dnp; + poj = doj; + pclr = dclr; + ptv = dtv; + pfh = dfh; + pex = dex; + pau = dau; + pkd = dkd; + if (pms != dmark) + { + pms = dmark; + imk = pms; + } + } + firstarg = 0; + } + for (i = 0; i < pb; i++) + printf ("\n"); + + exit (0); +} + +static void +doline (void) +{ + int cx, hx, xhx, chs; + mkp = imk; + for (cx = 0; cx < strl; cx++) + { /* loop on chars */ + chh = arg + cx; + + /* patch to convert underscores to spaces */ + if (*chh == '_') + *chh = ' '; + + chs = (vx & 7) ? ctbl[(*chh)&0x7F][vx - 1] : 0; + /* convert mark to upper case */ + mk = (pau && *chh >= 'a' && *chh <= 'z') ? *chh - ('a' - 'A') : *chh; + for (hx = poj; hx <= 8; hx++) + { /* vert slice */ + for (xhx = 0; xhx <= ((hx & pfh) != 0); xhx++) + { + if (*pms) + { /* cycle mark string */ + mk = *mkp; + if (*++mkp == '\0') + mkp = pms; + } + *chp = ((chs << hx & 0200) == pnp) ? mk : ' '; + if (*chp++ != ' ') + esp = chp; + } + } + } +} + +static int +aqarg (void) +{ + static int dashsw = 0; + if (--aargc > 0) + { /* more cmd line args */ + if (**++aargv != '-' || *(*aargv + 1) != '\0') + { + arg = *aargv; + dashsw = 0; + return 1; + } + else + { /* lone dash - std input */ + dashsw = 1; + if (redarg ()) + return 1; + printf ("EOF on std input\n"); + return 0; + } + } + else + { /* read input if dash last */ + if (dashsw) + return (redarg ()); + arg = ioarg1; + ioarg1[0] = '\0'; + return 0; + } +} + +static int +redarg (void) +{ + static int c = 1, bufsw = 1; + register int i; + + arg = (bufsw ^= 1) ? ioarg1 : ioarg2; + arg[0] = '\0'; + + if (c == EOF) + return 0; + + for (i = 0; i < 120; i++) + { + arg[i] = (c = getchar ()); + if (c == '\n' || c == EOF) + break; + } + + arg[i] = '\0'; + + if (c == EOF) + return 0; + + if (c == '\n') + return 1; + + while ((c = getchar ()) != '\n' && c != EOF) + ; + + return 1; +} + +static int +gint (char **pp) +{ + int dsw = 0, rslt = 0; + + if (*(*pp + 1) == '-') + { + dsw = 1; + (*pp)++; + } + + while (*(*pp + 1) >= '0' && *(*pp + 1) <= '9') + { + (*pp)++; + rslt = 10 * rslt + **pp - '0'; + } + + if (dsw) + return -rslt; + + return rslt; +} diff --git a/base/bin/slackwareutils/diskcopy.1 b/base/bin/slackwareutils/diskcopy.1 new file mode 100644 index 0000000..c1caf09 --- /dev/null +++ b/base/bin/slackwareutils/diskcopy.1 @@ -0,0 +1,26 @@ +.TH diskcopy 1 "June 30, 2012" + +.LO 1 + +.SH NAME +.B diskcopy +\- copy a floppy disk + +.SH SYNOPSIS +.B diskcopy + +.SH DESCRIPTION +.B diskcopy +is shell script that copies the contents of one floppy disk to another. It +imitates the DOS diskcopy program. When started +.B diskcopy +will interactively prompt the user to insert a source floppy disk in the +/dev/fd0 drive. It will then proceed to make an exact copy the contents of the +source floppy bit for bit. When this is done, +.B diskcopy +will then prompt to insert a destination floppy disk in the /dev/fd0 drive and +finally copy back the contents of the source floppy disk to the destination +floppy disk. + +.SH "SEE ALSO" +.BR dd (1) diff --git a/base/bin/slackwareutils/diskcopy.sh b/base/bin/slackwareutils/diskcopy.sh new file mode 100644 index 0000000..9f3cc58 --- /dev/null +++ b/base/bin/slackwareutils/diskcopy.sh @@ -0,0 +1,9 @@ +#!/bin/sh +echo -n "Insert source disk in first floppy drive, then hit enter" +read ans; +MCOOKIE=`mcookie` +dd if=/dev/fd0 of=/tmp/dcopy.$MCOOKIE +echo -n "Remove source disk and insert destination disk, then hit enter" +read ans; +dd of=/dev/fd0 if=/tmp/dcopy.$MCOOKIE +/bin/rm -f /tmp/dcopy.$MCOOKIE diff --git a/base/bin/slackwareutils/fromdos.1 b/base/bin/slackwareutils/fromdos.1 new file mode 100644 index 0000000..a90fad4 --- /dev/null +++ b/base/bin/slackwareutils/fromdos.1 @@ -0,0 +1,23 @@ +.\" +.\" Man page for fromdos +.\" +.\" Copyright (c) 1997 Timothy J. Halloran. +.\" +.\" You may distribute under the terms of the GNU General Public +.\" License as specified in the README file that comes with the man 1.0 +.\" distribution. +.\" +.TH fromdos 1 "May 4, 1997" +.LO 1 +.SH NAME +fromdos \- convert DOS text file format to UNIX. +.SH SYNOPSIS +.BI fromdos\ <\ dosfile.txt\ >\ unixfile.txt +.SH DESCRIPTION +fromdos takes a DOS text file as stdin and sends a UNIX text file to stdout. +DOS text file format separates lines of text by two characters: CR followed +by LF (hex 0d 0a). UNIX text file format separates lines of text with +a single LF character (hex 0a). This program changes the CR LF groups found +in the input stream to LF in the output stream. +.SH "SEE ALSO" +todos(1). diff --git a/base/bin/slackwareutils/fromdos.c b/base/bin/slackwareutils/fromdos.c new file mode 100644 index 0000000..e8958dc --- /dev/null +++ b/base/bin/slackwareutils/fromdos.c @@ -0,0 +1,44 @@ +/* Copyright 1994,1995 Patrick Volkerding, Moorhead, Minnesota USA + All rights reserved. + + Redistribution and use of this source code, with or without modification, is + permitted provided that the following condition is met: + + 1. Redistributions of this source code must retain the above copyright + notice, this condition, and the following disclaimer. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +int main( int argc, char **argv ) { + int c; + if (argc > 1) { + c = *argv[1]; + if (c == '-') { + printf("Usage: fromdos < dostextfile > unixtextfile\n"); + exit(1); + } + } + c = getchar(); + while (c != EOF) { + /* Eat any \r's... they shouldn't be here */ + while (c == '\r') c = getchar(); + if (c == EOF) break; + putchar(c); + c = getchar(); + } + + return 0; +} diff --git a/base/bin/slackwareutils/getopt.c b/base/bin/slackwareutils/getopt.c new file mode 100644 index 0000000..7126cc1 --- /dev/null +++ b/base/bin/slackwareutils/getopt.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1987 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +#include +#include +#include + +/* + * get option letter from argument vector + */ +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt; /* character checked for validity */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define EMSG "" + +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + static char *place = EMSG; /* option letter processing */ + register char *oli; /* option letter list index */ + char *p; + + if (!*place) { /* update scanning pointer */ + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return(EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return(EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = index(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return(EOF); + if (!*place) + ++optind; + if (opterr) { + if (!(p = rindex(*nargv, '/'))) + p = *nargv; + else + ++p; + (void)fprintf(stderr, "%s: illegal option -- %c\n", + p, optopt); + } + return(BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (!(p = rindex(*nargv, '/'))) + p = *nargv; + else + ++p; + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + p, optopt); + return(BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return(optopt); /* dump back option letter */ +} diff --git a/base/bin/slackwareutils/mktemp-bsd.1 b/base/bin/slackwareutils/mktemp-bsd.1 new file mode 100644 index 0000000..2566283 --- /dev/null +++ b/base/bin/slackwareutils/mktemp-bsd.1 @@ -0,0 +1 @@ +.so man1/mktemp.1 diff --git a/base/bin/slackwareutils/mktemp.1 b/base/bin/slackwareutils/mktemp.1 new file mode 100644 index 0000000..11d56bd --- /dev/null +++ b/base/bin/slackwareutils/mktemp.1 @@ -0,0 +1,238 @@ +.\" $Id: mktemp.man,v 1.9 2001/11/12 19:47:06 millert Exp $ +.\" +.\" Copyright (c) 1996, 2000, 2001 Todd C. Miller +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote products +.\" derived from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH MKTEMP 1 "30 September 2001" +.SH NAME +\fBmktemp\fP \- make temporary filename (unique) +.SH SYNOPSIS +\fBmktemp\fP [\fB\-V\fP] | [\fB\-dqtu\fP] [\fB\-p\fP \fIdirectory\fP] [\fItemplate\fP] +.SH DESCRIPTION +The +.B mktemp +utility takes the given filename +.I template +and overwrites a portion of it to create a unique filename. +The +.I template +may be any filename with six (6) +`Xs' appended to it, for example +.I /tmp/tfile.XXXXXX. +If no +.I template +is specified a default of +.I tmp.XXXXXX +is used and the +.B \-t +flag is implied (see below). +.PP +The trailing `Xs' are replaced with a combination +of the current process number and random letters. +.PP +If +.B mktemp +can successfully generate a unique filename, the file (or directory) +is created with file permissions such that it is only readable and writable +by its owner (unless the +.B \-u +flag is given) and the filename is printed to standard output. +.PP +.B mktemp +is provided to allow shell scripts to safely use temporary +files. Traditionally, many shell scripts take the name of the program with +the PID as a suffix and use that as a temporary filename. +This kind of naming scheme is predictable and the race condition it creates +is easy for an attacker to win. +A safer, though still inferior approach +is to make a temporary directory using the same naming scheme. +While this does allow one to guarantee that a temporary file will not be +subverted, it still allows a simple denial of service attack. +For these reasons it is suggested that +.B mktemp +be used instead. +.PP +The options are as follows: +.TP +.B \-V +Print the version and exit. +.TP +.B \-d +Make a directory instead of a file. +.TP +.BI "\-p " directory +Use the specified +.I directory +as a prefix when generating the temporary filename. +The +.I directory +will be overridden by the user's +.SM TMPDIR +environment variable if it is set. +This option implies the +.B \-t +flag (see below). +.TP +.B \-q +Fail silently if an error occurs. +This is useful if +a script does not want error output to go to standard error. +.TP +.B \-t +Generate a path rooted in a temporary directory. +This directory is chosen as follows: +.RS +.IP \(bu +If the user's +.SM TMPDIR +environment variable is set, the directory contained therein is used. +.IP \(bu +Otherwise, if the +.B \-p +flag was given the specified directory is used. +.IP \(bu +If none of the above apply, +.I /tmp +is used. +.RE +.PP +In this mode, the +.I template +(if specified) should be a directory component (as opposed to a full path) +and thus should not contain any forward slashes. +.TP +.B \-u +Operate in ``unsafe'' mode. +The temp file will be unlinked before +.B mktemp +exits. This is slightly better than mktemp(3) +but still introduces a race condition. Use of this +option is not encouraged. +.PP +The +.B mktemp +utility +exits with a value of 0 on success or 1 on failure. +.Pp +Debian packages using +.Nm +in maintainer scripts must depend on debianutils >= 1.7. +.SH EXAMPLES +The following sh(1) +fragment illustrates a simple use of +.B mktemp +where the script should quit if it cannot get a safe +temporary file. +.RS +.nf + +TMPFILE=`mktemp /tmp/example.XXXXXX` || exit 1 +echo "program output" >> $TMPFILE + +.fi +.RE +The same fragment with support for a user's +.SM TMPDIR +environment variable can be written as follows. +.RS +.nf + +TMPFILE=`mktemp \-t example.XXXXXX` || exit 1 +echo "program output" >> $TMPFILE + +.fi +.RE +This can be further simplified if we don't care about the actual name of +the temporary file. In this case the +.B \-t +flag is implied. +.RS +.nf + +TMPFILE=`mktemp` || exit 1 +echo "program output" >> $TMPFILE + +.fi +.RE +In some cases, it may be desirable to use a default temporary directory +other than +.I /tmp. +In this example the temporary file will be created in +.I /extra/tmp +unless the user's +.SM TMPDIR +environment variable specifies otherwise. +.RS +.nf + +TMPFILE=`mktemp \-p /extra/tmp example.XXXXXX` || exit 1 +echo "program output" >> $TMPFILE + +.fi +.RE +In some cases, we want the script to catch the error. +For instance, if we attempt to create two temporary files and +the second one fails we need to remove the first before exiting. +.RS +.nf + +TMP1=`mktemp \-t example.1.XXXXXX` || exit 1 +TMP2=`mktemp \-t example.2.XXXXXX` +if [ $? \-ne 0 ]; then + rm \-f $TMP1 + exit 1 +fi + +.fi +.RE +Or perhaps you don't want to exit if +.B mktemp +is unable to create the file. +In this case you can protect that part of the script thusly. +.RS +.nf + +TMPFILE=`mktemp \-t example.XXXXXX` && { + # Safe to use $TMPFILE in this block + echo data > $TMPFILE + ... + rm \-f $TMPFILE +} + +.fi +.RE +.SH ENVIRONMENT +.IP TMPDIR 8 +directory in which to place the temporary file when in +.B \-t +mode +.SH SEE ALSO +.BR mkdtemp (3), +.BR mkstemp (3), +.BR mktemp (3) +.SH HISTORY +The +.B mktemp +utility appeared in OpenBSD 2.1. diff --git a/base/bin/slackwareutils/mktemp.c b/base/bin/slackwareutils/mktemp.c new file mode 100644 index 0000000..25c1563 --- /dev/null +++ b/base/bin/slackwareutils/mktemp.c @@ -0,0 +1,201 @@ +/* $OpenBSD: mktemp.c,v 1.6 2001/10/01 17:08:30 millert Exp $ */ + +/* + * Copyright (c) 1996, 2000, 2001 Todd C. Miller + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* #include "config.h" */ + +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 + +#include +#include +#ifdef HAVE_STDLIB_H +#include +#endif /* HAVE_STDLIB_H */ +#ifdef HAVE_STRING_H +# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H) +# include +# endif +# include +#else +# ifdef HAVE_STRINGS_H +# include +# endif /* HAVE_STRINGS_H */ +#endif /* HAVE_STRING_H */ +#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS) +#include +#endif /* HAVE_MALLOC_H && !STDC_HEADERS */ +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ +#ifdef HAVE_PATHS_H +#include +#endif /* HAVE_PATHS_H */ +#include + +#ifndef _PATH_TMP +#define _PATH_TMP "/tmp" +#endif + +#ifdef HAVE_PROGNAME +extern char *__progname; +#else +char *__progname; +#endif + +void usage __P((void)) __attribute__((__noreturn__)); + +int +main(argc, argv) + int argc; + char **argv; +{ + int ch, fd, uflag = 0, quiet = 0, tflag = 0, makedir = 0; + char *cp, *template, *tempfile, *prefix = _PATH_TMP; + size_t plen; + extern char *optarg; + extern int optind; + +#ifndef HAVE_PROGNAME + __progname = argv[0]; +#endif + + while ((ch = getopt(argc, argv, "dp:qtuV")) != -1) + switch(ch) { + case 'd': + makedir = 1; + break; + case 'p': + prefix = optarg; + tflag = 1; + break; + case 'q': + quiet = 1; + break; + case 't': + tflag = 1; + break; + case 'u': + uflag = 1; + break; + case 'V': + printf("%s version debianutils-%s\n", __progname, "2.7"); + exit(0); + default: + usage(); + } + + /* If no template specified use a default one (implies -t mode) */ + switch (argc - optind) { + case 1: + template = argv[optind]; + break; + case 0: + template = "tmp.XXXXXX"; + tflag = 1; + break; + default: + usage(); + } + + if (tflag) { + if (strchr(template, '/')) { + if (!quiet) + (void)fprintf(stderr, + "%s: template must not contain directory separators in -t mode\n", __progname); + exit(1); + } + + cp = getenv("TMPDIR"); + if (cp != NULL && *cp != '\0') + prefix = cp; + plen = strlen(prefix); + while (plen != 0 && prefix[plen - 1] == '/') + plen--; + + tempfile = (char *)malloc(plen + 1 + strlen(template) + 1); + if (tempfile == NULL) { + if (!quiet) + (void)fprintf(stderr, + "%s: cannot allocate memory\n", __progname); + exit(1); + } + (void)memcpy(tempfile, prefix, plen); + tempfile[plen] = '/'; + (void)strcpy(tempfile + plen + 1, template); /* SAFE */ + } else { + if ((tempfile = strdup(template)) == NULL) { + if (!quiet) + (void)fprintf(stderr, + "%s: cannot allocate memory\n", __progname); + exit(1); + } + } + + if (makedir) { + if (mkdtemp(tempfile) == NULL) { + if (!quiet) { + (void)fprintf(stderr, + "%s: cannot make temp dir %s: %s\n", + __progname, tempfile, strerror(errno)); + } + exit(1); + } + + if (uflag) + (void)rmdir(tempfile); + } else { + if ((fd = mkstemp(tempfile)) < 0) { + if (!quiet) { + (void)fprintf(stderr, + "%s: cannot create temp file %s: %s\n", + __progname, tempfile, strerror(errno)); + } + exit(1); + } + (void)close(fd); + + if (uflag) + (void)unlink(tempfile); + } + + (void)puts(tempfile); + free(tempfile); + + exit(0); +} + +void +usage() +{ + + (void)fprintf(stderr, + "Usage: %s [-V] | [-dqtu] [-p prefix] [template]\n", + __progname); + exit(1); +} diff --git a/base/bin/slackwareutils/strings.1 b/base/bin/slackwareutils/strings.1 new file mode 100644 index 0000000..08dda5b --- /dev/null +++ b/base/bin/slackwareutils/strings.1 @@ -0,0 +1,96 @@ +.\" Copyright (c) 1980, 1990 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)strings.1 6.11 (Berkeley) 5/9/91 +.\" +.Dd May 9, 1991 +.Dt STRINGS 1 +.Os BSD 3 +.Sh NAME +.Nm strings +.Nd find printable strings in a file +.Sh SYNOPSIS +.Nm strings +.Op Fl afo +.Op Fl n Ar number +.Op Ar file ... +.Sh DESCRIPTION +.Nm Strings +displays the sequences of printable characters in each of the specified +files, or in the standard input, by default. +By default, a sequence must be at least four characters in length +before being displayed. +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl a +By default, +.Nm strings +only searches the text and data segments of object files. +The +.Fl a +option causes +.Nm strings +to search the entire object file. +.It Fl f +Each string is preceded by the name of the file +in which it was found. +.It Fl n +Specifies the minimum number of characters in a sequence to be +.Ar number , +instead of four. +.It Fl o +Each string is preceded by its decimal offset in the +file. +.El +.Pp +.Nm Strings +is useful for identifying random binaries, among other things. +.Sh SEE ALSO +.Xr hexdump 1 +.Sh BUGS +The algorithm for identifying strings is extremely primitive. +In particular, machine code instructions on certain architectures +can resemble sequences of ASCII bytes, which +will fool the algorithm. +.Sh COMPATIBILITY +Historic implementations of +.Nm +only search the initialized data portion of the object file. +This was reasonable as strings were normally stored there. +Given new compiler technology which installs strings in the +text portion of the object file, the default behavior was +changed. +.Sh HISTORY +The +.Nm +command appeared in +.Bx 3.0 . diff --git a/base/bin/slackwareutils/strings.c b/base/bin/slackwareutils/strings.c new file mode 100644 index 0000000..6c201a7 --- /dev/null +++ b/base/bin/slackwareutils/strings.c @@ -0,0 +1,212 @@ +/* + * Copyright (c) 1980, 1987 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Wed Jun 22 22:22:37 1994, faith@cs.unc.edu: + * Added internationalization patches from Vitor Duarte + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEF_LEN 4 /* default minimum string length */ +#if 0 +#define ISSTR(ch) (isascii(ch) && (isprint(ch) || ch == '\t')) +#else +#define ISSTR(ch) (isprint(ch) || ch == '\t') +#endif + +typedef struct exec EXEC; /* struct exec cast */ + +static long foff; /* offset in the file */ +static int hcnt, /* head count */ + head_len, /* length of header */ + read_len; /* length to read */ +static u_char hbfr[sizeof(EXEC)]; /* buffer for struct exec */ + +static void usage(); + +main(argc, argv) + int argc; + char **argv; +{ + extern char *optarg; + extern int optind; + register int ch, cnt; + register u_char *C; + EXEC *head; + int exitcode, minlen; + short asdata, oflg, fflg; + u_char *bfr; + char *file, *p; + + setlocale(LC_CTYPE, ""); + + + /* + * for backward compatibility, allow '-' to specify 'a' flag; no + * longer documented in the man page or usage string. + */ + asdata = exitcode = fflg = oflg = 0; + minlen = -1; + while ((ch = getopt(argc, argv, "-0123456789an:of")) != EOF) + switch((char)ch) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + /* + * kludge: strings was originally designed to take + * a number after a dash. + */ + if (minlen == -1) { + p = argv[optind - 1]; + if (p[0] == '-' && p[1] == ch && !p[2]) + minlen = atoi(++p); + else + minlen = atoi(argv[optind] + 1); + } + break; + case '-': + case 'a': + asdata = 1; + break; + case 'f': + fflg = 1; + break; + case 'n': + minlen = atoi(optarg); + break; + case 'o': + oflg = 1; + break; + case '?': + default: + usage(); + } + argc -= optind; + argv += optind; + + if (minlen == -1) + minlen = DEF_LEN; + + if (!(bfr = malloc((u_int)minlen))) { + (void)fprintf(stderr, "strings: %s\n", strerror(errno)); + exit(1); + } + bfr[minlen] = '\0'; + file = "stdin"; + do { + if (*argv) { + file = *argv++; + if (!freopen(file, "r", stdin)) { + (void)fprintf(stderr, + "strings; %s: %s\n", file, strerror(errno)); + exitcode = 1; + goto nextfile; + } + } + foff = 0; +#define DO_EVERYTHING() {read_len = -1; head_len = 0; goto start;} + read_len = -1; + if (asdata) + DO_EVERYTHING() + else { + head = (EXEC *)hbfr; + if ((head_len = + read(fileno(stdin), head, sizeof(EXEC))) == -1) + DO_EVERYTHING() + if (head_len == sizeof(EXEC) && !N_BADMAG(*head)) { + foff = N_TXTOFF(*head); + if (fseek(stdin, foff, SEEK_SET) == -1) + DO_EVERYTHING() + read_len = head->a_text + head->a_data; + head_len = 0; + } + else + hcnt = 0; + } +start: + for (cnt = 0; (ch = getch()) != EOF;) { + if (ISSTR(ch)) { + if (!cnt) + C = bfr; + *C++ = ch; + if (++cnt < minlen) + continue; + if (fflg) + printf("%s:", file); + if (oflg) + printf("%07ld %s", + foff - minlen, (char *)bfr); + else + printf("%s", bfr); + while ((ch = getch()) != EOF && ISSTR(ch)) + putchar((char)ch); + putchar('\n'); + } + cnt = 0; + } +nextfile: ; + } while (*argv); + exit(exitcode); +} + +/* + * getch -- + * get next character from wherever + */ +getch() +{ + ++foff; + if (head_len) { + if (hcnt < head_len) + return((int)hbfr[hcnt++]); + head_len = 0; + } + if (read_len == -1 || read_len-- > 0) + return(getchar()); + return(EOF); +} + +static void +usage() +{ + (void)fprintf(stderr, + "usage: strings [-afo] [-n length] [file ... ]\n"); + exit(1); +} diff --git a/base/bin/slackwareutils/sysvbanner.1 b/base/bin/slackwareutils/sysvbanner.1 new file mode 100644 index 0000000..cbc69ab --- /dev/null +++ b/base/bin/slackwareutils/sysvbanner.1 @@ -0,0 +1,51 @@ +.TH sysvbanner 1 "June 30, 2012" + +.LO 1 + +.SH NAME +.B sysvbanner +\- display an ASCII art banner text + +.SH SYNOPSIS +.B sysvbanner +.I [message] + +.SH DESCRIPTION +.B sysvbanner +takes a string as argument and outputs it as a large ASCII art banner text. It +aims to be compatible with the UNIX System V +.B banner +program. + +.SH HISTORY +This implementation of +.B banner +was posted on the comp.sources.misc newsgroup in early july 1988. The motivation +behind this version of +.B banner +was that the BSD +.B banner +program works quite differently. +.PP +The +.B banner +program appeared in UNIX System V. One of its original uses was to create +highly visible separator pages for print jobs. + +.SH COPYRIGHT +This implementation of +.B sysvbanner +is in the public domain. + +.SH AUTHORS +Brian Wallis +.I +wrote the +.I sysvbanner +program. + +.SH "SEE ALSO" +.BR banner (1) +.BR bban (1) +.BR figlet (1) +.BR ascii (7) diff --git a/base/bin/slackwareutils/sysvbanner.c b/base/bin/slackwareutils/sysvbanner.c new file mode 100644 index 0000000..e0ec6c3 --- /dev/null +++ b/base/bin/slackwareutils/sysvbanner.c @@ -0,0 +1,151 @@ +/***************************************************************** + * + * SYSVbanner.c + * + * This is a PD version of the SYS V banner program (at least I think + * it is compatible to SYS V) which I wrote to use with the clock + * program written by: + ** DCF, Inc. + ** 14623 North 49th Place + ** Scottsdale, AZ 85254 + * and published in the net comp.sources.misc newsgroup in early July + * since the BSD banner program works quite differently. + * + * There is no copyright or responsibility accepted for the use + * of this software. + * + * Brian Wallis, brw@jim.odr.oz, 4 July 1988 + * + *****************************************************************/ + +#include +#include +#include + +char *glyphs[] = { +" ### ### ### # # ##### ### # ## ### ", +" ### ### ### # # # # ## # # # # ### ", +" ### # # ######## # ### # ## # ", +" # # # ##### # ### # ", +" ####### # # # #### # # ", +" ### # # # # # # # ## # ", +" ### # # ##### # ### #### # ", + +" ## ## #", +" # # # # # # ", +" # # # # # # ", +" # # ####### ##### ### ##### # ", +" # # # # # ### ### # ", +" # # # # # # ### # ", +" ## ## # ### # ", + +" ### # ##### ##### # ####### ##### #######", +" # # ## # ## ## # # # ## # ", +"# # # # # ## # # # # ", +"# # # ##### ##### # # ###### ###### # ", +"# # # # ######## ## # # ", +" # # # # # # # # ## # # ", +" ### ##### ####### ##### # ##### ##### # ", + +" ##### ##### # ### # # ##### ", +"# ## # ### ### # # # #", +"# ## # # # ##### # #", +" ##### ###### ### # # ## ", +"# # # # ### # ##### # # ", +"# ## # ### # # # ", +" ##### ##### # # # # # ", + +" ##### # ###### ##### ###### ############## ##### ", +"# # # # # ## ## ## # # #", +"# ### # # # # ## # ## # # ", +"# # # ## ####### # # ###### ##### # ####", +"# #### ######## ## # ## # # #", +"# # ## ## ## ## # # #", +" ##### # ####### ##### ###### ######## ##### ", + +"# # ### ## # # # ## ########", +"# # # ## # # ## #### ## #", +"# # # ## # # # # # ## # ## #", +"####### # #### # # # ## # ## #", +"# # # # ## # # # ## # ## #", +"# # # # ## # # # ## ### #", +"# # ### ##### # # ######## ## ########", + +"###### ##### ###### ##### ######## ## ## #", +"# ## ## ## # # # ## ## # #", +"# ## ## ## # # ## ## # #", +"###### # ####### ##### # # ## ## # #", +"# # # ## # # # # # # # # # #", +"# # # # # # # # # # # # # # #", +"# #### ## # ##### # ##### # ## ## ", + +"# ## ######## ##### # ##### # ", +" # # # # # # # # # # ", +" # # # # # # # # # # ", +" # # # # # # ", +" # # # # # # # ", +" # # # # # # # ", +"# # # ####### ##### # ##### #######", + +" ### ", +" ### ## ##### #### ##### ###### ###### #### ", +" # # # # # # # # # # # # #", +" # # # ##### # # # ##### ##### # ", +" ###### # # # # # # # # ###", +" # # # # # # # # # # # #", +" # # ##### #### ##### ###### # #### ", + +" ", +" # # # # # # # # # # # #### ", +" # # # # # # # ## ## ## # # #", +" ###### # # #### # # ## # # # # # #", +" # # # # # # # # # # # # # #", +" # # # # # # # # # # # ## # #", +" # # # #### # # ###### # # # # #### ", + +" ", +" ##### #### ##### #### ##### # # # # # #", +" # # # # # # # # # # # # # #", +" # # # # # # #### # # # # # # #", +" ##### # # # ##### # # # # # # # ## #", +" # # # # # # # # # # # # ## ##", +" # ### # # # #### # #### ## # #", + +" ### # ### ## # # # #", +" # # # # ###### # # # # # # # # # ", +" # # # # # # # # ## # # # #", +" ## # # ## ## # # # ", +" ## # # # # # # # # #", +" # # # # # # # # # # ", +" # # # ###### ### # ### # # # #"}; + + +int main(int argc, char *argv[]) +{ + int a,b,c,len,ind; + char line[80]; + + for(argv++;--argc;argv++){ + len=strlen(*argv); + if(len>10) + len=10; + for(a=0;a<7;a++){ + for(b=0;b 95) + ind=0; + for(c=0;c<7;c++){ + line[b*8+c] = glyphs[(ind/8*7)+a][(ind%8*7)+c]; + } + line[b*8+7] = ' '; + } + for(b=len*8-1;b>=0;b--){ + if(line[b]!=' ') + break; + line[b]='\0'; + } + puts(line); + } + puts(""); + } + exit(0); +} diff --git a/base/bin/slackwareutils/todos.1 b/base/bin/slackwareutils/todos.1 new file mode 100644 index 0000000..58b138c --- /dev/null +++ b/base/bin/slackwareutils/todos.1 @@ -0,0 +1,23 @@ +.\" +.\" Man page for todos +.\" +.\" Copyright (c) 1997 Timothy J. Halloran. +.\" +.\" You may distribute under the terms of the GNU General Public +.\" License as specified in the README file that comes with the man 1.0 +.\" distribution. +.\" +.TH todos 1 "May 4, 1997" +.LO 1 +.SH NAME +todos \- convert UNIX text file format to DOS. +.SH SYNOPSIS +.BI todos\ <\ unixfile.txt\ >\ dosfile.txt +.SH DESCRIPTION +todos takes a UNIX text file as stdin and sends a DOS text file to stdout. +DOS text file format separates lines of text by two characters: CR followed +by LF (hex 0d 0a). UNIX text file format separates lines of text with +a single LF character (hex 0a). This program changes the LF characters found +in the input stream to CR LF groups in the output stream. +.SH "SEE ALSO" +fromdos(1). diff --git a/base/bin/slackwareutils/todos.c b/base/bin/slackwareutils/todos.c new file mode 100644 index 0000000..6bfa61c --- /dev/null +++ b/base/bin/slackwareutils/todos.c @@ -0,0 +1,47 @@ +/* Copyright 1994,1995 Patrick Volkerding, Moorhead, Minnesota USA + All rights reserved. + + Redistribution and use of this source code, with or without modification, is + permitted provided that the following condition is met: + + 1. Redistributions of this source code must retain the above copyright + notice, this condition, and the following disclaimer. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include + +int main( int argc, char **argv ) { + int c; + if (argc > 1) { + c = *argv[1]; + if (c == '-') { + printf("Usage: todos < unixtextfile > dostextfile\n"); + exit(1); + } + } + c = getchar(); + while (c != EOF) { + /* Eat any \r's... they shouldn't be here */ + while (c == '\r') c = getchar(); + if (c == EOF) break; + if (c != '\n') { + putchar(c); + } else { + printf("\r\n"); + } + c = getchar(); + } + return 0; +} diff --git a/base/bin/slackwareutils/xx.1 b/base/bin/slackwareutils/xx.1 new file mode 100644 index 0000000..b0a4852 --- /dev/null +++ b/base/bin/slackwareutils/xx.1 @@ -0,0 +1,40 @@ +.TH xx 1 "June 30, 2012" + +.LO 1 + +.SH NAME +.B xx +\- extract binary files from uudecoded files + +.SH SYNOPSIS +.B xx +< file.uu + +.SH DESCRIPTION +.B xx +is shell script that extracts binary files from files encoded in the UNIX-to-UNIX +(uu) format. It ignores all headers and irrelevant stuff. + +.SH BUGS +.B xx +has shortfalls like all such scripts/programs, but it works (almost) 100% of +the time. It was tested against many such tools available at many ftp sites and +it was found that it had a higher success rate. There are a few C programs out +there and +.B xx +is slower compared to them. But it works even in those cases where they fail to +work. The only time it will not work is when a uuencoded source file is cut up in +many pieces and the last part contains less than three source lines in it. Such +cases are however rare. + +.SH AUTHORS +.B xx +was written by Tahir Zia Khawaja +.I +and Nasir Ahmed Noor +.I + +.SH "SEE ALSO" +.BR uudecode (1) +.BR uuencode (1) +.BR uucp (1) diff --git a/base/bin/slackwareutils/xx.sh b/base/bin/slackwareutils/xx.sh new file mode 100644 index 0000000..4116c20 --- /dev/null +++ b/base/bin/slackwareutils/xx.sh @@ -0,0 +1,21 @@ +# +# A script to extract binary files from uudecoded files. Ignores all headers +# and irrelevant stuff. Has shortfalls like all such scripts/programs but works +# (almost) 100% of the time. We tested it against many such tools available +# at many ftp sites and found it having higher success rate. There are +# a few c-programs out there and it is slower as compared to them but it +# works even in those cases when they fail to work. +# The only time it will not work is that if uuencoded source file is cut up +# in many pieces and LAST part contains LESS THAN 3 SOURCE lines in it and +# we know that such cases (almost) never arise....guarenteed....:) +# +# Written by Tahir Zia Khawaja and +# Nasir Ahmed Noor +#umnoor@ccu.umanitoba.ca +#umkhawaj@ccu.umanitoba.ca +# +awk '$0 ~ /^begin / {print $0; exit}' $1 > $$gifile +egrep "^M[^a-z]" $1 >> $$gifile +awk 'NR > 2 {sl=lr; lr=pr; pr=$0} $1 ~ /^end/ {print sl; print lr; print pr; exit}' $1 >> $$gifile +uudecode $$gifile +rm $$gifile -- cgit v1.2.3-70-g09d2