aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:57:26 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 13:57:26 +1000
commit0c9d2455301ed633826e222aacd930126990913e (patch)
tree2353a480f55dfa41d9e6d2fa328af1b60dd3653e
parente8db4fe96b3a68b6f971d88084ef2fd2c8513e78 (diff)
parent9dc04124d5a3f0c9be249287817a964691e187b0 (diff)
downloadbusybox-w32-0c9d2455301ed633826e222aacd930126990913e.tar.gz
busybox-w32-0c9d2455301ed633826e222aacd930126990913e.tar.bz2
busybox-w32-0c9d2455301ed633826e222aacd930126990913e.zip
Merge branch 'origin/master' (early part)
-rw-r--r--Makefile15
-rw-r--r--applets/Kbuild.src2
-rw-r--r--applets/applet_tables.c2
-rw-r--r--applets/applets.c2
-rw-r--r--applets/individual.c2
-rw-r--r--applets/usage.c2
-rw-r--r--applets/usage_pod.c2
-rw-r--r--archival/Config.src4
-rw-r--r--archival/Kbuild.src2
-rw-r--r--archival/ar.c5
-rw-r--r--archival/bbunzip.c12
-rw-r--r--archival/cpio.c2
-rw-r--r--archival/dpkg_deb.c2
-rw-r--r--archival/gzip.c2
-rw-r--r--archival/libunarchive/Kbuild.src3
-rw-r--r--archival/libunarchive/data_align.c2
-rw-r--r--archival/libunarchive/data_extract_all.c2
-rw-r--r--archival/libunarchive/data_extract_to_command.c2
-rw-r--r--archival/libunarchive/data_extract_to_stdout.c2
-rw-r--r--archival/libunarchive/data_skip.c2
-rw-r--r--archival/libunarchive/decompress_bunzip2.c2
-rw-r--r--archival/libunarchive/decompress_unlzma.c2
-rw-r--r--archival/libunarchive/decompress_unxz.c2
-rw-r--r--archival/libunarchive/decompress_unzip.c2
-rw-r--r--archival/libunarchive/filter_accept_all.c2
-rw-r--r--archival/libunarchive/filter_accept_list.c2
-rw-r--r--archival/libunarchive/filter_accept_list_reassign.c2
-rw-r--r--archival/libunarchive/filter_accept_reject_list.c2
-rw-r--r--archival/libunarchive/find_list_entry.c2
-rw-r--r--archival/libunarchive/get_header_ar.c2
-rw-r--r--archival/libunarchive/get_header_cpio.c2
-rw-r--r--archival/libunarchive/get_header_tar.c8
-rw-r--r--archival/libunarchive/get_header_tar_bz2.c2
-rw-r--r--archival/libunarchive/get_header_tar_gz.c2
-rw-r--r--archival/libunarchive/get_header_tar_lzma.c2
-rw-r--r--archival/libunarchive/header_list.c2
-rw-r--r--archival/libunarchive/header_skip.c2
-rw-r--r--archival/libunarchive/header_verbose_list.c2
-rw-r--r--archival/libunarchive/init_handle.c2
-rw-r--r--archival/libunarchive/open_transformer.c2
-rw-r--r--archival/libunarchive/seek_by_jump.c2
-rw-r--r--archival/libunarchive/seek_by_read.c2
-rw-r--r--archival/libunarchive/unpack_ar_archive.c2
-rw-r--r--archival/rpm.c2
-rw-r--r--archival/rpm.h2
-rw-r--r--archival/rpm2cpio.c2
-rw-r--r--archival/tar.c7
-rw-r--r--archival/unzip.c2
-rw-r--r--console-tools/Kbuild.src2
-rw-r--r--console-tools/chvt.c2
-rw-r--r--console-tools/clear.c2
-rw-r--r--console-tools/deallocvt.c2
-rw-r--r--console-tools/dumpkmap.c2
-rw-r--r--console-tools/fgconsole.c2
-rw-r--r--console-tools/kbd_mode.c2
-rw-r--r--console-tools/loadfont.c2
-rw-r--r--console-tools/loadkmap.c2
-rw-r--r--console-tools/openvt.c2
-rw-r--r--console-tools/reset.c2
-rw-r--r--console-tools/resize.c2
-rw-r--r--console-tools/setconsole.c2
-rw-r--r--console-tools/setkeycodes.c2
-rw-r--r--console-tools/setlogcons.c2
-rw-r--r--console-tools/showkey.c34
-rw-r--r--coreutils/Kbuild.src2
-rw-r--r--coreutils/basename.c2
-rw-r--r--coreutils/cal.c2
-rw-r--r--coreutils/cat.c2
-rw-r--r--coreutils/catv.c2
-rw-r--r--coreutils/chgrp.c2
-rw-r--r--coreutils/chmod.c2
-rw-r--r--coreutils/chown.c2
-rw-r--r--coreutils/chroot.c2
-rw-r--r--coreutils/cksum.c2
-rw-r--r--coreutils/comm.c2
-rw-r--r--coreutils/cp.c2
-rw-r--r--coreutils/cut.c2
-rw-r--r--coreutils/date.c2
-rw-r--r--coreutils/dd.c2
-rw-r--r--coreutils/df.c2
-rw-r--r--coreutils/dirname.c2
-rw-r--r--coreutils/dos2unix.c2
-rw-r--r--coreutils/du.c2
-rw-r--r--coreutils/echo.c2
-rw-r--r--coreutils/env.c2
-rw-r--r--coreutils/expand.c2
-rw-r--r--coreutils/expr.c2
-rw-r--r--coreutils/false.c2
-rw-r--r--coreutils/fold.c2
-rw-r--r--coreutils/fsync.c2
-rw-r--r--coreutils/head.c2
-rw-r--r--coreutils/hostid.c2
-rw-r--r--coreutils/id.c2
-rw-r--r--coreutils/install.c2
-rw-r--r--coreutils/length.c2
-rw-r--r--coreutils/libcoreutils/Kbuild.src2
-rw-r--r--coreutils/libcoreutils/coreutils.h2
-rw-r--r--coreutils/ln.c2
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/md5_sha1_sum.c2
-rw-r--r--coreutils/mkdir.c2
-rw-r--r--coreutils/mkfifo.c2
-rw-r--r--coreutils/mknod.c2
-rw-r--r--coreutils/mv.c2
-rw-r--r--coreutils/nice.c2
-rw-r--r--coreutils/nohup.c2
-rw-r--r--coreutils/od.c2
-rw-r--r--coreutils/printenv.c2
-rw-r--r--coreutils/printf.c6
-rw-r--r--coreutils/pwd.c2
-rw-r--r--coreutils/readlink.c2
-rw-r--r--coreutils/realpath.c2
-rw-r--r--coreutils/rm.c2
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/seq.c2
-rw-r--r--coreutils/sleep.c2
-rw-r--r--coreutils/sort.c2
-rw-r--r--coreutils/split.c6
-rw-r--r--coreutils/stat.c2
-rw-r--r--coreutils/stty.c2
-rw-r--r--coreutils/sum.c2
-rw-r--r--coreutils/sync.c2
-rw-r--r--coreutils/tac.c2
-rw-r--r--coreutils/tail.c2
-rw-r--r--coreutils/tee.c2
-rw-r--r--coreutils/test.c2
-rw-r--r--coreutils/test_ptr_hack.c2
-rw-r--r--coreutils/touch.c2
-rw-r--r--coreutils/tr.c2
-rw-r--r--coreutils/true.c2
-rw-r--r--coreutils/tty.c2
-rw-r--r--coreutils/uname.c2
-rw-r--r--coreutils/uniq.c2
-rw-r--r--coreutils/usleep.c2
-rw-r--r--coreutils/uudecode.c91
-rw-r--r--coreutils/uuencode.c6
-rw-r--r--coreutils/wc.c2
-rw-r--r--coreutils/who.c2
-rw-r--r--coreutils/whoami.c2
-rw-r--r--coreutils/yes.c2
-rw-r--r--debianutils/Kbuild.src2
-rw-r--r--debianutils/mktemp.c2
-rw-r--r--debianutils/pipe_progress.c2
-rw-r--r--debianutils/run_parts.c2
-rw-r--r--debianutils/start_stop_daemon.c2
-rw-r--r--debianutils/which.c2
-rw-r--r--docs/new-applet-HOWTO.txt2
-rw-r--r--e2fsprogs/Kbuild.src2
-rw-r--r--e2fsprogs/e2fs_lib.c2
-rw-r--r--e2fsprogs/fsck.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/Kbuild.src2
-rw-r--r--e2fsprogs/old_e2fsprogs/blkid/Kbuild.src2
-rw-r--r--e2fsprogs/old_e2fsprogs/e2fsck.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/e2p/Kbuild.src2
-rw-r--r--e2fsprogs/old_e2fsprogs/ext2fs/Kbuild.src2
-rw-r--r--e2fsprogs/old_e2fsprogs/fsck.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/mke2fs.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/tune2fs.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/util.c2
-rw-r--r--e2fsprogs/old_e2fsprogs/uuid/Kbuild.src2
-rw-r--r--e2fsprogs/tune2fs.c2
-rw-r--r--editors/Kbuild.src2
-rw-r--r--editors/awk.c2
-rw-r--r--editors/cmp.c2
-rw-r--r--editors/diff.c4
-rw-r--r--editors/patch.c51
-rw-r--r--editors/patch_bbox.c26
-rw-r--r--editors/sed.c16
-rw-r--r--editors/vi.c2
-rwxr-xr-xexamples/depmod2
-rw-r--r--findutils/Kbuild.src2
-rw-r--r--findutils/find.c26
-rw-r--r--findutils/grep.c12
-rw-r--r--findutils/xargs.c2
-rw-r--r--include/ar.h2
-rw-r--r--include/busybox.h2
-rw-r--r--include/fix_u32.h2
-rw-r--r--include/libbb.h37
-rw-r--r--include/platform.h4
-rw-r--r--include/rtc_.h2
-rw-r--r--include/unicode.h2
-rw-r--r--include/xatonum.h2
-rw-r--r--include/xregex.h4
-rw-r--r--init/Kbuild.src2
-rw-r--r--init/bootchartd.c2
-rw-r--r--init/halt.c2
-rw-r--r--init/init.c2
-rw-r--r--init/mesg.c2
-rw-r--r--libbb/Kbuild.src2
-rw-r--r--libbb/appletlib.c4
-rw-r--r--libbb/ask_confirmation.c2
-rw-r--r--libbb/bb_askpass.c2
-rw-r--r--libbb/bb_basename.c2
-rw-r--r--libbb/bb_do_delay.c2
-rw-r--r--libbb/bb_pwd.c2
-rw-r--r--libbb/bb_qsort.c2
-rw-r--r--libbb/bb_strtod.c2
-rw-r--r--libbb/bb_strtonum.c2
-rw-r--r--libbb/chomp.c2
-rw-r--r--libbb/compare_string_array.c2
-rw-r--r--libbb/concat_path_file.c2
-rw-r--r--libbb/concat_subpath_file.c2
-rw-r--r--libbb/copy_file.c2
-rw-r--r--libbb/copyfd.c2
-rw-r--r--libbb/crc32.c2
-rw-r--r--libbb/create_icmp6_socket.c2
-rw-r--r--libbb/create_icmp_socket.c2
-rw-r--r--libbb/default_error_retval.c2
-rw-r--r--libbb/device_open.c2
-rw-r--r--libbb/die_if_bad_username.c2
-rw-r--r--libbb/dump.c6
-rw-r--r--libbb/execable.c2
-rw-r--r--libbb/fclose_nonstdin.c2
-rw-r--r--libbb/fflush_stdout_and_exit.c2
-rw-r--r--libbb/fgets_str.c2
-rw-r--r--libbb/find_mount_point.c2
-rw-r--r--libbb/find_pid_by_name.c2
-rw-r--r--libbb/find_root_device.c2
-rw-r--r--libbb/full_write.c2
-rw-r--r--libbb/get_console.c2
-rw-r--r--libbb/get_cpu_count.c2
-rw-r--r--libbb/get_last_path_component.c2
-rw-r--r--libbb/get_line_from_file.c2
-rw-r--r--libbb/get_volsize.c2
-rw-r--r--libbb/getopt32.c2
-rw-r--r--libbb/getpty.c2
-rw-r--r--libbb/herror_msg.c2
-rw-r--r--libbb/human_readable.c2
-rw-r--r--libbb/inet_common.c2
-rw-r--r--libbb/info_msg.c2
-rw-r--r--libbb/inode_hash.c2
-rw-r--r--libbb/isdirectory.c4
-rw-r--r--libbb/kernel_version.c2
-rw-r--r--libbb/last_char_is.c2
-rw-r--r--libbb/lineedit_ptr_hack.c2
-rw-r--r--libbb/llist.c2
-rw-r--r--libbb/login.c2
-rw-r--r--libbb/loop.c2
-rw-r--r--libbb/make_directory.c2
-rw-r--r--libbb/makedev.c2
-rw-r--r--libbb/match_fstype.c2
-rw-r--r--libbb/md5.c16
-rw-r--r--libbb/messages.c2
-rw-r--r--libbb/mode_string.c2
-rw-r--r--libbb/mtab.c2
-rw-r--r--libbb/mtab_file.c2
-rw-r--r--libbb/obscure.c80
-rw-r--r--libbb/parse_config.c2
-rw-r--r--libbb/parse_mode.c2
-rw-r--r--libbb/perror_msg.c2
-rw-r--r--libbb/perror_nomsg.c2
-rw-r--r--libbb/perror_nomsg_and_die.c2
-rw-r--r--libbb/pidfile.c2
-rw-r--r--libbb/platform.c2
-rw-r--r--libbb/print_flags.c2
-rw-r--r--libbb/printable.c2
-rw-r--r--libbb/printable_string.c2
-rw-r--r--libbb/process_escape_sequence.c2
-rw-r--r--libbb/procps.c162
-rw-r--r--libbb/ptr_to_globals.c2
-rw-r--r--libbb/pw_encrypt.c2
-rw-r--r--libbb/read.c2
-rw-r--r--libbb/read_key.c2
-rw-r--r--libbb/read_printf.c2
-rw-r--r--libbb/recursive_action.c2
-rw-r--r--libbb/remove_file.c2
-rw-r--r--libbb/rtc.c2
-rw-r--r--libbb/safe_gethostname.c2
-rw-r--r--libbb/safe_poll.c2
-rw-r--r--libbb/safe_strncpy.c2
-rw-r--r--libbb/safe_write.c2
-rw-r--r--libbb/selinux_common.c2
-rw-r--r--libbb/sha1.c2
-rw-r--r--libbb/signals.c2
-rw-r--r--libbb/simplify_path.c2
-rw-r--r--libbb/single_argv.c2
-rw-r--r--libbb/skip_whitespace.c2
-rw-r--r--libbb/speed_table.c2
-rw-r--r--libbb/str_tolower.c2
-rw-r--r--libbb/strrstr.c2
-rw-r--r--libbb/time.c2
-rw-r--r--libbb/trim.c2
-rw-r--r--libbb/u_signal_names.c2
-rw-r--r--libbb/udp_io.c2
-rw-r--r--libbb/unicode.c2
-rw-r--r--libbb/update_passwd.c4
-rw-r--r--libbb/utmp.c2
-rw-r--r--libbb/uuencode.c2
-rw-r--r--libbb/vdprintf.c2
-rw-r--r--libbb/verror_msg.c2
-rw-r--r--libbb/vfork_daemon_rexec.c2
-rw-r--r--libbb/warn_ignoring_args.c2
-rw-r--r--libbb/wfopen.c2
-rw-r--r--libbb/wfopen_input.c10
-rw-r--r--libbb/write.c2
-rw-r--r--libbb/xatonum.c2
-rw-r--r--libbb/xatonum_template.c2
-rw-r--r--libbb/xconnect.c2
-rw-r--r--libbb/xfunc_die.c2
-rw-r--r--libbb/xfuncs.c2
-rw-r--r--libbb/xfuncs_printf.c12
-rw-r--r--libbb/xgetcwd.c2
-rw-r--r--libbb/xgethostbyname.c2
-rw-r--r--libbb/xreadlink.c2
-rw-r--r--libbb/xrealloc_vector.c2
-rw-r--r--libbb/xregcomp.c2
-rw-r--r--libpwdgrp/Kbuild.src2
-rw-r--r--libpwdgrp/pwd_grp.c11
-rw-r--r--libpwdgrp/pwd_grp_internal.c11
-rw-r--r--loginutils/Kbuild.src2
-rw-r--r--loginutils/addgroup.c2
-rw-r--r--loginutils/adduser.c2
-rw-r--r--loginutils/chpasswd.c2
-rw-r--r--loginutils/cryptpw.c4
-rw-r--r--loginutils/deluser.c2
-rw-r--r--loginutils/getty.c18
-rw-r--r--loginutils/login.c2
-rw-r--r--loginutils/passwd.c2
-rw-r--r--loginutils/su.c4
-rw-r--r--loginutils/sulogin.c2
-rw-r--r--loginutils/vlock.c2
-rw-r--r--mailutils/Kbuild.src2
-rw-r--r--mailutils/mail.c2
-rw-r--r--mailutils/mime.c2
-rw-r--r--mailutils/popmaildir.c2
-rw-r--r--mailutils/sendmail.c2
-rw-r--r--miscutils/Config.src14
-rw-r--r--miscutils/Kbuild.src2
-rw-r--r--miscutils/adjtimex.c2
-rw-r--r--miscutils/bbconfig.c22
-rw-r--r--miscutils/beep.c2
-rw-r--r--miscutils/chat.c2
-rw-r--r--miscutils/chrt.c2
-rw-r--r--miscutils/conspy.c2
-rw-r--r--miscutils/crond.c2
-rw-r--r--miscutils/crontab.c2
-rw-r--r--miscutils/dc.c2
-rw-r--r--miscutils/devfsd.c2
-rw-r--r--miscutils/devmem.c2
-rw-r--r--miscutils/eject.c2
-rw-r--r--miscutils/fbsplash.c2
-rw-r--r--miscutils/flash_eraseall.c2
-rw-r--r--miscutils/flash_lock_unlock.c2
-rw-r--r--miscutils/flashcp.c2
-rw-r--r--miscutils/hdparm.c2
-rw-r--r--miscutils/inotifyd.c2
-rw-r--r--miscutils/ionice.c2
-rw-r--r--miscutils/last.c2
-rw-r--r--miscutils/last_fancy.c2
-rw-r--r--miscutils/less.c2
-rw-r--r--miscutils/makedevs.c2
-rw-r--r--miscutils/man.c2
-rw-r--r--miscutils/microcom.c2
-rw-r--r--miscutils/mountpoint.c2
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/nandwrite.c142
-rw-r--r--miscutils/raidautorun.c2
-rw-r--r--miscutils/readahead.c2
-rw-r--r--miscutils/rfkill.c2
-rw-r--r--miscutils/runlevel.c2
-rw-r--r--miscutils/rx.c2
-rw-r--r--miscutils/strings.c2
-rw-r--r--miscutils/taskset.c2
-rw-r--r--miscutils/time.c2
-rw-r--r--miscutils/ttysize.c2
-rw-r--r--miscutils/ubi_attach_detach.c6
-rw-r--r--miscutils/wall.c2
-rw-r--r--miscutils/watchdog.c2
-rw-r--r--modutils/Kbuild.src2
-rw-r--r--modutils/depmod.c2
-rw-r--r--modutils/insmod.c2
-rw-r--r--modutils/lsmod.c2
-rw-r--r--modutils/modinfo.c2
-rw-r--r--modutils/modprobe-small.c2
-rw-r--r--modutils/modprobe.c2
-rw-r--r--modutils/modutils-24.c2
-rw-r--r--modutils/modutils.c10
-rw-r--r--modutils/modutils.h2
-rw-r--r--modutils/rmmod.c2
-rw-r--r--networking/Kbuild.src2
-rw-r--r--networking/arping.c2
-rw-r--r--networking/brctl.c2
-rw-r--r--networking/dnsd.c2
-rw-r--r--networking/ether-wake.c2
-rw-r--r--networking/ftpd.c2
-rw-r--r--networking/ftpgetput.c2
-rw-r--r--networking/hostname.c2
-rw-r--r--networking/httpd.c2
-rw-r--r--networking/httpd_indexcgi.c2
-rw-r--r--networking/httpd_ssi.c2
-rw-r--r--networking/ifconfig.c2
-rw-r--r--networking/ifplugd.c2
-rw-r--r--networking/ifupdown.c2
-rw-r--r--networking/interface.c2
-rw-r--r--networking/ip.c2
-rw-r--r--networking/ipcalc.c2
-rw-r--r--networking/isrv.c2
-rw-r--r--networking/isrv.h2
-rw-r--r--networking/isrv_identd.c2
-rw-r--r--networking/libiproute/Kbuild.src2
-rw-r--r--networking/libiproute/ipaddress.c2
-rw-r--r--networking/libiproute/iplink.c7
-rw-r--r--networking/libiproute/iproute.c2
-rw-r--r--networking/libiproute/iptunnel.c2
-rw-r--r--networking/libiproute/utils.c2
-rw-r--r--networking/nameif.c2
-rw-r--r--networking/nc.c8
-rw-r--r--networking/nc_bloaty.c2
-rw-r--r--networking/netstat.c2
-rw-r--r--networking/nslookup.c2
-rw-r--r--networking/ntpd.c27
-rw-r--r--networking/ntpd_simple.c2
-rw-r--r--networking/ping.c2
-rw-r--r--networking/pscan.c2
-rw-r--r--networking/route.c2
-rw-r--r--networking/tc.c2
-rw-r--r--networking/tcpudp.c2
-rw-r--r--networking/tcpudp_perhost.c2
-rw-r--r--networking/tcpudp_perhost.h2
-rw-r--r--networking/telnet.c2
-rw-r--r--networking/telnetd.c2
-rw-r--r--networking/tftp.c2
-rw-r--r--networking/tunctl.c2
-rw-r--r--networking/udhcp/Kbuild.src2
-rw-r--r--networking/udhcp/arpping.c2
-rw-r--r--networking/udhcp/common.c2
-rw-r--r--networking/udhcp/common.h2
-rw-r--r--networking/udhcp/dhcpc.h2
-rw-r--r--networking/udhcp/dhcpd.h2
-rw-r--r--networking/udhcp/dhcprelay.c2
-rw-r--r--networking/udhcp/domain_codec.c2
-rw-r--r--networking/udhcp/dumpleases.c2
-rw-r--r--networking/udhcp/files.c2
-rw-r--r--networking/udhcp/leases.c2
-rw-r--r--networking/udhcp/packet.c2
-rw-r--r--networking/udhcp/static_leases.c2
-rw-r--r--networking/vconfig.c2
-rw-r--r--networking/wget.c2
-rw-r--r--networking/zcip.c2
-rw-r--r--printutils/Kbuild.src2
-rw-r--r--printutils/lpd.c2
-rw-r--r--printutils/lpr.c2
-rw-r--r--procps/Kbuild.src2
-rw-r--r--procps/free.c2
-rw-r--r--procps/fuser.c2
-rw-r--r--procps/iostat.c2
-rw-r--r--procps/kill.c6
-rw-r--r--procps/mpstat.c12
-rw-r--r--procps/nmeter.c11
-rw-r--r--procps/pgrep.c2
-rw-r--r--procps/pidof.c2
-rw-r--r--procps/pmap.c111
-rw-r--r--procps/ps.c2
-rw-r--r--procps/renice.c4
-rw-r--r--procps/sysctl.c2
-rw-r--r--procps/top.c18
-rw-r--r--procps/uptime.c2
-rw-r--r--procps/watch.c2
-rw-r--r--runit/Kbuild.src2
-rw-r--r--scripts/echo.c2
-rwxr-xr-xscripts/mkconfigs43
-rwxr-xr-xscripts/showasm2
-rw-r--r--selinux/Kbuild.src2
-rw-r--r--selinux/chcon.c2
-rw-r--r--selinux/getenforce.c2
-rw-r--r--selinux/getsebool.c2
-rw-r--r--selinux/load_policy.c2
-rw-r--r--selinux/matchpathcon.c2
-rw-r--r--selinux/runcon.c2
-rw-r--r--selinux/selinuxenabled.c2
-rw-r--r--selinux/sestatus.c2
-rw-r--r--selinux/setenforce.c2
-rw-r--r--selinux/setsebool.c2
-rw-r--r--shell/Kbuild.src2
-rw-r--r--shell/ash.c25
-rw-r--r--shell/ash_ptr_hack.c2
-rw-r--r--shell/ash_test/ash-vars/var_bash5.right4
-rwxr-xr-xshell/ash_test/ash-vars/var_bash5.tests11
-rw-r--r--shell/bbsh.c2
-rw-r--r--shell/cttyhack.c4
-rw-r--r--shell/hush.c2
-rw-r--r--shell/match.c2
-rw-r--r--shell/math.c2
-rw-r--r--shell/random.c2
-rw-r--r--shell/random.h2
-rw-r--r--shell/shell_common.c4
-rw-r--r--shell/shell_common.h2
-rw-r--r--sysklogd/Kbuild.src2
-rw-r--r--sysklogd/klogd.c2
-rw-r--r--sysklogd/logger.c2
-rw-r--r--sysklogd/logread.c2
-rw-r--r--sysklogd/syslogd.c2
-rw-r--r--sysklogd/syslogd_and_logger.c2
-rwxr-xr-xtestsuite/all_sourcecode.tests2
-rwxr-xr-xtestsuite/ar.tests2
-rwxr-xr-xtestsuite/ash.tests2
-rwxr-xr-xtestsuite/awk.tests2
-rwxr-xr-xtestsuite/bunzip2.tests6
-rwxr-xr-xtestsuite/busybox.tests2
-rwxr-xr-xtestsuite/bzcat.tests5
-rwxr-xr-xtestsuite/cal.tests2
-rwxr-xr-xtestsuite/comm.tests2
-rwxr-xr-xtestsuite/cp.tests2
-rwxr-xr-xtestsuite/cpio.tests2
-rwxr-xr-xtestsuite/cut.tests2
-rwxr-xr-xtestsuite/diff.tests2
-rwxr-xr-xtestsuite/expand.tests2
-rwxr-xr-xtestsuite/fold.tests2
-rwxr-xr-xtestsuite/grep.tests6
-rwxr-xr-xtestsuite/ls.tests2
-rwxr-xr-xtestsuite/makedevs.tests2
-rwxr-xr-xtestsuite/mdev.tests12
-rwxr-xr-xtestsuite/mkfs.minix.tests2
-rwxr-xr-xtestsuite/mount.testroot2
-rwxr-xr-xtestsuite/mount.tests2
-rwxr-xr-xtestsuite/od.tests2
-rwxr-xr-xtestsuite/parse.tests2
-rwxr-xr-xtestsuite/patch.tests26
-rwxr-xr-xtestsuite/pidof.tests2
-rwxr-xr-xtestsuite/printf.tests2
-rwxr-xr-xtestsuite/readlink.tests4
-rwxr-xr-xtestsuite/runtest10
-rwxr-xr-xtestsuite/rx.tests2
-rwxr-xr-xtestsuite/sed.tests16
-rwxr-xr-xtestsuite/seq.tests2
-rwxr-xr-xtestsuite/sort.tests2
-rwxr-xr-xtestsuite/start-stop-daemon.tests2
-rwxr-xr-xtestsuite/sum.tests2
-rwxr-xr-xtestsuite/tail.tests2
-rwxr-xr-xtestsuite/tar.tests2
-rwxr-xr-xtestsuite/taskset.tests2
-rwxr-xr-xtestsuite/test.tests2
-rwxr-xr-xtestsuite/tr.tests2
-rwxr-xr-xtestsuite/unexpand.tests2
-rwxr-xr-xtestsuite/uniq.tests2
-rwxr-xr-xtestsuite/unzip.tests2
-rwxr-xr-xtestsuite/uuencode.tests2
-rwxr-xr-xtestsuite/xargs.tests2
-rw-r--r--util-linux/Kbuild.src2
-rw-r--r--util-linux/acpid.c2
-rw-r--r--util-linux/blkid.c2
-rw-r--r--util-linux/dmesg.c2
-rw-r--r--util-linux/fbset.c2
-rw-r--r--util-linux/fdformat.c2
-rw-r--r--util-linux/fdisk.c2
-rw-r--r--util-linux/fdisk_aix.c2
-rw-r--r--util-linux/fdisk_sgi.c2
-rw-r--r--util-linux/fdisk_sun.c2
-rw-r--r--util-linux/findfs.c2
-rw-r--r--util-linux/freeramdisk.c2
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/getopt.c2
-rw-r--r--util-linux/hexdump.c2
-rw-r--r--util-linux/hwclock.c2
-rw-r--r--util-linux/ipcrm.c2
-rw-r--r--util-linux/ipcs.c2
-rw-r--r--util-linux/losetup.c2
-rw-r--r--util-linux/lspci.c2
-rw-r--r--util-linux/lsusb.c2
-rw-r--r--util-linux/mdev.c7
-rw-r--r--util-linux/mkfs_ext2.c4
-rw-r--r--util-linux/mkfs_minix.c5
-rw-r--r--util-linux/mkfs_reiser.c6
-rw-r--r--util-linux/mkfs_vfat.c5
-rw-r--r--util-linux/mkswap.c16
-rw-r--r--util-linux/more.c2
-rw-r--r--util-linux/mount.c4
-rw-r--r--util-linux/pivot_root.c2
-rw-r--r--util-linux/rdate.c2
-rw-r--r--util-linux/rdev.c2
-rw-r--r--util-linux/readprofile.c2
-rw-r--r--util-linux/rev.c2
-rw-r--r--util-linux/rtcwake.c2
-rw-r--r--util-linux/script.c2
-rw-r--r--util-linux/scriptreplay.c2
-rw-r--r--util-linux/setarch.c2
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/switch_root.c2
-rw-r--r--util-linux/umount.c2
-rw-r--r--util-linux/volume_id/Kbuild.src2
-rw-r--r--util-linux/volume_id/get_devname.c2
582 files changed, 1502 insertions, 866 deletions
diff --git a/Makefile b/Makefile
index 0a2a3db01..60999dd4b 100644
--- a/Makefile
+++ b/Makefile
@@ -434,7 +434,12 @@ ifeq ($(config-targets),1)
434-include $(srctree)/arch/$(ARCH)/Makefile 434-include $(srctree)/arch/$(ARCH)/Makefile
435export KBUILD_DEFCONFIG 435export KBUILD_DEFCONFIG
436 436
437config %config: scripts_basic outputmakefile gen_build_files FORCE 437config: scripts_basic outputmakefile gen_build_files FORCE
438 $(Q)mkdir -p include
439 $(Q)$(MAKE) $(build)=scripts/kconfig $@
440 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
441
442%config: scripts_basic outputmakefile gen_build_files FORCE
438 $(Q)mkdir -p include 443 $(Q)mkdir -p include
439 $(Q)$(MAKE) $(build)=scripts/kconfig $@ 444 $(Q)$(MAKE) $(build)=scripts/kconfig $@
440 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease 445 $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease
@@ -839,7 +844,7 @@ export CPPFLAGS_busybox.lds += -P -C -U$(ARCH)
839 844
840# Split autoconf.h into include/linux/config/* 845# Split autoconf.h into include/linux/config/*
841quiet_cmd_gen_bbconfigopts = GEN include/bbconfigopts.h 846quiet_cmd_gen_bbconfigopts = GEN include/bbconfigopts.h
842 cmd_gen_bbconfigopts = $(srctree)/scripts/mkconfigs > include/bbconfigopts.h 847 cmd_gen_bbconfigopts = $(srctree)/scripts/mkconfigs include/bbconfigopts.h include/bbconfigopts_bz2.h
843quiet_cmd_split_autoconf = SPLIT include/autoconf.h -> include/config/* 848quiet_cmd_split_autoconf = SPLIT include/autoconf.h -> include/config/*
844 cmd_split_autoconf = scripts/basic/split-include include/autoconf.h include/config 849 cmd_split_autoconf = scripts/basic/split-include include/autoconf.h include/config
845#bbox# piggybacked generation of few .h files 850#bbox# piggybacked generation of few .h files
@@ -1287,9 +1292,13 @@ endif
1287 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) 1292 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
1288 1293
1289# Modules 1294# Modules
1290/ %/: prepare scripts FORCE 1295%/: prepare scripts FORCE
1291 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1296 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1292 $(build)=$(build-dir) 1297 $(build)=$(build-dir)
1298/: prepare scripts FORCE
1299 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1300 $(build)=$(build-dir)
1301
1293%.ko: prepare scripts FORCE 1302%.ko: prepare scripts FORCE
1294 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ 1303 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1295 $(build)=$(build-dir) $(@:.ko=.o) 1304 $(build)=$(build-dir) $(@:.ko=.o)
diff --git a/applets/Kbuild.src b/applets/Kbuild.src
index 31fee8d1e..9b9808f25 100644
--- a/applets/Kbuild.src
+++ b/applets/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7obj-y := 7obj-y :=
8obj-y += applets.o 8obj-y += applets.o
diff --git a/applets/applet_tables.c b/applets/applet_tables.c
index f56908420..32dcdb73d 100644
--- a/applets/applet_tables.c
+++ b/applets/applet_tables.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Denys Vlasenko <vda.linux@googlemail.com> 6 * Copyright (C) 2007 Denys Vlasenko <vda.linux@googlemail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include <stdlib.h> 11#include <stdlib.h>
diff --git a/applets/applets.c b/applets/applets.c
index 5a7b88e88..98c2b44f5 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko <vda.linux@googlemail.com> 5 * Copyright (C) 2007 Denys Vlasenko <vda.linux@googlemail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "busybox.h" 9#include "busybox.h"
10 10
diff --git a/applets/individual.c b/applets/individual.c
index 341f4d1c2..1e74e4ce5 100644
--- a/applets/individual.c
+++ b/applets/individual.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * Copyright 2005 Rob Landley <rob@landley.net 3 * Copyright 2005 Rob Landley <rob@landley.net
4 * 4 *
5 * Licensed under GPL version 2, see file LICENSE in this tarball for details 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8const char *applet_name; 8const char *applet_name;
diff --git a/applets/usage.c b/applets/usage.c
index 46adbf475..94520ff66 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 Denys Vlasenko. 3 * Copyright (C) 2008 Denys Vlasenko.
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include <unistd.h> 7#include <unistd.h>
8#include <stdlib.h> 8#include <stdlib.h>
diff --git a/applets/usage_pod.c b/applets/usage_pod.c
index 85a2a8ec4..da0baefc6 100644
--- a/applets/usage_pod.c
+++ b/applets/usage_pod.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2009 Denys Vlasenko. 3 * Copyright (C) 2009 Denys Vlasenko.
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include <unistd.h> 7#include <unistd.h>
8#include <stdint.h> 8#include <stdint.h>
diff --git a/archival/Config.src b/archival/Config.src
index 9a84fd6c6..81788ecd9 100644
--- a/archival/Config.src
+++ b/archival/Config.src
@@ -194,7 +194,7 @@ config LZOP
194 Lzop compression/decompresion. 194 Lzop compression/decompresion.
195 195
196config LZOP_COMPR_HIGH 196config LZOP_COMPR_HIGH
197 bool "lzop complession levels 7,8,9 (not very useful)" 197 bool "lzop compression levels 7,8,9 (not very useful)"
198 default n 198 default n
199 depends on LZOP 199 depends on LZOP
200 help 200 help
@@ -206,7 +206,7 @@ config RPM2CPIO
206 bool "rpm2cpio" 206 bool "rpm2cpio"
207 default y 207 default y
208 help 208 help
209 Converts an RPM file into a CPIO archive. 209 Converts a RPM file into a CPIO archive.
210 210
211config RPM 211config RPM
212 bool "rpm" 212 bool "rpm"
diff --git a/archival/Kbuild.src b/archival/Kbuild.src
index 076e58278..a0edb123d 100644
--- a/archival/Kbuild.src
+++ b/archival/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7libs-y += libunarchive/ 7libs-y += libunarchive/
8 8
diff --git a/archival/ar.c b/archival/ar.c
index 1b7b66a57..05556c6cb 100644
--- a/archival/ar.c
+++ b/archival/ar.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Based in part on BusyBox tar, Debian dpkg-deb and GNU ar. 7 * Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 * Archive creation support: 11 * Archive creation support:
12 * Copyright (C) 2010 Nokia Corporation. All rights reserved. 12 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
@@ -123,8 +123,7 @@ static int write_ar_archive(archive_handle_t *handle)
123 struct stat st; 123 struct stat st;
124 archive_handle_t *out_handle; 124 archive_handle_t *out_handle;
125 125
126 if (fstat(handle->src_fd, &st) == -1) 126 xfstat(handle->src_fd, &st, handle->ar__name);
127 bb_simple_perror_msg_and_die(handle->ar__name);
128 127
129 /* if archive exists, create a new handle for output. 128 /* if archive exists, create a new handle for output.
130 * we create it in place of the old one. 129 * we create it in place of the old one.
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index c1259ac46..787f4124d 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Common code for gunzip-like applets 3 * Common code for gunzip-like applets
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7#include "libbb.h" 7#include "libbb.h"
8#include "unarchive.h" 8#include "unarchive.h"
@@ -165,7 +165,7 @@ char* FAST_FUNC make_new_name_generic(char *filename, const char *expected_ext)
165/* 165/*
166 * Uncompress applet for busybox (c) 2002 Glenn McGrath 166 * Uncompress applet for busybox (c) 2002 Glenn McGrath
167 * 167 *
168 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 168 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
169 */ 169 */
170#if ENABLE_UNCOMPRESS 170#if ENABLE_UNCOMPRESS
171static 171static
@@ -206,7 +206,7 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
206 * General cleanup to better adhere to the style guide and make use of standard 206 * General cleanup to better adhere to the style guide and make use of standard
207 * busybox functions by Glenn McGrath 207 * busybox functions by Glenn McGrath
208 * 208 *
209 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 209 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
210 * 210 *
211 * gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface 211 * gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
212 * Copyright (C) 1992-1993 Jean-loup Gailly 212 * Copyright (C) 1992-1993 Jean-loup Gailly
@@ -302,7 +302,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
302 * Modified for busybox by Glenn McGrath 302 * Modified for busybox by Glenn McGrath
303 * Added support output to stdout by Thomas Lundquist <thomasez@zelow.no> 303 * Added support output to stdout by Thomas Lundquist <thomasez@zelow.no>
304 * 304 *
305 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 305 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
306 */ 306 */
307//usage:#define bunzip2_trivial_usage 307//usage:#define bunzip2_trivial_usage
308//usage: "[OPTIONS] [FILE]..." 308//usage: "[OPTIONS] [FILE]..."
@@ -342,7 +342,7 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
342 * 342 *
343 * Based on bunzip.c from busybox 343 * Based on bunzip.c from busybox
344 * 344 *
345 * Licensed under GPL v2, see file LICENSE in this tarball for details. 345 * Licensed under GPLv2, see file LICENSE in this source tree.
346 */ 346 */
347#if ENABLE_UNLZMA 347#if ENABLE_UNLZMA
348static 348static
diff --git a/archival/cpio.c b/archival/cpio.c
index e0ca7fa5c..7cd8ee8a7 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 by Glenn McGrath 5 * Copyright (C) 2001 by Glenn McGrath
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 * Limitations: 9 * Limitations:
10 * Doesn't check CRC's 10 * Doesn't check CRC's
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 45a791bba..4c627e890 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * dpkg-deb packs, unpacks and provides information about Debian archives. 3 * dpkg-deb packs, unpacks and provides information about Debian archives.
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7#include "libbb.h" 7#include "libbb.h"
8#include "unarchive.h" 8#include "unarchive.h"
diff --git a/archival/gzip.c b/archival/gzip.c
index f80754f8b..e9f09730d 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -13,7 +13,7 @@
13 * files as well as stdin/stdout, and to generally behave itself wrt 13 * files as well as stdin/stdout, and to generally behave itself wrt
14 * command line handling. 14 * command line handling.
15 * 15 *
16 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 16 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
17 */ 17 */
18 18
19/* big objects in bss: 19/* big objects in bss:
diff --git a/archival/libunarchive/Kbuild.src b/archival/libunarchive/Kbuild.src
index a8549570e..e92b4aad2 100644
--- a/archival/libunarchive/Kbuild.src
+++ b/archival/libunarchive/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5# Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
@@ -54,6 +54,7 @@ lib-$(CONFIG_FEATURE_SEAMLESS_BZ2) += open_transformer.o decompress_bunzip2
54lib-$(CONFIG_FEATURE_SEAMLESS_LZMA) += open_transformer.o decompress_unlzma.o get_header_tar_lzma.o 54lib-$(CONFIG_FEATURE_SEAMLESS_LZMA) += open_transformer.o decompress_unlzma.o get_header_tar_lzma.o
55lib-$(CONFIG_FEATURE_SEAMLESS_XZ) += open_transformer.o decompress_unxz.o 55lib-$(CONFIG_FEATURE_SEAMLESS_XZ) += open_transformer.o decompress_unxz.o
56lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o 56lib-$(CONFIG_FEATURE_COMPRESS_USAGE) += decompress_bunzip2.o
57lib-$(CONFIG_FEATURE_COMPRESS_BBCONFIG) += decompress_bunzip2.o
57lib-$(CONFIG_FEATURE_TAR_TO_COMMAND) += data_extract_to_command.o 58lib-$(CONFIG_FEATURE_TAR_TO_COMMAND) += data_extract_to_command.o
58 59
59ifneq ($(lib-y),) 60ifneq ($(lib-y),)
diff --git a/archival/libunarchive/data_align.c b/archival/libunarchive/data_align.c
index 0c8542bf5..4e21a36b3 100644
--- a/archival/libunarchive/data_align.c
+++ b/archival/libunarchive/data_align.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/data_extract_all.c b/archival/libunarchive/data_extract_all.c
index 00e67d405..cc549cd78 100644
--- a/archival/libunarchive/data_extract_all.c
+++ b/archival/libunarchive/data_extract_all.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/data_extract_to_command.c b/archival/libunarchive/data_extract_to_command.c
index 95f5bc864..b54f7f215 100644
--- a/archival/libunarchive/data_extract_to_command.c
+++ b/archival/libunarchive/data_extract_to_command.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/data_extract_to_stdout.c b/archival/libunarchive/data_extract_to_stdout.c
index a3efea16d..ce0713ac4 100644
--- a/archival/libunarchive/data_extract_to_stdout.c
+++ b/archival/libunarchive/data_extract_to_stdout.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/data_skip.c b/archival/libunarchive/data_skip.c
index 06d3dced4..06b74399d 100644
--- a/archival/libunarchive/data_skip.c
+++ b/archival/libunarchive/data_skip.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c
index bdbd39ac2..22015683c 100644
--- a/archival/libunarchive/decompress_bunzip2.c
+++ b/archival/libunarchive/decompress_bunzip2.c
@@ -6,7 +6,7 @@
6 Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten, 6 Peter Fenwick, Alistair Moffat, Radford Neal, Ian H. Witten,
7 Robert Sedgewick, and Jon L. Bentley. 7 Robert Sedgewick, and Jon L. Bentley.
8 8
9 Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 Licensed under GPLv2 or later, see file LICENSE in this source tree.
10*/ 10*/
11 11
12/* 12/*
diff --git a/archival/libunarchive/decompress_unlzma.c b/archival/libunarchive/decompress_unlzma.c
index ecda17481..1a3a8f86b 100644
--- a/archival/libunarchive/decompress_unlzma.c
+++ b/archival/libunarchive/decompress_unlzma.c
@@ -6,7 +6,7 @@
6 * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/) 6 * Based on LzmaDecode.c from the LZMA SDK 4.22 (http://www.7-zip.org/)
7 * Copyright (C) 1999-2005 Igor Pavlov 7 * Copyright (C) 1999-2005 Igor Pavlov
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11#include "libbb.h" 11#include "libbb.h"
12#include "unarchive.h" 12#include "unarchive.h"
diff --git a/archival/libunarchive/decompress_unxz.c b/archival/libunarchive/decompress_unxz.c
index 721acd907..faba9ca82 100644
--- a/archival/libunarchive/decompress_unxz.c
+++ b/archival/libunarchive/decompress_unxz.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * This file is: 8 * This file is:
9 * Copyright (C) 2010 Denys Vlasenko <vda.linux@googlemail.com> 9 * Copyright (C) 2010 Denys Vlasenko <vda.linux@googlemail.com>
10 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13#include "unarchive.h" 13#include "unarchive.h"
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index bccd0262e..20fda9d26 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -30,7 +30,7 @@
30 * 30 *
31 * See the file algorithm.doc for the compression algorithms and file formats. 31 * See the file algorithm.doc for the compression algorithms and file formats.
32 * 32 *
33 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 33 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
34 */ 34 */
35 35
36#include <setjmp.h> 36#include <setjmp.h>
diff --git a/archival/libunarchive/filter_accept_all.c b/archival/libunarchive/filter_accept_all.c
index 21f9c5c9e..cb1f506c8 100644
--- a/archival/libunarchive/filter_accept_all.c
+++ b/archival/libunarchive/filter_accept_all.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/archival/libunarchive/filter_accept_list.c b/archival/libunarchive/filter_accept_list.c
index afa0b4cbf..fe4414c85 100644
--- a/archival/libunarchive/filter_accept_list.c
+++ b/archival/libunarchive/filter_accept_list.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/archival/libunarchive/filter_accept_list_reassign.c b/archival/libunarchive/filter_accept_list_reassign.c
index 060a2c72b..891f58390 100644
--- a/archival/libunarchive/filter_accept_list_reassign.c
+++ b/archival/libunarchive/filter_accept_list_reassign.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/archival/libunarchive/filter_accept_reject_list.c b/archival/libunarchive/filter_accept_reject_list.c
index aa601e137..89a5502d5 100644
--- a/archival/libunarchive/filter_accept_reject_list.c
+++ b/archival/libunarchive/filter_accept_reject_list.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/archival/libunarchive/find_list_entry.c b/archival/libunarchive/find_list_entry.c
index bc7bc6471..5c0c85f09 100644
--- a/archival/libunarchive/find_list_entry.c
+++ b/archival/libunarchive/find_list_entry.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2002 by Glenn McGrath 3 * Copyright (C) 2002 by Glenn McGrath
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include <fnmatch.h> 8#include <fnmatch.h>
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c
index dbc5ec004..6bfc6bc27 100644
--- a/archival/libunarchive/get_header_ar.c
+++ b/archival/libunarchive/get_header_ar.c
@@ -1,7 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Copyright 2001 Glenn McGrath. 2/* Copyright 2001 Glenn McGrath.
3 * 3 *
4 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 */ 5 */
6 6
7#include "libbb.h" 7#include "libbb.h"
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c
index 4507d538b..8cd1096ba 100644
--- a/archival/libunarchive/get_header_cpio.c
+++ b/archival/libunarchive/get_header_cpio.c
@@ -1,7 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Copyright 2002 Laurence Anderson 2/* Copyright 2002 Laurence Anderson
3 * 3 *
4 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 */ 5 */
6 6
7#include "libbb.h" 7#include "libbb.h"
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index d5c92359c..cf6487207 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -1,14 +1,14 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 2/* Licensed under GPLv2 or later, see file LICENSE in this source tree.
3 * 3 *
4 * FIXME: 4 * FIXME:
5 * In privileged mode if uname and gname map to a uid and gid then use the 5 * In privileged mode if uname and gname map to a uid and gid then use the
6 * mapped value instead of the uid/gid values in tar header 6 * mapped value instead of the uid/gid values in tar header
7 * 7 *
8 * References: 8 * References:
9 * GNU tar and star man pages, 9 * GNU tar and star man pages,
10 * Opengroup's ustar interchange format, 10 * Opengroup's ustar interchange format,
11 * http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html 11 * http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html
12 */ 12 */
13 13
14#include "libbb.h" 14#include "libbb.h"
diff --git a/archival/libunarchive/get_header_tar_bz2.c b/archival/libunarchive/get_header_tar_bz2.c
index 615bbba4a..4ffc17086 100644
--- a/archival/libunarchive/get_header_tar_bz2.c
+++ b/archival/libunarchive/get_header_tar_bz2.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/get_header_tar_gz.c b/archival/libunarchive/get_header_tar_gz.c
index e88b720a8..a9af22e0e 100644
--- a/archival/libunarchive/get_header_tar_gz.c
+++ b/archival/libunarchive/get_header_tar_gz.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/get_header_tar_lzma.c b/archival/libunarchive/get_header_tar_lzma.c
index 03b1b792d..9876b3827 100644
--- a/archival/libunarchive/get_header_tar_lzma.c
+++ b/archival/libunarchive/get_header_tar_lzma.c
@@ -3,7 +3,7 @@
3 * Small lzma deflate implementation. 3 * Small lzma deflate implementation.
4 * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org> 4 * Copyright (C) 2006 Aurelien Jacobs <aurel@gnuage.org>
5 * 5 *
6 * Licensed under GPL v2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/archival/libunarchive/header_list.c b/archival/libunarchive/header_list.c
index b1c425aca..902d6ebe0 100644
--- a/archival/libunarchive/header_list.c
+++ b/archival/libunarchive/header_list.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5#include "libbb.h" 5#include "libbb.h"
6#include "unarchive.h" 6#include "unarchive.h"
diff --git a/archival/libunarchive/header_skip.c b/archival/libunarchive/header_skip.c
index a97a9ce80..2af36ac9c 100644
--- a/archival/libunarchive/header_skip.c
+++ b/archival/libunarchive/header_skip.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5#include "libbb.h" 5#include "libbb.h"
6#include "unarchive.h" 6#include "unarchive.h"
diff --git a/archival/libunarchive/header_verbose_list.c b/archival/libunarchive/header_verbose_list.c
index 3319e63a9..d863e6a29 100644
--- a/archival/libunarchive/header_verbose_list.c
+++ b/archival/libunarchive/header_verbose_list.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/init_handle.c b/archival/libunarchive/init_handle.c
index ff7d484e5..de7021f78 100644
--- a/archival/libunarchive/init_handle.c
+++ b/archival/libunarchive/init_handle.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/open_transformer.c b/archival/libunarchive/open_transformer.c
index cba049f1f..ed6a556bb 100644
--- a/archival/libunarchive/open_transformer.c
+++ b/archival/libunarchive/open_transformer.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/seek_by_jump.c b/archival/libunarchive/seek_by_jump.c
index 7181cb3ce..bda55e1b1 100644
--- a/archival/libunarchive/seek_by_jump.c
+++ b/archival/libunarchive/seek_by_jump.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/seek_by_read.c b/archival/libunarchive/seek_by_read.c
index af65e5d85..25b31365d 100644
--- a/archival/libunarchive/seek_by_read.c
+++ b/archival/libunarchive/seek_by_read.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/libunarchive/unpack_ar_archive.c b/archival/libunarchive/unpack_ar_archive.c
index 300d10e48..4f68ba3d8 100644
--- a/archival/libunarchive/unpack_ar_archive.c
+++ b/archival/libunarchive/unpack_ar_archive.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/archival/rpm.c b/archival/rpm.c
index 38ec20ef5..7b316a5b8 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001,2002 by Laurence Anderson 5 * Copyright (C) 2001,2002 by Laurence Anderson
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/archival/rpm.h b/archival/rpm.h
index f7c6fc2fa..afe2b550c 100644
--- a/archival/rpm.h
+++ b/archival/rpm.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 by Laurence Anderson 5 * Copyright (C) 2001 by Laurence Anderson
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* RPM file starts with this struct: */ 10/* RPM file starts with this struct: */
diff --git a/archival/rpm2cpio.c b/archival/rpm2cpio.c
index 5bc50b88f..70021d539 100644
--- a/archival/rpm2cpio.c
+++ b/archival/rpm2cpio.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 by Laurence Anderson 5 * Copyright (C) 2001 by Laurence Anderson
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "unarchive.h" 10#include "unarchive.h"
diff --git a/archival/tar.c b/archival/tar.c
index 5ddff7fa5..2176ad2ac 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -15,12 +15,12 @@
15 * Copyright (c) 1999 by David I. Bell 15 * Copyright (c) 1999 by David I. Bell
16 * Permission is granted to use, distribute, or modify this source, 16 * Permission is granted to use, distribute, or modify this source,
17 * provided that this copyright notice remains intact. 17 * provided that this copyright notice remains intact.
18 * Permission to distribute sash derived code under the GPL has been granted. 18 * Permission to distribute sash derived code under GPL has been granted.
19 * 19 *
20 * Based in part on the tar implementation from busybox-0.28 20 * Based in part on the tar implementation from busybox-0.28
21 * Copyright (C) 1995 Bruce Perens 21 * Copyright (C) 1995 Bruce Perens
22 * 22 *
23 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 23 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
24 */ 24 */
25 25
26#include <fnmatch.h> 26#include <fnmatch.h>
@@ -572,8 +572,7 @@ static NOINLINE int writeTarFile(int tar_fd, int verboseFlag,
572 572
573 /* Store the stat info for the tarball's file, so 573 /* Store the stat info for the tarball's file, so
574 * can avoid including the tarball into itself.... */ 574 * can avoid including the tarball into itself.... */
575 if (fstat(tbInfo.tarFd, &tbInfo.tarFileStatBuf) < 0) 575 xfstat(tbInfo.tarFd, &tbInfo.tarFileStatBuf, "can't stat tar file");
576 bb_perror_msg_and_die("can't stat tar file");
577 576
578#if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2 577#if ENABLE_FEATURE_SEAMLESS_GZ || ENABLE_FEATURE_SEAMLESS_BZ2
579 if (gzip) 578 if (gzip)
diff --git a/archival/unzip.c b/archival/unzip.c
index d9705a56e..204e34952 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -7,7 +7,7 @@
7 * Loosely based on original busybox unzip applet by Laurence Anderson. 7 * Loosely based on original busybox unzip applet by Laurence Anderson.
8 * All options and features should work in this version. 8 * All options and features should work in this version.
9 * 9 *
10 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13/* For reference see 13/* For reference see
diff --git a/console-tools/Kbuild.src b/console-tools/Kbuild.src
index 17f660638..94de9ad9f 100644
--- a/console-tools/Kbuild.src
+++ b/console-tools/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/console-tools/chvt.c b/console-tools/chvt.c
index 977c26905..07e58c3b8 100644
--- a/console-tools/chvt.c
+++ b/console-tools/chvt.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/console-tools/clear.c b/console-tools/clear.c
index cac716394..dcb9bfb02 100644
--- a/console-tools/clear.c
+++ b/console-tools/clear.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c
index 09748834f..6a1d13d14 100644
--- a/console-tools/deallocvt.c
+++ b/console-tools/deallocvt.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it> 5 * Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it>
6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* no options, no getopt */ 11/* no options, no getopt */
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c
index a03b59340..301a90674 100644
--- a/console-tools/dumpkmap.c
+++ b/console-tools/dumpkmap.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) Arne Bernin <arne@matrix.loopback.org> 5 * Copyright (C) Arne Bernin <arne@matrix.loopback.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10/* no options, no getopt */ 10/* no options, no getopt */
diff --git a/console-tools/fgconsole.c b/console-tools/fgconsole.c
index 75fd98fd5..e2dba4860 100644
--- a/console-tools/fgconsole.c
+++ b/console-tools/fgconsole.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 by Grigory Batalov <bga@altlinux.org> 5 * Copyright (C) 2010 by Grigory Batalov <bga@altlinux.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/console-tools/kbd_mode.c b/console-tools/kbd_mode.c
index e1d85231c..14f2ae516 100644
--- a/console-tools/kbd_mode.c
+++ b/console-tools/kbd_mode.c
@@ -6,7 +6,7 @@
6 * written using Andries Brouwer <aeb@cwi.nl>'s kbd_mode from 6 * written using Andries Brouwer <aeb@cwi.nl>'s kbd_mode from
7 * console-utils v0.2.3, licensed under GNU GPLv2 7 * console-utils v0.2.3, licensed under GNU GPLv2
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11#include "libbb.h" 11#include "libbb.h"
12#include <linux/kd.h> 12#include <linux/kd.h>
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index e51142c8e..3c77813b5 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -7,7 +7,7 @@
7 * Loads the console font, and possibly the corresponding screen map(s). 7 * Loads the console font, and possibly the corresponding screen map(s).
8 * (Adapted for busybox by Matej Vela.) 8 * (Adapted for busybox by Matej Vela.)
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13#include <sys/kd.h> 13#include <sys/kd.h>
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c
index 8f1a9153a..2d1c9e284 100644
--- a/console-tools/loadkmap.c
+++ b/console-tools/loadkmap.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1998 Enrique Zanardi <ezanardi@ull.es> 5 * Copyright (C) 1998 Enrique Zanardi <ezanardi@ull.es>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/console-tools/openvt.c b/console-tools/openvt.c
index e3ea71bc5..6e0b589a0 100644
--- a/console-tools/openvt.c
+++ b/console-tools/openvt.c
@@ -5,7 +5,7 @@
5 * busyboxed by Quy Tonthat <quy@signal3.com> 5 * busyboxed by Quy Tonthat <quy@signal3.com>
6 * hacked by Tito <farmatito@tiscali.it> 6 * hacked by Tito <farmatito@tiscali.it>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include <linux/vt.h> 11#include <linux/vt.h>
diff --git a/console-tools/reset.c b/console-tools/reset.c
index f0ea5cb20..7dffdea18 100644
--- a/console-tools/reset.c
+++ b/console-tools/reset.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Written by Erik Andersen and Kent Robotti <robotti@metconnect.com> 6 * Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/console-tools/resize.c b/console-tools/resize.c
index 828b5bb42..12e50a116 100644
--- a/console-tools/resize.c
+++ b/console-tools/resize.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2006 Bernhard Reutner-Fischer 5 * Copyright 2006 Bernhard Reutner-Fischer
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9/* no options, no getopt */ 9/* no options, no getopt */
10#include "libbb.h" 10#include "libbb.h"
diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c
index 8ad9948dd..87265baf8 100644
--- a/console-tools/setconsole.c
+++ b/console-tools/setconsole.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de> 5 * Copyright (C) 2004,2005 Enrik Berkhan <Enrik.Berkhan@inka.de>
6 * Copyright (C) 2008 Bernhard Reutner-Fischer 6 * Copyright (C) 2008 Bernhard Reutner-Fischer
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c
index b6a9a32af..ca8cd21c2 100644
--- a/console-tools/setkeycodes.c
+++ b/console-tools/setkeycodes.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Adjusted for BusyBox by Erik Andersen <andersen@codepoet.org> 7 * Adjusted for BusyBox by Erik Andersen <andersen@codepoet.org>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11#include "libbb.h" 11#include "libbb.h"
12 12
diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c
index dd44591a3..52d2608aa 100644
--- a/console-tools/setlogcons.c
+++ b/console-tools/setlogcons.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Based on setlogcons (kbd-1.12) by Andries E. Brouwer 7 * Based on setlogcons (kbd-1.12) by Andries E. Brouwer
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/console-tools/showkey.c b/console-tools/showkey.c
index 681114df7..149ea6465 100644
--- a/console-tools/showkey.c
+++ b/console-tools/showkey.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
@@ -13,21 +13,19 @@
13// set raw tty mode 13// set raw tty mode
14// also used by microcom 14// also used by microcom
15// libbb candidates? 15// libbb candidates?
16static void xget1(int fd, struct termios *t, struct termios *oldt) 16static void xget1(struct termios *t, struct termios *oldt)
17{ 17{
18 tcgetattr(fd, oldt); 18 tcgetattr(STDIN_FILENO, oldt);
19 *t = *oldt; 19 *t = *oldt;
20 cfmakeraw(t); 20 cfmakeraw(t);
21} 21}
22 22
23static int xset1(int fd, struct termios *tio, const char *device) 23static void xset1(struct termios *tio)
24{ 24{
25 int ret = tcsetattr(fd, TCSAFLUSH, tio); 25 int ret = tcsetattr(STDIN_FILENO, TCSAFLUSH, tio);
26
27 if (ret) { 26 if (ret) {
28 bb_perror_msg("can't tcsetattr for %s", device); 27 bb_perror_msg("can't tcsetattr for stdin");
29 } 28 }
30 return ret;
31} 29}
32 30
33/* 31/*
@@ -49,7 +47,7 @@ struct globals {
49static void signal_handler(int signo) 47static void signal_handler(int signo)
50{ 48{
51 // restore keyboard and console settings 49 // restore keyboard and console settings
52 xset1(STDIN_FILENO, &tio0, "stdin"); 50 xset1(&tio0);
53 xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode); 51 xioctl(STDIN_FILENO, KDSKBMODE, (void *)(ptrdiff_t)kbmode);
54 // alarmed? -> exit 0 52 // alarmed? -> exit 0
55 exit(SIGALRM == signo); 53 exit(SIGALRM == signo);
@@ -79,15 +77,15 @@ int showkey_main(int argc UNUSED_PARAM, char **argv)
79 , (option_mask32 & OPT_a) ? "when CTRL+D pressed" : "10s after last keypress" 77 , (option_mask32 & OPT_a) ? "when CTRL+D pressed" : "10s after last keypress"
80 ); 78 );
81 // prepare for raw mode 79 // prepare for raw mode
82 xget1(STDIN_FILENO, &tio, &tio0); 80 xget1(&tio, &tio0);
83 // put stdin in raw mode 81 // put stdin in raw mode
84 xset1(STDIN_FILENO, &tio, "stdin"); 82 xset1(&tio);
85 83
86 if (option_mask32 & OPT_a) { 84 if (option_mask32 & OPT_a) {
87 char c; 85 unsigned char c;
88 // just read stdin char by char 86 // just read stdin char by char
89 while (1 == safe_read(STDIN_FILENO, &c, 1)) { 87 while (1 == safe_read(STDIN_FILENO, &c, 1)) {
90 printf("%3d 0%03o 0x%02x\r\n", c, c, c); 88 printf("%3u 0%03o 0x%02x\r\n", c, c, c);
91 if (04 /*CTRL-D*/ == c) 89 if (04 /*CTRL-D*/ == c)
92 break; 90 break;
93 } 91 }
@@ -114,16 +112,18 @@ int showkey_main(int argc UNUSED_PARAM, char **argv)
114 // show interpreted scancodes (default) ? -> 112 // show interpreted scancodes (default) ? ->
115 } else { 113 } else {
116 int kc; 114 int kc;
117 if (i+2 < n && (c & 0x7f) == 0 115 if (i+2 < n
118 && (buf[i+1] & 0x80) != 0 116 && (c & 0x7f) == 0
119 && (buf[i+2] & 0x80) != 0) { 117 && (buf[i+1] & 0x80) != 0
118 && (buf[i+2] & 0x80) != 0
119 ) {
120 kc = ((buf[i+1] & 0x7f) << 7) | (buf[i+2] & 0x7f); 120 kc = ((buf[i+1] & 0x7f) << 7) | (buf[i+2] & 0x7f);
121 i += 3; 121 i += 3;
122 } else { 122 } else {
123 kc = (c & 0x7f); 123 kc = (c & 0x7f);
124 i++; 124 i++;
125 } 125 }
126 printf("keycode %3d %s", kc, (c & 0x80) ? "release" : "press"); 126 printf("keycode %3u %s", kc, (c & 0x80) ? "release" : "press");
127 } 127 }
128 } 128 }
129 puts("\r"); 129 puts("\r");
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index 1c846a75f..630b048df 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7libs-y += libcoreutils/ 7libs-y += libcoreutils/
8 8
diff --git a/coreutils/basename.c b/coreutils/basename.c
index b79d561c2..d44124741 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 10/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
diff --git a/coreutils/cal.c b/coreutils/cal.c
index c98229cb0..ef5dbeadb 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * See original copyright at the end of this file 5 * See original copyright at the end of this file
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */ 10/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 454c46b68..922549828 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/catv.c b/coreutils/catv.c
index ff3139c80..f92d93d24 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2006 Rob Landley <rob@landley.net> 5 * Copyright (C) 2006 Rob Landley <rob@landley.net>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* See "Cat -v considered harmful" at 10/* See "Cat -v considered harmful" at
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
index 7f3904805..58f78e736 100644
--- a/coreutils/chgrp.c
+++ b/coreutils/chgrp.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 defects - none? */ 10/* BB_AUDIT SUSv3 defects - none? */
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index c04201eec..f07a49bd3 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -7,7 +7,7 @@
7 * Reworked by (C) 2002 Vladimir Oleynik <dzo@simtreas.ru> 7 * Reworked by (C) 2002 Vladimir Oleynik <dzo@simtreas.ru>
8 * to correctly parse '-rwxgoa' 8 * to correctly parse '-rwxgoa'
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13/* BB_AUDIT SUSv3 compliant */ 13/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/chown.c b/coreutils/chown.c
index 717e4b17a..282deccfb 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 defects - none? */ 10/* BB_AUDIT SUSv3 defects - none? */
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index 046c2fabf..b80a12ee0 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 8e65b1ca3..8e7800ee9 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms 5 * Copyright (C) 2006 by Rob Sullivan, with ideas from code by Walter Harms
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/coreutils/comm.c b/coreutils/comm.c
index 221cbfbcc..c04da1896 100644
--- a/coreutils/comm.c
+++ b/coreutils/comm.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 by Robert Sullivan <cogito.ergo.cogito@gmail.com> 5 * Copyright (C) 2005 by Robert Sullivan <cogito.ergo.cogito@gmail.com>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/coreutils/cp.c b/coreutils/cp.c
index d7c8d91cc..ab17b39a6 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2000 by Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2000 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * SELinux support by Yuichi Nakamura <ynakam@hitachisoft.jp> 6 * SELinux support by Yuichi Nakamura <ynakam@hitachisoft.jp>
7 * 7 *
8 * Licensed under GPL v2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */ 11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
diff --git a/coreutils/cut.c b/coreutils/cut.c
index b7a3cfabb..38cd32c77 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -6,7 +6,7 @@
6 * Written by Mark Whitley <markw@codepoet.org> 6 * Written by Mark Whitley <markw@codepoet.org>
7 * debloated by Bernhard Reutner-Fischer 7 * debloated by Bernhard Reutner-Fischer
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/coreutils/date.c b/coreutils/date.c
index 3ce352c8d..c9dfedf81 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -7,7 +7,7 @@
7 * iso-format handling added by Robert Griebl <griebl@gmx.de> 7 * iso-format handling added by Robert Griebl <griebl@gmx.de>
8 * bugfixes and cleanup by Bernhard Reutner-Fischer 8 * bugfixes and cleanup by Bernhard Reutner-Fischer
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11*/ 11*/
12 12
13/* This 'date' command supports only 2 time setting formats, 13/* This 'date' command supports only 2 time setting formats,
diff --git a/coreutils/dd.c b/coreutils/dd.c
index eb9f8885f..c22a39da7 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2000,2001 Matt Kraai 6 * Copyright (C) 2000,2001 Matt Kraai
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/coreutils/df.c b/coreutils/df.c
index 5eeb5b476..af9b77b23 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * based on original code by (I think) Bruce Perens <bruce@pixar.com>. 6 * based on original code by (I think) Bruce Perens <bruce@pixar.com>.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */ 11/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index 94c22a7ee..246946ed0 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index 98eaec172..ef1ea4328 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -9,7 +9,7 @@
9 * 9 *
10 * dos2unix filters reading input from stdin and writing output to stdout. 10 * dos2unix filters reading input from stdin and writing output to stdout.
11 * 11 *
12 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13*/ 13*/
14 14
15#include "libbb.h" 15#include "libbb.h"
diff --git a/coreutils/du.c b/coreutils/du.c
index 5894ed438..cc3c78433 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> 6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * Copyright (C) 2002 Edward Betts <edward@debian.org> 7 * Copyright (C) 2002 Edward Betts <edward@debian.org>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */ 12/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 69039969b..3821e594e 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -5,7 +5,7 @@
5 * Copyright (c) 1991, 1993 5 * Copyright (c) 1991, 1993
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 * 9 *
10 * Original copyright notice is retained at the end of this file. 10 * Original copyright notice is retained at the end of this file.
11 */ 11 */
diff --git a/coreutils/env.c b/coreutils/env.c
index d4eab191b..f50ee7869 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -5,7 +5,7 @@
5 * Copyright (c) 1988, 1993, 1994 5 * Copyright (c) 1988, 1993, 1994
6 * The Regents of the University of California. All rights reserved. 6 * The Regents of the University of California. All rights reserved.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 * 9 *
10 * Original copyright notice is retained at the end of this file. 10 * Original copyright notice is retained at the end of this file.
11 * 11 *
diff --git a/coreutils/expand.c b/coreutils/expand.c
index b874b6ad4..7491b717a 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 89, 91, 1995-2006 Free Software Foundation, Inc. 4 * Copyright (C) 89, 91, 1995-2006 Free Software Foundation, Inc.
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 * 7 *
8 * David MacKenzie <djm@gnu.ai.mit.edu> 8 * David MacKenzie <djm@gnu.ai.mit.edu>
9 * 9 *
diff --git a/coreutils/expr.c b/coreutils/expr.c
index 8988340f1..04d783f2b 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -11,7 +11,7 @@
11 * - reduced 464 bytes. 11 * - reduced 464 bytes.
12 * - 64 math support 12 * - 64 math support
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16 16
17/* This program evaluates expressions. Each token (operator, operand, 17/* This program evaluates expressions. Each token (operator, operand,
diff --git a/coreutils/false.c b/coreutils/false.c
index f448ebf72..033d2bff4 100644
--- a/coreutils/false.c
+++ b/coreutils/false.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/fold.c b/coreutils/fold.c
index cbea31fad..54f1aa2ac 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -7,7 +7,7 @@
7 Modified for busybox based on coreutils v 5.0 7 Modified for busybox based on coreutils v 5.0
8 Copyright (C) 2003 Glenn McGrath 8 Copyright (C) 2003 Glenn McGrath
9 9
10 Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 10 Licensed under GPLv2 or later, see file LICENSE in this source tree.
11*/ 11*/
12#include "libbb.h" 12#include "libbb.h"
13#include "unicode.h" 13#include "unicode.h"
diff --git a/coreutils/fsync.c b/coreutils/fsync.c
index 53900f8d2..d1fe2b584 100644
--- a/coreutils/fsync.c
+++ b/coreutils/fsync.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Nokia Corporation. All rights reserved. 5 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#ifndef O_NOATIME 10#ifndef O_NOATIME
diff --git a/coreutils/head.c b/coreutils/head.c
index cc2837411..0845b4375 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index a537e3ad6..635e48e12 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2000 Edward Betts <edward@debian.org>. 5 * Copyright (C) 2000 Edward Betts <edward@debian.org>.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/id.c b/coreutils/id.c
index ec9227d06..56286f4d4 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2000 by Randolph Chung <tausq@debian.org> 5 * Copyright (C) 2000 by Randolph Chung <tausq@debian.org>
6 * Copyright (C) 2008 by Tito Ragusa <farmatito@tiscali.it> 6 * Copyright (C) 2008 by Tito Ragusa <farmatito@tiscali.it>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* BB_AUDIT SUSv3 compliant. */ 11/* BB_AUDIT SUSv3 compliant. */
diff --git a/coreutils/install.c b/coreutils/install.c
index ab9feffaf..9dc90d641 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -3,7 +3,7 @@
3 * Copyright (C) 2003 by Glenn McGrath 3 * Copyright (C) 2003 by Glenn McGrath
4 * SELinux support: by Yuichi Nakamura <ynakam@hitachisoft.jp> 4 * SELinux support: by Yuichi Nakamura <ynakam@hitachisoft.jp>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/coreutils/length.c b/coreutils/length.c
index 015b2216f..7f0b48ccd 100644
--- a/coreutils/length.c
+++ b/coreutils/length.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5 5
6/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ 6/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
diff --git a/coreutils/libcoreutils/Kbuild.src b/coreutils/libcoreutils/Kbuild.src
index 981b60628..2042d5f84 100644
--- a/coreutils/libcoreutils/Kbuild.src
+++ b/coreutils/libcoreutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5# Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/coreutils/libcoreutils/coreutils.h b/coreutils/libcoreutils/coreutils.h
index 99b67b14d..307d0330a 100644
--- a/coreutils/libcoreutils/coreutils.h
+++ b/coreutils/libcoreutils/coreutils.h
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#ifndef COREUTILS_H 6#ifndef COREUTILS_H
diff --git a/coreutils/ln.c b/coreutils/ln.c
index f977aa177..ddad120d1 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 8357b9a33..62f453f2f 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2000 Edward Betts <edward@debian.org>. 5 * Copyright (C) 2000 Edward Betts <edward@debian.org>.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 279d30c69..ab66b42c1 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -3,7 +3,7 @@
3 * tiny-ls.c version 0.1.0: A minimalist 'ls' 3 * tiny-ls.c version 0.1.0: A minimalist 'ls'
4 * Copyright (C) 1996 Brian Candler <B.Candler@pobox.com> 4 * Copyright (C) 1996 Brian Candler <B.Candler@pobox.com>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9/* [date unknown. Perhaps before year 2000] 9/* [date unknown. Perhaps before year 2000]
diff --git a/coreutils/md5_sha1_sum.c b/coreutils/md5_sha1_sum.c
index 3d50bb0f5..646f8bd10 100644
--- a/coreutils/md5_sha1_sum.c
+++ b/coreutils/md5_sha1_sum.c
@@ -3,7 +3,7 @@
3 * Copyright (C) 2003 Glenn L. McGrath 3 * Copyright (C) 2003 Glenn L. McGrath
4 * Copyright (C) 2003-2004 Erik Andersen 4 * Copyright (C) 2003-2004 Erik Andersen
5 * 5 *
6 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index c837e9726..0de0d5c3b 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index 65494609c..41aedd099 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index 0c694948e..0e5542dde 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/mv.c b/coreutils/mv.c
index 1c5a46792..7f49d5bab 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2000 by Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2000 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * SELinux support by Yuichi Nakamura <ynakam@hitachisoft.jp> 6 * SELinux support by Yuichi Nakamura <ynakam@hitachisoft.jp>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 11/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
diff --git a/coreutils/nice.c b/coreutils/nice.c
index ff3eb1140..6b8fce24d 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include <sys/resource.h> 10#include <sys/resource.h>
diff --git a/coreutils/nohup.c b/coreutils/nohup.c
index 3dc531409..c21aae9f5 100644
--- a/coreutils/nohup.c
+++ b/coreutils/nohup.c
@@ -7,7 +7,7 @@
7 * Copyright 2006 Rob Landley <rob@landley.net> 7 * Copyright 2006 Rob Landley <rob@landley.net>
8 * Copyright 2006 Bernhard Reutner-Fischer 8 * Copyright 2006 Bernhard Reutner-Fischer
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/coreutils/od.c b/coreutils/od.c
index 228db19ac..30b5bd676 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -6,7 +6,7 @@
6 * Copyright (c) 1990 6 * Copyright (c) 1990
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 * Original copyright notice is retained at the end of this file. 11 * Original copyright notice is retained at the end of this file.
12 */ 12 */
diff --git a/coreutils/printenv.c b/coreutils/printenv.c
index 2430f3a1a..d38f8fb5f 100644
--- a/coreutils/printenv.c
+++ b/coreutils/printenv.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org> 6 * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/coreutils/printf.c b/coreutils/printf.c
index eb53fa490..2cc238439 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -4,7 +4,7 @@
4 Copyright 1999 Dave Cinege 4 Copyright 1999 Dave Cinege
5 Portions copyright (C) 1990-1996 Free Software Foundation, Inc. 5 Portions copyright (C) 1990-1996 Free Software Foundation, Inc.
6 6
7 Licensed under GPL v2 or later, see file LICENSE in this tarball for details. 7 Licensed under GPLv2 or later, see file LICENSE in this source tree.
8*/ 8*/
9 9
10/* Usage: printf format [argument...] 10/* Usage: printf format [argument...]
@@ -66,7 +66,7 @@ static int multiconvert(const char *arg, void *result, converter convert)
66 errno = 0; 66 errno = 0;
67 convert(arg, result); 67 convert(arg, result);
68 if (errno) { 68 if (errno) {
69 bb_error_msg("%s: invalid number", arg); 69 bb_error_msg("invalid number '%s'", arg);
70 return 1; 70 return 1;
71 } 71 }
72 return 0; 72 return 0;
@@ -230,7 +230,7 @@ static int get_width_prec(const char *str)
230{ 230{
231 int v = bb_strtoi(str, NULL, 10); 231 int v = bb_strtoi(str, NULL, 10);
232 if (errno) { 232 if (errno) {
233 bb_error_msg("%s: invalid number", str); 233 bb_error_msg("invalid number '%s'", str);
234 v = 0; 234 v = 0;
235 } 235 }
236 return v; 236 return v;
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index 11278a2a5..2949c55c2 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>. 5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index 2ed5e2cac..87602fbc6 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2000,2001 Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2000,2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * 6 *
7 * Licensed under GPL v2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/coreutils/realpath.c b/coreutils/realpath.c
index 3bc40ee04..5933062b8 100644
--- a/coreutils/realpath.c
+++ b/coreutils/realpath.c
@@ -7,7 +7,7 @@
7 * Now does proper error checking on output and returns a failure exit code 7 * Now does proper error checking on output and returns a failure exit code
8 * if one or more paths cannot be resolved. 8 * if one or more paths cannot be resolved.
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/coreutils/rm.c b/coreutils/rm.c
index 3090cc323..69c473ddb 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 2450a43a3..75bfc2813 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/seq.c b/coreutils/seq.c
index 84d11fd8c..8be25360f 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2004, Glenn McGrath 5 * Copyright (C) 2004, Glenn McGrath
6 * 6 *
7 * Licensed under the GPL v2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 399a38dd4..b983df47e 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/sort.c b/coreutils/sort.c
index 5c3fa1a71..4407b7105 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * MAINTAINER: Rob Landley <rob@landley.net> 7 * MAINTAINER: Rob Landley <rob@landley.net>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 * See SuS3 sort standard at: 11 * See SuS3 sort standard at:
12 * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html 12 * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
diff --git a/coreutils/split.c b/coreutils/split.c
index c2f388501..db5a1727a 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -3,7 +3,7 @@
3 * split - split a file into pieces 3 * split - split a file into pieces
4 * Copyright (c) 2007 Bernhard Reutner-Fischer 4 * Copyright (c) 2007 Bernhard Reutner-Fischer
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8/* BB_AUDIT: SUSv3 compliant 8/* BB_AUDIT: SUSv3 compliant
9 * SUSv3 requirements: 9 * SUSv3 requirements:
@@ -82,9 +82,7 @@ int split_main(int argc UNUSED_PARAM, char **argv)
82 int fd; 82 int fd;
83 if (argv[1]) 83 if (argv[1])
84 sfx = argv[1]; 84 sfx = argv[1];
85 fd = open_or_warn_stdin(argv[0]); 85 fd = xopen_stdin(argv[0]);
86 if (fd == -1)
87 return EXIT_FAILURE;
88 xmove_fd(fd, STDIN_FILENO); 86 xmove_fd(fd, STDIN_FILENO);
89 } else { 87 } else {
90 argv[0] = (char *) bb_msg_standard_input; 88 argv[0] = (char *) bb_msg_standard_input;
diff --git a/coreutils/stat.c b/coreutils/stat.c
index e7c24e642..777197292 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -10,7 +10,7 @@
10 * Written by Michael Meskes 10 * Written by Michael Meskes
11 * Taken from coreutils and turned into a busybox applet by Mike Frysinger 11 * Taken from coreutils and turned into a busybox applet by Mike Frysinger
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15#include "libbb.h" 15#include "libbb.h"
16 16
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 33f7b21dd..0cb4fb234 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -2,7 +2,7 @@
2/* stty -- change and print terminal line settings 2/* stty -- change and print terminal line settings
3 Copyright (C) 1990-1999 Free Software Foundation, Inc. 3 Copyright (C) 1990-1999 Free Software Foundation, Inc.
4 4
5 Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 Licensed under GPLv2 or later, see file LICENSE in this source tree.
6*/ 6*/
7/* Usage: stty [-ag] [-F device] [setting...] 7/* Usage: stty [-ag] [-F device] [setting...]
8 8
diff --git a/coreutils/sum.c b/coreutils/sum.c
index 35e89a6a3..e087fb85b 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -10,7 +10,7 @@
10 * Written by Kayvan Aghaiepour and David MacKenzie 10 * Written by Kayvan Aghaiepour and David MacKenzie
11 * Taken from coreutils and turned into a busybox applet by Mike Frysinger 11 * Taken from coreutils and turned into a busybox applet by Mike Frysinger
12 * 12 *
13 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16#include "libbb.h" 16#include "libbb.h"
diff --git a/coreutils/sync.c b/coreutils/sync.c
index 59305c677..bb112ea38 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>. 5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/tac.c b/coreutils/tac.c
index b8db8eaba..ab3e66ac2 100644
--- a/coreutils/tac.c
+++ b/coreutils/tac.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2007 Natanael Copa <natanael.copa@gmail.com> 6 * Copyright (C) 2007 Natanael Copa <natanael.copa@gmail.com>
7 * Copyright (C) 2007 Tito Ragusa <farmatito@tiscali.it> 7 * Copyright (C) 2007 Tito Ragusa <farmatito@tiscali.it>
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 * 10 *
11 */ 11 */
12 12
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 6397702a0..44698f304 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant (need fancy for -c) */ 10/* BB_AUDIT SUSv3 compliant (need fancy for -c) */
diff --git a/coreutils/tee.c b/coreutils/tee.c
index 0f2424670..8db9042aa 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/test.c b/coreutils/test.c
index fb5778760..1952337b3 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -14,7 +14,7 @@
14 * in busybox. 14 * in busybox.
15 * modified by Bernhard Reutner-Fischer to be useable (i.e. a bit less bloaty). 15 * modified by Bernhard Reutner-Fischer to be useable (i.e. a bit less bloaty).
16 * 16 *
17 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 * 18 *
19 * Original copyright notice states: 19 * Original copyright notice states:
20 * "This program is in the Public Domain." 20 * "This program is in the Public Domain."
diff --git a/coreutils/test_ptr_hack.c b/coreutils/test_ptr_hack.c
index a05203d68..5ba9dcc68 100644
--- a/coreutils/test_ptr_hack.c
+++ b/coreutils/test_ptr_hack.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8struct test_statics; 8struct test_statics;
diff --git a/coreutils/touch.c b/coreutils/touch.c
index dceb7c1cc..03aac3aa2 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m, -r, -t not supported. */ 10/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m, -r, -t not supported. */
diff --git a/coreutils/tr.c b/coreutils/tr.c
index f3db3793f..d6bc7d20a 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -13,7 +13,7 @@
13 * This version of tr is adapted from Minix tr and was modified 13 * This version of tr is adapted from Minix tr and was modified
14 * by Erik Andersen <andersen@codepoet.org> to be used in busybox. 14 * by Erik Andersen <andersen@codepoet.org> to be used in busybox.
15 * 15 *
16 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 16 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
17 */ 17 */
18/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html 18/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html
19 * TODO: graph, print 19 * TODO: graph, print
diff --git a/coreutils/true.c b/coreutils/true.c
index 8a7e6ae9e..0a862ef18 100644
--- a/coreutils/true.c
+++ b/coreutils/true.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/tty.c b/coreutils/tty.c
index 69352ecf8..489181319 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv4 compliant */ 10/* BB_AUDIT SUSv4 compliant */
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 9822e49bd..d1c50e222 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -2,7 +2,7 @@
2/* uname -- print system information 2/* uname -- print system information
3 * Copyright (C) 1989-1999 Free Software Foundation, Inc. 3 * Copyright (C) 1989-1999 Free Software Foundation, Inc.
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8/* BB_AUDIT SUSv3 compliant */ 8/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index e566dc1bc..f0364b9a1 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 compliant */ 10/* BB_AUDIT SUSv3 compliant */
diff --git a/coreutils/usleep.c b/coreutils/usleep.c
index e7acd5f82..cb4ec5898 100644
--- a/coreutils/usleep.c
+++ b/coreutils/usleep.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ 10/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index 0298a4bdb..207fb0b8d 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -1,19 +1,18 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Copyright 2003, Glenn McGrath 3 * Copyright 2003, Glenn McGrath
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Based on specification from 7 * Based on specification from
8 * http://www.opengroup.org/onlinepubs/007904975/utilities/uuencode.html 8 * http://www.opengroup.org/onlinepubs/007904975/utilities/uuencode.html
9 * 9 *
10 * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the 10 * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the
11 * "end" line 11 * "end" line
12 */ 12 */
13
14
15#include "libbb.h" 13#include "libbb.h"
16 14
15#if ENABLE_UUDECODE
17static void read_stduu(FILE *src_stream, FILE *dst_stream) 16static void read_stduu(FILE *src_stream, FILE *dst_stream)
18{ 17{
19 char *line; 18 char *line;
@@ -74,13 +73,14 @@ static void read_stduu(FILE *src_stream, FILE *dst_stream)
74 } 73 }
75 bb_error_msg_and_die("short file"); 74 bb_error_msg_and_die("short file");
76} 75}
76#endif
77 77
78static void read_base64(FILE *src_stream, FILE *dst_stream) 78static void read_base64(FILE *src_stream, FILE *dst_stream)
79{ 79{
80 int term_count = 1; 80 int term_count = 1;
81 81
82 while (1) { 82 while (1) {
83 char translated[4]; 83 unsigned char translated[4];
84 int count = 0; 84 int count = 0;
85 85
86 while (count < 4) { 86 while (count < 4) {
@@ -94,6 +94,12 @@ static void read_base64(FILE *src_stream, FILE *dst_stream)
94 do { 94 do {
95 ch = fgetc(src_stream); 95 ch = fgetc(src_stream);
96 if (ch == EOF) { 96 if (ch == EOF) {
97 if (ENABLE_BASE64
98 && (!ENABLE_UUDECODE || applet_name[0] == 'b')
99 && count == 0
100 ) {
101 return;
102 }
97 bb_error_msg_and_die("short file"); 103 bb_error_msg_and_die("short file");
98 } 104 }
99 table_ptr = strchr(bb_uuenc_tbl_base64, ch); 105 table_ptr = strchr(bb_uuenc_tbl_base64, ch);
@@ -135,6 +141,7 @@ static void read_base64(FILE *src_stream, FILE *dst_stream)
135 } 141 }
136} 142}
137 143
144#if ENABLE_UUDECODE
138int uudecode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 145int uudecode_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
139int uudecode_main(int argc UNUSED_PARAM, char **argv) 146int uudecode_main(int argc UNUSED_PARAM, char **argv)
140{ 147{
@@ -146,9 +153,9 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv)
146 getopt32(argv, "o:", &outname); 153 getopt32(argv, "o:", &outname);
147 argv += optind; 154 argv += optind;
148 155
149 if (!*argv) 156 if (!argv[0])
150 *--argv = (char*)"-"; 157 *--argv = (char*)"-";
151 src_stream = xfopen_stdin(*argv); 158 src_stream = xfopen_stdin(argv[0]);
152 159
153 /* Search for the start of the encoding */ 160 /* Search for the start of the encoding */
154 while ((line = xmalloc_fgetline(src_stream)) != NULL) { 161 while ((line = xmalloc_fgetline(src_stream)) != NULL) {
@@ -189,6 +196,68 @@ int uudecode_main(int argc UNUSED_PARAM, char **argv)
189 } 196 }
190 bb_error_msg_and_die("no 'begin' line"); 197 bb_error_msg_and_die("no 'begin' line");
191} 198}
199#endif
200
201//applet:IF_BASE64(APPLET(base64, _BB_DIR_BIN, _BB_SUID_DROP))
202
203//kbuild:lib-$(CONFIG_BASE64) += uudecode.o
204
205//config:config BASE64
206//config: bool "base64"
207//config: default y
208//config: help
209//config: Base64 encode and decode
210
211//usage:#define base64_trivial_usage
212//usage: "[-d] [FILE]"
213//usage:#define base64_full_usage "\n\n"
214//usage: "Base64 encode or decode FILE to standard output"
215//usage: "\nOptions:"
216//usage: "\n -d Decode data"
217////usage: "\n -w COL Wrap lines at COL (default 76, 0 disables)"
218////usage: "\n -i When decoding, ignore non-alphabet characters"
219
220#if ENABLE_BASE64
221int base64_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
222int base64_main(int argc UNUSED_PARAM, char **argv)
223{
224 FILE *src_stream;
225 unsigned opts;
226
227 opt_complementary = "?1"; /* 1 argument max */
228 opts = getopt32(argv, "d");
229 argv += optind;
230
231 if (!argv[0])
232 *--argv = (char*)"-";
233 src_stream = xfopen_stdin(argv[0]);
234 if (opts) {
235 read_base64(src_stream, stdout);
236 } else {
237 enum {
238 SRC_BUF_SIZE = 76/4*3, /* This *MUST* be a multiple of 3 */
239 DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3),
240 };
241 char src_buf[SRC_BUF_SIZE];
242 char dst_buf[DST_BUF_SIZE + 1];
243 int src_fd = fileno(src_stream);
244 while (1) {
245 size_t size = full_read(src_fd, src_buf, SRC_BUF_SIZE);
246 if (!size)
247 break;
248 if ((ssize_t)size < 0)
249 bb_perror_msg_and_die(bb_msg_read_error);
250 /* Encode the buffer we just read in */
251 bb_uuencode(dst_buf, src_buf, size, bb_uuenc_tbl_base64);
252 xwrite(STDOUT_FILENO, dst_buf, 4 * ((size + 2) / 3));
253 bb_putchar('\n');
254 fflush(stdout);
255 }
256 }
257
258 fflush_stdout_and_exit(EXIT_SUCCESS);
259}
260#endif
192 261
193/* Test script. 262/* Test script.
194Put this into an empty dir with busybox binary, an run. 263Put this into an empty dir with busybox binary, an run.
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index bf661851d..fe9e8c664 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -5,13 +5,13 @@
5 * based on the function base64_encode from http.c in wget v1.6 5 * based on the function base64_encode from http.c in wget v1.6
6 * Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. 6 * Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
12 12
13enum { 13enum {
14 SRC_BUF_SIZE = 45, /* This *MUST* be a multiple of 3 */ 14 SRC_BUF_SIZE = 15*3, /* This *MUST* be a multiple of 3 */
15 DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3), 15 DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3),
16}; 16};
17 17
@@ -33,7 +33,7 @@ int uuencode_main(int argc UNUSED_PARAM, char **argv)
33 } 33 }
34 argv += optind; 34 argv += optind;
35 if (argv[1]) { 35 if (argv[1]) {
36 src_fd = xopen(*argv, O_RDONLY); 36 src_fd = xopen(argv[0], O_RDONLY);
37 fstat(src_fd, &stat_buf); 37 fstat(src_fd, &stat_buf);
38 mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); 38 mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
39 argv++; 39 argv++;
diff --git a/coreutils/wc.c b/coreutils/wc.c
index 711684225..4f14374c3 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 _NOT_ compliant -- option -m is not currently supported. */ 10/* BB_AUDIT SUSv3 _NOT_ compliant -- option -m is not currently supported. */
diff --git a/coreutils/who.c b/coreutils/who.c
index 2b4331025..8384d9534 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -12,7 +12,7 @@
12 * 12 *
13 * Copyright (c) 2002 AYR Networks, Inc. 13 * Copyright (c) 2002 AYR Networks, Inc.
14 * 14 *
15 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 15 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
16 * 16 *
17 *---------------------------------------------------------------------- 17 *----------------------------------------------------------------------
18 */ 18 */
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 22d722ec7..78d20db14 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2000 Edward Betts <edward@debian.org>. 5 * Copyright (C) 2000 Edward Betts <edward@debian.org>.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/yes.c b/coreutils/yes.c
index ead674b27..5d799f09b 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/debianutils/Kbuild.src b/debianutils/Kbuild.src
index da34e4e4f..d41b5c8e4 100644
--- a/debianutils/Kbuild.src
+++ b/debianutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c
index 7ce9f1096..86881f86d 100644
--- a/debianutils/mktemp.c
+++ b/debianutils/mktemp.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2000 by Daniel Jacobowitz 6 * Copyright (C) 2000 by Daniel Jacobowitz
7 * Written by Daniel Jacobowitz <dan@debian.org> 7 * Written by Daniel Jacobowitz <dan@debian.org>
8 * 8 *
9 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12/* Coreutils 6.12 man page says: 12/* Coreutils 6.12 man page says:
diff --git a/debianutils/pipe_progress.c b/debianutils/pipe_progress.c
index 6adefac99..1e57dc241 100644
--- a/debianutils/pipe_progress.c
+++ b/debianutils/pipe_progress.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 by Rob Landley <rob@landley.net>, Joey Hess 5 * Copyright (C) 2003 by Rob Landley <rob@landley.net>, Joey Hess
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index ba05897f9..b93a5a917 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -12,7 +12,7 @@
12 * Copyright (C) 1996-1999 Guy Maor <maor@debian.org> 12 * Copyright (C) 1996-1999 Guy Maor <maor@debian.org>
13 * 13 *
14 * 14 *
15 * Licensed under GPL v2 or later, see file LICENSE in this tarball for details. 15 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
16 */ 16 */
17 17
18/* This is my first attempt to write a program in C (well, this is my first 18/* This is my first attempt to write a program in C (well, this is my first
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 568f32eec..d2ee95068 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -5,7 +5,7 @@
5 * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, 5 * Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
6 * Adapted for busybox David Kimdon <dwhedon@gordian.com> 6 * Adapted for busybox David Kimdon <dwhedon@gordian.com>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* 11/*
diff --git a/debianutils/which.c b/debianutils/which.c
index 59dedf58d..0cf786803 100644
--- a/debianutils/which.c
+++ b/debianutils/which.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2006 Gabriel Somlo <somlo at cmu.edu> 6 * Copyright (C) 2006 Gabriel Somlo <somlo at cmu.edu>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 * 9 *
10 * Based on which from debianutils 10 * Based on which from debianutils
11 */ 11 */
diff --git a/docs/new-applet-HOWTO.txt b/docs/new-applet-HOWTO.txt
index a2c5a49fe..2f237564d 100644
--- a/docs/new-applet-HOWTO.txt
+++ b/docs/new-applet-HOWTO.txt
@@ -36,7 +36,7 @@ For a new applet mu, here is the code that would go in mu.c:
36 * 36 *
37 * Copyright (C) [YEAR] by [YOUR NAME] <YOUR EMAIL> 37 * Copyright (C) [YEAR] by [YOUR NAME] <YOUR EMAIL>
38 * 38 *
39 * Licensed under GPLv2, see file LICENSE in this tarball for details. 39 * Licensed under GPLv2, see file LICENSE in this source tree.
40 */ 40 */
41 41
42#include "libbb.h" 42#include "libbb.h"
diff --git a/e2fsprogs/Kbuild.src b/e2fsprogs/Kbuild.src
index 31c271238..b7a14c381 100644
--- a/e2fsprogs/Kbuild.src
+++ b/e2fsprogs/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/e2fsprogs/e2fs_lib.c b/e2fsprogs/e2fs_lib.c
index f033a19ed..a6aec9484 100644
--- a/e2fsprogs/e2fs_lib.c
+++ b/e2fsprogs/e2fs_lib.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * See README for additional information 3 * See README for additional information
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index d694bb110..a86a9d96f 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -20,7 +20,7 @@
20 * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 20 * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
21 * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. 21 * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
22 * 22 *
23 * Licensed under GPLv2, see file LICENSE in this tarball for details. 23 * Licensed under GPLv2, see file LICENSE in this source tree.
24 */ 24 */
25 25
26/* All filesystem specific hooks have been removed. 26/* All filesystem specific hooks have been removed.
diff --git a/e2fsprogs/old_e2fsprogs/Kbuild.src b/e2fsprogs/old_e2fsprogs/Kbuild.src
index 07a09ca3d..fff1a0d6f 100644
--- a/e2fsprogs/old_e2fsprogs/Kbuild.src
+++ b/e2fsprogs/old_e2fsprogs/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/e2fsprogs/old_e2fsprogs/blkid/Kbuild.src b/e2fsprogs/old_e2fsprogs/blkid/Kbuild.src
index bae77fe63..02b4d2496 100644
--- a/e2fsprogs/old_e2fsprogs/blkid/Kbuild.src
+++ b/e2fsprogs/old_e2fsprogs/blkid/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7NEEDED-$(CONFIG_E2FSCK) = y 7NEEDED-$(CONFIG_E2FSCK) = y
8NEEDED-$(CONFIG_FSCK) = y 8NEEDED-$(CONFIG_FSCK) = y
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c
index cf52f51b6..d73665988 100644
--- a/e2fsprogs/old_e2fsprogs/e2fsck.c
+++ b/e2fsprogs/old_e2fsprogs/e2fsck.c
@@ -26,7 +26,7 @@
26 * Journal recovery routines for the generic filesystem journaling code; 26 * Journal recovery routines for the generic filesystem journaling code;
27 * part of the ext2fs journaling system. 27 * part of the ext2fs journaling system.
28 * 28 *
29 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 29 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
30 */ 30 */
31 31
32#include "e2fsck.h" /*Put all of our defines here to clean things up*/ 32#include "e2fsck.h" /*Put all of our defines here to clean things up*/
diff --git a/e2fsprogs/old_e2fsprogs/e2p/Kbuild.src b/e2fsprogs/old_e2fsprogs/e2p/Kbuild.src
index 194870788..482630cc2 100644
--- a/e2fsprogs/old_e2fsprogs/e2p/Kbuild.src
+++ b/e2fsprogs/old_e2fsprogs/e2p/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7NEEDED-$(CONFIG_CHATTR) = y 7NEEDED-$(CONFIG_CHATTR) = y
8NEEDED-$(CONFIG_LSATTR) = y 8NEEDED-$(CONFIG_LSATTR) = y
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/Kbuild.src b/e2fsprogs/old_e2fsprogs/ext2fs/Kbuild.src
index 8ca65ee90..12adc6e46 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/Kbuild.src
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7NEEDED-$(CONFIG_E2FSCK) = y 7NEEDED-$(CONFIG_E2FSCK) = y
8NEEDED-$(CONFIG_FSCK) = y 8NEEDED-$(CONFIG_FSCK) = y
diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c
index 2a66d728a..524b84652 100644
--- a/e2fsprogs/old_e2fsprogs/fsck.c
+++ b/e2fsprogs/old_e2fsprogs/fsck.c
@@ -20,7 +20,7 @@
20 * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 20 * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
21 * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o. 21 * 2001, 2002, 2003, 2004, 2005 by Theodore Ts'o.
22 * 22 *
23 * Licensed under GPLv2, see file LICENSE in this tarball for details. 23 * Licensed under GPLv2, see file LICENSE in this source tree.
24 */ 24 */
25 25
26#include <sys/types.h> 26#include <sys/types.h>
diff --git a/e2fsprogs/old_e2fsprogs/mke2fs.c b/e2fsprogs/old_e2fsprogs/mke2fs.c
index f1e97b96a..7555650a2 100644
--- a/e2fsprogs/old_e2fsprogs/mke2fs.c
+++ b/e2fsprogs/old_e2fsprogs/mke2fs.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 * Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
6 * 2003, 2004, 2005 by Theodore Ts'o. 6 * 2003, 2004, 2005 by Theodore Ts'o.
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* Usage: mke2fs [options] device 11/* Usage: mke2fs [options] device
diff --git a/e2fsprogs/old_e2fsprogs/tune2fs.c b/e2fsprogs/old_e2fsprogs/tune2fs.c
index 00f8682a5..3c3f4afa5 100644
--- a/e2fsprogs/old_e2fsprogs/tune2fs.c
+++ b/e2fsprogs/old_e2fsprogs/tune2fs.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. 9 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o.
10 * 10 *
11 * Licensed under GPLv2, see file LICENSE in this tarball for details. 11 * Licensed under GPLv2, see file LICENSE in this source tree.
12 */ 12 */
13 13
14/* 14/*
diff --git a/e2fsprogs/old_e2fsprogs/util.c b/e2fsprogs/old_e2fsprogs/util.c
index 0829f5686..a61abc2c6 100644
--- a/e2fsprogs/old_e2fsprogs/util.c
+++ b/e2fsprogs/old_e2fsprogs/util.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o. 5 * Copyright 1995, 1996, 1997, 1998, 1999, 2000 by Theodore Ts'o.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include <stdio.h> 10#include <stdio.h>
diff --git a/e2fsprogs/old_e2fsprogs/uuid/Kbuild.src b/e2fsprogs/old_e2fsprogs/uuid/Kbuild.src
index 9454faba7..b8c687d30 100644
--- a/e2fsprogs/old_e2fsprogs/uuid/Kbuild.src
+++ b/e2fsprogs/old_e2fsprogs/uuid/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7NEEDED-$(CONFIG_E2FSCK) = y 7NEEDED-$(CONFIG_E2FSCK) = y
8NEEDED-$(CONFIG_FSCK) = y 8NEEDED-$(CONFIG_FSCK) = y
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c
index 00ede4f1e..311349fec 100644
--- a/e2fsprogs/tune2fs.c
+++ b/e2fsprogs/tune2fs.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include <linux/fs.h> 10#include <linux/fs.h>
diff --git a/editors/Kbuild.src b/editors/Kbuild.src
index 9d4b9d053..98128064d 100644
--- a/editors/Kbuild.src
+++ b/editors/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/editors/awk.c b/editors/awk.c
index 83c5b47ce..f47d1ab02 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2002 by Dmitry Zakharov <dmit@crp.bank.gov.ua> 5 * Copyright (C) 2002 by Dmitry Zakharov <dmit@crp.bank.gov.ua>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/editors/cmp.c b/editors/cmp.c
index dbfa4be35..f495da7d2 100644
--- a/editors/cmp.c
+++ b/editors/cmp.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2000,2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2000,2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 (virtually) compliant -- uses nicer GNU format for -l. */ 10/* BB_AUDIT SUSv3 (virtually) compliant -- uses nicer GNU format for -l. */
diff --git a/editors/diff.c b/editors/diff.c
index a3ca2b660..83de52753 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -10,7 +10,7 @@
10 * Agency (DARPA) and Air Force Research Laboratory, Air Force 10 * Agency (DARPA) and Air Force Research Laboratory, Air Force
11 * Materiel Command, USAF, under agreement number F39502-99-1-0512. 11 * Materiel Command, USAF, under agreement number F39502-99-1-0512.
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16/* 16/*
@@ -479,7 +479,7 @@ start:
479 for (; suff < nlen[0] - pref && suff < nlen[1] - pref && 479 for (; suff < nlen[0] - pref && suff < nlen[1] - pref &&
480 nfile[0][nlen[0] - suff].value == nfile[1][nlen[1] - suff].value; 480 nfile[0][nlen[0] - suff].value == nfile[1][nlen[1] - suff].value;
481 suff++); 481 suff++);
482 /* Arrays are pruned by the suffix and prefix lenght, 482 /* Arrays are pruned by the suffix and prefix length,
483 * the result being sorted and stored in sfile[fileno], 483 * the result being sorted and stored in sfile[fileno],
484 * and their sizes are stored in slen[fileno] 484 * and their sizes are stored in slen[fileno]
485 */ 485 */
diff --git a/editors/patch.c b/editors/patch.c
index eb16bca12..c40f54155 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -12,7 +12,6 @@
12 * TODO: 12 * TODO:
13 * -b backup 13 * -b backup
14 * -l treat all whitespace as a single space 14 * -l treat all whitespace as a single space
15 * -N ignore already applied
16 * -d chdir first 15 * -d chdir first
17 * -D define wrap #ifdef and #ifndef around changes 16 * -D define wrap #ifdef and #ifndef around changes
18 * -o outfile output here instead of in place 17 * -o outfile output here instead of in place
@@ -244,14 +243,12 @@ struct globals {
244} while (0) 243} while (0)
245 244
246 245
247//bbox had: "p:i:RN"
248#define FLAG_STR "Rup:i:Nx" 246#define FLAG_STR "Rup:i:Nx"
249/* FLAG_REVERSE must be == 1! Code uses this fact. */ 247/* FLAG_REVERSE must be == 1! Code uses this fact. */
250#define FLAG_REVERSE (1 << 0) 248#define FLAG_REVERSE (1 << 0)
251#define FLAG_u (1 << 1) 249#define FLAG_u (1 << 1)
252#define FLAG_PATHLEN (1 << 2) 250#define FLAG_PATHLEN (1 << 2)
253#define FLAG_INPUT (1 << 3) 251#define FLAG_INPUT (1 << 3)
254// -N: not supported yet
255#define FLAG_IGNORE (1 << 4) 252#define FLAG_IGNORE (1 << 4)
256//non-standard: 253//non-standard:
257#define FLAG_DEBUG (1 << 5) 254#define FLAG_DEBUG (1 << 5)
@@ -314,6 +311,10 @@ static int apply_one_hunk(void)
314{ 311{
315 struct double_list *plist, *buf = NULL, *check; 312 struct double_list *plist, *buf = NULL, *check;
316 int matcheof = 0, reverse = option_mask32 & FLAG_REVERSE, backwarn = 0; 313 int matcheof = 0, reverse = option_mask32 & FLAG_REVERSE, backwarn = 0;
314 /* Do we try "dummy" revert to check whether
315 * to silently skip this hunk? Used to implement -N.
316 */
317 int dummy_revert = 0;
317 318
318 // Break doubly linked list so we can use singly linked traversal function. 319 // Break doubly linked list so we can use singly linked traversal function.
319 TT.current_hunk->prev->next = NULL; 320 TT.current_hunk->prev->next = NULL;
@@ -343,9 +344,14 @@ static int apply_one_hunk(void)
343 while (plist && *plist->data == "+-"[reverse]) { 344 while (plist && *plist->data == "+-"[reverse]) {
344 if (data && !strcmp(data, plist->data+1)) { 345 if (data && !strcmp(data, plist->data+1)) {
345 if (!backwarn) { 346 if (!backwarn) {
347 backwarn++;
348 if (option_mask32 & FLAG_IGNORE) {
349 dummy_revert = 1;
350 reverse ^= 1;
351 continue;
352 }
346 fdprintf(2,"Possibly reversed hunk %d at %ld\n", 353 fdprintf(2,"Possibly reversed hunk %d at %ld\n",
347 TT.hunknum, TT.linenum); 354 TT.hunknum, TT.linenum);
348 backwarn++;
349 } 355 }
350 } 356 }
351 plist = plist->next; 357 plist = plist->next;
@@ -409,7 +415,7 @@ static int apply_one_hunk(void)
409 } 415 }
410out: 416out:
411 // We have a match. Emit changed data. 417 // We have a match. Emit changed data.
412 TT.state = "-+"[reverse]; 418 TT.state = "-+"[reverse ^ dummy_revert];
413 llist_free(TT.current_hunk, do_line); 419 llist_free(TT.current_hunk, do_line);
414 TT.current_hunk = NULL; 420 TT.current_hunk = NULL;
415 TT.state = 1; 421 TT.state = 1;
@@ -441,10 +447,21 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
441 INIT_TT(); 447 INIT_TT();
442 448
443 opts = getopt32(argv, FLAG_STR, &opt_p, &opt_i); 449 opts = getopt32(argv, FLAG_STR, &opt_p, &opt_i);
450 argv += optind;
444 reverse = opts & FLAG_REVERSE; 451 reverse = opts & FLAG_REVERSE;
445 TT.prefix = (opts & FLAG_PATHLEN) ? xatoi(opt_p) : 0; // can be negative! 452 TT.prefix = (opts & FLAG_PATHLEN) ? xatoi(opt_p) : 0; // can be negative!
446 if (opts & FLAG_INPUT) TT.filepatch = xopen(opt_i, O_RDONLY);
447 TT.filein = TT.fileout = -1; 453 TT.filein = TT.fileout = -1;
454 if (opts & FLAG_INPUT) {
455 TT.filepatch = xopen_stdin(opt_i);
456 } else {
457 if (argv[0] && argv[1]) {
458 TT.filepatch = xopen_stdin(argv[1]);
459 }
460 }
461 if (argv[0]) {
462 oldname = xstrdup(argv[0]);
463 newname = xstrdup(argv[0]);
464 }
448 465
449 // Loop through the lines in the patch 466 // Loop through the lines in the patch
450 for(;;) { 467 for(;;) {
@@ -492,18 +509,20 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
492 state = 1; 509 state = 1;
493 } 510 }
494 511
495 free(*name);
496 finish_oldfile(); 512 finish_oldfile();
497 513
498 // Trim date from end of filename (if any). We don't care. 514 if (!argv[0]) {
499 for (s = patchline+4; *s && *s!='\t'; s++) 515 free(*name);
500 if (*s=='\\' && s[1]) s++; 516 // Trim date from end of filename (if any). We don't care.
501 i = atoi(s); 517 for (s = patchline+4; *s && *s!='\t'; s++)
502 if (i>1900 && i<=1970) 518 if (*s=='\\' && s[1]) s++;
503 *name = xstrdup("/dev/null"); 519 i = atoi(s);
504 else { 520 if (i>1900 && i<=1970)
505 *s = 0; 521 *name = xstrdup("/dev/null");
506 *name = xstrdup(patchline+4); 522 else {
523 *s = 0;
524 *name = xstrdup(patchline+4);
525 }
507 } 526 }
508 527
509 // We defer actually opening the file because svn produces broken 528 // We defer actually opening the file because svn produces broken
diff --git a/editors/patch_bbox.c b/editors/patch_bbox.c
index 62477af16..78aa5fde8 100644
--- a/editors/patch_bbox.c
+++ b/editors/patch_bbox.c
@@ -1,22 +1,22 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * busybox patch applet to handle the unified diff format. 3 * busybox patch applet to handle the unified diff format.
4 * Copyright (C) 2003 Glenn McGrath 4 * Copyright (C) 2003 Glenn McGrath
5 * 5 *
6 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 * 7 *
8 * This applet is written to work with patches generated by GNU diff, 8 * This applet is written to work with patches generated by GNU diff,
9 * where there is equivalent functionality busybox patch shall behave 9 * where there is equivalent functionality busybox patch shall behave
10 * as per GNU patch. 10 * as per GNU patch.
11 * 11 *
12 * There is a SUSv3 specification for patch, however it looks to be 12 * There is a SUSv3 specification for patch, however it looks to be
13 * incomplete, it doesnt even mention unified diff format. 13 * incomplete, it doesnt even mention unified diff format.
14 * http://www.opengroup.org/onlinepubs/007904975/utilities/patch.html 14 * http://www.opengroup.org/onlinepubs/007904975/utilities/patch.html
15 * 15 *
16 * Issues 16 * Issues
17 * - Non-interactive 17 * - Non-interactive
18 * - Patches must apply cleanly or patch (not just one hunk) will fail. 18 * - Patches must apply cleanly or patch (not just one hunk) will fail.
19 * - Reject file isnt saved 19 * - Reject file isnt saved
20 */ 20 */
21 21
22#include "libbb.h" 22#include "libbb.h"
diff --git a/editors/sed.c b/editors/sed.c
index 7d6e7e79f..8d9f7b25b 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -10,7 +10,7 @@
10 * 10 *
11 * MAINTAINER: Rob Landley <rob@landley.net> 11 * MAINTAINER: Rob Landley <rob@landley.net>
12 * 12 *
13 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2, see file LICENSE in this source tree.
14 */ 14 */
15 15
16/* Code overview. 16/* Code overview.
@@ -992,6 +992,8 @@ static void process_files(void)
992 } 992 }
993 993
994 /* actual sedding */ 994 /* actual sedding */
995 //bb_error_msg("pattern_space:'%s' next_line:'%s' cmd:%c",
996 //pattern_space, next_line, sed_cmd->cmd);
995 switch (sed_cmd->cmd) { 997 switch (sed_cmd->cmd) {
996 998
997 /* Print line number */ 999 /* Print line number */
@@ -1118,10 +1120,16 @@ static void process_files(void)
1118 { 1120 {
1119 int len; 1121 int len;
1120 /* If no next line, jump to end of script and exit. */ 1122 /* If no next line, jump to end of script and exit. */
1123 /* http://www.gnu.org/software/sed/manual/sed.html:
1124 * "Most versions of sed exit without printing anything
1125 * when the N command is issued on the last line of
1126 * a file. GNU sed prints pattern space before exiting
1127 * unless of course the -n command switch has been
1128 * specified. This choice is by design."
1129 */
1121 if (next_line == NULL) { 1130 if (next_line == NULL) {
1122 free(next_line); 1131 //goto discard_line;
1123 next_line = NULL; 1132 goto discard_commands; /* GNU behavior */
1124 goto discard_line;
1125 } 1133 }
1126 /* Append next_line, read new next_line. */ 1134 /* Append next_line, read new next_line. */
1127 len = strlen(pattern_space); 1135 len = strlen(pattern_space);
diff --git a/editors/vi.c b/editors/vi.c
index 73e095cf8..602fc61d9 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3,7 +3,7 @@
3 * tiny vi.c: A small 'vi' clone 3 * tiny vi.c: A small 'vi' clone
4 * Copyright (C) 2000, 2001 Sterling Huxley <sterling@europa.com> 4 * Copyright (C) 2000, 2001 Sterling Huxley <sterling@europa.com>
5 * 5 *
6 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9/* 9/*
diff --git a/examples/depmod b/examples/depmod
index d8c4cc5aa..d769590d0 100755
--- a/examples/depmod
+++ b/examples/depmod
@@ -4,7 +4,7 @@
4# 4#
5# Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5# Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6# 6#
7# Licensed under GPLv2 7# Licensed under GPLv2, see file LICENSE in this source tree.
8# 8#
9 9
10local BASE="${1:-/usr/lib/modules}" 10local BASE="${1:-/usr/lib/modules}"
diff --git a/findutils/Kbuild.src b/findutils/Kbuild.src
index 771789ff5..6b4fb7470 100644
--- a/findutils/Kbuild.src
+++ b/findutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/findutils/find.c b/findutils/find.c
index d4bcd6545..dd00f37ea 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -7,7 +7,7 @@
7 * Reworked by David Douthitt <n9ubh@callsign.net> and 7 * Reworked by David Douthitt <n9ubh@callsign.net> and
8 * Matt Kraai <kraai@alumni.carnegiemellon.edu>. 8 * Matt Kraai <kraai@alumni.carnegiemellon.edu>.
9 * 9 *
10 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12 12
13/* findutils-4.1.20: 13/* findutils-4.1.20:
@@ -748,13 +748,13 @@ static action*** parse_params(char **argv)
748 748
749 /* This is the only place in busybox where we use nested function. 749 /* This is the only place in busybox where we use nested function.
750 * So far more standard alternatives were bigger. */ 750 * So far more standard alternatives were bigger. */
751 /* Suppress a warning "func without a prototype" */ 751 /* Auto decl suppresses "func without a prototype" warning: */
752 auto action* alloc_action(int sizeof_struct, action_fp f); 752 auto action* alloc_action(int sizeof_struct, action_fp f);
753 action* alloc_action(int sizeof_struct, action_fp f) 753 action* alloc_action(int sizeof_struct, action_fp f)
754 { 754 {
755 action *ap; 755 action *ap;
756 appp[cur_group] = xrealloc(appp[cur_group], (cur_action+2) * sizeof(*appp)); 756 appp[cur_group] = xrealloc(appp[cur_group], (cur_action+2) * sizeof(*appp));
757 appp[cur_group][cur_action++] = ap = xmalloc(sizeof_struct); 757 appp[cur_group][cur_action++] = ap = xzalloc(sizeof_struct);
758 appp[cur_group][cur_action] = NULL; 758 appp[cur_group][cur_action] = NULL;
759 ap->f = f; 759 ap->f = f;
760 IF_FEATURE_FIND_NOT( ap->invert = invert_flag; ) 760 IF_FEATURE_FIND_NOT( ap->invert = invert_flag; )
@@ -854,16 +854,20 @@ static action*** parse_params(char **argv)
854 IF_FEATURE_FIND_NOT( invert_flag = 0; ) 854 IF_FEATURE_FIND_NOT( invert_flag = 0; )
855 ap = ALLOC_ACTION(exec); 855 ap = ALLOC_ACTION(exec);
856 ap->exec_argv = ++argv; /* first arg after -exec */ 856 ap->exec_argv = ++argv; /* first arg after -exec */
857 ap->exec_argc = 0; 857 /*ap->exec_argc = 0; - ALLOC_ACTION did it */
858 while (1) { 858 while (1) {
859 if (!*argv) /* did not see ';' or '+' until end */ 859 if (!*argv) /* did not see ';' or '+' until end */
860 bb_error_msg_and_die(bb_msg_requires_arg, "-exec"); 860 bb_error_msg_and_die(bb_msg_requires_arg, "-exec");
861 if (LONE_CHAR(argv[0], ';')) 861 // find -exec echo Foo ">{}<" ";"
862 // executes "echo Foo <filename>",
863 // find -exec echo Foo ">{}<" "+"
864 // executes "echo Foo <filename1> <filename2> <filename3>...".
865 // TODO (so far we treat "+" just like ";")
866 if ((argv[0][0] == ';' || argv[0][0] == '+')
867 && argv[0][1] == '\0'
868 ) {
862 break; 869 break;
863 //TODO: implement {} + (like xargs) 870 }
864 // See:
865 // find findutils/ -exec echo ">"{}"<" \;
866 // find findutils/ -exec echo ">"{}"<" +
867 argv++; 871 argv++;
868 ap->exec_argc++; 872 ap->exec_argc++;
869 } 873 }
@@ -936,7 +940,7 @@ static action*** parse_params(char **argv)
936 ap = ALLOC_ACTION(perm); 940 ap = ALLOC_ACTION(perm);
937 ap->perm_char = arg1[0]; 941 ap->perm_char = arg1[0];
938 arg1 = plus_minus_num(arg1); 942 arg1 = plus_minus_num(arg1);
939 ap->perm_mask = 0; 943 /*ap->perm_mask = 0; - ALLOC_ACTION did it */
940 if (!bb_parse_mode(arg1, &ap->perm_mask)) 944 if (!bb_parse_mode(arg1, &ap->perm_mask))
941 bb_error_msg_and_die("invalid mode '%s'", arg1); 945 bb_error_msg_and_die("invalid mode '%s'", arg1);
942 } 946 }
@@ -1022,7 +1026,7 @@ static action*** parse_params(char **argv)
1022 else if (parm == PARM_context) { 1026 else if (parm == PARM_context) {
1023 action_context *ap; 1027 action_context *ap;
1024 ap = ALLOC_ACTION(context); 1028 ap = ALLOC_ACTION(context);
1025 ap->context = NULL; 1029 /*ap->context = NULL; - ALLOC_ACTION did it */
1026 /* SELinux headers erroneously declare non-const parameter */ 1030 /* SELinux headers erroneously declare non-const parameter */
1027 if (selinux_raw_to_trans_context((char*)arg1, &ap->context)) 1031 if (selinux_raw_to_trans_context((char*)arg1, &ap->context))
1028 bb_simple_perror_msg(arg1); 1032 bb_simple_perror_msg(arg1);
diff --git a/findutils/grep.c b/findutils/grep.c
index 9eb5e5a1b..bf42753c5 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999,2000,2001 by Lineo, inc. and Mark Whitley 5 * Copyright (C) 1999,2000,2001 by Lineo, inc. and Mark Whitley
6 * Copyright (C) 1999,2000,2001 by Mark Whitley <markw@codepoet.org> 6 * Copyright (C) 1999,2000,2001 by Mark Whitley <markw@codepoet.org>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10/* BB_AUDIT SUSv3 defects - unsupported option -x "match whole line only". */ 10/* BB_AUDIT SUSv3 defects - unsupported option -x "match whole line only". */
11/* BB_AUDIT GNU defects - always acts as -a. */ 11/* BB_AUDIT GNU defects - always acts as -a. */
@@ -469,15 +469,19 @@ static int grep_file(FILE *file)
469 if (found) 469 if (found)
470 print_line(gl->pattern, strlen(gl->pattern), linenum, ':'); 470 print_line(gl->pattern, strlen(gl->pattern), linenum, ':');
471 } else while (1) { 471 } else while (1) {
472 unsigned start = gl->matched_range.rm_so;
472 unsigned end = gl->matched_range.rm_eo; 473 unsigned end = gl->matched_range.rm_eo;
474 unsigned len = end - start;
473 char old = line[end]; 475 char old = line[end];
474 line[end] = '\0'; 476 line[end] = '\0';
475 print_line(line + gl->matched_range.rm_so, 477 /* Empty match is not printed: try "echo test | grep -o ''" */
476 end - gl->matched_range.rm_so, 478 if (len != 0)
477 linenum, ':'); 479 print_line(line + start, len, linenum, ':');
478 if (old == '\0') 480 if (old == '\0')
479 break; 481 break;
480 line[end] = old; 482 line[end] = old;
483 if (len == 0)
484 end++;
481#if !ENABLE_EXTRA_COMPAT 485#if !ENABLE_EXTRA_COMPAT
482 if (regexec(&gl->compiled_regex, line + end, 486 if (regexec(&gl->compiled_regex, line + end,
483 1, &gl->matched_range, REG_NOTBOL) != 0) 487 1, &gl->matched_range, REG_NOTBOL) != 0)
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 7b9f1fb73..d73fad9de 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -9,7 +9,7 @@
9 * - Mike Rendell <michael@cs.mun.ca> 9 * - Mike Rendell <michael@cs.mun.ca>
10 * and David MacKenzie <djm@gnu.ai.mit.edu>. 10 * and David MacKenzie <djm@gnu.ai.mit.edu>.
11 * 11 *
12 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13 * 13 *
14 * xargs is described in the Single Unix Specification v3 at 14 * xargs is described in the Single Unix Specification v3 at
15 * http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html 15 * http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html
diff --git a/include/ar.h b/include/ar.h
index 26678895a..386fe0456 100644
--- a/include/ar.h
+++ b/include/ar.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * busybox ar archive data structures 2 * busybox ar archive data structures
3 * Licensed under the GPL v2 or later, see the file LICENSE in this source tree. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5#ifndef AR_H 5#ifndef AR_H
6#define AR_H 6#define AR_H
diff --git a/include/busybox.h b/include/busybox.h
index 48fc0b4c8..76415dd72 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -2,7 +2,7 @@
2/* 2/*
3 * Busybox main internal header file 3 * Busybox main internal header file
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7#ifndef BUSYBOX_H 7#ifndef BUSYBOX_H
8#define BUSYBOX_H 1 8#define BUSYBOX_H 1
diff --git a/include/fix_u32.h b/include/fix_u32.h
index c26e5d192..a2ba6d0a9 100644
--- a/include/fix_u32.h
+++ b/include/fix_u32.h
@@ -3,7 +3,7 @@
3 * This header makes it easier to include kernel headers 3 * This header makes it easier to include kernel headers
4 * which use u32 and such. 4 * which use u32 and such.
5 * 5 *
6 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8#ifndef FIX_U32_H 8#ifndef FIX_U32_H
9#define FIX_U32_H 1 9#define FIX_U32_H 1
diff --git a/include/libbb.h b/include/libbb.h
index fcff7b51e..7c0ff9de0 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -3,9 +3,9 @@
3 * Busybox main internal header file 3 * Busybox main internal header file
4 * 4 *
5 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell 5 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
6 * Permission has been granted to redistribute this code under the GPL. 6 * Permission has been granted to redistribute this code under GPL.
7 * 7 *
8 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#ifndef LIBBB_H 10#ifndef LIBBB_H
11#define LIBBB_H 1 11#define LIBBB_H 1
@@ -422,12 +422,14 @@ void bb_unsetenv(const char *key) FAST_FUNC;
422void bb_unsetenv_and_free(char *key) FAST_FUNC; 422void bb_unsetenv_and_free(char *key) FAST_FUNC;
423void xunlink(const char *pathname) FAST_FUNC; 423void xunlink(const char *pathname) FAST_FUNC;
424void xstat(const char *pathname, struct stat *buf) FAST_FUNC; 424void xstat(const char *pathname, struct stat *buf) FAST_FUNC;
425void xfstat(int fd, struct stat *buf, const char *errmsg) FAST_FUNC;
425int xopen(const char *pathname, int flags) FAST_FUNC; 426int xopen(const char *pathname, int flags) FAST_FUNC;
426int xopen_nonblocking(const char *pathname) FAST_FUNC; 427int xopen_nonblocking(const char *pathname) FAST_FUNC;
427int xopen3(const char *pathname, int flags, int mode) FAST_FUNC; 428int xopen3(const char *pathname, int flags, int mode) FAST_FUNC;
428int open_or_warn(const char *pathname, int flags) FAST_FUNC; 429int open_or_warn(const char *pathname, int flags) FAST_FUNC;
429int open3_or_warn(const char *pathname, int flags, int mode) FAST_FUNC; 430int open3_or_warn(const char *pathname, int flags, int mode) FAST_FUNC;
430int open_or_warn_stdin(const char *pathname) FAST_FUNC; 431int open_or_warn_stdin(const char *pathname) FAST_FUNC;
432int xopen_stdin(const char *pathname) FAST_FUNC;
431void xrename(const char *oldpath, const char *newpath) FAST_FUNC; 433void xrename(const char *oldpath, const char *newpath) FAST_FUNC;
432int rename_or_warn(const char *oldpath, const char *newpath) FAST_FUNC; 434int rename_or_warn(const char *oldpath, const char *newpath) FAST_FUNC;
433off_t xlseek(int fd, off_t offset, int whence) FAST_FUNC; 435off_t xlseek(int fd, off_t offset, int whence) FAST_FUNC;
@@ -1402,6 +1404,29 @@ enum { COMM_LEN = TASK_COMM_LEN };
1402enum { COMM_LEN = 16 }; 1404enum { COMM_LEN = 16 };
1403# endif 1405# endif
1404#endif 1406#endif
1407
1408struct smaprec {
1409 unsigned long mapped_rw;
1410 unsigned long mapped_ro;
1411 unsigned long shared_clean;
1412 unsigned long shared_dirty;
1413 unsigned long private_clean;
1414 unsigned long private_dirty;
1415 unsigned long stack;
1416 unsigned long smap_pss, smap_swap;
1417 unsigned long smap_size;
1418 unsigned long smap_start;
1419 char smap_mode[5];
1420 char *smap_name;
1421};
1422
1423#if !ENABLE_PMAP
1424#define procps_read_smaps(pid, total, cb, data) \
1425 procps_read_smaps(pid, total)
1426#endif
1427int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
1428 void (*cb)(struct smaprec *, void *), void *data);
1429
1405typedef struct procps_status_t { 1430typedef struct procps_status_t {
1406 DIR *dir; 1431 DIR *dir;
1407 IF_FEATURE_SHOW_THREADS(DIR *task_dir;) 1432 IF_FEATURE_SHOW_THREADS(DIR *task_dir;)
@@ -1430,13 +1455,7 @@ typedef struct procps_status_t {
1430#endif 1455#endif
1431 unsigned tty_major,tty_minor; 1456 unsigned tty_major,tty_minor;
1432#if ENABLE_FEATURE_TOPMEM 1457#if ENABLE_FEATURE_TOPMEM
1433 unsigned long mapped_rw; 1458 struct smaprec smaps;
1434 unsigned long mapped_ro;
1435 unsigned long shared_clean;
1436 unsigned long shared_dirty;
1437 unsigned long private_clean;
1438 unsigned long private_dirty;
1439 unsigned long stack;
1440#endif 1459#endif
1441 char state[4]; 1460 char state[4];
1442 /* basename of executable in exec(2), read from /proc/N/stat 1461 /* basename of executable in exec(2), read from /proc/N/stat
diff --git a/include/platform.h b/include/platform.h
index 7f2216a55..232fead89 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Copyright 2006, Bernhard Reutner-Fischer 3 * Copyright 2006, Bernhard Reutner-Fischer
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7#ifndef BB_PLATFORM_H 7#ifndef BB_PLATFORM_H
8#define BB_PLATFORM_H 1 8#define BB_PLATFORM_H 1
diff --git a/include/rtc_.h b/include/rtc_.h
index b5fe8ec32..bd322c940 100644
--- a/include/rtc_.h
+++ b/include/rtc_.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Common defines/structures/etc... for applets that need to work with the RTC. 2 * Common defines/structures/etc... for applets that need to work with the RTC.
3 * 3 *
4 * Licensed under the GPL-2 or later. 4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 */ 5 */
6 6
7#ifndef BB_RTC_H 7#ifndef BB_RTC_H
diff --git a/include/unicode.h b/include/unicode.h
index e9e2bd14a..1dd55e67d 100644
--- a/include/unicode.h
+++ b/include/unicode.h
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5#ifndef UNICODE_H 5#ifndef UNICODE_H
6#define UNICODE_H 1 6#define UNICODE_H 1
diff --git a/include/xatonum.h b/include/xatonum.h
index 978c502f6..6f76a3c96 100644
--- a/include/xatonum.h
+++ b/include/xatonum.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 10PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
diff --git a/include/xregex.h b/include/xregex.h
index 44a2297e6..5e5e6a256 100644
--- a/include/xregex.h
+++ b/include/xregex.h
@@ -4,9 +4,9 @@
4 * C library we're linking against may not support regex.h. 4 * C library we're linking against may not support regex.h.
5 * 5 *
6 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell 6 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
7 * Permission has been granted to redistribute this code under the GPL. 7 * Permission has been granted to redistribute this code under GPL.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11#ifndef BB_REGEX_H 11#ifndef BB_REGEX_H
12#define BB_REGEX_H 1 12#define BB_REGEX_H 1
diff --git a/init/Kbuild.src b/init/Kbuild.src
index 6095a78bb..32dd5a045 100644
--- a/init/Kbuild.src
+++ b/init/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/init/bootchartd.c b/init/bootchartd.c
index 465a34979..f14d5c0fd 100644
--- a/init/bootchartd.c
+++ b/init/bootchartd.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6//config:config BOOTCHARTD 6//config:config BOOTCHARTD
diff --git a/init/halt.c b/init/halt.c
index abd801fda..903953e80 100644
--- a/init/halt.c
+++ b/init/halt.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2006 by Rob Landley <rob@landley.net> 5 * Copyright 2006 by Rob Landley <rob@landley.net>
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/init/init.c b/init/init.c
index fa1af6d7c..5c0d11402 100644
--- a/init/init.c
+++ b/init/init.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * Adjusted by so many folks, it's impossible to keep track. 7 * Adjusted by so many folks, it's impossible to keep track.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/init/mesg.c b/init/mesg.c
index 2e8b16e5d..ef5f0eb66 100644
--- a/init/mesg.c
+++ b/init/mesg.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (c) 2002 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (c) 2002 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index a6a163f3e..4fbf486b5 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7libbb/appletlib.o: include/usage_compressed.h 7libbb/appletlib.o: include/usage_compressed.h
8 8
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index b470f30f9..751000e5d 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -7,9 +7,9 @@
7 * here, please feel free to acknowledge your work. 7 * here, please feel free to acknowledge your work.
8 * 8 *
9 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell 9 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
10 * Permission has been granted to redistribute this code under the GPL. 10 * Permission has been granted to redistribute this code under GPL.
11 * 11 *
12 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13 */ 13 */
14 14
15/* We are trying to not use printf, this benefits the case when selected 15/* We are trying to not use printf, this benefits the case when selected
diff --git a/libbb/ask_confirmation.c b/libbb/ask_confirmation.c
index e0e94195e..d95729cc9 100644
--- a/libbb/ask_confirmation.c
+++ b/libbb/ask_confirmation.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y', 10/* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y',
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c
index 12ebe179e..9a4188f52 100644
--- a/libbb/bb_askpass.c
+++ b/libbb/bb_askpass.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/bb_basename.c b/libbb/bb_basename.c
index cc9b246e3..92fdb6545 100644
--- a/libbb/bb_basename.c
+++ b/libbb/bb_basename.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko 5 * Copyright (C) 2007 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/bb_do_delay.c b/libbb/bb_do_delay.c
index 139dc1878..05c879fb9 100644
--- a/libbb/bb_do_delay.c
+++ b/libbb/bb_do_delay.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 by Tito Ragusa <tito-wolit@tiscali.it> 5 * Copyright (C) 2005 by Tito Ragusa <tito-wolit@tiscali.it>
6 * 6 *
7 * Licensed under the GPL v2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/bb_pwd.c b/libbb/bb_pwd.c
index d72857771..32406cb58 100644
--- a/libbb/bb_pwd.c
+++ b/libbb/bb_pwd.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2008 by Tito Ragusa <farmatito@tiscali.it> 6 * Copyright (C) 2008 by Tito Ragusa <farmatito@tiscali.it>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/bb_qsort.c b/libbb/bb_qsort.c
index 9773afa6e..a54e7236a 100644
--- a/libbb/bb_qsort.c
+++ b/libbb/bb_qsort.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (c) 2008 Denys Vlasenko 5 * Copyright (c) 2008 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/bb_strtod.c b/libbb/bb_strtod.c
index 1e9671029..5dde78414 100644
--- a/libbb/bb_strtod.c
+++ b/libbb/bb_strtod.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/bb_strtonum.c b/libbb/bb_strtonum.c
index 87cd744a7..c66c774f4 100644
--- a/libbb/bb_strtonum.c
+++ b/libbb/bb_strtonum.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/chomp.c b/libbb/chomp.c
index ed4bf6beb..cb92befb1 100644
--- a/libbb/chomp.c
+++ b/libbb/chomp.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c
index 599449fe0..4b10cc138 100644
--- a/libbb/compare_string_array.c
+++ b/libbb/compare_string_array.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/libbb/concat_path_file.c b/libbb/concat_path_file.c
index fb533547e..9ed295996 100644
--- a/libbb/concat_path_file.c
+++ b/libbb/concat_path_file.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* Concatenate path and filename to new allocated buffer. 11/* Concatenate path and filename to new allocated buffer.
diff --git a/libbb/concat_subpath_file.c b/libbb/concat_subpath_file.c
index 313fa63cf..c9167d492 100644
--- a/libbb/concat_subpath_file.c
+++ b/libbb/concat_subpath_file.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> 5 * Copyright (C) (C) 2003 Vladimir Oleynik <dzo@simtreas.ru>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 80a64f791..2134ee046 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2001 by Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * SELinux support by Yuichi Nakamura <ynakam@hitachisoft.jp> 6 * SELinux support by Yuichi Nakamura <ynakam@hitachisoft.jp>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index 82622c06f..eda2747f9 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/crc32.c b/libbb/crc32.c
index 36ac86042..520b1ffb9 100644
--- a/libbb/crc32.c
+++ b/libbb/crc32.c
@@ -13,7 +13,7 @@
13 * endian = 1: big-endian 13 * endian = 1: big-endian
14 * endian = 0: little-endian 14 * endian = 0: little-endian
15 * 15 *
16 * Licensed under GPLv2, see file LICENSE in this tarball for details. 16 * Licensed under GPLv2, see file LICENSE in this source tree.
17 */ 17 */
18 18
19#include "libbb.h" 19#include "libbb.h"
diff --git a/libbb/create_icmp6_socket.c b/libbb/create_icmp6_socket.c
index 91e478ec8..368c69028 100644
--- a/libbb/create_icmp6_socket.c
+++ b/libbb/create_icmp6_socket.c
@@ -5,7 +5,7 @@
5 * create raw socket for icmp (IPv6 version) protocol 5 * create raw socket for icmp (IPv6 version) protocol
6 * and drop root privileges if running setuid 6 * and drop root privileges if running setuid
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/create_icmp_socket.c b/libbb/create_icmp_socket.c
index d75f8452d..585626983 100644
--- a/libbb/create_icmp_socket.c
+++ b/libbb/create_icmp_socket.c
@@ -5,7 +5,7 @@
5 * create raw socket for icmp protocol 5 * create raw socket for icmp protocol
6 * and drop root privileges if running setuid 6 * and drop root privileges if running setuid
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/default_error_retval.c b/libbb/default_error_retval.c
index 0b19f2163..4da5b3efb 100644
--- a/libbb/default_error_retval.c
+++ b/libbb/default_error_retval.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 3 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8/* Seems silly to copyright a global variable. ;-) Oh well. 8/* Seems silly to copyright a global variable. ;-) Oh well.
diff --git a/libbb/device_open.c b/libbb/device_open.c
index cf8bcf646..a8fe2fcb4 100644
--- a/libbb/device_open.c
+++ b/libbb/device_open.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/die_if_bad_username.c b/libbb/die_if_bad_username.c
index 8b4deec29..9946e3a1d 100644
--- a/libbb/die_if_bad_username.c
+++ b/libbb/die_if_bad_username.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Tito Ragusa <farmatito@tiscali.it> 5 * Copyright (C) 2008 Tito Ragusa <farmatito@tiscali.it>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/dump.c b/libbb/dump.c
index 7a87219ba..4db3f06f0 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -6,7 +6,7 @@
6 * Copyright (c) 1989 6 * Copyright (c) 1989
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 * Original copyright notice is retained at the end of this file. 11 * Original copyright notice is retained at the end of this file.
12 */ 12 */
@@ -323,9 +323,7 @@ static void do_skip(priv_dumper_t *dumper, const char *fname, int statok)
323 struct stat sbuf; 323 struct stat sbuf;
324 324
325 if (statok) { 325 if (statok) {
326 if (fstat(STDIN_FILENO, &sbuf)) { 326 xfstat(STDIN_FILENO, &sbuf, fname);
327 bb_simple_perror_msg_and_die(fname);
328 }
329 if (!(S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode) || S_ISFIFO(sbuf.st_mode)) 327 if (!(S_ISCHR(sbuf.st_mode) || S_ISBLK(sbuf.st_mode) || S_ISFIFO(sbuf.st_mode))
330 && dumper->pub.dump_skip >= sbuf.st_size 328 && dumper->pub.dump_skip >= sbuf.st_size
331 ) { 329 ) {
diff --git a/libbb/execable.c b/libbb/execable.c
index de368fad0..3b144a730 100644
--- a/libbb/execable.c
+++ b/libbb/execable.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2006 Gabriel Somlo <somlo at cmu.edu> 5 * Copyright (C) 2006 Gabriel Somlo <somlo at cmu.edu>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/fclose_nonstdin.c b/libbb/fclose_nonstdin.c
index 6f3f37332..5ce9d5b48 100644
--- a/libbb/fclose_nonstdin.c
+++ b/libbb/fclose_nonstdin.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* A number of standard utilities can accept multiple command line args 10/* A number of standard utilities can accept multiple command line args
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c
index 742fb9f58..9ad5dbf96 100644
--- a/libbb/fflush_stdout_and_exit.c
+++ b/libbb/fflush_stdout_and_exit.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Attempt to fflush(stdout), and exit with an error code if stdout is 10/* Attempt to fflush(stdout), and exit with an error code if stdout is
diff --git a/libbb/fgets_str.c b/libbb/fgets_str.c
index 3fe61cdc3..89210a3c9 100644
--- a/libbb/fgets_str.c
+++ b/libbb/fgets_str.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c
index bcb18effe..361698a6b 100644
--- a/libbb/find_mount_point.c
+++ b/libbb/find_mount_point.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c
index 52a0c6dab..db823d05b 100644
--- a/libbb/find_pid_by_name.c
+++ b/libbb/find_pid_by_name.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c
index ca46bf535..32c86cea8 100644
--- a/libbb/find_root_device.c
+++ b/libbb/find_root_device.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/full_write.c b/libbb/full_write.c
index f353b7d55..a2abaee25 100644
--- a/libbb/full_write.c
+++ b/libbb/full_write.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/get_console.c b/libbb/get_console.c
index 74022b543..9b6407bd0 100644
--- a/libbb/get_console.c
+++ b/libbb/get_console.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. If you wrote this, please 5 * Copyright (C) many different people. If you wrote this, please
6 * acknowledge your work. 6 * acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/get_cpu_count.c b/libbb/get_cpu_count.c
index edb7e6d37..ab468afdf 100644
--- a/libbb/get_cpu_count.c
+++ b/libbb/get_cpu_count.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com> 5 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index 7c99116e9..72598d22e 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index cbfb45b7c..a0ed9193f 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2004 Erik Andersen <andersen@codepoet.org> 6 * Copyright (C) 2004 Erik Andersen <andersen@codepoet.org>
7 * Copyright (C) 2001 Matt Krai 7 * Copyright (C) 2001 Matt Krai
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/libbb/get_volsize.c b/libbb/get_volsize.c
index 5b0270968..241ceda9b 100644
--- a/libbb/get_volsize.c
+++ b/libbb/get_volsize.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 Denys Vlasenko 5 * Copyright (C) 2010 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/getopt32.c b/libbb/getopt32.c
index bcb2db645..ab77755fc 100644
--- a/libbb/getopt32.c
+++ b/libbb/getopt32.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003-2005 Vladimir Oleynik <dzo@simtreas.ru> 5 * Copyright (C) 2003-2005 Vladimir Oleynik <dzo@simtreas.ru>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include <getopt.h> 10#include <getopt.h>
diff --git a/libbb/getpty.c b/libbb/getpty.c
index 4bffd9ae6..ea653b0b6 100644
--- a/libbb/getpty.c
+++ b/libbb/getpty.c
@@ -3,7 +3,7 @@
3 * Mini getpty implementation for busybox 3 * Mini getpty implementation for busybox
4 * Bjorn Wesen, Axis Communications AB (bjornw@axis.com) 4 * Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/libbb/herror_msg.c b/libbb/herror_msg.c
index ca9274cf7..d041076e0 100644
--- a/libbb/herror_msg.c
+++ b/libbb/herror_msg.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/human_readable.c b/libbb/human_readable.c
index 4228aaf42..22dc5d23f 100644
--- a/libbb/human_readable.c
+++ b/libbb/human_readable.c
@@ -25,7 +25,7 @@
25 * Some code to omit the decimal point and tenths digit is sketched out 25 * Some code to omit the decimal point and tenths digit is sketched out
26 * and "#if 0"'d below. 26 * and "#if 0"'d below.
27 * 27 *
28 * Licensed under GPLv2, see file LICENSE in this tarball for details. 28 * Licensed under GPLv2, see file LICENSE in this source tree.
29 */ 29 */
30 30
31#include "libbb.h" 31#include "libbb.h"
diff --git a/libbb/inet_common.c b/libbb/inet_common.c
index 0fc08d69d..b47259089 100644
--- a/libbb/inet_common.c
+++ b/libbb/inet_common.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Heavily modified by Manuel Novoa III Mar 12, 2001 6 * Heavily modified by Manuel Novoa III Mar 12, 2001
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/info_msg.c b/libbb/info_msg.c
index 81164faa0..56ca2efd4 100644
--- a/libbb/info_msg.c
+++ b/libbb/info_msg.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/inode_hash.c b/libbb/inode_hash.c
index b32bd26bf..2aea08b04 100644
--- a/libbb/inode_hash.c
+++ b/libbb/inode_hash.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/isdirectory.c b/libbb/isdirectory.c
index 4a2961e0d..9861be6f8 100644
--- a/libbb/isdirectory.c
+++ b/libbb/isdirectory.c
@@ -3,9 +3,9 @@
3 * Utility routines. 3 * Utility routines.
4 * 4 *
5 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell 5 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
6 * Permission has been granted to redistribute this code under the GPL. 6 * Permission has been granted to redistribute this code under GPL.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include <sys/stat.h> 11#include <sys/stat.h>
diff --git a/libbb/kernel_version.c b/libbb/kernel_version.c
index cc237120d..a168a1e4e 100644
--- a/libbb/kernel_version.c
+++ b/libbb/kernel_version.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/last_char_is.c b/libbb/last_char_is.c
index b0592568c..65e6cdf04 100644
--- a/libbb/last_char_is.c
+++ b/libbb/last_char_is.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Larry Doolittle, <ldoolitt@recycle.lbl.gov> 5 * Copyright (C) 2001 Larry Doolittle, <ldoolitt@recycle.lbl.gov>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/lineedit_ptr_hack.c b/libbb/lineedit_ptr_hack.c
index 53716a235..dc45855d5 100644
--- a/libbb/lineedit_ptr_hack.c
+++ b/libbb/lineedit_ptr_hack.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8struct lineedit_statics; 8struct lineedit_statics;
diff --git a/libbb/llist.c b/libbb/llist.c
index 51b1ce6c9..ed84e6472 100644
--- a/libbb/llist.c
+++ b/libbb/llist.c
@@ -7,7 +7,7 @@
7 * Copyright (C) 2005 Bernhard Reutner-Fischer 7 * Copyright (C) 2005 Bernhard Reutner-Fischer
8 * Copyright (C) 2006 Rob Landley <rob@landley.net> 8 * Copyright (C) 2006 Rob Landley <rob@landley.net>
9 * 9 *
10 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/libbb/login.c b/libbb/login.c
index 740c588f3..aa2e17164 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Optimize and correcting OCRNL by Vladimir Oleynik <dzo@simtreas.ru> 7 * Optimize and correcting OCRNL by Vladimir Oleynik <dzo@simtreas.ru>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/libbb/loop.c b/libbb/loop.c
index eb7016d56..b798932fa 100644
--- a/libbb/loop.c
+++ b/libbb/loop.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2005 by Rob Landley <rob@landley.net> 6 * Copyright (C) 2005 by Rob Landley <rob@landley.net>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11#include <linux/version.h> 11#include <linux/version.h>
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index 4bb79bdf6..1095b49a3 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Mar 5, 2003 Manuel Novoa III 10/* Mar 5, 2003 Manuel Novoa III
diff --git a/libbb/makedev.c b/libbb/makedev.c
index ca71fdba6..cf59e616b 100644
--- a/libbb/makedev.c
+++ b/libbb/makedev.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2006 Denys Vlasenko 4 * Copyright (C) 2006 Denys Vlasenko
5 * 5 *
6 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8 8
9/* We do not include libbb.h - #define makedev() is there! */ 9/* We do not include libbb.h - #define makedev() is there! */
diff --git a/libbb/match_fstype.c b/libbb/match_fstype.c
index 9360e757a..83d6e6770 100644
--- a/libbb/match_fstype.c
+++ b/libbb/match_fstype.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Returns 1 for a match, otherwise 0 8 * Returns 1 for a match, otherwise 0
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/libbb/md5.c b/libbb/md5.c
index a98631d0c..d8655ba91 100644
--- a/libbb/md5.c
+++ b/libbb/md5.c
@@ -1,16 +1,16 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * md5.c - Compute MD5 checksum of strings according to the 3 * md5.c - Compute MD5 checksum of strings according to the
4 * definition of MD5 in RFC 1321 from April 1992. 4 * definition of MD5 in RFC 1321 from April 1992.
5 * 5 *
6 * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 6 * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
7 * 7 *
8 * Copyright (C) 1995-1999 Free Software Foundation, Inc. 8 * Copyright (C) 1995-1999 Free Software Foundation, Inc.
9 * Copyright (C) 2001 Manuel Novoa III 9 * Copyright (C) 2001 Manuel Novoa III
10 * Copyright (C) 2003 Glenn L. McGrath 10 * Copyright (C) 2003 Glenn L. McGrath
11 * Copyright (C) 2003 Erik Andersen 11 * Copyright (C) 2003 Erik Andersen
12 * 12 *
13 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16#include "libbb.h" 16#include "libbb.h"
diff --git a/libbb/messages.c b/libbb/messages.c
index ffa8d00cd..0c13449c0 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 3 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/libbb/mode_string.c b/libbb/mode_string.c
index 7d4e514b1..f1afe7d61 100644
--- a/libbb/mode_string.c
+++ b/libbb/mode_string.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Aug 13, 2003 10/* Aug 13, 2003
diff --git a/libbb/mtab.c b/libbb/mtab.c
index 586a66196..22bff6490 100644
--- a/libbb/mtab.c
+++ b/libbb/mtab.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include <mntent.h> 10#include <mntent.h>
diff --git a/libbb/mtab_file.c b/libbb/mtab_file.c
index c9d9a695e..add990ded 100644
--- a/libbb/mtab_file.c
+++ b/libbb/mtab_file.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/obscure.c b/libbb/obscure.c
index 19b87523e..dd8cd319a 100644
--- a/libbb/obscure.c
+++ b/libbb/obscure.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2006 Tito Ragusa <farmatito@tiscali.it> 5 * Copyright (C) 2006 Tito Ragusa <farmatito@tiscali.it>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* A good password: 10/* A good password:
@@ -45,53 +45,59 @@ static int string_checker_helper(const char *p1, const char *p2) __attribute__ (
45 45
46static int string_checker_helper(const char *p1, const char *p2) 46static int string_checker_helper(const char *p1, const char *p2)
47{ 47{
48 /* as-is or capitalized */
49 if (strcasecmp(p1, p2) == 0
50 /* as sub-string */ 48 /* as sub-string */
51 || strcasestr(p2, p1) != NULL 49 if (strcasestr(p2, p1) != NULL
52 /* invert in case haystack is shorter than needle */ 50 /* invert in case haystack is shorter than needle */
53 || strcasestr(p1, p2) != NULL) 51 || strcasestr(p1, p2) != NULL
52 /* as-is or capitalized */
53 /* || strcasecmp(p1, p2) == 0 - 1st strcasestr should catch this too */
54 ) {
54 return 1; 55 return 1;
56 }
55 return 0; 57 return 0;
56} 58}
57 59
58static int string_checker(const char *p1, const char *p2) 60static int string_checker(const char *p1, const char *p2)
59{ 61{
60 int size; 62 int size, i;
61 /* check string */ 63 /* check string */
62 int ret = string_checker_helper(p1, p2); 64 int ret = string_checker_helper(p1, p2);
63 /* Make our own copy */ 65 /* make our own copy */
64 char *p = xstrdup(p1); 66 char *p = xstrdup(p1);
65 /* reverse string */
66 size = strlen(p);
67 67
68 while (size--) { 68 /* reverse string */
69 *p = p1[size]; 69 i = size = strlen(p1);
70 p++; 70 while (--i >= 0) {
71 *p++ = p1[i];
71 } 72 }
72 /* restore pointer */ 73 p -= size; /* restore pointer */
73 p -= strlen(p1); 74
74 /* check reversed string */ 75 /* check reversed string */
75 ret |= string_checker_helper(p, p2); 76 ret |= string_checker_helper(p, p2);
77
76 /* clean up */ 78 /* clean up */
77 memset(p, 0, strlen(p1)); 79 memset(p, 0, size);
78 free(p); 80 free(p);
81
79 return ret; 82 return ret;
80} 83}
81 84
82#define LOWERCASE 1 85#define CATEGORIES 4
83#define UPPERCASE 2 86
84#define NUMBERS 4 87#define LOWERCASE 1
85#define SPECIAL 8 88#define UPPERCASE 2
89#define NUMBERS 4
90#define SPECIAL 8
91
92#define LAST_CAT 8
86 93
87static const char *obscure_msg(const char *old_p, const char *new_p, const struct passwd *pw) 94static const char *obscure_msg(const char *old_p, const char *new_p, const struct passwd *pw)
88{ 95{
89 int i; 96 unsigned length;
90 int c; 97 unsigned size;
91 int length; 98 unsigned mixed;
92 int mixed = 0; 99 unsigned c;
93 /* Add 2 for each type of characters to the minlen of password */ 100 unsigned i;
94 int size = CONFIG_PASSWORD_MINLEN + 8;
95 const char *p; 101 const char *p;
96 char *hostname; 102 char *hostname;
97 103
@@ -104,7 +110,7 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
104 return "similar to username"; 110 return "similar to username";
105 } 111 }
106 /* no gecos as-is, as sub-string, reversed, capitalized, doubled */ 112 /* no gecos as-is, as sub-string, reversed, capitalized, doubled */
107 if (*pw->pw_gecos && string_checker(new_p, pw->pw_gecos)) { 113 if (pw->pw_gecos[0] && string_checker(new_p, pw->pw_gecos)) {
108 return "similar to gecos"; 114 return "similar to gecos";
109 } 115 }
110 /* hostname as-is, as sub-string, reversed, capitalized, doubled */ 116 /* hostname as-is, as sub-string, reversed, capitalized, doubled */
@@ -115,6 +121,7 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
115 return "similar to hostname"; 121 return "similar to hostname";
116 122
117 /* Should / Must contain a mix of: */ 123 /* Should / Must contain a mix of: */
124 mixed = 0;
118 for (i = 0; i < length; i++) { 125 for (i = 0; i < length; i++) {
119 if (islower(new_p[i])) { /* a-z */ 126 if (islower(new_p[i])) { /* a-z */
120 mixed |= LOWERCASE; 127 mixed |= LOWERCASE;
@@ -125,7 +132,7 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
125 } else { /* special characters */ 132 } else { /* special characters */
126 mixed |= SPECIAL; 133 mixed |= SPECIAL;
127 } 134 }
128 /* More than 50% similar characters ? */ 135 /* Count i'th char */
129 c = 0; 136 c = 0;
130 p = new_p; 137 p = new_p;
131 while (1) { 138 while (1) {
@@ -134,26 +141,31 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
134 break; 141 break;
135 } 142 }
136 c++; 143 c++;
137 if (!++p) { 144 p++;
138 break; /* move past the matched char if possible */ 145 if (!*p) {
146 break;
139 } 147 }
140 } 148 }
141 149 /* More than 50% similar characters ? */
142 if (c >= (length / 2)) { 150 if (c*2 >= length) {
143 return "too many similar characters"; 151 return "too many similar characters";
144 } 152 }
145 } 153 }
146 for (i=0; i<4; i++) 154
147 if (mixed & (1<<i)) size -= 2; 155 size = CONFIG_PASSWORD_MINLEN + 2*CATEGORIES;
156 for (i = 1; i <= LAST_CAT; i <<= 1)
157 if (mixed & i)
158 size -= 2;
148 if (length < size) 159 if (length < size)
149 return "too weak"; 160 return "too weak";
150 161
151 if (old_p && old_p[0] != '\0') { 162 if (old_p && old_p[0]) {
152 /* check vs. old password */ 163 /* check vs. old password */
153 if (string_checker(new_p, old_p)) { 164 if (string_checker(new_p, old_p)) {
154 return "similar to old password"; 165 return "similar to old password";
155 } 166 }
156 } 167 }
168
157 return NULL; 169 return NULL;
158} 170}
159 171
diff --git a/libbb/parse_config.c b/libbb/parse_config.c
index b7c3a00e0..3fff9f212 100644
--- a/libbb/parse_config.c
+++ b/libbb/parse_config.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later. 8 * Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later.
9 */ 9 */
10 10
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c
index 6eca00ab1..8ea89163c 100644
--- a/libbb/parse_mode.c
+++ b/libbb/parse_mode.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */ 10/* http://www.opengroup.org/onlinepubs/007904975/utilities/chmod.html */
diff --git a/libbb/perror_msg.c b/libbb/perror_msg.c
index cbba805fb..fa1f0d339 100644
--- a/libbb/perror_msg.c
+++ b/libbb/perror_msg.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/perror_nomsg.c b/libbb/perror_nomsg.c
index a157caa1f..a2a11cc8e 100644
--- a/libbb/perror_nomsg.c
+++ b/libbb/perror_nomsg.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* gcc warns about a null format string, therefore we provide 10/* gcc warns about a null format string, therefore we provide
diff --git a/libbb/perror_nomsg_and_die.c b/libbb/perror_nomsg_and_die.c
index d56e05d32..543ff5178 100644
--- a/libbb/perror_nomsg_and_die.c
+++ b/libbb/perror_nomsg_and_die.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* gcc warns about a null format string, therefore we provide 10/* gcc warns about a null format string, therefore we provide
diff --git a/libbb/pidfile.c b/libbb/pidfile.c
index 7b8fee21c..a48dfc38b 100644
--- a/libbb/pidfile.c
+++ b/libbb/pidfile.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 by Stephane Billiart <stephane.billiart@gmail.com> 5 * Copyright (C) 2007 by Stephane Billiart <stephane.billiart@gmail.com>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Override ENABLE_FEATURE_PIDFILE */ 10/* Override ENABLE_FEATURE_PIDFILE */
diff --git a/libbb/platform.c b/libbb/platform.c
index 67048648f..30d06e3a7 100644
--- a/libbb/platform.c
+++ b/libbb/platform.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 by Dan Fandrich <dan@coneharvesters.com>, et. al. 5 * Copyright (C) 2009 by Dan Fandrich <dan@coneharvesters.com>, et. al.
6 * 6 *
7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/print_flags.c b/libbb/print_flags.c
index 9639dc6f3..eaec731e5 100644
--- a/libbb/print_flags.c
+++ b/libbb/print_flags.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2008 Natanael Copa <natanael.copa@gmail.com> 4 * Copyright (C) 2008 Natanael Copa <natanael.copa@gmail.com>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9 9
diff --git a/libbb/printable.c b/libbb/printable.c
index ae9335932..f6ada4904 100644
--- a/libbb/printable.c
+++ b/libbb/printable.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko 5 * Copyright (C) 2007 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/printable_string.c b/libbb/printable_string.c
index 83a482196..a316f60de 100644
--- a/libbb/printable_string.c
+++ b/libbb/printable_string.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 Denys Vlasenko 5 * Copyright (C) 2010 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "unicode.h" 10#include "unicode.h"
diff --git a/libbb/process_escape_sequence.c b/libbb/process_escape_sequence.c
index 3ad908b57..82cbe10dc 100644
--- a/libbb/process_escape_sequence.c
+++ b/libbb/process_escape_sequence.c
@@ -5,7 +5,7 @@
5 * Copyright (C) Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) Manuel Novoa III <mjn3@codepoet.org>
6 * and Vladimir Oleynik <dzo@simtreas.ru> 6 * and Vladimir Oleynik <dzo@simtreas.ru>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/procps.c b/libbb/procps.c
index 48e60a792..14d4481bd 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2002 by Vladimir Oleynik <dzo@simtreas.ru> 6 * Copyright (C) 2002 by Vladimir Oleynik <dzo@simtreas.ru>
7 * SELinux support: (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp> 7 * SELinux support: (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
@@ -137,12 +137,9 @@ static unsigned long fast_strtoul_16(char **endptr)
137 *endptr = str; /* We skip trailing space! */ 137 *endptr = str; /* We skip trailing space! */
138 return n; 138 return n;
139} 139}
140/* TOPMEM uses fast_strtoul_10, so... */
141# undef ENABLE_FEATURE_FAST_TOP
142# define ENABLE_FEATURE_FAST_TOP 1
143#endif 140#endif
144 141
145#if ENABLE_FEATURE_FAST_TOP 142#if ENABLE_FEATURE_FAST_TOP || ENABLE_FEATURE_TOPMEM || ENABLE_PMAP
146/* We cut a lot of corners here for speed */ 143/* We cut a lot of corners here for speed */
147static unsigned long fast_strtoul_10(char **endptr) 144static unsigned long fast_strtoul_10(char **endptr)
148{ 145{
@@ -177,6 +174,111 @@ static char *skip_fields(char *str, int count)
177} 174}
178#endif 175#endif
179 176
177#if ENABLE_FEATURE_TOPMEM || ENABLE_PMAP
178int FAST_FUNC procps_read_smaps(pid_t pid, struct smaprec *total,
179 void (*cb)(struct smaprec *, void *), void *data)
180{
181 FILE *file;
182 struct smaprec currec;
183 char filename[sizeof("/proc/%u/smaps") + sizeof(int)*3];
184 char buf[PROCPS_BUFSIZE];
185#if !ENABLE_PMAP
186 void (*cb)(struct smaprec *, void *) = NULL;
187 void *data = NULL;
188#endif
189
190 sprintf(filename, "/proc/%u/smaps", (int)pid);
191
192 file = fopen_for_read(filename);
193 if (!file)
194 return 1;
195
196 memset(&currec, 0, sizeof(currec));
197 while (fgets(buf, PROCPS_BUFSIZE, file)) {
198 // Each mapping datum has this form:
199 // f7d29000-f7d39000 rw-s ADR M:m OFS FILE
200 // Size: nnn kB
201 // Rss: nnn kB
202 // .....
203
204 char *tp = buf, *p;
205
206#define SCAN(S, X) \
207 if (strncmp(tp, S, sizeof(S)-1) == 0) { \
208 tp = skip_whitespace(tp + sizeof(S)-1); \
209 total->X += currec.X = fast_strtoul_10(&tp); \
210 continue; \
211 }
212 if (cb) {
213 SCAN("Pss:" , smap_pss );
214 SCAN("Swap:" , smap_swap );
215 }
216 SCAN("Private_Dirty:", private_dirty);
217 SCAN("Private_Clean:", private_clean);
218 SCAN("Shared_Dirty:" , shared_dirty );
219 SCAN("Shared_Clean:" , shared_clean );
220#undef SCAN
221 tp = strchr(buf, '-');
222 if (tp) {
223 // We reached next mapping - the line of this form:
224 // f7d29000-f7d39000 rw-s ADR M:m OFS FILE
225
226 if (cb) {
227 /* If we have a previous record, there's nothing more
228 * for it, call the callback and clear currec
229 */
230 if (currec.smap_size)
231 cb(&currec, data);
232 free(currec.smap_name);
233 }
234 memset(&currec, 0, sizeof(currec));
235
236 *tp = ' ';
237 tp = buf;
238 currec.smap_start = fast_strtoul_16(&tp);
239 currec.smap_size = (fast_strtoul_16(&tp) - currec.smap_start) >> 10;
240
241 strncpy(currec.smap_mode, tp, sizeof(currec.smap_mode)-1);
242
243 // skipping "rw-s ADR M:m OFS "
244 tp = skip_whitespace(skip_fields(tp, 4));
245 // filter out /dev/something (something != zero)
246 if (strncmp(tp, "/dev/", 5) != 0 || strcmp(tp, "/dev/zero\n") == 0) {
247 if (currec.smap_mode[1] == 'w') {
248 currec.mapped_rw = currec.smap_size;
249 total->mapped_rw += currec.smap_size;
250 } else if (currec.smap_mode[1] == '-') {
251 currec.mapped_ro = currec.smap_size;
252 total->mapped_ro += currec.smap_size;
253 }
254 }
255
256 if (strcmp(tp, "[stack]\n") == 0)
257 total->stack += currec.smap_size;
258 if (cb) {
259 p = skip_non_whitespace(tp);
260 if (p == tp) {
261 currec.smap_name = xstrdup(" [ anon ]");
262 } else {
263 *p = '\0';
264 currec.smap_name = xstrdup(tp);
265 }
266 }
267 total->smap_size += currec.smap_size;
268 }
269 }
270 fclose(file);
271
272 if (cb) {
273 if (currec.smap_size)
274 cb(&currec, data);
275 free(currec.smap_name);
276 }
277
278 return 0;
279}
280#endif
281
180void BUG_comm_size(void); 282void BUG_comm_size(void);
181procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags) 283procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
182{ 284{
@@ -365,54 +467,8 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
365 } 467 }
366 468
367#if ENABLE_FEATURE_TOPMEM 469#if ENABLE_FEATURE_TOPMEM
368 if (flags & (PSSCAN_SMAPS)) { 470 if (flags & PSSCAN_SMAPS)
369 FILE *file; 471 procps_read_smaps(pid, &sp->smaps, NULL, NULL);
370
371 strcpy(filename_tail, "smaps");
372 file = fopen_for_read(filename);
373 if (file) {
374 while (fgets(buf, sizeof(buf), file)) {
375 unsigned long sz;
376 char *tp;
377 char w;
378#define SCAN(str, name) \
379 if (strncmp(buf, str, sizeof(str)-1) == 0) { \
380 tp = skip_whitespace(buf + sizeof(str)-1); \
381 sp->name += fast_strtoul_10(&tp); \
382 continue; \
383 }
384 SCAN("Shared_Clean:" , shared_clean );
385 SCAN("Shared_Dirty:" , shared_dirty );
386 SCAN("Private_Clean:", private_clean);
387 SCAN("Private_Dirty:", private_dirty);
388#undef SCAN
389 // f7d29000-f7d39000 rw-s ADR M:m OFS FILE
390 tp = strchr(buf, '-');
391 if (tp) {
392 *tp = ' ';
393 tp = buf;
394 sz = fast_strtoul_16(&tp); /* start */
395 sz = (fast_strtoul_16(&tp) - sz) >> 10; /* end - start */
396 // tp -> "rw-s" string
397 w = tp[1];
398 // skipping "rw-s ADR M:m OFS "
399 tp = skip_whitespace(skip_fields(tp, 4));
400 // filter out /dev/something (something != zero)
401 if (strncmp(tp, "/dev/", 5) != 0 || strcmp(tp, "/dev/zero\n") == 0) {
402 if (w == 'w') {
403 sp->mapped_rw += sz;
404 } else if (w == '-') {
405 sp->mapped_ro += sz;
406 }
407 }
408//else printf("DROPPING %s (%s)\n", buf, tp);
409 if (strcmp(tp, "[stack]\n") == 0)
410 sp->stack += sz;
411 }
412 }
413 fclose(file);
414 }
415 }
416#endif /* TOPMEM */ 472#endif /* TOPMEM */
417#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS 473#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS
418 if (flags & PSSCAN_RUIDGID) { 474 if (flags & PSSCAN_RUIDGID) {
diff --git a/libbb/ptr_to_globals.c b/libbb/ptr_to_globals.c
index 5f30e2a64..1074538f3 100644
--- a/libbb/ptr_to_globals.c
+++ b/libbb/ptr_to_globals.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include <errno.h> 8#include <errno.h>
diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c
index 6fc0ba87c..c6c04d44a 100644
--- a/libbb/pw_encrypt.c
+++ b/libbb/pw_encrypt.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/read.c b/libbb/read.c
index 1ed7c5f92..5906bc225 100644
--- a/libbb/read.c
+++ b/libbb/read.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/read_key.c b/libbb/read_key.c
index 64557ab14..840325c99 100644
--- a/libbb/read_key.c
+++ b/libbb/read_key.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2008 Rob Landley <rob@landley.net> 5 * Copyright (C) 2008 Rob Landley <rob@landley.net>
6 * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com> 6 * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
7 * 7 *
8 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
diff --git a/libbb/read_printf.c b/libbb/read_printf.c
index 1b215f97a..7ca3d68c3 100644
--- a/libbb/read_printf.c
+++ b/libbb/read_printf.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c
index 57262cd43..b5cf7c0ab 100644
--- a/libbb/recursive_action.c
+++ b/libbb/recursive_action.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/remove_file.c b/libbb/remove_file.c
index da1488544..c6531a0b9 100644
--- a/libbb/remove_file.c
+++ b/libbb/remove_file.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu> 5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/rtc.c b/libbb/rtc.c
index 97d18ed53..97455e86a 100644
--- a/libbb/rtc.c
+++ b/libbb/rtc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Common RTC functions 2 * Common RTC functions
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6 6
7#include "libbb.h" 7#include "libbb.h"
diff --git a/libbb/safe_gethostname.c b/libbb/safe_gethostname.c
index 05e095448..bdb989631 100644
--- a/libbb/safe_gethostname.c
+++ b/libbb/safe_gethostname.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Tito Ragusa <farmatito@tiscali.it> 5 * Copyright (C) 2008 Tito Ragusa <farmatito@tiscali.it>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/libbb/safe_poll.c b/libbb/safe_poll.c
index 58c7bda5a..b492a8151 100644
--- a/libbb/safe_poll.c
+++ b/libbb/safe_poll.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 by Denys Vlasenko <vda.linux@googlemail.com> 5 * Copyright (C) 2007 by Denys Vlasenko <vda.linux@googlemail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/safe_strncpy.c b/libbb/safe_strncpy.c
index 4acd9766b..8eb6a014f 100644
--- a/libbb/safe_strncpy.c
+++ b/libbb/safe_strncpy.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/safe_write.c b/libbb/safe_write.c
index e3561f3cf..8f7628016 100644
--- a/libbb/safe_write.c
+++ b/libbb/safe_write.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/selinux_common.c b/libbb/selinux_common.c
index 2acb50e96..62910e285 100644
--- a/libbb/selinux_common.c
+++ b/libbb/selinux_common.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2007 KaiGai Kohei <kaigai@kaigai.gr.jp> 5 * Copyright 2007 KaiGai Kohei <kaigai@kaigai.gr.jp>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include <selinux/context.h> 10#include <selinux/context.h>
diff --git a/libbb/sha1.c b/libbb/sha1.c
index 5f42532cd..beeb70cf6 100644
--- a/libbb/sha1.c
+++ b/libbb/sha1.c
@@ -7,7 +7,7 @@
7 * Copyright (C) 2003 Glenn L. McGrath 7 * Copyright (C) 2003 Glenn L. McGrath
8 * Copyright (C) 2003 Erik Andersen 8 * Copyright (C) 2003 Erik Andersen
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 * 11 *
12 * --------------------------------------------------------------------------- 12 * ---------------------------------------------------------------------------
13 * Issue Date: 10/11/2002 13 * Issue Date: 10/11/2002
diff --git a/libbb/signals.c b/libbb/signals.c
index a528756ff..cdc37b1ef 100644
--- a/libbb/signals.c
+++ b/libbb/signals.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2006 Rob Landley 6 * Copyright (C) 2006 Rob Landley
7 * Copyright (C) 2006 Denys Vlasenko 7 * Copyright (C) 2006 Denys Vlasenko
8 * 8 *
9 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/libbb/simplify_path.c b/libbb/simplify_path.c
index f80e3e8a5..3818d32be 100644
--- a/libbb/simplify_path.c
+++ b/libbb/simplify_path.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/single_argv.c b/libbb/single_argv.c
index 6173c884e..85137b40f 100644
--- a/libbb/single_argv.c
+++ b/libbb/single_argv.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Denys Vlasenko 5 * Copyright (C) 2009 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/skip_whitespace.c b/libbb/skip_whitespace.c
index f5a61a3cf..8c7b674c3 100644
--- a/libbb/skip_whitespace.c
+++ b/libbb/skip_whitespace.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/speed_table.c b/libbb/speed_table.c
index af676e1eb..6f95c54e6 100644
--- a/libbb/speed_table.c
+++ b/libbb/speed_table.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/str_tolower.c b/libbb/str_tolower.c
index f402e8e6f..c2d563798 100644
--- a/libbb/str_tolower.c
+++ b/libbb/str_tolower.c
@@ -1,7 +1,7 @@
1/* vi set: sw=4 ts=4: */ 1/* vi set: sw=4 ts=4: */
2/* Convert string str to lowercase, return str. 2/* Convert string str to lowercase, return str.
3 * 3 *
4 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 */ 5 */
6#include "libbb.h" 6#include "libbb.h"
7 7
diff --git a/libbb/strrstr.c b/libbb/strrstr.c
index d201f5172..d8823fc51 100644
--- a/libbb/strrstr.c
+++ b/libbb/strrstr.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Bernhard Reutner-Fischer 5 * Copyright (C) 2008 Bernhard Reutner-Fischer
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#ifdef __DO_STRRSTR_TEST 10#ifdef __DO_STRRSTR_TEST
diff --git a/libbb/time.c b/libbb/time.c
index 8d176e52e..2a74d34c2 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko 5 * Copyright (C) 2007 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/trim.c b/libbb/trim.c
index df00b846e..16cb4fbb0 100644
--- a/libbb/trim.c
+++ b/libbb/trim.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index 915eea579..9263859f5 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2006 Rob Landley <rob@landley.net> 5 * Copyright 2006 Rob Landley <rob@landley.net>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/udp_io.c b/libbb/udp_io.c
index 24237be99..b8fb6755d 100644
--- a/libbb/udp_io.c
+++ b/libbb/udp_io.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko 5 * Copyright (C) 2007 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/unicode.c b/libbb/unicode.c
index d6fcf7a43..c4b5f86ee 100644
--- a/libbb/unicode.c
+++ b/libbb/unicode.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Denys Vlasenko 5 * Copyright (C) 2009 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "unicode.h" 10#include "unicode.h"
diff --git a/libbb/update_passwd.c b/libbb/update_passwd.c
index f5ce1f955..a2be0f155 100644
--- a/libbb/update_passwd.c
+++ b/libbb/update_passwd.c
@@ -11,7 +11,7 @@
11 * Modified to be able to add or delete users, groups and users to/from groups 11 * Modified to be able to add or delete users, groups and users to/from groups
12 * by Tito Ragusa <farmatito@tiscali.it> 12 * by Tito Ragusa <farmatito@tiscali.it>
13 * 13 *
14 * Licensed under GPLv2, see file LICENSE in this tarball for details. 14 * Licensed under GPLv2, see file LICENSE in this source tree.
15 */ 15 */
16#include "libbb.h" 16#include "libbb.h"
17 17
@@ -133,7 +133,7 @@ int FAST_FUNC update_passwd(const char *filename,
133 goto close_old_fp; 133 goto close_old_fp;
134 134
135 created: 135 created:
136 if (!fstat(old_fd, &sb)) { 136 if (fstat(old_fd, &sb) == 0) {
137 fchmod(new_fd, sb.st_mode & 0777); /* ignore errors */ 137 fchmod(new_fd, sb.st_mode & 0777); /* ignore errors */
138 fchown(new_fd, sb.st_uid, sb.st_gid); 138 fchown(new_fd, sb.st_uid, sb.st_gid);
139 } 139 }
diff --git a/libbb/utmp.c b/libbb/utmp.c
index 68c358e9a..2bf9c11f2 100644
--- a/libbb/utmp.c
+++ b/libbb/utmp.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 Denys Vlasenko 5 * Copyright (C) 2010 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include <utmp.h> 10#include <utmp.h>
diff --git a/libbb/uuencode.c b/libbb/uuencode.c
index 67d98d598..181f49de0 100644
--- a/libbb/uuencode.c
+++ b/libbb/uuencode.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright 2006 Rob Landley <rob@landley.net> 3 * Copyright 2006 Rob Landley <rob@landley.net>
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/libbb/vdprintf.c b/libbb/vdprintf.c
index 09fffbca8..feeb403a0 100644
--- a/libbb/vdprintf.c
+++ b/libbb/vdprintf.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/verror_msg.c b/libbb/verror_msg.c
index c5fbc380c..ee95be3e3 100644
--- a/libbb/verror_msg.c
+++ b/libbb/verror_msg.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#if ENABLE_FEATURE_SYSLOG 10#if ENABLE_FEATURE_SYSLOG
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 2b6ee9e74..1fbb1bba9 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -12,7 +12,7 @@
12 * 12 *
13 * Modified for uClibc by Erik Andersen <andersee@debian.org> 13 * Modified for uClibc by Erik Andersen <andersee@debian.org>
14 * 14 *
15 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 15 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
16 */ 16 */
17 17
18#include "busybox.h" /* uses applet tables */ 18#include "busybox.h" /* uses applet tables */
diff --git a/libbb/warn_ignoring_args.c b/libbb/warn_ignoring_args.c
index fa33c258f..3f3025c03 100644
--- a/libbb/warn_ignoring_args.c
+++ b/libbb/warn_ignoring_args.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/wfopen.c b/libbb/wfopen.c
index deec79a28..76dc8b82a 100644
--- a/libbb/wfopen.c
+++ b/libbb/wfopen.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/wfopen_input.c b/libbb/wfopen_input.c
index 46ff7a6de..422a58ecf 100644
--- a/libbb/wfopen_input.c
+++ b/libbb/wfopen_input.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* A number of applets need to open a file for reading, where the filename 10/* A number of applets need to open a file for reading, where the filename
@@ -46,3 +46,11 @@ int FAST_FUNC open_or_warn_stdin(const char *filename)
46 46
47 return fd; 47 return fd;
48} 48}
49
50int FAST_FUNC xopen_stdin(const char *filename)
51{
52 int fd = open_or_warn_stdin(filename);
53 if (fd >= 0)
54 return fd;
55 xfunc_die(); /* We already output an error message. */
56}
diff --git a/libbb/write.c b/libbb/write.c
index 116e4d153..2d67a7281 100644
--- a/libbb/write.c
+++ b/libbb/write.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Bernhard Reutner-Fischer 5 * Copyright (C) 2008 Bernhard Reutner-Fischer
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/xatonum.c b/libbb/xatonum.c
index 60b65f525..62bbe53e7 100644
--- a/libbb/xatonum.c
+++ b/libbb/xatonum.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/xatonum_template.c b/libbb/xatonum_template.c
index c97a4b795..f67b50710 100644
--- a/libbb/xatonum_template.c
+++ b/libbb/xatonum_template.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * 2 *
3 * Licensed under GPLv2, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5/* 5/*
6You need to define the following (example): 6You need to define the following (example):
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index 2de6de7c5..3a6585caa 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Connect to host at port using address resolution from getaddrinfo 5 * Connect to host at port using address resolution from getaddrinfo
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include <sys/types.h> 10#include <sys/types.h>
diff --git a/libbb/xfunc_die.c b/libbb/xfunc_die.c
index ba9fe935a..204e5e49d 100644
--- a/libbb/xfunc_die.c
+++ b/libbb/xfunc_die.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> 5 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Keeping it separate allows to NOT suck in stdio for VERY small applets. 10/* Keeping it separate allows to NOT suck in stdio for VERY small applets.
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 275dd4b62..07504b75b 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2006 Rob Landley 6 * Copyright (C) 2006 Rob Landley
7 * Copyright (C) 2006 Denys Vlasenko 7 * Copyright (C) 2006 Denys Vlasenko
8 * 8 *
9 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11 11
12/* We need to have separate xfuncs.c and xfuncs_printf.c because 12/* We need to have separate xfuncs.c and xfuncs_printf.c because
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 31a6d8e3c..ae950f94f 100644
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2006 Rob Landley 6 * Copyright (C) 2006 Rob Landley
7 * Copyright (C) 2006 Denys Vlasenko 7 * Copyright (C) 2006 Denys Vlasenko
8 * 8 *
9 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11 11
12/* We need to have separate xfuncs.c and xfuncs_printf.c because 12/* We need to have separate xfuncs.c and xfuncs_printf.c because
@@ -450,6 +450,16 @@ void FAST_FUNC xstat(const char *name, struct stat *stat_buf)
450 bb_perror_msg_and_die("can't stat '%s'", name); 450 bb_perror_msg_and_die("can't stat '%s'", name);
451} 451}
452 452
453void FAST_FUNC xfstat(int fd, struct stat *stat_buf, const char *errmsg)
454{
455 /* errmsg is usually a file name, but not always:
456 * xfstat may be called in a spot where file name is no longer
457 * available, and caller may give e.g. "can't stat input file" string.
458 */
459 if (fstat(fd, stat_buf))
460 bb_simple_perror_msg_and_die(errmsg);
461}
462
453// selinux_or_die() - die if SELinux is disabled. 463// selinux_or_die() - die if SELinux is disabled.
454void FAST_FUNC selinux_or_die(void) 464void FAST_FUNC selinux_or_die(void)
455{ 465{
diff --git a/libbb/xgetcwd.c b/libbb/xgetcwd.c
index 10febe32d..97367217e 100644
--- a/libbb/xgetcwd.c
+++ b/libbb/xgetcwd.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Special function for busybox written by Vladimir Oleynik <dzo@simtreas.ru> 7 * Special function for busybox written by Vladimir Oleynik <dzo@simtreas.ru>
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/libbb/xgethostbyname.c b/libbb/xgethostbyname.c
index 7afa9b696..89d0329cc 100644
--- a/libbb/xgethostbyname.c
+++ b/libbb/xgethostbyname.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>. 5 * Copyright (C) 2001 Matt Kraai <kraai@alumni.carnegiemellon.edu>.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/libbb/xreadlink.c b/libbb/xreadlink.c
index 1a012456f..f2faa6d7a 100644
--- a/libbb/xreadlink.c
+++ b/libbb/xreadlink.c
@@ -3,7 +3,7 @@
3 * xreadlink.c - safe implementation of readlink. 3 * xreadlink.c - safe implementation of readlink.
4 * Returns a NULL on failure... 4 * Returns a NULL on failure...
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/libbb/xrealloc_vector.c b/libbb/xrealloc_vector.c
index 98fa9678e..e8d31b7e4 100644
--- a/libbb/xrealloc_vector.c
+++ b/libbb/xrealloc_vector.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Denys Vlasenko 5 * Copyright (C) 2008 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/libbb/xregcomp.c b/libbb/xregcomp.c
index 61efb5bc6..344028f44 100644
--- a/libbb/xregcomp.c
+++ b/libbb/xregcomp.c
@@ -5,7 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/libpwdgrp/Kbuild.src b/libpwdgrp/Kbuild.src
index f9f1ddbf3..d15e3a2d1 100644
--- a/libpwdgrp/Kbuild.src
+++ b/libpwdgrp/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y := uidgid_get.o 7lib-y := uidgid_get.o
8 8
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index 34690a738..06f3607a0 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -1,21 +1,20 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Copyright (C) 2003 Manuel Novoa III 2/* Copyright (C) 2003 Manuel Novoa III
3 * 3 *
4 * Licensed under GPL v2, or later. See file LICENSE in this tarball. 4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 */ 5 */
6 6
7/* Nov 6, 2003 Initial version. 7/* Nov 6, 2003 Initial version.
8 * 8 *
9 * NOTE: This implementation is quite strict about requiring all 9 * NOTE: This implementation is quite strict about requiring all
10 * field seperators. It also does not allow leading whitespace 10 * field seperators. It also does not allow leading whitespace
11 * except when processing the numeric fields. glibc is more 11 * except when processing the numeric fields. glibc is more
12 * lenient. See the various glibc difference comments below. 12 * lenient. See the various glibc difference comments below.
13 * 13 *
14 * TODO: 14 * TODO:
15 * Move to dynamic allocation of (currently statically allocated) 15 * Move to dynamic allocation of (currently statically allocated)
16 * buffers; especially for the group-related functions since 16 * buffers; especially for the group-related functions since
17 * large group member lists will cause error returns. 17 * large group member lists will cause error returns.
18 *
19 */ 18 */
20 19
21#include "libbb.h" 20#include "libbb.h"
diff --git a/libpwdgrp/pwd_grp_internal.c b/libpwdgrp/pwd_grp_internal.c
index ffdc85e4e..04e436fae 100644
--- a/libpwdgrp/pwd_grp_internal.c
+++ b/libpwdgrp/pwd_grp_internal.c
@@ -1,21 +1,20 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Copyright (C) 2003 Manuel Novoa III 2/* Copyright (C) 2003 Manuel Novoa III
3 * 3 *
4 * Licensed under GPL v2, or later. See file LICENSE in this tarball. 4 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 */ 5 */
6 6
7/* Nov 6, 2003 Initial version. 7/* Nov 6, 2003 Initial version.
8 * 8 *
9 * NOTE: This implementation is quite strict about requiring all 9 * NOTE: This implementation is quite strict about requiring all
10 * field seperators. It also does not allow leading whitespace 10 * field seperators. It also does not allow leading whitespace
11 * except when processing the numeric fields. glibc is more 11 * except when processing the numeric fields. glibc is more
12 * lenient. See the various glibc difference comments below. 12 * lenient. See the various glibc difference comments below.
13 * 13 *
14 * TODO: 14 * TODO:
15 * Move to dynamic allocation of (currently statically allocated) 15 * Move to dynamic allocation of (currently statically allocated)
16 * buffers; especially for the group-related functions since 16 * buffers; especially for the group-related functions since
17 * large group member lists will cause error returns. 17 * large group member lists will cause error returns.
18 *
19 */ 18 */
20 19
21#ifndef GETXXKEY_R_FUNC 20#ifndef GETXXKEY_R_FUNC
diff --git a/loginutils/Kbuild.src b/loginutils/Kbuild.src
index fd1ea06c1..ef416a76f 100644
--- a/loginutils/Kbuild.src
+++ b/loginutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index 78ca22585..5a0714501 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> 6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * Copyright (C) 2007 by Tito Ragusa <farmatito@tiscali.it> 7 * Copyright (C) 2007 by Tito Ragusa <farmatito@tiscali.it>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index f5dca929f..1a9949e97 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999 by Lineo, inc. and John Beppu 5 * Copyright (C) 1999 by Lineo, inc. and John Beppu
6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> 6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index 181723169..101920c03 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -3,7 +3,7 @@
3 * chpasswd.c 3 * chpasswd.c
4 * 4 *
5 * Written for SLIND (from passwd.c) by Alexander Shishkin <virtuoso@slind.org> 5 * Written for SLIND (from passwd.c) by Alexander Shishkin <virtuoso@slind.org>
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9 9
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index b44993f06..f32cbceb9 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -2,12 +2,12 @@
2/* 2/*
3 * cryptpw.c - output a crypt(3)ed password to stdout. 3 * cryptpw.c - output a crypt(3)ed password to stdout.
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Cooked from passwd.c by Thomas Lundquist <thomasez@zelow.no> 7 * Cooked from passwd.c by Thomas Lundquist <thomasez@zelow.no>
8 * mkpasswd compatible options added by Bernhard Reutner-Fischer 8 * mkpasswd compatible options added by Bernhard Reutner-Fischer
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index 293e324b0..e234d6678 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org> 6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * Copyright (C) 2007 by Tito Ragusa <farmatito@tiscali.it> 7 * Copyright (C) 2007 by Tito Ragusa <farmatito@tiscali.it>
8 * 8 *
9 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 * 10 *
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 7f04d33fb..b1cd235fb 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -12,7 +12,7 @@
12 * 1999-05-05 Thorsten Kranzkowski <dl8bcu@gmx.net> 12 * 1999-05-05 Thorsten Kranzkowski <dl8bcu@gmx.net>
13 * - enable hardware flow control before displaying /etc/issue 13 * - enable hardware flow control before displaying /etc/issue
14 * 14 *
15 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 15 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
16 */ 16 */
17 17
18#include "libbb.h" 18#include "libbb.h"
@@ -216,9 +216,7 @@ static void parse_args(char **argv, struct options *op, char **fakehost_p)
216 ts = argv[0]; /* baud rate(s) */ 216 ts = argv[0]; /* baud rate(s) */
217 } 217 }
218 parse_speeds(op, ts); 218 parse_speeds(op, ts);
219 219 applet_name = xasprintf("getty: %s", op->tty);
220// TODO: if applet_name is set to "getty: TTY", bb_error_msg's get simpler!
221// grep for "%s:"
222 220
223 if (argv[2]) 221 if (argv[2])
224 xsetenv("TERM", argv[2]); 222 xsetenv("TERM", argv[2]);
@@ -240,7 +238,7 @@ static void open_tty(const char *tty)
240// xchdir("/dev"); 238// xchdir("/dev");
241// xstat(tty, &st); 239// xstat(tty, &st);
242// if (!S_ISCHR(st.st_mode)) 240// if (!S_ISCHR(st.st_mode))
243// bb_error_msg_and_die("%s: not a character device", tty); 241// bb_error_msg_and_die("not a character device");
244 242
245 if (tty[0] != '/') 243 if (tty[0] != '/')
246 tty = xasprintf("/dev/%s", tty); /* will leak it */ 244 tty = xasprintf("/dev/%s", tty); /* will leak it */
@@ -434,7 +432,7 @@ static char *get_logname(char *logname, unsigned size_logname,
434 if (read(STDIN_FILENO, &c, 1) < 1) { 432 if (read(STDIN_FILENO, &c, 1) < 1) {
435 if (errno == EINTR || errno == EIO) 433 if (errno == EINTR || errno == EIO)
436 exit(EXIT_SUCCESS); 434 exit(EXIT_SUCCESS);
437 bb_perror_msg_and_die("%s: read", op->tty); 435 bb_perror_msg_and_die(bb_msg_read_error);
438 } 436 }
439 437
440 /* BREAK. If we have speeds to try, 438 /* BREAK. If we have speeds to try,
@@ -490,7 +488,7 @@ static char *get_logname(char *logname, unsigned size_logname,
490 if (ascval < ' ') { 488 if (ascval < ' ') {
491 /* ignore garbage characters */ 489 /* ignore garbage characters */
492 } else if ((int)(bp - logname) >= size_logname - 1) { 490 } else if ((int)(bp - logname) >= size_logname - 1) {
493 bb_error_msg_and_die("%s: input overrun", op->tty); 491 bb_error_msg_and_die("input overrun");
494 } else { 492 } else {
495 full_write(STDOUT_FILENO, &c, 1); /* echo the character */ 493 full_write(STDOUT_FILENO, &c, 1); /* echo the character */
496 *bp++ = ascval; /* and store it */ 494 *bp++ = ascval; /* and store it */
@@ -574,7 +572,7 @@ static void termios_final(struct options *op, struct termios *tp, struct chardat
574 572
575 /* Finally, make the new settings effective */ 573 /* Finally, make the new settings effective */
576 if (tcsetattr_stdin_TCSANOW(tp) < 0) 574 if (tcsetattr_stdin_TCSANOW(tp) < 0)
577 bb_perror_msg_and_die("%s: tcsetattr", op->tty); 575 bb_perror_msg_and_die("tcsetattr");
578} 576}
579 577
580int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 578int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -652,7 +650,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
652 * 5 seconds seems to be a good value. 650 * 5 seconds seems to be a good value.
653 */ 651 */
654 if (tcgetattr(0, &termios) < 0) 652 if (tcgetattr(0, &termios) < 0)
655 bb_perror_msg_and_die("%s: tcgetattr", options.tty); 653 bb_perror_msg_and_die("tcgetattr");
656 654
657 pid = getpid(); 655 pid = getpid();
658#ifdef __linux__ 656#ifdef __linux__
@@ -733,5 +731,5 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
733 * and getty is not suid-root applet. */ 731 * and getty is not suid-root applet. */
734 /* With -n, logname == NULL, and login will ask for username instead */ 732 /* With -n, logname == NULL, and login will ask for username instead */
735 BB_EXECLP(options.login, options.login, "--", logname, NULL); 733 BB_EXECLP(options.login, options.login, "--", logname, NULL);
736 bb_error_msg_and_die("%s: can't exec %s", options.tty, options.login); 734 bb_error_msg_and_die("can't execute '%s'", options.login);
737} 735}
diff --git a/loginutils/login.c b/loginutils/login.c
index 10012486f..e104fbb93 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5#include "libbb.h" 5#include "libbb.h"
6#include <syslog.h> 6#include <syslog.h>
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index b447af2f5..728e61867 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5#include "libbb.h" 5#include "libbb.h"
6#include <syslog.h> 6#include <syslog.h>
diff --git a/loginutils/su.c b/loginutils/su.c
index 9bae37551..5bec4bc8b 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Mini su implementation for busybox 3 * Mini su implementation for busybox
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index 3516013f1..307536721 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Mini sulogin implementation for busybox 3 * Mini sulogin implementation for busybox
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/loginutils/vlock.c b/loginutils/vlock.c
index 59aeb54e8..216b317f1 100644
--- a/loginutils/vlock.c
+++ b/loginutils/vlock.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2000 by spoon <spoon@ix.netcom.com> 5 * Copyright (C) 2000 by spoon <spoon@ix.netcom.com>
6 * Written by spoon <spon@ix.netcom.com> 6 * Written by spoon <spon@ix.netcom.com>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* Shoutz to Michael K. Johnson <johnsonm@redhat.com>, author of the 11/* Shoutz to Michael K. Johnson <johnsonm@redhat.com>, author of the
diff --git a/mailutils/Kbuild.src b/mailutils/Kbuild.src
index b2fb73515..20220dac8 100644
--- a/mailutils/Kbuild.src
+++ b/mailutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/mailutils/mail.c b/mailutils/mail.c
index bcd358302..8e52a3efc 100644
--- a/mailutils/mail.c
+++ b/mailutils/mail.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "mail.h" 10#include "mail.h"
diff --git a/mailutils/mime.c b/mailutils/mime.c
index 5eb8ef6f2..44c7d0216 100644
--- a/mailutils/mime.c
+++ b/mailutils/mime.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11#include "mail.h" 11#include "mail.h"
diff --git a/mailutils/popmaildir.c b/mailutils/popmaildir.c
index ab9ddbaed..f37db03d5 100644
--- a/mailutils/popmaildir.c
+++ b/mailutils/popmaildir.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 8 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13#include "mail.h" 13#include "mail.h"
diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c
index 4b58a78eb..59591ee4b 100644
--- a/mailutils/sendmail.c
+++ b/mailutils/sendmail.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "mail.h" 10#include "mail.h"
diff --git a/miscutils/Config.src b/miscutils/Config.src
index cadaabb65..151f61bcc 100644
--- a/miscutils/Config.src
+++ b/miscutils/Config.src
@@ -22,6 +22,20 @@ config BBCONFIG
22 The bbconfig applet will print the config file with which 22 The bbconfig applet will print the config file with which
23 busybox was built. 23 busybox was built.
24 24
25config FEATURE_COMPRESS_BBCONFIG
26 bool "Compress bbconfig data"
27 default y
28 depends on BBCONFIG
29 help
30 Store bbconfig data in compressed form, uncompress them on-the-fly
31 before output.
32
33 If you have a really tiny busybox with few applets enabled (and
34 bunzip2 isn't one of them), the overhead of the decompressor might
35 be noticeable. Also, if you run executables directly from ROM
36 and have very little memory, this might not be a win. Otherwise,
37 you probably want this.
38
25config BEEP 39config BEEP
26 bool "beep" 40 bool "beep"
27 default y 41 default y
diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src
index d9bf14312..8c498643b 100644
--- a/miscutils/Kbuild.src
+++ b/miscutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index a6f323ba2..8e8ff8c0a 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * busyboxed 20 March 2001, Larry Doolittle <ldoolitt@recycle.lbl.gov> 9 * busyboxed 20 March 2001, Larry Doolittle <ldoolitt@recycle.lbl.gov>
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13 13
14#include "libbb.h" 14#include "libbb.h"
diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c
index 0d649b4e5..286077168 100644
--- a/miscutils/bbconfig.c
+++ b/miscutils/bbconfig.c
@@ -3,10 +3,32 @@
3 */ 3 */
4#include "libbb.h" 4#include "libbb.h"
5#include "bbconfigopts.h" 5#include "bbconfigopts.h"
6#if ENABLE_FEATURE_COMPRESS_BBCONFIG
7# include "unarchive.h"
8# include "bbconfigopts_bz2.h"
9#endif
6 10
7int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 11int bbconfig_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
8int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 12int bbconfig_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
9{ 13{
14#if ENABLE_FEATURE_COMPRESS_BBCONFIG
15 bunzip_data *bd;
16 int i = start_bunzip(&bd,
17 /* src_fd: */ -1,
18 /* inbuf: */ (void *)bbconfig_config_bz2,
19 /* len: */ sizeof(bbconfig_config_bz2));
20 /* read_bunzip can longjmp to start_bunzip, and ultimately
21 * end up here with i != 0 on read data errors! Not trivial */
22 if (!i) {
23 /* Cannot use xmalloc: will leak bd in NOFORK case! */
24 char *outbuf = malloc_or_warn(sizeof(bbconfig_config));
25 if (outbuf) {
26 read_bunzip(bd, outbuf, sizeof(bbconfig_config));
27 full_write1_str(outbuf);
28 }
29 }
30#else
10 full_write1_str(bbconfig_config); 31 full_write1_str(bbconfig_config);
32#endif
11 return 0; 33 return 0;
12} 34}
diff --git a/miscutils/beep.c b/miscutils/beep.c
index b0ee7ea25..013a72543 100644
--- a/miscutils/beep.c
+++ b/miscutils/beep.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Bernhard Reutner-Fischer 5 * Copyright (C) 2009 Bernhard Reutner-Fischer
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
diff --git a/miscutils/chat.c b/miscutils/chat.c
index 3ffd7b228..2040c3f6a 100644
--- a/miscutils/chat.c
+++ b/miscutils/chat.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index d5f87c4d7..c40277b39 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -3,7 +3,7 @@
3 * chrt - manipulate real-time attributes of a process 3 * chrt - manipulate real-time attributes of a process
4 * Copyright (c) 2006-2007 Bernhard Reutner-Fischer 4 * Copyright (c) 2006-2007 Bernhard Reutner-Fischer
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8#include <sched.h> 8#include <sched.h>
9#include "libbb.h" 9#include "libbb.h"
diff --git a/miscutils/conspy.c b/miscutils/conspy.c
index 02b13e9c8..01928b35f 100644
--- a/miscutils/conspy.c
+++ b/miscutils/conspy.c
@@ -7,7 +7,7 @@
7 * Based on Russell Stuart's conspy.c 7 * Based on Russell Stuart's conspy.c
8 * http://ace-host.stuart.id.au/russell/files/conspy.c 8 * http://ace-host.stuart.id.au/russell/files/conspy.c
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13//applet:IF_CONSPY(APPLET(conspy, _BB_DIR_BIN, _BB_SUID_DROP)) 13//applet:IF_CONSPY(APPLET(conspy, _BB_DIR_BIN, _BB_SUID_DROP))
diff --git a/miscutils/crond.c b/miscutils/crond.c
index d028eb089..fddddcd8c 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -8,7 +8,7 @@
8 * (version 2.3.2) 8 * (version 2.3.2)
9 * Vladimir Oleynik <dzo@simtreas.ru> (C) 2002 9 * Vladimir Oleynik <dzo@simtreas.ru> (C) 2002
10 * 10 *
11 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13 13
14#include "libbb.h" 14#include "libbb.h"
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index b8a5abc64..163e15dce 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -7,7 +7,7 @@
7 * Copyright 1994 Matthew Dillon (dillon@apollo.west.oic.com) 7 * Copyright 1994 Matthew Dillon (dillon@apollo.west.oic.com)
8 * Vladimir Oleynik <dzo@simtreas.ru> (C) 2002 8 * Vladimir Oleynik <dzo@simtreas.ru> (C) 2002
9 * 9 *
10 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 767d746e0..777ec1654 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 4ccb76d95..8f19288cc 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6/* 6/*
diff --git a/miscutils/devmem.c b/miscutils/devmem.c
index 39b580840..7a9f533af 100644
--- a/miscutils/devmem.c
+++ b/miscutils/devmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 2 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
3 * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) 3 * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
4 * Copyright (C) 2008, BusyBox Team. -solar 4/26/08 4 * Copyright (C) 2008, BusyBox Team. -solar 4/26/08
5 */ 5 */
diff --git a/miscutils/eject.c b/miscutils/eject.c
index a869c6311..63d20d3ad 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2004 Peter Willis <psyphreak@phreaker.net> 5 * Copyright (C) 2004 Peter Willis <psyphreak@phreaker.net>
6 * Copyright (C) 2005 Tito Ragusa <farmatito@tiscali.it> 6 * Copyright (C) 2005 Tito Ragusa <farmatito@tiscali.it>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* 11/*
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index a031cbd3a..6b84563a3 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 Michele Sanges <michele.sanges@gmail.com> 3 * Copyright (C) 2008 Michele Sanges <michele.sanges@gmail.com>
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Usage: 7 * Usage:
8 * - use kernel option 'vga=xxx' or otherwise enable framebuffer device. 8 * - use kernel option 'vga=xxx' or otherwise enable framebuffer device.
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index ca00a130e..53aad3d52 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Renamed to flash_eraseall.c 8 * Renamed to flash_eraseall.c
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/miscutils/flash_lock_unlock.c b/miscutils/flash_lock_unlock.c
index f4e2f73b2..fcb836b07 100644
--- a/miscutils/flash_lock_unlock.c
+++ b/miscutils/flash_lock_unlock.c
@@ -1,7 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Ported to busybox from mtd-utils. 2/* Ported to busybox from mtd-utils.
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6#include "libbb.h" 6#include "libbb.h"
7#include <mtd/mtd-user.h> 7#include <mtd/mtd-user.h>
diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c
index 9472c7527..fe37c3913 100644
--- a/miscutils/flashcp.c
+++ b/miscutils/flashcp.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (C) 2009 Stefan Seyfried <seife@sphairon.com> 5 * (C) 2009 Stefan Seyfried <seife@sphairon.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index c6ca3af80..d946c7165 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -5,7 +5,7 @@
5 * Copyright (C) [2003] by [Matteo Croce] <3297627799@wind.it> 5 * Copyright (C) [2003] by [Matteo Croce] <3297627799@wind.it>
6 * Hacked by Tito <farmatito@tiscali.it> for size optimization. 6 * Hacked by Tito <farmatito@tiscali.it> for size optimization.
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 * 9 *
10 * This program is based on the source code of hdparm: see below... 10 * This program is based on the source code of hdparm: see below...
11 * hdparm.c - Command line interface to get/set hard disk parameters 11 * hdparm.c - Command line interface to get/set hard disk parameters
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index 271f3ade1..fe429b636 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* 11/*
diff --git a/miscutils/ionice.c b/miscutils/ionice.c
index 6b791c491..481a738ee 100644
--- a/miscutils/ionice.c
+++ b/miscutils/ionice.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by <u173034@informatik.uni-oldenburg.de> 5 * Copyright (C) 2008 by <u173034@informatik.uni-oldenburg.de>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include <sys/syscall.h> 10#include <sys/syscall.h>
diff --git a/miscutils/last.c b/miscutils/last.c
index 55c03ae41..888a0a3d1 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 2003-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c
index f3ea0375d..7e69fc281 100644
--- a/miscutils/last_fancy.c
+++ b/miscutils/last_fancy.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Patricia Muscalu <patricia.muscalu@axis.com> 5 * Copyright (C) 2008 by Patricia Muscalu <patricia.muscalu@axis.com>
6 * 6 *
7 * Licensed under the GPLv2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/miscutils/less.c b/miscutils/less.c
index da2cd07af..d737e4cba 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 by Rob Sullivan <cogito.ergo.cogito@gmail.com> 5 * Copyright (C) 2005 by Rob Sullivan <cogito.ergo.cogito@gmail.com>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 0578d9251..bba7fa61d 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -76,7 +76,7 @@ int makedevs_main(int argc, char **argv)
76 76
77#elif ENABLE_FEATURE_MAKEDEVS_TABLE 77#elif ENABLE_FEATURE_MAKEDEVS_TABLE
78 78
79/* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ 79/* Licensed under GPLv2 or later, see file LICENSE in this source tree. */
80 80
81int makedevs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 81int makedevs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
82int makedevs_main(int argc UNUSED_PARAM, char **argv) 82int makedevs_main(int argc UNUSED_PARAM, char **argv)
diff --git a/miscutils/man.c b/miscutils/man.c
index a4ff274d4..2d3776cf3 100644
--- a/miscutils/man.c
+++ b/miscutils/man.c
@@ -1,6 +1,6 @@
1/* mini man implementation for busybox 1/* mini man implementation for busybox
2 * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com> 2 * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
3 * Licensed under GPLv2, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/miscutils/microcom.c b/miscutils/microcom.c
index 78863d49f..3acbe3023 100644
--- a/miscutils/microcom.c
+++ b/miscutils/microcom.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index a35c38907..784c3cbfc 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 Bernhard Reutner-Fischer 5 * Copyright (C) 2005 Bernhard Reutner-Fischer
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 * Based on sysvinit's mountpoint 9 * Based on sysvinit's mountpoint
10 */ 10 */
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 8df2b75f7..d19866a5f 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5
6#include "libbb.h" 6#include "libbb.h"
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
new file mode 100644
index 000000000..f42242687
--- /dev/null
+++ b/miscutils/nandwrite.c
@@ -0,0 +1,142 @@
1/*
2 * nandwrite.c - ported to busybox from mtd-utils
3 *
4 * Author: Baruch Siach <baruch@tkos.co.il>, Orex Computed Radiography
5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 *
8 * TODO: add support for large (>4GB) MTD devices
9 */
10
11//applet:IF_NANDWRITE(APPLET(nandwrite, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
12
13//kbuild:lib-$(CONFIG_NANDWRITE) += nandwrite.o
14
15//config:config NANDWRITE
16//config: bool "nandwrite"
17//config: default n
18//config: depends on PLATFORM_LINUX
19//config: help
20//config: Write to the specified MTD device, with bad blocks awareness
21
22#include "libbb.h"
23#include <mtd/mtd-user.h>
24
25//usage:#define nandwrite_trivial_usage
26//usage: "[-p] [-s ADDR] MTD_DEVICE [FILE]"
27//usage:#define nandwrite_full_usage "\n\n"
28//usage: "Write to the specified MTD device\n"
29//usage: "\nOptions:"
30//usage: "\n -p Pad to page size"
31//usage: "\n -s ADDR Start address"
32
33static unsigned next_good_eraseblock(int fd, struct mtd_info_user *meminfo,
34 unsigned block_offset)
35{
36 while (1) {
37 loff_t offs;
38 if (block_offset >= meminfo->size)
39 bb_error_msg_and_die("not enough space in MTD device");
40 offs = block_offset;
41 if (xioctl(fd, MEMGETBADBLOCK, &offs) == 0)
42 return block_offset;
43 /* ioctl returned 1 => "bad block" */
44 printf("Skipping bad block at 0x%08x\n", block_offset);
45 block_offset += meminfo->erasesize;
46 }
47}
48
49int nandwrite_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
50int nandwrite_main(int argc UNUSED_PARAM, char **argv)
51{
52 unsigned opts;
53 int fd;
54 ssize_t cnt;
55 unsigned mtdoffset, meminfo_writesize, blockstart;
56 struct mtd_info_user meminfo;
57 unsigned char *filebuf;
58 const char *opt_s = "0";
59 enum {
60 OPT_p = (1 << 0),
61 OPT_s = (1 << 1),
62 };
63
64 opt_complementary = "-1:?2";
65 opts = getopt32(argv, "ps:", &opt_s);
66 argv += optind;
67
68 if (argv[1])
69 xmove_fd(xopen_stdin(argv[1]), STDIN_FILENO);
70
71 fd = xopen(argv[0], O_RDWR);
72 xioctl(fd, MEMGETINFO, &meminfo);
73
74 mtdoffset = bb_strtou(opt_s, NULL, 0);
75 if (errno)
76 bb_error_msg_and_die("invalid number '%s'", opt_s);
77
78 /* Pull it into a CPU register (hopefully) - smaller code that way */
79 meminfo_writesize = meminfo.writesize;
80
81 if (mtdoffset & (meminfo_writesize - 1))
82 bb_error_msg_and_die("start address is not page aligned");
83
84 filebuf = xmalloc(meminfo_writesize);
85
86 blockstart = mtdoffset & ~(meminfo.erasesize - 1);
87 if (blockstart != mtdoffset) {
88 unsigned tmp;
89 /* mtdoffset is in the middle of an erase block, verify that
90 * this block is OK. Advance mtdoffset only if this block is
91 * bad.
92 */
93 tmp = next_good_eraseblock(fd, &meminfo, blockstart);
94 if (tmp != blockstart) /* bad block(s), advance mtdoffset */
95 mtdoffset = tmp;
96 }
97
98 cnt = -1;
99 while (mtdoffset < meminfo.size) {
100 blockstart = mtdoffset & ~(meminfo.erasesize - 1);
101 if (blockstart == mtdoffset) {
102 /* starting a new eraseblock */
103 mtdoffset = next_good_eraseblock(fd, &meminfo, blockstart);
104 printf("Writing at 0x%08x\n", mtdoffset);
105 }
106 /* get some more data from input */
107 cnt = full_read(STDIN_FILENO, filebuf, meminfo_writesize);
108 if (cnt == 0) {
109 /* even with -p, we do not pad past the end of input
110 * (-p only zero-pads last incomplete page)
111 */
112 break;
113 }
114 if (cnt < meminfo_writesize) {
115 if (!(opts & OPT_p))
116 bb_error_msg_and_die("input size is not rounded up to page size, "
117 "use -p to zero pad");
118 /* zero pad to end of write block */
119 memset(filebuf + cnt, 0, meminfo_writesize - cnt);
120 }
121 xlseek(fd, mtdoffset, SEEK_SET);
122 xwrite(fd, filebuf, meminfo_writesize);
123 mtdoffset += meminfo_writesize;
124 if (cnt < meminfo_writesize)
125 break;
126 }
127
128 if (cnt != 0) {
129 /* We filled entire MTD, but did we reach EOF on input? */
130 if (full_read(STDIN_FILENO, filebuf, meminfo_writesize) != 0) {
131 /* no */
132 bb_error_msg_and_die("not enough space in MTD device");
133 }
134 }
135
136 if (ENABLE_FEATURE_CLEAN_UP) {
137 free(filebuf);
138 close(fd);
139 }
140
141 return EXIT_SUCCESS;
142}
diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c
index 113e49ff2..bbfa8577c 100644
--- a/miscutils/raidautorun.c
+++ b/miscutils/raidautorun.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2006 Bernhard Reutner-Fischer 5 * Copyright (C) 2006 Bernhard Reutner-Fischer
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10 10
diff --git a/miscutils/readahead.c b/miscutils/readahead.c
index e7b75f12f..dd6de7c45 100644
--- a/miscutils/readahead.c
+++ b/miscutils/readahead.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Copyright (C) 2006 Michael Opdenacker <michael@free-electrons.com> 8 * Copyright (C) 2006 Michael Opdenacker <michael@free-electrons.com>
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/miscutils/rfkill.c b/miscutils/rfkill.c
index 7d8ad1cfc..b150b2cae 100644
--- a/miscutils/rfkill.c
+++ b/miscutils/rfkill.c
@@ -4,7 +4,7 @@
4* 4*
5* Copyright (C) 2010 Malek Degachi <malek-degachi@laposte.net> 5* Copyright (C) 2010 Malek Degachi <malek-degachi@laposte.net>
6* 6*
7* Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7* Licensed under GPLv2 or later, see file LICENSE in this source tree.
8*/ 8*/
9#include "libbb.h" 9#include "libbb.h"
10#include <linux/rfkill.h> 10#include <linux/rfkill.h>
diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c
index 83b5a77d4..608e87fe1 100644
--- a/miscutils/runlevel.c
+++ b/miscutils/runlevel.c
@@ -7,7 +7,7 @@
7 * This file is part of the sysvinit suite, 7 * This file is part of the sysvinit suite,
8 * Copyright 1991-1997 Miquel van Smoorenburg. 8 * Copyright 1991-1997 Miquel van Smoorenburg.
9 * 9 *
10 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 * 11 *
12 * initially busyboxified by Bernhard Reutner-Fischer 12 * initially busyboxified by Bernhard Reutner-Fischer
13 */ 13 */
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 4c5d5a19c..de785d53c 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -10,7 +10,7 @@
10 * 10 *
11 * Copyright (C) 2001 Hewlett-Packard Laboratories 11 * Copyright (C) 2001 Hewlett-Packard Laboratories
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 * 14 *
15 * This was originally written for blob and then adapted for busybox. 15 * This was originally written for blob and then adapted for busybox.
16 */ 16 */
diff --git a/miscutils/strings.c b/miscutils/strings.c
index b4c5854cf..40478de40 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2003 Tito Ragusa <farmatito@tiscali.it> 5 * Copyright 2003 Tito Ragusa <farmatito@tiscali.it>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/miscutils/taskset.c b/miscutils/taskset.c
index 08198d5d4..389ef43e4 100644
--- a/miscutils/taskset.c
+++ b/miscutils/taskset.c
@@ -3,7 +3,7 @@
3 * taskset - retrieve or set a processes' CPU affinity 3 * taskset - retrieve or set a processes' CPU affinity
4 * Copyright (c) 2006 Bernhard Reutner-Fischer 4 * Copyright (c) 2006 Bernhard Reutner-Fischer
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include <sched.h> 9#include <sched.h>
diff --git a/miscutils/time.c b/miscutils/time.c
index 9facc3657..6b1c3c42c 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -2,7 +2,7 @@
2/* 'time' utility to display resource usage of processes. 2/* 'time' utility to display resource usage of processes.
3 Copyright (C) 1990, 91, 92, 93, 96 Free Software Foundation, Inc. 3 Copyright (C) 1990, 91, 92, 93, 96 Free Software Foundation, Inc.
4 4
5 Licensed under GPL version 2, see file LICENSE in this tarball for details. 5 Licensed under GPLv2, see file LICENSE in this source tree.
6*/ 6*/
7/* Originally written by David Keppel <pardo@cs.washington.edu>. 7/* Originally written by David Keppel <pardo@cs.washington.edu>.
8 Heavily modified by David MacKenzie <djm@gnu.ai.mit.edu>. 8 Heavily modified by David MacKenzie <djm@gnu.ai.mit.edu>.
diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c
index ca9a2ec8d..f93a506a2 100644
--- a/miscutils/ttysize.c
+++ b/miscutils/ttysize.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * Copyright (C) 2007 by Denys Vlasenko <vda.linux@googlemail.com> 8 * Copyright (C) 2007 by Denys Vlasenko <vda.linux@googlemail.com>
9 * 9 *
10 * Licensed under the GPL v2, see the file LICENSE in this tarball. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13 13
diff --git a/miscutils/ubi_attach_detach.c b/miscutils/ubi_attach_detach.c
index 0d63a10d5..18ffd4df2 100644
--- a/miscutils/ubi_attach_detach.c
+++ b/miscutils/ubi_attach_detach.c
@@ -1,6 +1,6 @@
1/* Ported to busybox from mtd-utils. 1/* Ported to busybox from mtd-utils.
2 * 2 *
3 * Licensed under GPLv2, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5 5
6//applet:IF_UBIATTACH(APPLET_ODDNAME(ubiattach, ubi_attach_detach, _BB_DIR_USR_SBIN, _BB_SUID_DROP, ubiattach)) 6//applet:IF_UBIATTACH(APPLET_ODDNAME(ubiattach, ubi_attach_detach, _BB_DIR_USR_SBIN, _BB_SUID_DROP, ubiattach))
@@ -63,9 +63,9 @@ int ubi_attach_detach_main(int argc UNUSED_PARAM, char **argv)
63 ubi_ctrl = argv[optind]; 63 ubi_ctrl = argv[optind];
64 64
65 fd = xopen(ubi_ctrl, O_RDWR); 65 fd = xopen(ubi_ctrl, O_RDWR);
66 //fstat(fd, &st); 66 //xfstat(fd, &st, ubi_ctrl);
67 //if (!S_ISCHR(st.st_mode)) 67 //if (!S_ISCHR(st.st_mode))
68 // bb_error_msg_and_die("'%s' is not a char device", ubi_ctrl); 68 // bb_error_msg_and_die("%s: not a char device", ubi_ctrl);
69 69
70 if (do_attach) { 70 if (do_attach) {
71 if (!(opts & OPTION_M)) 71 if (!(opts & OPTION_M))
diff --git a/miscutils/wall.c b/miscutils/wall.c
index 2dbab60b4..eecfc166b 100644
--- a/miscutils/wall.c
+++ b/miscutils/wall.c
@@ -3,7 +3,7 @@
3 * wall - write a message to all logged-in users 3 * wall - write a message to all logged-in users
4 * Copyright (c) 2009 Bernhard Reutner-Fischer 4 * Copyright (c) 2009 Bernhard Reutner-Fischer
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 8e961f0c1..332539658 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2006 Bernhard Reutner-Fischer <busybox@busybox.net> 6 * Copyright (C) 2006 Bernhard Reutner-Fischer <busybox@busybox.net>
7 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com> 7 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>
8 * 8 *
9 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/modutils/Kbuild.src b/modutils/Kbuild.src
index a512f6066..1a7ac8751 100644
--- a/modutils/Kbuild.src
+++ b/modutils/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/modutils/depmod.c b/modutils/depmod.c
index 694f9ea5a..006a7bcc1 100644
--- a/modutils/depmod.c
+++ b/modutils/depmod.c
@@ -5,7 +5,7 @@
5 * Copyrihgt (c) 2008 Timo Teras <timo.teras@iki.fi> 5 * Copyrihgt (c) 2008 Timo Teras <timo.teras@iki.fi>
6 * Copyright (c) 2008 Vladimir Dronnikov 6 * Copyright (c) 2008 Vladimir Dronnikov
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/modutils/insmod.c b/modutils/insmod.c
index b88446c10..17fc18c09 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi> 5 * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index 97954c71f..9558a2510 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11#include "unicode.h" 11#include "unicode.h"
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index 454a1b366..37ba77edf 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -3,7 +3,7 @@
3 * modinfo - retrieve module info 3 * modinfo - retrieve module info
4 * Copyright (c) 2008 Pascal Bellard 4 * Copyright (c) 2008 Pascal Bellard
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9//applet:IF_MODINFO(APPLET(modinfo, _BB_DIR_SBIN, _BB_SUID_DROP)) 9//applet:IF_MODINFO(APPLET(modinfo, _BB_DIR_SBIN, _BB_SUID_DROP))
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 0e1874ed4..05f2c34eb 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -5,7 +5,7 @@
5 * Copyright (c) 2008 Vladimir Dronnikov 5 * Copyright (c) 2008 Vladimir Dronnikov
6 * Copyright (c) 2008 Bernhard Reutner-Fischer (initial depmod code) 6 * Copyright (c) 2008 Bernhard Reutner-Fischer (initial depmod code)
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/modutils/modprobe.c b/modutils/modprobe.c
index 0a9424293..ab35628f4 100644
--- a/modutils/modprobe.c
+++ b/modutils/modprobe.c
@@ -5,7 +5,7 @@
5 * Copyright (c) 2008 Timo Teras <timo.teras@iki.fi> 5 * Copyright (c) 2008 Timo Teras <timo.teras@iki.fi>
6 * Copyright (c) 2008 Vladimir Dronnikov 6 * Copyright (c) 2008 Vladimir Dronnikov
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* Note that unlike older versions of modules.dep/depmod (busybox and m-i-t), 11/* Note that unlike older versions of modules.dep/depmod (busybox and m-i-t),
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c
index c42d3c0bb..7228954d6 100644
--- a/modutils/modutils-24.c
+++ b/modutils/modutils-24.c
@@ -55,7 +55,7 @@
55 * Restructured (and partly rewritten) by: 55 * Restructured (and partly rewritten) by:
56 * Bjrn Ekwall <bj0rn@blox.se> February 1999 56 * Bjrn Ekwall <bj0rn@blox.se> February 1999
57 * 57 *
58 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 58 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
59 */ 59 */
60 60
61#include "libbb.h" 61#include "libbb.h"
diff --git a/modutils/modutils.c b/modutils/modutils.c
index 850a8683b..565d0d22f 100644
--- a/modutils/modutils.c
+++ b/modutils/modutils.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2008 by Timo Teras <timo.teras@iki.fi> 4 * Copyright (C) 2008 by Timo Teras <timo.teras@iki.fi>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8#include "modutils.h" 8#include "modutils.h"
9 9
@@ -71,8 +71,12 @@ char* FAST_FUNC parse_cmdline_module_options(char **argv)
71 optlen = 0; 71 optlen = 0;
72 while (*++argv) { 72 while (*++argv) {
73 options = xrealloc(options, optlen + 2 + strlen(*argv) + 2); 73 options = xrealloc(options, optlen + 2 + strlen(*argv) + 2);
74 /* Spaces handled by "" pairs, but no way of escaping quotes */ 74 /* Older versions were enclosing space-containing *argv in "",
75 optlen += sprintf(options + optlen, (strchr(*argv, ' ') ? "\"%s\" " : "%s "), *argv); 75 * but both modprobe and insmod from module-init-tools 3.11.1
76 * don't do this anymore. (As to extra trailing space,
77 * insmod adds it but modprobe does not. We do in both cases)
78 */
79 optlen += sprintf(options + optlen, "%s ", *argv);
76 } 80 }
77 return options; 81 return options;
78} 82}
diff --git a/modutils/modutils.h b/modutils/modutils.h
index d46870ca6..863bc26d3 100644
--- a/modutils/modutils.h
+++ b/modutils/modutils.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2008 by Timo Teras <timo.teras@iki.fi> 4 * Copyright (C) 2008 by Timo Teras <timo.teras@iki.fi>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#ifndef MODUTILS_H 9#ifndef MODUTILS_H
diff --git a/modutils/rmmod.c b/modutils/rmmod.c
index ee32dfdef..aa1bb01d6 100644
--- a/modutils/rmmod.c
+++ b/modutils/rmmod.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi> 6 * Copyright (C) 2008 Timo Teras <timo.teras@iki.fi>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/networking/Kbuild.src b/networking/Kbuild.src
index e1a4ebcb3..f41a2df70 100644
--- a/networking/Kbuild.src
+++ b/networking/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/networking/arping.c b/networking/arping.c
index effe418a6..f2b12ed04 100644
--- a/networking/arping.c
+++ b/networking/arping.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * arping.c - Ping hosts by ARP requests/replies 3 * arping.c - Ping hosts by ARP requests/replies
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Author: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 7 * Author: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 * Busybox port: Nick Fedchik <nick@fedchik.org.ua> 8 * Busybox port: Nick Fedchik <nick@fedchik.org.ua>
diff --git a/networking/brctl.c b/networking/brctl.c
index 0f56412ce..0defce46a 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -7,7 +7,7 @@
7 * Some helper functions from bridge-utils are 7 * Some helper functions from bridge-utils are
8 * Copyright (C) 2000 Lennert Buytenhek 8 * Copyright (C) 2000 Lennert Buytenhek
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12/* This applet currently uses only the ioctl interface and no sysfs at all. 12/* This applet currently uses only the ioctl interface and no sysfs at all.
13 * At the time of this writing this was considered a feature. 13 * At the time of this writing this was considered a feature.
diff --git a/networking/dnsd.c b/networking/dnsd.c
index 1a99040ac..92d4867aa 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2005 Odd Arild Olsen (oao at fibula dot no) 6 * Copyright (C) 2005 Odd Arild Olsen (oao at fibula dot no)
7 * Copyright (C) 2003 Paul Sheer 7 * Copyright (C) 2003 Paul Sheer
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 * Odd Arild Olsen started out with the sheerdns [1] of Paul Sheer and rewrote 11 * Odd Arild Olsen started out with the sheerdns [1] of Paul Sheer and rewrote
12 * it into a shape which I believe is both easier to understand and maintain. 12 * it into a shape which I believe is both easier to understand and maintain.
diff --git a/networking/ether-wake.c b/networking/ether-wake.c
index deeb68c09..121f15366 100644
--- a/networking/ether-wake.c
+++ b/networking/ether-wake.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * ether-wake.c - Send a magic packet to wake up sleeping machines. 3 * ether-wake.c - Send a magic packet to wake up sleeping machines.
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Author: Donald Becker, http://www.scyld.com/"; http://www.scyld.com/wakeonlan.html 7 * Author: Donald Becker, http://www.scyld.com/"; http://www.scyld.com/wakeonlan.html
8 * Busybox port: Christian Volkmann <haveaniceday@online.de> 8 * Busybox port: Christian Volkmann <haveaniceday@online.de>
diff --git a/networking/ftpd.c b/networking/ftpd.c
index 0daf9f7a3..64068e467 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Author: Adam Tkac <vonsch@gmail.com> 5 * Author: Adam Tkac <vonsch@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 * 8 *
9 * Only subset of FTP protocol is implemented but vast majority of clients 9 * Only subset of FTP protocol is implemented but vast majority of clients
10 * should not have any problem. 10 * should not have any problem.
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 120ccff83..c68d0ace2 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -10,7 +10,7 @@
10 * Based on wget.c by Chip Rosenthal Covad Communications 10 * Based on wget.c by Chip Rosenthal Covad Communications
11 * <chip@laserlink.net> 11 * <chip@laserlink.net>
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16#include "libbb.h" 16#include "libbb.h"
diff --git a/networking/hostname.c b/networking/hostname.c
index 121ad40bb..66b52dd90 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -7,7 +7,7 @@
7 * Adjusted by Erik Andersen <andersen@codepoet.org> to remove 7 * Adjusted by Erik Andersen <andersen@codepoet.org> to remove
8 * use of long options and GNU getopt. Improved the usage info. 8 * use of long options and GNU getopt. Improved the usage info.
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12#include "libbb.h" 12#include "libbb.h"
13 13
diff --git a/networking/httpd.c b/networking/httpd.c
index 3fea3f04c..c174958e2 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2002,2003 Glenn Engel <glenne@engel.org> 5 * Copyright (C) 2002,2003 Glenn Engel <glenne@engel.org>
6 * Copyright (C) 2003-2006 Vladimir Oleynik <dzo@simtreas.ru> 6 * Copyright (C) 2003-2006 Vladimir Oleynik <dzo@simtreas.ru>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 * 9 *
10 ***************************************************************************** 10 *****************************************************************************
11 * 11 *
diff --git a/networking/httpd_indexcgi.c b/networking/httpd_indexcgi.c
index af4338006..7e0225e19 100644
--- a/networking/httpd_indexcgi.c
+++ b/networking/httpd_indexcgi.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com> 2 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com>
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6 6
7/* 7/*
diff --git a/networking/httpd_ssi.c b/networking/httpd_ssi.c
index 03f263397..87f43fcfa 100644
--- a/networking/httpd_ssi.c
+++ b/networking/httpd_ssi.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (c) 2009 Denys Vlasenko <vda.linux@googlemail.com> 2 * Copyright (c) 2009 Denys Vlasenko <vda.linux@googlemail.com>
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6 6
7/* 7/*
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 1a56c1cd5..853910f67 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -10,7 +10,7 @@
10 * Authors of the original ifconfig was: 10 * Authors of the original ifconfig was:
11 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 11 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16/* 16/*
diff --git a/networking/ifplugd.c b/networking/ifplugd.c
index 2f8c90ffc..58f56dbf1 100644
--- a/networking/ifplugd.c
+++ b/networking/ifplugd.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Maksym Kryzhanovskyy <xmaks@email.cz> 5 * Copyright (C) 2009 Maksym Kryzhanovskyy <xmaks@email.cz>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 69c56e879..5d6994f6e 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -14,7 +14,7 @@
14 * (defined via CONFIG_IFUPDOWN_IFSTATE_PATH) and can be overridden by build 14 * (defined via CONFIG_IFUPDOWN_IFSTATE_PATH) and can be overridden by build
15 * configuration. 15 * configuration.
16 * 16 *
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19 19
20#include "libbb.h" 20#include "libbb.h"
diff --git a/networking/interface.c b/networking/interface.c
index 7c6ed82df..83af62b7c 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -19,7 +19,7 @@
19 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 19 * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
20 * and others. Copyright 1993 MicroWalt Corporation 20 * and others. Copyright 1993 MicroWalt Corporation
21 * 21 *
22 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 22 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
23 * 23 *
24 * Patched to support 'add' and 'del' keywords for INET(4) addresses 24 * Patched to support 'add' and 'del' keywords for INET(4) addresses
25 * by Mrs. Brisby <mrs.brisby@nimh.org> 25 * by Mrs. Brisby <mrs.brisby@nimh.org>
diff --git a/networking/ip.c b/networking/ip.c
index 004289667..7b1e2eb6a 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * "ip" utility frontend. 3 * "ip" utility frontend.
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 * 8 *
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index 265009ad8..d4aa885c6 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -9,7 +9,7 @@
9 * from Red Hat. I didn't look at their source code, but there 9 * from Red Hat. I didn't look at their source code, but there
10 * is no denying that this is a loving reimplementation 10 * is no denying that this is a loving reimplementation
11 * 11 *
12 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13 */ 13 */
14#include "libbb.h" 14#include "libbb.h"
15/* After libbb.h, because on some systems it needs other includes */ 15/* After libbb.h, because on some systems it needs other includes */
diff --git a/networking/isrv.c b/networking/isrv.c
index 66bb3718e..1c6491edd 100644
--- a/networking/isrv.c
+++ b/networking/isrv.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Denys Vlasenko 6 * Copyright (C) 2007 Denys Vlasenko
7 * 7 *
8 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/networking/isrv.h b/networking/isrv.h
index f20714df8..4c7e01dd1 100644
--- a/networking/isrv.h
+++ b/networking/isrv.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2007 Denys Vlasenko 6 * Copyright (C) 2007 Denys Vlasenko
7 * 7 *
8 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 11PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c
index e8ba00766..18ce59aaf 100644
--- a/networking/isrv_identd.c
+++ b/networking/isrv_identd.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko 5 * Copyright (C) 2007 Denys Vlasenko
6 * 6 *
7 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/networking/libiproute/Kbuild.src b/networking/libiproute/Kbuild.src
index b0aa50a97..7c78f3c6a 100644
--- a/networking/libiproute/Kbuild.src
+++ b/networking/libiproute/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5# Licensed under GPLv2 or later, see file LICENSE in this source tree.
6# 6#
7 7
8lib-y:= 8lib-y:=
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index b6f469d0f..1be03a6c3 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * ipaddress.c "ip address". 3 * ipaddress.c "ip address".
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 * 8 *
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index 9f9218573..f9421fc68 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 5 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include <net/if.h> 9#include <net/if.h>
10#include <net/if_packet.h> 10#include <net/if_packet.h>
@@ -15,6 +15,11 @@
15#include "rt_names.h" 15#include "rt_names.h"
16#include "utils.h" 16#include "utils.h"
17 17
18#ifndef IFLA_LINKINFO
19# define IFLA_LINKINFO 18
20# define IFLA_INFO_KIND 1
21#endif
22
18/* taken from linux/sockios.h */ 23/* taken from linux/sockios.h */
19#define SIOCSIFNAME 0x8923 /* set interface name */ 24#define SIOCSIFNAME 0x8923 /* set interface name */
20 25
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index 8dba2bf3d..1696e6a34 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * iproute.c "ip route". 3 * iproute.c "ip route".
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 * 8 *
diff --git a/networking/libiproute/iptunnel.c b/networking/libiproute/iptunnel.c
index 8389ef348..bce373d05 100644
--- a/networking/libiproute/iptunnel.c
+++ b/networking/libiproute/iptunnel.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * iptunnel.c "ip tunnel" 3 * iptunnel.c "ip tunnel"
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 * 8 *
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index 85034c0f6..5125617c7 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * utils.c 3 * utils.c
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 * 8 *
diff --git a/networking/nameif.c b/networking/nameif.c
index 046e308c5..45a3229f4 100644
--- a/networking/nameif.c
+++ b/networking/nameif.c
@@ -7,7 +7,7 @@
7 * Glenn McGrath 7 * Glenn McGrath
8 * Extended matching support 2008 by Nico Erfurth <masta@perlgolf.de> 8 * Extended matching support 2008 by Nico Erfurth <masta@perlgolf.de>
9 * 9 *
10 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13#include "libbb.h" 13#include "libbb.h"
diff --git a/networking/nc.c b/networking/nc.c
index c77137480..31d450dda 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -1,10 +1,10 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* nc: mini-netcat - built from the ground up for LRP 2/* nc: mini-netcat - built from the ground up for LRP
3 * 3 *
4 * Copyright (C) 1998, 1999 Charles P. Wright 4 * Copyright (C) 1998, 1999 Charles P. Wright
5 * Copyright (C) 1998 Dave Cinege 5 * Copyright (C) 1998 Dave Cinege
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/networking/nc_bloaty.c b/networking/nc_bloaty.c
index aebb9cb8c..dbcce8bf4 100644
--- a/networking/nc_bloaty.c
+++ b/networking/nc_bloaty.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007 Denys Vlasenko. 4 * Copyright (C) 2007 Denys Vlasenko.
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8 8
9/* Author's comments from nc 1.10: 9/* Author's comments from nc 1.10:
diff --git a/networking/netstat.c b/networking/netstat.c
index 8b7a57405..3114a3902 100644
--- a/networking/netstat.c
+++ b/networking/netstat.c
@@ -11,7 +11,7 @@
11 * 2008-07-10 11 * 2008-07-10
12 * optional '-p' flag support ported from net-tools by G. Somlo <somlo@cmu.edu> 12 * optional '-p' flag support ported from net-tools by G. Somlo <somlo@cmu.edu>
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16 16
17#include "libbb.h" 17#include "libbb.h"
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 26287114c..dcac7379e 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -8,7 +8,7 @@
8 * Correct default name server display and explicit name server option 8 * Correct default name server display and explicit name server option
9 * added by Ben Zeckel <bzeckel@hmc.edu> June 2001 9 * added by Ben Zeckel <bzeckel@hmc.edu> June 2001
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13 13
14#include <resolv.h> 14#include <resolv.h>
diff --git a/networking/ntpd.c b/networking/ntpd.c
index e9cfdbddd..6707e9bdb 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Author: Adam Tkac <vonsch@gmail.com> 4 * Author: Adam Tkac <vonsch@gmail.com>
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 * 7 *
8 * Parts of OpenNTPD clock syncronization code is replaced by 8 * Parts of OpenNTPD clock syncronization code is replaced by
9 * code which is based on ntp-4.2.6, whuch carries the following 9 * code which is based on ntp-4.2.6, whuch carries the following
@@ -1920,9 +1920,28 @@ static NOINLINE void ntp_init(char **argv)
1920 if (opts & OPT_N) 1920 if (opts & OPT_N)
1921 setpriority(PRIO_PROCESS, 0, -15); 1921 setpriority(PRIO_PROCESS, 0, -15);
1922 1922
1923 bb_signals((1 << SIGTERM) | (1 << SIGINT), record_signo); 1923 /* If network is up, syncronization occurs in ~10 seconds.
1924 /* Removed SIGHUP here: */ 1924 * We give "ntpd -q" a full minute to finish, then we exit.
1925 bb_signals((1 << SIGPIPE) | (1 << SIGCHLD), SIG_IGN); 1925 *
1926 * I tested ntpd 4.2.6p1 and apparently it never exits
1927 * (will try forever), but it does not feel right.
1928 * The goal of -q is to act like ntpdate: set time
1929 * after a reasonably small period of polling, or fail.
1930 */
1931 if (opts & OPT_q)
1932 alarm(60);
1933
1934 bb_signals(0
1935 | (1 << SIGTERM)
1936 | (1 << SIGINT)
1937 | (1 << SIGALRM)
1938 , record_signo
1939 );
1940 bb_signals(0
1941 | (1 << SIGPIPE)
1942 | (1 << SIGCHLD)
1943 , SIG_IGN
1944 );
1926} 1945}
1927 1946
1928int ntpd_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE; 1947int ntpd_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE;
diff --git a/networking/ntpd_simple.c b/networking/ntpd_simple.c
index 5e48306c7..5905e54e9 100644
--- a/networking/ntpd_simple.c
+++ b/networking/ntpd_simple.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Author: Adam Tkac <vonsch@gmail.com> 4 * Author: Adam Tkac <vonsch@gmail.com>
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9#include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */ 9#include <netinet/ip.h> /* For IPTOS_LOWDELAY definition */
diff --git a/networking/ping.c b/networking/ping.c
index 6a766a437..e18d88e39 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -11,7 +11,7 @@
11 * This code is derived from software contributed to Berkeley by 11 * This code is derived from software contributed to Berkeley by
12 * Mike Muuss. 12 * Mike Muuss.
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16/* from ping6.c: 16/* from ping6.c:
17 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 17 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
diff --git a/networking/pscan.c b/networking/pscan.c
index 5fb6af0b3..a8194d1a8 100644
--- a/networking/pscan.c
+++ b/networking/pscan.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2007 Tito Ragusa <farmatito@tiscali.it> 4 * Copyright 2007 Tito Ragusa <farmatito@tiscali.it>
5 * 5 *
6 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9#include "libbb.h" 9#include "libbb.h"
diff --git a/networking/route.c b/networking/route.c
index a3199621a..c72e9457f 100644
--- a/networking/route.c
+++ b/networking/route.c
@@ -10,7 +10,7 @@
10 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> 10 * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
11 * (derived from FvK's 'route.c 1.70 01/04/94') 11 * (derived from FvK's 'route.c 1.70 01/04/94')
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 * 14 *
15 * 15 *
16 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru> 16 * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
diff --git a/networking/tc.c b/networking/tc.c
index 6a5a8504f..48d164285 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * tc.c "tc" utility frontend. 3 * tc.c "tc" utility frontend.
4 * 4 *
5 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 * 6 *
7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> 7 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
8 * 8 *
diff --git a/networking/tcpudp.c b/networking/tcpudp.c
index 40f68258e..b532e43cd 100644
--- a/networking/tcpudp.c
+++ b/networking/tcpudp.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko. 5 * Copyright (C) 2007 Denys Vlasenko.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Based on ipsvd-0.12.1. This tcpsvd accepts all options 10/* Based on ipsvd-0.12.1. This tcpsvd accepts all options
diff --git a/networking/tcpudp_perhost.c b/networking/tcpudp_perhost.c
index 3005f12c0..105410883 100644
--- a/networking/tcpudp_perhost.c
+++ b/networking/tcpudp_perhost.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko. 5 * Copyright (C) 2007 Denys Vlasenko.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/networking/tcpudp_perhost.h b/networking/tcpudp_perhost.h
index d370036a7..3e5757678 100644
--- a/networking/tcpudp_perhost.h
+++ b/networking/tcpudp_perhost.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Denys Vlasenko. 5 * Copyright (C) 2007 Denys Vlasenko.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 10PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
diff --git a/networking/telnet.c b/networking/telnet.c
index e0022b2cb..12d1970fa 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -8,7 +8,7 @@
8 * Created: Thu Apr 7 13:29:41 1994 too 8 * Created: Thu Apr 7 13:29:41 1994 too
9 * Last modified: Fri Jun 9 14:34:24 2000 too 9 * Last modified: Fri Jun 9 14:34:24 2000 too
10 * 10 *
11 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 * 12 *
13 * HISTORY 13 * HISTORY
14 * Revision 3.1 1994/04/17 11:31:54 too 14 * Revision 3.1 1994/04/17 11:31:54 too
diff --git a/networking/telnetd.c b/networking/telnetd.c
index ea66a25c0..5c011e15d 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -3,7 +3,7 @@
3 * Simple telnet server 3 * Simple telnet server
4 * Bjorn Wesen, Axis Communications AB (bjornw@axis.com) 4 * Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 * 7 *
8 * --------------------------------------------------------------------------- 8 * ---------------------------------------------------------------------------
9 * (C) Copyright 2000, Axis Communications AB, LUND, SWEDEN 9 * (C) Copyright 2000, Axis Communications AB, LUND, SWEDEN
diff --git a/networking/tftp.c b/networking/tftp.c
index 43ae13647..0269a93ab 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -16,7 +16,7 @@
16 * 16 *
17 * tftpd added by Denys Vlasenko & Vladimir Dronnikov 17 * tftpd added by Denys Vlasenko & Vladimir Dronnikov
18 * 18 *
19 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 19 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
20 */ 20 */
21#include "libbb.h" 21#include "libbb.h"
22 22
diff --git a/networking/tunctl.c b/networking/tunctl.c
index 02ff71dce..e17a9db64 100644
--- a/networking/tunctl.c
+++ b/networking/tunctl.c
@@ -7,7 +7,7 @@
7 * Original code: 7 * Original code:
8 * Jeff Dike 8 * Jeff Dike
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12#include <netinet/in.h> 12#include <netinet/in.h>
13#include <net/if.h> 13#include <net/if.h>
diff --git a/networking/udhcp/Kbuild.src b/networking/udhcp/Kbuild.src
index f845bc1d9..b8767baea 100644
--- a/networking/udhcp/Kbuild.src
+++ b/networking/udhcp/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 5# Licensed under GPLv2 or later, see file LICENSE in this source tree.
6# 6#
7 7
8lib-y:= 8lib-y:=
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 7c8c24446..ff6347847 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -3,7 +3,7 @@
3 * Mostly stolen from: dhcpcd - DHCP client daemon 3 * Mostly stolen from: dhcpcd - DHCP client daemon
4 * by Yoichi Hariguchi <yoichi@fore.com> 4 * by Yoichi Hariguchi <yoichi@fore.com>
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8#include <netinet/if_ether.h> 8#include <netinet/if_ether.h>
9#include <net/if_arp.h> 9#include <net/if_arp.h>
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 90a07ed09..97ab4cdbb 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 3 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include "common.h" 7#include "common.h"
8 8
diff --git a/networking/udhcp/common.h b/networking/udhcp/common.h
index ce81d1807..c5abf17d5 100644
--- a/networking/udhcp/common.h
+++ b/networking/udhcp/common.h
@@ -3,7 +3,7 @@
3 * Russ Dill <Russ.Dill@asu.edu> September 2001 3 * Russ Dill <Russ.Dill@asu.edu> September 2001
4 * Rewritten by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003 4 * Rewritten by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8#ifndef UDHCP_COMMON_H 8#ifndef UDHCP_COMMON_H
9#define UDHCP_COMMON_H 1 9#define UDHCP_COMMON_H 1
diff --git a/networking/udhcp/dhcpc.h b/networking/udhcp/dhcpc.h
index 6bef562c7..9ef053a1b 100644
--- a/networking/udhcp/dhcpc.h
+++ b/networking/udhcp/dhcpc.h
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5#ifndef UDHCP_DHCPC_H 5#ifndef UDHCP_DHCPC_H
6#define UDHCP_DHCPC_H 1 6#define UDHCP_DHCPC_H 1
diff --git a/networking/udhcp/dhcpd.h b/networking/udhcp/dhcpd.h
index eea90177f..7c801bf6b 100644
--- a/networking/udhcp/dhcpd.h
+++ b/networking/udhcp/dhcpd.h
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2, see file LICENSE in this tarball for details. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5#ifndef UDHCP_DHCPD_H 5#ifndef UDHCP_DHCPD_H
6#define UDHCP_DHCPD_H 1 6#define UDHCP_DHCPD_H 1
diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c
index d194a989b..a2c7f359d 100644
--- a/networking/udhcp/dhcprelay.c
+++ b/networking/udhcp/dhcprelay.c
@@ -1,7 +1,7 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* Port to Busybox Copyright (C) 2006 Jesse Dutton <jessedutton@gmail.com> 2/* Port to Busybox Copyright (C) 2006 Jesse Dutton <jessedutton@gmail.com>
3 * 3 *
4 * Licensed under GPL v2, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 * 5 *
6 * DHCP Relay for 'DHCPv4 Configuration of IPSec Tunnel Mode' support 6 * DHCP Relay for 'DHCPv4 Configuration of IPSec Tunnel Mode' support
7 * Copyright (C) 2002 Mario Strasser <mast@gmx.net>, 7 * Copyright (C) 2002 Mario Strasser <mast@gmx.net>,
diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c
index 2dd5347ae..c1325d8be 100644
--- a/networking/udhcp/domain_codec.c
+++ b/networking/udhcp/domain_codec.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Loosely based on the isc-dhcpd implementation by dhankins@isc.org 5 * Loosely based on the isc-dhcpd implementation by dhankins@isc.org
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#ifdef DNS_COMPR_TESTING 9#ifdef DNS_COMPR_TESTING
10# define FAST_FUNC /* nothing */ 10# define FAST_FUNC /* nothing */
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index fb6219fba..2eaadb6eb 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -1,6 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5#include "common.h" 5#include "common.h"
6#include "dhcpd.h" 6#include "dhcpd.h"
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index ff63111c9..f5348f658 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 5 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include <netinet/ether.h> 9#include <netinet/ether.h>
10 10
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index fad71ec6c..7aeb37bae 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Russ Dill <Russ.Dill@asu.edu> July 2001 3 * Russ Dill <Russ.Dill@asu.edu> July 2001
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include "common.h" 7#include "common.h"
8#include "dhcpd.h" 8#include "dhcpd.h"
diff --git a/networking/udhcp/packet.c b/networking/udhcp/packet.c
index 4badc9cbc..d8f9c5daa 100644
--- a/networking/udhcp/packet.c
+++ b/networking/udhcp/packet.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001 5 * Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include <netinet/in.h> 9#include <netinet/in.h>
10#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION 10#if (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1) || defined _NEWLIB_VERSION
diff --git a/networking/udhcp/static_leases.c b/networking/udhcp/static_leases.c
index b334a5888..f4a24ab62 100644
--- a/networking/udhcp/static_leases.c
+++ b/networking/udhcp/static_leases.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Wade Berrier <wberrier@myrealbox.com> September 2004 5 * Wade Berrier <wberrier@myrealbox.com> September 2004
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "common.h" 9#include "common.h"
10#include "dhcpd.h" 10#include "dhcpd.h"
diff --git a/networking/vconfig.c b/networking/vconfig.c
index 00379fc2f..1f574d2ad 100644
--- a/networking/vconfig.c
+++ b/networking/vconfig.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2001 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* BB_AUDIT SUSv3 N/A */ 10/* BB_AUDIT SUSv3 N/A */
diff --git a/networking/wget.c b/networking/wget.c
index 784e405da..88bb09eb2 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -3,7 +3,7 @@
3 * wget - retrieve a file using HTTP or FTP 3 * wget - retrieve a file using HTTP or FTP
4 * 4 *
5 * Chip Rosenthal Covad Communications <chip@laserlink.net> 5 * Chip Rosenthal Covad Communications <chip@laserlink.net>
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 * 7 *
8 * Copyright (C) 2010 Bradley M. Kuhn <bkuhn@ebb.org> 8 * Copyright (C) 2010 Bradley M. Kuhn <bkuhn@ebb.org>
9 * Kuhn's copyrights are licensed GPLv2-or-later. File as a whole remains GPLv2. 9 * Kuhn's copyrights are licensed GPLv2-or-later. File as a whole remains GPLv2.
diff --git a/networking/zcip.c b/networking/zcip.c
index 6b0b1c491..6fa265ad4 100644
--- a/networking/zcip.c
+++ b/networking/zcip.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 2003 by Arthur van Hoff (avh@strangeberry.com) 6 * Copyright (C) 2003 by Arthur van Hoff (avh@strangeberry.com)
7 * Copyright (C) 2004 by David Brownell 7 * Copyright (C) 2004 by David Brownell
8 * 8 *
9 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12/* 12/*
diff --git a/printutils/Kbuild.src b/printutils/Kbuild.src
index 008290ee9..194fe01d6 100644
--- a/printutils/Kbuild.src
+++ b/printutils/Kbuild.src
@@ -1,6 +1,6 @@
1# Makefile for busybox 1# Makefile for busybox
2# 2#
3# Licensed under the GPL v2, see the file LICENSE in this tarball. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5lib-y := 5lib-y :=
6 6
diff --git a/printutils/lpd.c b/printutils/lpd.c
index 54ff2227e..157cbe8ae 100644
--- a/printutils/lpd.c
+++ b/printutils/lpd.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/printutils/lpr.c b/printutils/lpr.c
index f21cffddf..fb7860d41 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -7,7 +7,7 @@
7 * Original idea and code: 7 * Original idea and code:
8 * Walter Harms <WHarms@bfs.de> 8 * Walter Harms <WHarms@bfs.de>
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 * 11 *
12 * See RFC 1179 for protocol description. 12 * See RFC 1179 for protocol description.
13 */ 13 */
diff --git a/procps/Kbuild.src b/procps/Kbuild.src
index c41f12b15..791d65670 100644
--- a/procps/Kbuild.src
+++ b/procps/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/procps/free.c b/procps/free.c
index db70712cf..be65f46f1 100644
--- a/procps/free.c
+++ b/procps/free.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* getopt not needed */ 10/* getopt not needed */
diff --git a/procps/fuser.c b/procps/fuser.c
index 85523c31c..addf1a7d8 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2004 Tony J. White 5 * Copyright 2004 Tony J. White
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/procps/iostat.c b/procps/iostat.c
index 05c758b6c..5d829861e 100644
--- a/procps/iostat.c
+++ b/procps/iostat.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com> 5 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//applet:IF_IOSTAT(APPLET(iostat, _BB_DIR_BIN, _BB_SUID_DROP)) 10//applet:IF_IOSTAT(APPLET(iostat, _BB_DIR_BIN, _BB_SUID_DROP))
diff --git a/procps/kill.c b/procps/kill.c
index 1d343edff..b51d44a70 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>. 5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * 7 *
8 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
@@ -153,7 +153,7 @@ int kill_main(int argc, char **argv)
153 arg = argv[i]; 153 arg = argv[i];
154 omit = bb_strtoi(arg, NULL, 10); 154 omit = bb_strtoi(arg, NULL, 10);
155 if (errno) { 155 if (errno) {
156 bb_error_msg("bad pid '%s'", arg); 156 bb_error_msg("invalid number '%s'", arg);
157 ret = 1; 157 ret = 1;
158 goto resume; 158 goto resume;
159 } 159 }
@@ -211,7 +211,7 @@ int kill_main(int argc, char **argv)
211 arg++; 211 arg++;
212 pid = bb_strtoi(arg, NULL, 10); 212 pid = bb_strtoi(arg, NULL, 10);
213 if (errno) { 213 if (errno) {
214 bb_error_msg("bad pid '%s'", arg); 214 bb_error_msg("invalid number '%s'", arg);
215 errors++; 215 errors++;
216 } else if (kill(pid, signo) != 0) { 216 } else if (kill(pid, signo) != 0) {
217 bb_perror_msg("can't kill pid %d", (int)pid); 217 bb_perror_msg("can't kill pid %d", (int)pid);
diff --git a/procps/mpstat.c b/procps/mpstat.c
index bf0f593f7..f1a0b00b8 100644
--- a/procps/mpstat.c
+++ b/procps/mpstat.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com> 5 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//applet:IF_MPSTAT(APPLET(mpstat, _BB_DIR_BIN, _BB_SUID_DROP)) 10//applet:IF_MPSTAT(APPLET(mpstat, _BB_DIR_BIN, _BB_SUID_DROP))
@@ -61,7 +61,7 @@ typedef long idata_t;
61 61
62 62
63struct stats_irqcpu { 63struct stats_irqcpu {
64 unsigned interrupt; 64 unsigned interrupts;
65 char irq_name[MAX_IRQNAME_LEN]; 65 char irq_name[MAX_IRQNAME_LEN];
66}; 66};
67 67
@@ -265,7 +265,7 @@ static void write_irqcpu_stats(struct stats_irqcpu *per_cpu_stats[],
265 p = &per_cpu_stats[current][(cpu - 1) * total_irqs + j]; 265 p = &per_cpu_stats[current][(cpu - 1) * total_irqs + j];
266 q = &per_cpu_stats[prev][(cpu - 1) * total_irqs + offset]; 266 q = &per_cpu_stats[prev][(cpu - 1) * total_irqs + offset];
267 printf("%"INTRATE_SCRWIDTH_STR".2f", 267 printf("%"INTRATE_SCRWIDTH_STR".2f",
268 (double)(p->interrupt - q->interrupt) / itv * G.hz); 268 (double)(p->interrupts - q->interrupts) / itv * G.hz);
269 } else { 269 } else {
270 printf(" N/A"); 270 printf(" N/A");
271 } 271 }
@@ -617,12 +617,12 @@ static void get_irqs_from_interrupts(const char *fname,
617 char *next; 617 char *next;
618 ic = &per_cpu_stats[current][cpu_index[cpu] * irqs_per_cpu + irq]; 618 ic = &per_cpu_stats[current][cpu_index[cpu] * irqs_per_cpu + irq];
619 irq_i = &G.st_irq[current][cpu_index[cpu] + 1]; 619 irq_i = &G.st_irq[current][cpu_index[cpu] + 1];
620 ic->interrupt = strtoul(cp, &next, 10); 620 ic->interrupts = strtoul(cp, &next, 10);
621 /* Count only numerical IRQs */ 621 /* Count only numerical IRQs */
622 if (isdigit(last_char)) { 622 if (isdigit(last_char)) {
623 irq_i->irq_nr += ic->interrupt; 623 irq_i->irq_nr += ic->interrupts;
624 //bb_error_msg("G.st_irq[%u][%u].irq_nr + %u = %lld", 624 //bb_error_msg("G.st_irq[%u][%u].irq_nr + %u = %lld",
625 // current, cpu_index[cpu] + 1, ic->interrupt, irq_i->irq_nr); 625 // current, cpu_index[cpu] + 1, ic->interrupts, irq_i->irq_nr);
626 } 626 }
627 cp = next; 627 cp = next;
628 } 628 }
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 930585695..7836a90d5 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -1,9 +1,10 @@
1/* 1/*
2** Licensed under the GPL v2, see the file LICENSE in this tarball 2 * Licensed under GPLv2, see file LICENSE in this source tree.
3** 3 *
4** Based on nanotop.c from floppyfw project 4 * Based on nanotop.c from floppyfw project
5** 5 *
6** Contact me: vda.linux@googlemail.com */ 6 * Contact me: vda.linux@googlemail.com
7 */
7 8
8//TODO: 9//TODO:
9// simplify code 10// simplify code
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 45de8bcda..5d388a87d 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2007 Loic Grenie <loic.grenie@gmail.com> 5 * Copyright (C) 2007 Loic Grenie <loic.grenie@gmail.com>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "xregex.h" 10#include "xregex.h"
diff --git a/procps/pidof.c b/procps/pidof.c
index bf5e7841a..49e469ca5 100644
--- a/procps/pidof.c
+++ b/procps/pidof.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/procps/pmap.c b/procps/pmap.c
new file mode 100644
index 000000000..cfa94ed82
--- /dev/null
+++ b/procps/pmap.c
@@ -0,0 +1,111 @@
1/*
2 * pmap implementation for busybox
3 *
4 * Copyright (C) 2010 Nokia Corporation. All rights reserved.
5 * Written by Alexander Shishkin <virtuoso@slind.org>
6 *
7 * Licensed under GPLv2 or later, see the LICENSE file in this source tree
8 * for details.
9 */
10
11//applet:IF_PMAP(APPLET(pmap, _BB_DIR_USR_BIN, _BB_SUID_DROP))
12//kbuild:lib-$(CONFIG_PMAP) += pmap.o
13
14//config:config PMAP
15//config: bool "pmap"
16//config: default y
17//config: help
18//config: Display processes' memory mappings.
19
20//usage:#define pmap_trivial_usage
21//usage: "[-x][-q] PID"
22//usage:#define pmap_full_usage "\n\n"
23//usage: "Display detailed precesses' memory usage\n"
24//usage: "\nOptions:"
25//usage: "\n -x show details"
26//usage: "\n -q quiet"
27
28#include "libbb.h"
29
30#if ULONG_MAX == 0xffffffff
31# define TABS "\t"
32# define AFMT "8"
33# define DASHES ""
34#else
35# define TABS "\t\t"
36# define AFMT "16"
37# define DASHES "--------"
38#endif
39
40enum {
41 OPT_x = 1 << 0,
42 OPT_q = 1 << 1,
43};
44
45static void print_smaprec(struct smaprec *currec, void *data)
46{
47 unsigned opt = (unsigned)data;
48
49 printf("%0" AFMT "lx ", currec->smap_start);
50
51 if (opt & OPT_x)
52 printf("%7lu %7lu %7lu %7lu ",
53 currec->smap_size,
54 currec->smap_pss,
55 currec->private_dirty,
56 currec->smap_swap);
57 else
58 printf("%7luK", currec->smap_size);
59
60 printf(" %.4s %s\n", currec->smap_mode, currec->smap_name);
61}
62
63static int procps_get_maps(pid_t pid, unsigned opt)
64{
65 struct smaprec total;
66 int ret;
67 char buf[256];
68
69 read_cmdline(buf, sizeof(buf), pid, "no such process");
70 printf("%u: %s\n", (int)pid, buf);
71
72 if (!(opt & OPT_q) && (opt & OPT_x))
73 puts("Address" TABS " Kbytes PSS Dirty Swap Mode Mapping");
74
75 memset(&total, 0, sizeof(total));
76
77 ret = procps_read_smaps(pid, &total, print_smaprec, (void*)opt);
78 if (ret)
79 return ret;
80
81 if (!(opt & OPT_q)) {
82 if (opt & OPT_x)
83 printf("--------" DASHES " ------ ------ ------ ------\n"
84 "total" TABS " %7lu %7lu %7lu %7lu\n",
85 total.smap_size, total.smap_pss, total.private_dirty, total.smap_swap);
86 else
87 printf("mapped: %luK\n", total.smap_size);
88 }
89
90 return 0;
91}
92
93int pmap_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
94int pmap_main(int argc UNUSED_PARAM, char **argv)
95{
96 unsigned opts;
97 int ret;
98
99 opts = getopt32(argv, "xq");
100 argv += optind;
101
102 ret = 0;
103 while (*argv) {
104 pid_t pid = xatoi_positive(*argv++);
105 /* GNU pmap returns 42 if any of the pids failed */
106 if (procps_get_maps(pid, opts) != 0)
107 ret = 42;
108 }
109
110 return ret;
111}
diff --git a/procps/ps.c b/procps/ps.c
index a3220a926..305381eb9 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -6,7 +6,7 @@
6 * Fix for SELinux Support:(c)2007 Hiroshi Shinji <shiroshi@my.email.ne.jp> 6 * Fix for SELinux Support:(c)2007 Hiroshi Shinji <shiroshi@my.email.ne.jp>
7 * (c)2007 Yuichi Nakamura <ynakam@hitachisoft.jp> 7 * (c)2007 Yuichi Nakamura <ynakam@hitachisoft.jp>
8 * 8 *
9 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/procps/renice.c b/procps/renice.c
index ea5fc703e..0a73cbeeb 100644
--- a/procps/renice.c
+++ b/procps/renice.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2005 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* Notes: 10/* Notes:
@@ -91,7 +91,7 @@ int renice_main(int argc UNUSED_PARAM, char **argv)
91 } else { 91 } else {
92 who = bb_strtou(arg, NULL, 10); 92 who = bb_strtou(arg, NULL, 10);
93 if (errno) { 93 if (errno) {
94 bb_error_msg("bad value: %s", arg); 94 bb_error_msg("invalid number '%s'", arg);
95 goto HAD_ERROR; 95 goto HAD_ERROR;
96 } 96 }
97 } 97 }
diff --git a/procps/sysctl.c b/procps/sysctl.c
index fc601d637..20b372c54 100644
--- a/procps/sysctl.c
+++ b/procps/sysctl.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 1999 George Staikos 5 * Copyright 1999 George Staikos
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 * Changelog: 9 * Changelog:
10 * v1.01 - added -p <preload> to preload values from a file 10 * v1.01 - added -p <preload> to preload values from a file
diff --git a/procps/top.c b/procps/top.c
index ec8437442..4f37878de 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -28,7 +28,7 @@
28 * Copyright (C) 1994-1996 Charles L. Blake. 28 * Copyright (C) 1994-1996 Charles L. Blake.
29 * Copyright (C) 1992-1998 Michael K. Johnson 29 * Copyright (C) 1992-1998 Michael K. Johnson
30 * 30 *
31 * Licensed under GPLv2, see file LICENSE in this tarball for details. 31 * Licensed under GPLv2, see file LICENSE in this source tree.
32 */ 32 */
33 33
34#include "libbb.h" 34#include "libbb.h"
@@ -942,20 +942,20 @@ int top_main(int argc UNUSED_PARAM, char **argv)
942 } 942 }
943#if ENABLE_FEATURE_TOPMEM 943#if ENABLE_FEATURE_TOPMEM
944 else { /* TOPMEM */ 944 else { /* TOPMEM */
945 if (!(p->mapped_ro | p->mapped_rw)) 945 if (!(p->smaps.mapped_ro | p->smaps.mapped_rw))
946 continue; /* kernel threads are ignored */ 946 continue; /* kernel threads are ignored */
947 n = ntop; 947 n = ntop;
948 /* No bug here - top and topmem are the same */ 948 /* No bug here - top and topmem are the same */
949 top = xrealloc_vector(topmem, 6, ntop++); 949 top = xrealloc_vector(topmem, 6, ntop++);
950 strcpy(topmem[n].comm, p->comm); 950 strcpy(topmem[n].comm, p->comm);
951 topmem[n].pid = p->pid; 951 topmem[n].pid = p->pid;
952 topmem[n].vsz = p->mapped_rw + p->mapped_ro; 952 topmem[n].vsz = p->smaps.mapped_rw + p->smaps.mapped_ro;
953 topmem[n].vszrw = p->mapped_rw; 953 topmem[n].vszrw = p->smaps.mapped_rw;
954 topmem[n].rss_sh = p->shared_clean + p->shared_dirty; 954 topmem[n].rss_sh = p->smaps.shared_clean + p->smaps.shared_dirty;
955 topmem[n].rss = p->private_clean + p->private_dirty + topmem[n].rss_sh; 955 topmem[n].rss = p->smaps.private_clean + p->smaps.private_dirty + topmem[n].rss_sh;
956 topmem[n].dirty = p->private_dirty + p->shared_dirty; 956 topmem[n].dirty = p->smaps.private_dirty + p->smaps.shared_dirty;
957 topmem[n].dirty_sh = p->shared_dirty; 957 topmem[n].dirty_sh = p->smaps.shared_dirty;
958 topmem[n].stack = p->stack; 958 topmem[n].stack = p->smaps.stack;
959 } 959 }
960#endif 960#endif
961 } /* end of "while we read /proc" */ 961 } /* end of "while we read /proc" */
diff --git a/procps/uptime.c b/procps/uptime.c
index d9aa1d037..5c48795bf 100644
--- a/procps/uptime.c
+++ b/procps/uptime.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* This version of uptime doesn't display the number of users on the system, 10/* This version of uptime doesn't display the number of users on the system,
diff --git a/procps/watch.c b/procps/watch.c
index a1cde9ea0..36f71c469 100644
--- a/procps/watch.c
+++ b/procps/watch.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2001 by Michael Habermann <mhabermann@gmx.de> 5 * Copyright (C) 2001 by Michael Habermann <mhabermann@gmx.de>
6 * Copyrigjt (C) Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 6 * Copyrigjt (C) Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* BB_AUDIT SUSv3 N/A */ 11/* BB_AUDIT SUSv3 N/A */
diff --git a/runit/Kbuild.src b/runit/Kbuild.src
index 4d85372df..d38bad20f 100644
--- a/runit/Kbuild.src
+++ b/runit/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/scripts/echo.c b/scripts/echo.c
index 3c45e339c..cb207ae05 100644
--- a/scripts/echo.c
+++ b/scripts/echo.c
@@ -6,7 +6,7 @@
6 * Copyright (c) 1991, 1993 6 * Copyright (c) 1991, 1993
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 * 10 *
11 * Original copyright notice is retained at the end of this file. 11 * Original copyright notice is retained at the end of this file.
12 */ 12 */
diff --git a/scripts/mkconfigs b/scripts/mkconfigs
index ef6ae8aaf..47ac53330 100755
--- a/scripts/mkconfigs
+++ b/scripts/mkconfigs
@@ -26,26 +26,51 @@
26# - Retain lines that begin with "# CONFIG_" 26# - Retain lines that begin with "# CONFIG_"
27# - lines that use double-quotes must \\-escape-quote them 27# - lines that use double-quotes must \\-escape-quote them
28 28
29config="$1" 29config=.config
30if [ $# -lt 1 ]
31then
32 config=.config
33fi
34 30
31{
35echo "\ 32echo "\
36#ifndef _BBCONFIGOPTS_H 33#ifndef _BBCONFIGOPTS_H
37#define _BBCONFIGOPTS_H 34#define _BBCONFIGOPTS_H
38/* 35/*
39 * busybox configuration settings. 36 * busybox configuration settings.
40 * 37 *
41 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 38 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
42 * 39 *
43 * This file is generated automatically by scripts/mkconfigs. 40 * This file is generated automatically by scripts/mkconfigs.
44 * Do not edit. 41 * Do not edit.
45 */ 42 */
46static const char bbconfig_config[] =" 43static const char bbconfig_config[] ALIGN1 ="
47 44
48sed 's/\"/\\\"/g' $config | grep "^#\? \?CONFIG_" | awk '{print "\"" $0 "\\n\"";}' 45grep '^#\? \?CONFIG_' "$config" \
46| sed -e 's/\"/\\\"/g' -e 's/^/"/' -e 's/$/\\n"/'
49 47
50echo ";" 48echo ";"
51echo "#endif /* _BBCONFIGOPTS_H */" 49echo "#endif"
50} >"$1"
51
52{
53echo "\
54#ifndef _BBCONFIGOPTS_BZ2_H
55#define _BBCONFIGOPTS_BZ2_H
56/*
57 * busybox configuration settings.
58 *
59 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
60 *
61 * This file is generated automatically by scripts/mkconfigs.
62 * Do not edit.
63 */
64static const char bbconfig_config_bz2[] ALIGN1 = {"
65
66grep '^#\? \?CONFIG_' "$config" \
67| bzip2 -1 | dd bs=2 skip=1 2>/dev/null \
68| od -v -t x1 \
69| sed -e 's/^[^ ]*//' \
70 -e 's/ //g' \
71 -e '/^$/d' \
72 -e 's/\(..\)/0x\1,/g'
73
74echo "};"
75echo "#endif"
76} >"$2"
diff --git a/scripts/showasm b/scripts/showasm
index dc2cd705d..b61ab98d0 100755
--- a/scripts/showasm
+++ b/scripts/showasm
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2006 Rob Landley <rob@landley.net> 3# Copyright 2006 Rob Landley <rob@landley.net>
4# Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 4# Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 5
6# Dumb little utility function to print out the assembly dump of a single 6# Dumb little utility function to print out the assembly dump of a single
7# function, or list the functions so dumpable in an executable. You'd think 7# function, or list the functions so dumpable in an executable. You'd think
diff --git a/selinux/Kbuild.src b/selinux/Kbuild.src
index 6567e3c07..cdd5f2adf 100644
--- a/selinux/Kbuild.src
+++ b/selinux/Kbuild.src
@@ -3,7 +3,7 @@
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# Copyright (C) 2007 by KaiGai Kohei <kaigai@kaigai.gr.jp> 4# Copyright (C) 2007 by KaiGai Kohei <kaigai@kaigai.gr.jp>
5# 5#
6# Licensed under the GPL v2, see the file LICENSE in this tarball. 6# Licensed under GPLv2, see file LICENSE in this source tree.
7 7
8lib-y:= 8lib-y:=
9 9
diff --git a/selinux/chcon.c b/selinux/chcon.c
index c6be37f44..e00cdda1b 100644
--- a/selinux/chcon.c
+++ b/selinux/chcon.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2006 - 2007 KaiGai Kohei <kaigai@kaigai.gr.jp> 6 * Copyright (C) 2006 - 2007 KaiGai Kohei <kaigai@kaigai.gr.jp>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include <getopt.h> 10#include <getopt.h>
11#include <selinux/context.h> 11#include <selinux/context.h>
diff --git a/selinux/getenforce.c b/selinux/getenforce.c
index 3d3eef14c..d9d9d0f65 100644
--- a/selinux/getenforce.c
+++ b/selinux/getenforce.c
@@ -4,7 +4,7 @@
4 * Based on libselinux 1.33.1 4 * Based on libselinux 1.33.1
5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp> 5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/selinux/getsebool.c b/selinux/getsebool.c
index 7478b79e1..924356cae 100644
--- a/selinux/getsebool.c
+++ b/selinux/getsebool.c
@@ -4,7 +4,7 @@
4 * Based on libselinux 1.33.1 4 * Based on libselinux 1.33.1
5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp> 5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/selinux/load_policy.c b/selinux/load_policy.c
index ea7c9132a..8fc92dbf3 100644
--- a/selinux/load_policy.c
+++ b/selinux/load_policy.c
@@ -2,7 +2,7 @@
2 * load_policy 2 * load_policy
3 * Author: Yuichi Nakamura <ynakam@hitachisoft.jp> 3 * Author: Yuichi Nakamura <ynakam@hitachisoft.jp>
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include "libbb.h" 7#include "libbb.h"
8 8
diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c
index 1532429b6..ec49077c8 100644
--- a/selinux/matchpathcon.c
+++ b/selinux/matchpathcon.c
@@ -3,7 +3,7 @@
3 * based on libselinux-1.32 3 * based on libselinux-1.32
4 * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp> 4 * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9 9
diff --git a/selinux/runcon.c b/selinux/runcon.c
index f8ca9a6aa..b70a5e396 100644
--- a/selinux/runcon.c
+++ b/selinux/runcon.c
@@ -26,7 +26,7 @@
26 * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp> 26 * Port to busybox: KaiGai Kohei <kaigai@kaigai.gr.jp>
27 * - based on coreutils-5.97 (in Fedora Core 6) 27 * - based on coreutils-5.97 (in Fedora Core 6)
28 * 28 *
29 * Licensed under GPLv2, see file LICENSE in this tarball for details. 29 * Licensed under GPLv2, see file LICENSE in this source tree.
30 */ 30 */
31#include <getopt.h> 31#include <getopt.h>
32#include <selinux/context.h> 32#include <selinux/context.h>
diff --git a/selinux/selinuxenabled.c b/selinux/selinuxenabled.c
index 1cf93c3f3..aa4e63f74 100644
--- a/selinux/selinuxenabled.c
+++ b/selinux/selinuxenabled.c
@@ -4,7 +4,7 @@
4 * Based on libselinux 1.33.1 4 * Based on libselinux 1.33.1
5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp> 5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/selinux/sestatus.c b/selinux/sestatus.c
index 1a02a6b0c..7fb2b470b 100644
--- a/selinux/sestatus.c
+++ b/selinux/sestatus.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) KaiGai Kohei <kaigai@ak.jp.nec.com> 6 * Copyright (C) KaiGai Kohei <kaigai@ak.jp.nec.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/selinux/setenforce.c b/selinux/setenforce.c
index 45f82238c..be5432147 100644
--- a/selinux/setenforce.c
+++ b/selinux/setenforce.c
@@ -4,7 +4,7 @@
4 * Based on libselinux 1.33.1 4 * Based on libselinux 1.33.1
5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp> 5 * Port to BusyBox Hiroshi Shinji <shiroshi@my.email.ne.jp>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/selinux/setsebool.c b/selinux/setsebool.c
index b615ce783..a8cc00407 100644
--- a/selinux/setsebool.c
+++ b/selinux/setsebool.c
@@ -5,7 +5,7 @@
5 * omitted in this version 5 * omitted in this version
6 * Yuichi Nakamura <ynakam@hitachisoft.jp> 6 * Yuichi Nakamura <ynakam@hitachisoft.jp>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/shell/Kbuild.src b/shell/Kbuild.src
index a669bdfb0..c00aec92a 100644
--- a/shell/Kbuild.src
+++ b/shell/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/shell/ash.c b/shell/ash.c
index f7fad88cd..6d67a1f8a 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13,7 +13,7 @@
13 * Copyright (c) 1997-2005 Herbert Xu <herbert@gondor.apana.org.au> 13 * Copyright (c) 1997-2005 Herbert Xu <herbert@gondor.apana.org.au>
14 * was re-ported from NetBSD and debianized. 14 * was re-ported from NetBSD and debianized.
15 * 15 *
16 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 16 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
17 */ 17 */
18 18
19/* 19/*
@@ -5204,9 +5204,13 @@ noclobberopen(const char *fname)
5204 * revealed that it was a regular file, and the file has not been 5204 * revealed that it was a regular file, and the file has not been
5205 * replaced, return the file descriptor. 5205 * replaced, return the file descriptor.
5206 */ 5206 */
5207 if (fstat(fd, &finfo2) == 0 && !S_ISREG(finfo2.st_mode) 5207 if (fstat(fd, &finfo2) == 0
5208 && finfo.st_dev == finfo2.st_dev && finfo.st_ino == finfo2.st_ino) 5208 && !S_ISREG(finfo2.st_mode)
5209 && finfo.st_dev == finfo2.st_dev
5210 && finfo.st_ino == finfo2.st_ino
5211 ) {
5209 return fd; 5212 return fd;
5213 }
5210 5214
5211 /* The file has been replaced. badness. */ 5215 /* The file has been replaced. badness. */
5212 close(fd); 5216 close(fd);
@@ -11611,10 +11615,9 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11611 if (dqvarnest > 0) { 11615 if (dqvarnest > 0) {
11612 dqvarnest--; 11616 dqvarnest--;
11613 } 11617 }
11614 USTPUTC(CTLENDVAR, out); 11618 c = CTLENDVAR;
11615 } else {
11616 USTPUTC(c, out);
11617 } 11619 }
11620 USTPUTC(c, out);
11618 break; 11621 break;
11619#if ENABLE_SH_MATH_SUPPORT 11622#if ENABLE_SH_MATH_SUPPORT
11620 case CLP: /* '(' in arithmetic */ 11623 case CLP: /* '(' in arithmetic */
@@ -11623,25 +11626,23 @@ readtoken1(int c, int syntax, char *eofmark, int striptabs)
11623 break; 11626 break;
11624 case CRP: /* ')' in arithmetic */ 11627 case CRP: /* ')' in arithmetic */
11625 if (parenlevel > 0) { 11628 if (parenlevel > 0) {
11626 USTPUTC(c, out); 11629 parenlevel--;
11627 --parenlevel;
11628 } else { 11630 } else {
11629 if (pgetc() == ')') { 11631 if (pgetc() == ')') {
11630 if (--arinest == 0) { 11632 if (--arinest == 0) {
11631 USTPUTC(CTLENDARI, out);
11632 syntax = prevsyntax; 11633 syntax = prevsyntax;
11633 dblquote = (syntax == DQSYNTAX); 11634 dblquote = (syntax == DQSYNTAX);
11634 } else 11635 c = CTLENDARI;
11635 USTPUTC(')', out); 11636 }
11636 } else { 11637 } else {
11637 /* 11638 /*
11638 * unbalanced parens 11639 * unbalanced parens
11639 * (don't 2nd guess - no error) 11640 * (don't 2nd guess - no error)
11640 */ 11641 */
11641 pungetc(); 11642 pungetc();
11642 USTPUTC(')', out);
11643 } 11643 }
11644 } 11644 }
11645 USTPUTC(c, out);
11645 break; 11646 break;
11646#endif 11647#endif
11647 case CBQUOTE: /* '`' */ 11648 case CBQUOTE: /* '`' */
diff --git a/shell/ash_ptr_hack.c b/shell/ash_ptr_hack.c
index 68d907292..f69840825 100644
--- a/shell/ash_ptr_hack.c
+++ b/shell/ash_ptr_hack.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8struct globals_misc; 8struct globals_misc;
diff --git a/shell/ash_test/ash-vars/var_bash5.right b/shell/ash_test/ash-vars/var_bash5.right
new file mode 100644
index 000000000..278ed3228
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash5.right
@@ -0,0 +1,4 @@
1a/
2a/d
3a/e/f
4Done: 0
diff --git a/shell/ash_test/ash-vars/var_bash5.tests b/shell/ash_test/ash-vars/var_bash5.tests
new file mode 100755
index 000000000..3f49321e1
--- /dev/null
+++ b/shell/ash_test/ash-vars/var_bash5.tests
@@ -0,0 +1,11 @@
1# This testcase checks whether slashes in ${v/a/b} are parsed before or after expansions
2# in a part
3
4v='a/b/c'
5s='b/c'
6r='e/f'
7echo "${v/$s}"
8echo "${v/$s/d}"
9echo "${v/$s/$r}"
10
11echo Done: $?
diff --git a/shell/bbsh.c b/shell/bbsh.c
index 83132f928..8e25db458 100644
--- a/shell/bbsh.c
+++ b/shell/bbsh.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2006 Rob Landley <rob@landley.net> 5 * Copyright 2006 Rob Landley <rob@landley.net>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10// A section of code that gets repeatedly or conditionally executed is stored 10// A section of code that gets repeatedly or conditionally executed is stored
diff --git a/shell/cttyhack.c b/shell/cttyhack.c
index 7a5e1ffd2..d1cb7fcc3 100644
--- a/shell/cttyhack.c
+++ b/shell/cttyhack.c
@@ -1,8 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Licensed under GPLv2
4 *
5 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com> 3 * Copyright (c) 2007 Denys Vlasenko <vda.linux@googlemail.com>
4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7#include "libbb.h" 7#include "libbb.h"
8 8
diff --git a/shell/hush.c b/shell/hush.c
index df4058998..e8dfb2499 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -79,7 +79,7 @@
79 * $ "export" i=`echo 'aaa bbb'`; echo "$i" 79 * $ "export" i=`echo 'aaa bbb'`; echo "$i"
80 * aaa 80 * aaa
81 * 81 *
82 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 82 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
83 */ 83 */
84#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */ 84#include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */
85#include <malloc.h> /* for malloc_trim */ 85#include <malloc.h> /* for malloc_trim */
diff --git a/shell/match.c b/shell/match.c
index fb6a38ef1..8b1ddacd5 100644
--- a/shell/match.c
+++ b/shell/match.c
@@ -4,7 +4,7 @@
4 * This code is derived from software contributed to Berkeley by 4 * This code is derived from software contributed to Berkeley by
5 * Kenneth Almquist. 5 * Kenneth Almquist.
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 * Copyright (c) 1989, 1991, 1993, 1994 9 * Copyright (c) 1989, 1991, 1993, 1994
10 * The Regents of the University of California. All rights reserved. 10 * The Regents of the University of California. All rights reserved.
diff --git a/shell/math.c b/shell/math.c
index 91fb28f05..f0cc2e35d 100644
--- a/shell/math.c
+++ b/shell/math.c
@@ -23,7 +23,7 @@
23 * rewrote arith (see notes to this), added locale support, 23 * rewrote arith (see notes to this), added locale support,
24 * rewrote dynamic variables. 24 * rewrote dynamic variables.
25 * 25 *
26 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 26 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
27 */ 27 */
28/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com> 28/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com>
29 29
diff --git a/shell/random.c b/shell/random.c
index 7f5821cbc..853ab085a 100644
--- a/shell/random.c
+++ b/shell/random.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Denys Vlasenko 5 * Copyright (C) 2009 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include "random.h" 10#include "random.h"
diff --git a/shell/random.h b/shell/random.h
index 08563402c..180c48abb 100644
--- a/shell/random.h
+++ b/shell/random.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Denys Vlasenko 5 * Copyright (C) 2009 Denys Vlasenko
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#ifndef SHELL_RANDOM_H 9#ifndef SHELL_RANDOM_H
10#define SHELL_RANDOM_H 1 10#define SHELL_RANDOM_H 1
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 957d71928..0b9d4ebe6 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -14,7 +14,7 @@
14 * Copyright (c) 2010 Denys Vlasenko 14 * Copyright (c) 2010 Denys Vlasenko
15 * Split from ash.c 15 * Split from ash.c
16 * 16 *
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19#include "libbb.h" 19#include "libbb.h"
20#include "shell_common.h" 20#include "shell_common.h"
@@ -429,7 +429,7 @@ shell_builtin_ulimit(char **argv)
429 else 429 else
430 val = bb_strtoull(val_str, NULL, 10); 430 val = bb_strtoull(val_str, NULL, 10);
431 if (errno) { 431 if (errno) {
432 bb_error_msg("bad number"); 432 bb_error_msg("invalid number '%s'", val_str);
433 return EXIT_FAILURE; 433 return EXIT_FAILURE;
434 } 434 }
435 val <<= l->factor_shift; 435 val <<= l->factor_shift;
diff --git a/shell/shell_common.h b/shell/shell_common.h
index 1e9f6a691..f06bc4120 100644
--- a/shell/shell_common.h
+++ b/shell/shell_common.h
@@ -14,7 +14,7 @@
14 * Copyright (c) 2010 Denys Vlasenko 14 * Copyright (c) 2010 Denys Vlasenko
15 * Split from ash.c 15 * Split from ash.c
16 * 16 *
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19#ifndef SHELL_COMMON_H 19#ifndef SHELL_COMMON_H
20#define SHELL_COMMON_H 1 20#define SHELL_COMMON_H 1
diff --git a/sysklogd/Kbuild.src b/sysklogd/Kbuild.src
index faaac110c..d386cc291 100644
--- a/sysklogd/Kbuild.src
+++ b/sysklogd/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 3468656cc..6766b649d 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -14,7 +14,7 @@
14 * 14 *
15 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001 15 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
16 * 16 *
17 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19 19
20#include "libbb.h" 20#include "libbb.h"
diff --git a/sysklogd/logger.c b/sysklogd/logger.c
index def833070..ff1519192 100644
--- a/sysklogd/logger.c
+++ b/sysklogd/logger.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 1e8d6bcc0..52c97aa77 100644
--- a/sysklogd/logread.c
+++ b/sysklogd/logread.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001 7 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 37a119b3d..fb7309538 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -10,7 +10,7 @@
10 * 10 *
11 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001 11 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
12 * 12 *
13 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15 15
16/* 16/*
diff --git a/sysklogd/syslogd_and_logger.c b/sysklogd/syslogd_and_logger.c
index 51573bd92..0964f239c 100644
--- a/sysklogd/syslogd_and_logger.c
+++ b/sysklogd/syslogd_and_logger.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@gmail.com> 5 * Copyright (C) 2008 by Denys Vlasenko <vda.linux@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/testsuite/all_sourcecode.tests b/testsuite/all_sourcecode.tests
index 071399c28..7dcbbe8f5 100755
--- a/testsuite/all_sourcecode.tests
+++ b/testsuite/all_sourcecode.tests
@@ -2,7 +2,7 @@
2 2
3# Tests for the sourcecode base itself. 3# Tests for the sourcecode base itself.
4# Copyright 2006 by Mike Frysinger <vapier@gentoo.org> 4# Copyright 2006 by Mike Frysinger <vapier@gentoo.org>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7[ -n "$srcdir" ] || srcdir=$(pwd) 7[ -n "$srcdir" ] || srcdir=$(pwd)
8. ./testing.sh 8. ./testing.sh
diff --git a/testsuite/ar.tests b/testsuite/ar.tests
index 4630d08a4..0a8eb9b32 100755
--- a/testsuite/ar.tests
+++ b/testsuite/ar.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2010 Nokia Corporation 2# Copyright 2010 Nokia Corporation
3# Written by Alexander Shishkin 3# Written by Alexander Shishkin
4# Licensed under GPL v2 or later, see file LICENSE for details 4# Licensed under GPLv2 or later, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/ash.tests b/testsuite/ash.tests
index 2eeb746e4..2a99245a9 100755
--- a/testsuite/ash.tests
+++ b/testsuite/ash.tests
@@ -3,7 +3,7 @@
3# These are not ash tests, we use ash as a way to test lineedit! 3# These are not ash tests, we use ash as a way to test lineedit!
4# 4#
5# Copyright 2010 by Denys Vlasenko 5# Copyright 2010 by Denys Vlasenko
6# Licensed under GPL v2, see file LICENSE for details. 6# Licensed under GPLv2, see file LICENSE in this source tree.
7 7
8. ./testing.sh 8. ./testing.sh
9test -f "$bindir/.config" && . "$bindir/.config" 9test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 0691a7972..9e5e5a0f1 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/bunzip2.tests b/testsuite/bunzip2.tests
index 734acbb75..827aee867 100755
--- a/testsuite/bunzip2.tests
+++ b/testsuite/bunzip2.tests
@@ -1,6 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2# Used by both gunzip and bunzip2 tests 2# Used by both gunzip and bunzip2 tests
3 3
4FAILCOUNT=0
5
4if test "${0##*/}" = "gunzip.tests"; then 6if test "${0##*/}" = "gunzip.tests"; then
5 unpack=gunzip 7 unpack=gunzip
6 ext=gz 8 ext=gz
@@ -473,6 +475,7 @@ check() {
473 echo "PASS: $1" 475 echo "PASS: $1"
474 else 476 else
475 echo "FAIL: $1" 477 echo "FAIL: $1"
478 FAILCOUNT=$((FAILCOUNT + 1))
476 fi 479 fi
477} 480}
478 481
@@ -520,5 +523,8 @@ if test "${0##*/}" = "bunzip2.tests"; then
520 echo "PASS: $unpack: test bz2 file" 523 echo "PASS: $unpack: test bz2 file"
521 else 524 else
522 echo "FAIL: $unpack: test bz2 file" 525 echo "FAIL: $unpack: test bz2 file"
526 FAILCOUNT=$((FAILCOUNT + 1))
523 fi 527 fi
524fi 528fi
529
530exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
diff --git a/testsuite/busybox.tests b/testsuite/busybox.tests
index 0c740530d..04fea3ea2 100755
--- a/testsuite/busybox.tests
+++ b/testsuite/busybox.tests
@@ -2,7 +2,7 @@
2 2
3# Tests for busybox applet itself. 3# Tests for busybox applet itself.
4# Copyright 2005 by Rob Landley <rob@landley.net> 4# Copyright 2005 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7. ./testing.sh 7. ./testing.sh
8 8
diff --git a/testsuite/bzcat.tests b/testsuite/bzcat.tests
index 78d74f229..5b4f3f4b3 100755
--- a/testsuite/bzcat.tests
+++ b/testsuite/bzcat.tests
@@ -1,5 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3FAILCOUNT=0
4
3ext=bz2 5ext=bz2
4 6
5bb="busybox " 7bb="busybox "
@@ -35,6 +37,7 @@ check() {
35 echo "PASS: $1" 37 echo "PASS: $1"
36 else 38 else
37 echo "FAIL: $1" 39 echo "FAIL: $1"
40 FAILCOUNT=$((FAILCOUNT + 1))
38 fi 41 fi
39} 42}
40 43
@@ -47,3 +50,5 @@ prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo
47 50
48) 51)
49rm -rf testdir 52rm -rf testdir
53
54exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
diff --git a/testsuite/cal.tests b/testsuite/cal.tests
index db693ee59..5509cf0ef 100755
--- a/testsuite/cal.tests
+++ b/testsuite/cal.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2010 by Denys Vlasenko 2# Copyright 2010 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config" 6test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/comm.tests b/testsuite/comm.tests
index 753db217c..2f4816893 100755
--- a/testsuite/comm.tests
+++ b/testsuite/comm.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/cp.tests b/testsuite/cp.tests
index e81939df5..33cd876be 100755
--- a/testsuite/cp.tests
+++ b/testsuite/cp.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2010 by Denys Vlasenko 2# Copyright 2010 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
index 44c17e693..05b92dbe4 100755
--- a/testsuite/cpio.tests
+++ b/testsuite/cpio.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/cut.tests b/testsuite/cut.tests
index 0fd79f2df..110340277 100755
--- a/testsuite/cut.tests
+++ b/testsuite/cut.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/diff.tests b/testsuite/diff.tests
index 27a4b33a7..6de46483b 100755
--- a/testsuite/diff.tests
+++ b/testsuite/diff.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/expand.tests b/testsuite/expand.tests
index 631ab4db3..0682c2950 100755
--- a/testsuite/expand.tests
+++ b/testsuite/expand.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config" 6test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/fold.tests b/testsuite/fold.tests
index e5700cc2b..ecf8b9caa 100755
--- a/testsuite/fold.tests
+++ b/testsuite/fold.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2009 by Denys Vlasenko 2# Copyright 2009 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config" 6test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/grep.tests b/testsuite/grep.tests
index d4bf80d83..ffce033e6 100755
--- a/testsuite/grep.tests
+++ b/testsuite/grep.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2005 by Rob Landley <rob@landley.net> 3# Copyright 2005 by Rob Landley <rob@landley.net>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6# AUDIT: 6# AUDIT:
7 7
@@ -98,5 +98,9 @@ testing "grep -o does not loop forever" \
98 'grep -o "[^/]*$"' \ 98 'grep -o "[^/]*$"' \
99 "test\n" \ 99 "test\n" \
100 "" "/var/test\n" 100 "" "/var/test\n"
101testing "grep -o does not loop forever on zero-length match" \
102 'grep -o "" | head -n1' \
103 "" \
104 "" "test\n"
101 105
102exit $FAILCOUNT 106exit $FAILCOUNT
diff --git a/testsuite/ls.tests b/testsuite/ls.tests
index dc842123d..1669579e7 100755
--- a/testsuite/ls.tests
+++ b/testsuite/ls.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2010 by Denys Vlasenko 2# Copyright 2010 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config" 6test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/makedevs.tests b/testsuite/makedevs.tests
index f19af8a52..eb51410b3 100755
--- a/testsuite/makedevs.tests
+++ b/testsuite/makedevs.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests
index c375fc774..7320e17dd 100755
--- a/testsuite/mdev.tests
+++ b/testsuite/mdev.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
@@ -38,6 +38,16 @@ brw-rw---- 1 0 0 8,0 sda
38SKIP= 38SKIP=
39 39
40# continuing to use directory structure from prev test 40# continuing to use directory structure from prev test
41optional STATIC FEATURE_MDEV_CONF FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME
42testing "mdev deletes /block/sda" \
43 "env - PATH=$PATH ACTION=remove DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
44 ls -ln mdev.testdir/dev | $FILTER_LS" \
45"\
46" \
47 "" ""
48SKIP=
49
50# continuing to use directory structure from prev test
41rm -rf mdev.testdir/dev/* 51rm -rf mdev.testdir/dev/*
42echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf 52echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf
43echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf 53echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
diff --git a/testsuite/mkfs.minix.tests b/testsuite/mkfs.minix.tests
index 7cad7daa6..8a33c1681 100755
--- a/testsuite/mkfs.minix.tests
+++ b/testsuite/mkfs.minix.tests
@@ -2,7 +2,7 @@
2 2
3# mkfs.minix tests. 3# mkfs.minix tests.
4# Copyright 2007 by Denys Vlasenko 4# Copyright 2007 by Denys Vlasenko
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7. ./testing.sh 7. ./testing.sh
8 8
diff --git a/testsuite/mount.testroot b/testsuite/mount.testroot
index e18d0461d..4f34c5719 100755
--- a/testsuite/mount.testroot
+++ b/testsuite/mount.testroot
@@ -2,7 +2,7 @@
2 2
3# SUSv3 compliant mount and umount tests. 3# SUSv3 compliant mount and umount tests.
4# Copyright 2005 by Rob Landley <rob@landley.net> 4# Copyright 2005 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7if [ -z "$TESTDIR" ] 7if [ -z "$TESTDIR" ]
8then 8then
diff --git a/testsuite/mount.tests b/testsuite/mount.tests
index ce1a6006b..d3d2400e8 100755
--- a/testsuite/mount.tests
+++ b/testsuite/mount.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> 2# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config" 6test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/od.tests b/testsuite/od.tests
index a2d015ad7..138efedea 100755
--- a/testsuite/od.tests
+++ b/testsuite/od.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/parse.tests b/testsuite/parse.tests
index 999efef1c..9899b73bf 100755
--- a/testsuite/parse.tests
+++ b/testsuite/parse.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/patch.tests b/testsuite/patch.tests
index f55b53f61..e482304f6 100755
--- a/testsuite/patch.tests
+++ b/testsuite/patch.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
@@ -129,7 +129,6 @@ abc
129" \ 129" \
130 130
131# testing "test name" "command(s)" "expected result" "file input" "stdin" 131# testing "test name" "command(s)" "expected result" "file input" "stdin"
132
133testing "patch -N ignores already applied hunk" \ 132testing "patch -N ignores already applied hunk" \
134 'patch -N 2>&1; echo $?; cat input' \ 133 'patch -N 2>&1; echo $?; cat input' \
135"\ 134"\
@@ -153,6 +152,29 @@ def
153 123 152 123
154" \ 153" \
155 154
155# testing "test name" "command(s)" "expected result" "file input" "stdin"
156testing "patch FILE PATCH" \
157 'cat >a.patch; patch input a.patch 2>&1; echo $?; cat input; rm a.patch' \
158"\
159patching file input
1600
161abc
162def
163123
164" \
165"\
166abc
167123
168" \
169"\
170--- foo.old
171+++ foo
172@@ -1,2 +1,3 @@
173 abc
174+def
175 123
176" \
177
156rm input.orig 2>/dev/null 178rm input.orig 2>/dev/null
157 179
158exit $FAILCOUNT 180exit $FAILCOUNT
diff --git a/testsuite/pidof.tests b/testsuite/pidof.tests
index 624b0a720..2a06d2b1c 100755
--- a/testsuite/pidof.tests
+++ b/testsuite/pidof.tests
@@ -2,7 +2,7 @@
2 2
3# pidof tests. 3# pidof tests.
4# Copyright 2005 by Bernhard Reutner-Fischer 4# Copyright 2005 by Bernhard Reutner-Fischer
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7# AUDIT: 7# AUDIT:
8 8
diff --git a/testsuite/printf.tests b/testsuite/printf.tests
index 95f8110ad..b48e293f4 100755
--- a/testsuite/printf.tests
+++ b/testsuite/printf.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/readlink.tests b/testsuite/readlink.tests
index ecc3ad03e..c7fc8adf0 100755
--- a/testsuite/readlink.tests
+++ b/testsuite/readlink.tests
@@ -2,7 +2,7 @@
2 2
3# Readlink tests. 3# Readlink tests.
4# Copyright 2006 by Natanael Copa <n@tanael.org> 4# Copyright 2006 by Natanael Copa <n@tanael.org>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7. ./testing.sh 7. ./testing.sh
8 8
@@ -29,3 +29,5 @@ testing "readlink -f on a wierd dir" "readlink -f $TESTDIR/../$TESTFILE" "$PWD/$
29 29
30# clean up 30# clean up
31rm -r "$TESTLINK" "$TESTDIR" 31rm -r "$TESTLINK" "$TESTDIR"
32
33exit $((FAILCOUNT <= 255 ? FAILCOUNT : 255))
diff --git a/testsuite/runtest b/testsuite/runtest
index c300233cd..9a4fccbbf 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -4,6 +4,8 @@
4 4
5. ./testing.sh 5. ./testing.sh
6 6
7total_failed=0
8
7# Run one old-style test. 9# Run one old-style test.
8# Tests are stored in applet/testcase shell scripts. 10# Tests are stored in applet/testcase shell scripts.
9# They are run using "sh -x -e applet/testcase". 11# They are run using "sh -x -e applet/testcase".
@@ -73,6 +75,7 @@ run_oldstyle_applet_tests()
73 *.r[0-9]*) continue ;; # svn-produced junk 75 *.r[0-9]*) continue ;; # svn-produced junk
74 esac 76 esac
75 run_applet_testcase "$applet" "$testcase" || status=1 77 run_applet_testcase "$applet" "$testcase" || status=1
78 total_failed=$((total_failed + status))
76 done 79 done
77 return $status 80 return $status
78} 81}
@@ -150,7 +153,10 @@ for applet in $applets; do
150 fi 153 fi
151# echo "Running test $tsdir/$applet.tests" 154# echo "Running test $tsdir/$applet.tests"
152 PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \ 155 PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \
153 "$tsdir/$applet.tests" || status=1 156 "$tsdir/$applet.tests"
157 rc=$?
158 total_failed=$((total_failed + rc))
159 test $rc -ne 0 && status=1
154 fi 160 fi
155done 161done
156 162
@@ -158,6 +164,6 @@ done
158#rm -rf "$LINKSDIR" 164#rm -rf "$LINKSDIR"
159 165
160if [ $status -ne 0 ] && [ x"$VERBOSE" = x ]; then 166if [ $status -ne 0 ] && [ x"$VERBOSE" = x ]; then
161 echo "Failures detected, running with -v (verbose) will give more info" 167 echo "$total_failed failure(s) detected; running with -v (verbose) will give more info"
162fi 168fi
163exit $status 169exit $status
diff --git a/testsuite/rx.tests b/testsuite/rx.tests
index 985fcdc01..37fa02e5e 100755
--- a/testsuite/rx.tests
+++ b/testsuite/rx.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2009 by Denys Vlasenko 2# Copyright 2009 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/sed.tests b/testsuite/sed.tests
index 880fc2118..395372ae6 100755
--- a/testsuite/sed.tests
+++ b/testsuite/sed.tests
@@ -2,7 +2,7 @@
2 2
3# SUSv3 compliant sed tests. 3# SUSv3 compliant sed tests.
4# Copyright 2005 by Rob Landley <rob@landley.net> 4# Copyright 2005 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7. ./testing.sh 7. ./testing.sh
8 8
@@ -80,10 +80,18 @@ test x"$SKIP_KNOWN_BUGS" = x"" && {
80# Query: how does this interact with no newline at EOF? 80# Query: how does this interact with no newline at EOF?
81testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \ 81testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \
82 "a\nb\nb\nc\n" "" "a\nb\nc\n" 82 "a\nb\nb\nc\n" "" "a\nb\nc\n"
83# N does _not_ flush pattern space, therefore c is still in there @ script end.
84testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \
85 "a\nb\na\nb\nc\n" "" "a\nb\nc\n"
86} 83}
84# non-GNU sed: N does _not_ flush pattern space, therefore c is eaten @ script end
85# GNU sed: N flushes pattern space, therefore c is printed too @ script end
86testing "sed N (flushes pattern space (GNU behavior))" "sed -e 'N;p'" \
87 "a\nb\na\nb\nc\n" "" "a\nb\nc\n"
88
89testing "sed N test2" "sed ':a;N;s/\n/ /;ta'" \
90 "a b c\n" "" "a\nb\nc\n"
91
92testing "sed N test3" "sed 'N;s/\n/ /'" \
93 "a b\nc\n" "" "a\nb\nc\n"
94
87testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ 95testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \
88 "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" 96 "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n"
89 97
diff --git a/testsuite/seq.tests b/testsuite/seq.tests
index 7a5537427..1e1116c7d 100755
--- a/testsuite/seq.tests
+++ b/testsuite/seq.tests
@@ -2,7 +2,7 @@
2 2
3# SUSv3 compliant seq tests. 3# SUSv3 compliant seq tests.
4# Copyright 2006 by Rob Landley <rob@landley.net> 4# Copyright 2006 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7# AUDIT: Full SUSv3 coverage (except internationalization). 7# AUDIT: Full SUSv3 coverage (except internationalization).
8 8
diff --git a/testsuite/sort.tests b/testsuite/sort.tests
index 8a810f8d4..91b282ea0 100755
--- a/testsuite/sort.tests
+++ b/testsuite/sort.tests
@@ -2,7 +2,7 @@
2 2
3# SUSv3 compliant sort tests. 3# SUSv3 compliant sort tests.
4# Copyright 2005 by Rob Landley <rob@landley.net> 4# Copyright 2005 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7. ./testing.sh 7. ./testing.sh
8 8
diff --git a/testsuite/start-stop-daemon.tests b/testsuite/start-stop-daemon.tests
index 76b0be08c..d07aeef0e 100755
--- a/testsuite/start-stop-daemon.tests
+++ b/testsuite/start-stop-daemon.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/sum.tests b/testsuite/sum.tests
index da278c787..b9f4cbfa8 100755
--- a/testsuite/sum.tests
+++ b/testsuite/sum.tests
@@ -2,7 +2,7 @@
2 2
3# unit test for sum. 3# unit test for sum.
4# Copyright 2007 by Bernhard Reutner-Fischer 4# Copyright 2007 by Bernhard Reutner-Fischer
5# Licensed under GPL v2 or later, see file LICENSE for details. 5# Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 6
7# AUDIT: Unit tests for sum 7# AUDIT: Unit tests for sum
8 8
diff --git a/testsuite/tail.tests b/testsuite/tail.tests
index d2427d430..7140da262 100755
--- a/testsuite/tail.tests
+++ b/testsuite/tail.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/tar.tests b/testsuite/tar.tests
index 6604b4d22..cef16b65e 100755
--- a/testsuite/tar.tests
+++ b/testsuite/tar.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2009 by Denys Vlasenko 2# Copyright 2009 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/testsuite/taskset.tests b/testsuite/taskset.tests
index 1a19285d7..3fb5c90d0 100755
--- a/testsuite/taskset.tests
+++ b/testsuite/taskset.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2006 Bernhard Reutner-Fischer 2# Copyright 2006 Bernhard Reutner-Fischer
3# Licensed under GPL v2 or later, see file LICENSE for details. 3# Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6a="taskset" 6a="taskset"
diff --git a/testsuite/test.tests b/testsuite/test.tests
index 7d8044467..2c92e34ba 100755
--- a/testsuite/test.tests
+++ b/testsuite/test.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/tr.tests b/testsuite/tr.tests
index 5dabbb52f..5cca299ac 100755
--- a/testsuite/tr.tests
+++ b/testsuite/tr.tests
@@ -1,7 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com> 3# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 4# Licensed under GPLv2, see file LICENSE in this source tree.
5 5
6. ./testing.sh 6. ./testing.sh
7 7
diff --git a/testsuite/unexpand.tests b/testsuite/unexpand.tests
index 8dbe3eb27..7b326dc2c 100755
--- a/testsuite/unexpand.tests
+++ b/testsuite/unexpand.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config" 6test -f "$bindir/.config" && . "$bindir/.config"
diff --git a/testsuite/uniq.tests b/testsuite/uniq.tests
index 02c595a0e..83bf382cd 100755
--- a/testsuite/uniq.tests
+++ b/testsuite/uniq.tests
@@ -2,7 +2,7 @@
2 2
3# SUSv3 compliant uniq tests. 3# SUSv3 compliant uniq tests.
4# Copyright 2005 by Rob Landley <rob@landley.net> 4# Copyright 2005 by Rob Landley <rob@landley.net>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7# AUDIT: Full SUSv3 coverage (except internationalization). 7# AUDIT: Full SUSv3 coverage (except internationalization).
8 8
diff --git a/testsuite/unzip.tests b/testsuite/unzip.tests
index 0ce5da26c..8677a0306 100755
--- a/testsuite/unzip.tests
+++ b/testsuite/unzip.tests
@@ -3,7 +3,7 @@
3# Tests for unzip. 3# Tests for unzip.
4# Copyright 2006 Rob Landley <rob@landley.net> 4# Copyright 2006 Rob Landley <rob@landley.net>
5# Copyright 2006 Glenn McGrath 5# Copyright 2006 Glenn McGrath
6# Licensed under GPL v2, see file LICENSE for details. 6# Licensed under GPLv2, see file LICENSE in this source tree.
7 7
8. ./testing.sh 8. ./testing.sh
9 9
diff --git a/testsuite/uuencode.tests b/testsuite/uuencode.tests
index adb2d3390..cd6191b1b 100755
--- a/testsuite/uuencode.tests
+++ b/testsuite/uuencode.tests
@@ -2,7 +2,7 @@
2 2
3# unit test for uuencode to test functionality. 3# unit test for uuencode to test functionality.
4# Copyright 2006 by Erik Hovland <erik@hovland.org> 4# Copyright 2006 by Erik Hovland <erik@hovland.org>
5# Licensed under GPL v2, see file LICENSE for details. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7# AUDIT: Unit tests for uuencode 7# AUDIT: Unit tests for uuencode
8 8
diff --git a/testsuite/xargs.tests b/testsuite/xargs.tests
index 6463252bf..2d0a201b7 100755
--- a/testsuite/xargs.tests
+++ b/testsuite/xargs.tests
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# Copyright 2008 by Denys Vlasenko 2# Copyright 2008 by Denys Vlasenko
3# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6 6
diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src
index afc0db50e..c06d911ec 100644
--- a/util-linux/Kbuild.src
+++ b/util-linux/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/util-linux/acpid.c b/util-linux/acpid.c
index 11a9f624a..c3b3c8b0b 100644
--- a/util-linux/acpid.c
+++ b/util-linux/acpid.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/util-linux/blkid.c b/util-linux/blkid.c
index ec699d167..4ce44b144 100644
--- a/util-linux/blkid.c
+++ b/util-linux/blkid.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2008 Denys Vlasenko. 5 * Copyright (C) 2008 Denys Vlasenko.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index b0dc592d2..06a03d3fb 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -6,7 +6,7 @@
6 * Copyright 2006 Rob Landley <rob@landley.net> 6 * Copyright 2006 Rob Landley <rob@landley.net>
7 * Copyright 2006 Bernhard Reutner-Fischer <rep.nop@aon.at> 7 * Copyright 2006 Bernhard Reutner-Fischer <rep.nop@aon.at>
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11#include <sys/klog.h> 11#include <sys/klog.h>
12#include "libbb.h" 12#include "libbb.h"
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index 2769a371a..07c8f55d1 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> 5 * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 * This is a from-scratch implementation of fbset; but the de facto fbset 9 * This is a from-scratch implementation of fbset; but the de facto fbset
10 * implementation was a good reference. fbset (original) is released under 10 * implementation was a good reference. fbset (original) is released under
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index 3831ab44e..f5c386c46 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -2,7 +2,7 @@
2/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger 2/* fdformat.c - Low-level formats a floppy disk - Werner Almesberger
3 * 5 July 2003 -- modified for Busybox by Erik Andersen 3 * 5 July 2003 -- modified for Busybox by Erik Andersen
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8#include "libbb.h" 8#include "libbb.h"
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index fc02000e5..b6417a355 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -4,7 +4,7 @@
4 * Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk) 4 * Copyright (C) 1992 A. V. Le Blanc (LeBlanc@mcc.ac.uk)
5 * Copyright (C) 2001,2002 Vladimir Oleynik <dzo@simtreas.ru> (initial bb port) 5 * Copyright (C) 2001,2002 Vladimir Oleynik <dzo@simtreas.ru> (initial bb port)
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#ifndef _LARGEFILE64_SOURCE 10#ifndef _LARGEFILE64_SOURCE
diff --git a/util-linux/fdisk_aix.c b/util-linux/fdisk_aix.c
index 2a0ab1744..ee5df50e5 100644
--- a/util-linux/fdisk_aix.c
+++ b/util-linux/fdisk_aix.c
@@ -2,7 +2,7 @@
2/* 2/*
3 * Copyright (C) Andreas Neuper, Sep 1998. 3 * Copyright (C) Andreas Neuper, Sep 1998.
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this tarball for details. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7 7
8typedef struct { 8typedef struct {
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index 0e3cff50c..785fc661b 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) Andreas Neuper, Sep 1998. 2 * Copyright (C) Andreas Neuper, Sep 1998.
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this tarball for details. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6 6
7#if ENABLE_FEATURE_SGI_LABEL 7#if ENABLE_FEATURE_SGI_LABEL
diff --git a/util-linux/fdisk_sun.c b/util-linux/fdisk_sun.c
index 463082f6a..6b7940c54 100644
--- a/util-linux/fdisk_sun.c
+++ b/util-linux/fdisk_sun.c
@@ -9,7 +9,7 @@
9 * Sat Mar 20 EST 1999 Arnaldo Carvalho de Melo <acme@conectiva.com.br> 9 * Sat Mar 20 EST 1999 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
10 * Internationalization 10 * Internationalization
11 * 11 *
12 * Licensed under GPLv2, see file LICENSE in this tarball for details. 12 * Licensed under GPLv2, see file LICENSE in this source tree.
13 */ 13 */
14 14
15#if ENABLE_FEATURE_SUN_LABEL 15#if ENABLE_FEATURE_SUN_LABEL
diff --git a/util-linux/findfs.c b/util-linux/findfs.c
index 1e9c68752..e1ec41f1b 100644
--- a/util-linux/findfs.c
+++ b/util-linux/findfs.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2006 by Jason Schoon <floydpink@gmail.com> 5 * Copyright (C) 2006 by Jason Schoon <floydpink@gmail.com>
6 * Some portions cribbed from e2fsprogs, util-linux, dosfstools 6 * Some portions cribbed from e2fsprogs, util-linux, dosfstools
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c
index 4949056a6..7ad443086 100644
--- a/util-linux/freeramdisk.c
+++ b/util-linux/freeramdisk.c
@@ -6,7 +6,7 @@
6 * Adjusted a bit by Erik Andersen <andersen@codepoet.org> 6 * Adjusted a bit by Erik Andersen <andersen@codepoet.org>
7 * Unified with fdflush by Tito Ragusa <farmatito@tiscali.it> 7 * Unified with fdflush by Tito Ragusa <farmatito@tiscali.it>
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11#include <sys/mount.h> 11#include <sys/mount.h>
12#include "libbb.h" 12#include "libbb.h"
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 970f5f79f..e02e05fa4 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (C) 1991, 1992 Linus Torvalds. 5 * (C) 1991, 1992 Linus Torvalds.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index adb96751f..7c498538f 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -3,7 +3,7 @@
3 * getopt.c - Enhanced implementation of BSD getopt(1) 3 * getopt.c - Enhanced implementation of BSD getopt(1)
4 * Copyright (c) 1997, 1998, 1999, 2000 Frodo Looijaard <frodol@dds.nl> 4 * Copyright (c) 1997, 1998, 1999, 2000 Frodo Looijaard <frodol@dds.nl>
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8 8
9/* 9/*
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 3db91113d..8c4d521ab 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -6,7 +6,7 @@
6 * Copyright (c) 1989 6 * Copyright (c) 1989
7 * The Regents of the University of California. All rights reserved. 7 * The Regents of the University of California. All rights reserved.
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11 11
12#include "libbb.h" 12#include "libbb.h"
diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c
index 3da2e23c3..922dd0578 100644
--- a/util-linux/hwclock.c
+++ b/util-linux/hwclock.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2002 Robert Griebl <griebl@gmx.de> 5 * Copyright (C) 2002 Robert Griebl <griebl@gmx.de>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8*/ 8*/
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c
index 8b0b226d3..6360c706f 100644
--- a/util-linux/ipcrm.c
+++ b/util-linux/ipcrm.c
@@ -5,7 +5,7 @@
5 * 01 Sept 2004 - Rodney Radford <rradford@mindspring.com> 5 * 01 Sept 2004 - Rodney Radford <rradford@mindspring.com>
6 * Adapted for busybox from util-linux-2.12a. 6 * Adapted for busybox from util-linux-2.12a.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c
index c1103b093..14df65280 100644
--- a/util-linux/ipcs.c
+++ b/util-linux/ipcs.c
@@ -5,7 +5,7 @@
5 * 01 Sept 2004 - Rodney Radford <rradford@mindspring.com> 5 * 01 Sept 2004 - Rodney Radford <rradford@mindspring.com>
6 * Adapted for busybox from util-linux-2.12a. 6 * Adapted for busybox from util-linux-2.12a.
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10 10
11/* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */ 11/* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */
diff --git a/util-linux/losetup.c b/util-linux/losetup.c
index 3873be399..776f784f5 100644
--- a/util-linux/losetup.c
+++ b/util-linux/losetup.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2002 Matt Kraai. 5 * Copyright (C) 2002 Matt Kraai.
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/util-linux/lspci.c b/util-linux/lspci.c
index 514c3a4e0..46e93b04d 100644
--- a/util-linux/lspci.c
+++ b/util-linux/lspci.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Malek Degachi <malek-degachi@laposte.net> 5 * Copyright (C) 2009 Malek Degachi <malek-degachi@laposte.net>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/util-linux/lsusb.c b/util-linux/lsusb.c
index 23b03495f..6f9b54daa 100644
--- a/util-linux/lsusb.c
+++ b/util-linux/lsusb.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 2009 Malek Degachi <malek-degachi@laposte.net> 5 * Copyright (C) 2009 Malek Degachi <malek-degachi@laposte.net>
6 * 6 *
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10 10
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index b4042c07e..a970f91f2 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -5,7 +5,7 @@
5 * Copyright 2005 Rob Landley <rob@landley.net> 5 * Copyright 2005 Rob Landley <rob@landley.net>
6 * Copyright 2005 Frank Sorenson <frank@tuxrocks.com> 6 * Copyright 2005 Frank Sorenson <frank@tuxrocks.com>
7 * 7 *
8 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11#include "xregex.h" 11#include "xregex.h"
@@ -132,6 +132,7 @@ static void make_device(char *path, int delete)
132 major = -1; 132 major = -1;
133 } 133 }
134 } 134 }
135 /* else: for delete, -1 still deletes the node, but < -1 suppresses that */
135 136
136 /* Determine device name, type, major and minor */ 137 /* Determine device name, type, major and minor */
137 device_name = (char*) bb_basename(path); 138 device_name = (char*) bb_basename(path);
@@ -279,7 +280,7 @@ static void make_device(char *path, int delete)
279 if (aliaslink == '!' && s == a+1) { 280 if (aliaslink == '!' && s == a+1) {
280 val = st; 281 val = st;
281 /* "!": suppress node creation/deletion */ 282 /* "!": suppress node creation/deletion */
282 major = -1; 283 major = -2;
283 } 284 }
284 else if (aliaslink == '>' || aliaslink == '=') { 285 else if (aliaslink == '>' || aliaslink == '=') {
285 val = st; 286 val = st;
@@ -379,7 +380,7 @@ static void make_device(char *path, int delete)
379 free(command); 380 free(command);
380 } 381 }
381 382
382 if (delete && major >= 0) { 383 if (delete && major >= -1) {
383 if (ENABLE_FEATURE_MDEV_RENAME && alias) { 384 if (ENABLE_FEATURE_MDEV_RENAME && alias) {
384 if (aliaslink == '>') 385 if (aliaslink == '>')
385 unlink(device_name); 386 unlink(device_name);
diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
index 14feb9288..6dccd3a5d 100644
--- a/util-linux/mkfs_ext2.c
+++ b/util-linux/mkfs_ext2.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11#include <linux/fs.h> 11#include <linux/fs.h>
@@ -221,7 +221,7 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
221 221
222 // open the device, check the device is a block device 222 // open the device, check the device is a block device
223 xmove_fd(xopen(argv[0], O_WRONLY), fd); 223 xmove_fd(xopen(argv[0], O_WRONLY), fd);
224 fstat(fd, &st); 224 xfstat(fd, &st, argv[0]);
225 if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F)) 225 if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_F))
226 bb_error_msg_and_die("%s: not a block device", argv[0]); 226 bb_error_msg_and_die("%s: not a block device", argv[0]);
227 227
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c
index abfb94226..95499ba17 100644
--- a/util-linux/mkfs_minix.c
+++ b/util-linux/mkfs_minix.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (C) 1991 Linus Torvalds. 5 * (C) 1991 Linus Torvalds.
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
@@ -686,8 +686,7 @@ int mkfs_minix_main(int argc UNUSED_PARAM, char **argv)
686 bb_error_msg_and_die("can't format mounted filesystem"); 686 bb_error_msg_and_die("can't format mounted filesystem");
687 687
688 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd); 688 xmove_fd(xopen(G.device_name, O_RDWR), dev_fd);
689 if (fstat(dev_fd, &statbuf) < 0) 689 xfstat(dev_fd, &statbuf, G.device_name);
690 bb_error_msg_and_die("can't stat '%s'", G.device_name);
691 if (!S_ISBLK(statbuf.st_mode)) 690 if (!S_ISBLK(statbuf.st_mode))
692 opt &= ~1; // clear -c (check) 691 opt &= ~1; // clear -c (check)
693 692
diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c
index f9a0ca82a..00ce8f1d1 100644
--- a/util-linux/mkfs_reiser.c
+++ b/util-linux/mkfs_reiser.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com> 5 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com>
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9#include "libbb.h" 9#include "libbb.h"
10#include <linux/fs.h> 10#include <linux/fs.h>
@@ -168,9 +168,9 @@ int mkfs_reiser_main(int argc UNUSED_PARAM, char **argv)
168 168
169 // check the device is a block device 169 // check the device is a block device
170 fd = xopen(argv[0], O_WRONLY | O_EXCL); 170 fd = xopen(argv[0], O_WRONLY | O_EXCL);
171 fstat(fd, &st); 171 xfstat(fd, &st, argv[0]);
172 if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_f)) 172 if (!S_ISBLK(st.st_mode) && !(option_mask32 & OPT_f))
173 bb_error_msg_and_die("not a block device"); 173 bb_error_msg_and_die("%s: not a block device", argv[0]);
174 174
175 // check if it is mounted 175 // check if it is mounted
176 // N.B. what if we format a file? find_mount_point will return false negative since 176 // N.B. what if we format a file? find_mount_point will return false negative since
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index c57cd9d5a..45760f7c5 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com> 6 * Busybox'ed (2009) by Vladimir Dronnikov <dronnikov@gmail.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
11 11
@@ -245,8 +245,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
245 volume_id = time(NULL); 245 volume_id = time(NULL);
246 246
247 dev = xopen(device_name, O_RDWR); 247 dev = xopen(device_name, O_RDWR);
248 if (fstat(dev, &st) < 0) 248 xfstat(dev, &st, device_name);
249 bb_simple_perror_msg_and_die(device_name);
250 249
251 // 250 //
252 // Get image size and sector size 251 // Get image size and sector size
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index 7e32d91ed..53537fcd9 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright 2006 Rob Landley <rob@landley.net> 4 * Copyright 2006 Rob Landley <rob@landley.net>
5 * 5 *
6 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8#include "libbb.h" 8#include "libbb.h"
9 9
@@ -15,8 +15,7 @@ static void mkswap_selinux_setcontext(int fd, const char *path)
15 if (!is_selinux_enabled()) 15 if (!is_selinux_enabled())
16 return; 16 return;
17 17
18 if (fstat(fd, &stbuf) < 0) 18 xfstat(fd, &stbuf, argv[0]);
19 bb_perror_msg_and_die("fstat failed");
20 if (S_ISREG(stbuf.st_mode)) { 19 if (S_ISREG(stbuf.st_mode)) {
21 security_context_t newcon; 20 security_context_t newcon;
22 security_context_t oldcon = NULL; 21 security_context_t oldcon = NULL;
@@ -102,7 +101,15 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv)
102 printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len); 101 printf("Setting up swapspace version 1, size = %"OFF_FMT"u bytes\n", len);
103 mkswap_selinux_setcontext(fd, argv[0]); 102 mkswap_selinux_setcontext(fd, argv[0]);
104 103
105 /* Make a header. hdr is zero-filled so far... */ 104 /* hdr is zero-filled so far. Clear the first kbyte, or else
105 * mkswap-ing former FAT partition does NOT erase its signature.
106 *
107 * util-linux-ng 2.17.2 claims to erase it only if it does not see
108 * a partition table and is not run on whole disk. -f forces it.
109 */
110 xwrite(fd, hdr, 1024);
111
112 /* Fill the header. */
106 hdr->version = 1; 113 hdr->version = 1;
107 hdr->last_page = (uoff_t)len / pagesize; 114 hdr->last_page = (uoff_t)len / pagesize;
108 115
@@ -123,7 +130,6 @@ int mkswap_main(int argc UNUSED_PARAM, char **argv)
123 130
124 /* Write the header. Sync to disk because some kernel versions check 131 /* Write the header. Sync to disk because some kernel versions check
125 * signature on disk (not in cache) during swapon. */ 132 * signature on disk (not in cache) during swapon. */
126 xlseek(fd, 1024, SEEK_SET);
127 xwrite(fd, hdr, NWORDS * 4); 133 xwrite(fd, hdr, NWORDS * 4);
128 xlseek(fd, pagesize - 10, SEEK_SET); 134 xlseek(fd, pagesize - 10, SEEK_SET);
129 xwrite(fd, SWAPSPACE2, 10); 135 xwrite(fd, SWAPSPACE2, 10);
diff --git a/util-linux/more.c b/util-linux/more.c
index 00a427a6f..1fd6f9ee8 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -11,7 +11,7 @@
11 * 11 *
12 * Termios corrects by Vladimir Oleynik <dzo@simtreas.ru> 12 * Termios corrects by Vladimir Oleynik <dzo@simtreas.ru>
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16 16
17#include "libbb.h" 17#include "libbb.h"
diff --git a/util-linux/mount.c b/util-linux/mount.c
index aa17872da..5e85f9986 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -6,7 +6,7 @@
6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
7 * Copyright (C) 2005-2006 by Rob Landley <rob@landley.net> 7 * Copyright (C) 2005-2006 by Rob Landley <rob@landley.net>
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11// Design notes: There is no spec for mount. Remind me to write one. 11// Design notes: There is no spec for mount. Remind me to write one.
12// 12//
@@ -532,7 +532,7 @@ static int mount_it_now(struct mntent *mp, long vfsflags, char *filteropts)
532 * Linux NFS mount 532 * Linux NFS mount
533 * Copyright (C) 1993 Rick Sladkey <jrs@world.std.com> 533 * Copyright (C) 1993 Rick Sladkey <jrs@world.std.com>
534 * 534 *
535 * Licensed under GPLv2, see file LICENSE in this tarball for details. 535 * Licensed under GPLv2, see file LICENSE in this source tree.
536 * 536 *
537 * Wed Feb 8 12:51:48 1995, biro@yggdrasil.com (Ross Biro): allow all port 537 * Wed Feb 8 12:51:48 1995, biro@yggdrasil.com (Ross Biro): allow all port
538 * numbers to be specified on the command line. 538 * numbers to be specified on the command line.
diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c
index 28af00cc1..ac52a7aed 100644
--- a/util-linux/pivot_root.c
+++ b/util-linux/pivot_root.c
@@ -6,7 +6,7 @@
6 * pivot_root syscall stubbed by Erik Andersen, so it will compile 6 * pivot_root syscall stubbed by Erik Andersen, so it will compile
7 * regardless of the kernel being used. 7 * regardless of the kernel being used.
8 * 8 *
9 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11#include "libbb.h" 11#include "libbb.h"
12 12
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index f5df2f794..2c3de74bc 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * by Sterling Huxley <sterling@europa.com> 6 * by Sterling Huxley <sterling@europa.com>
7 * 7 *
8 * Licensed under GPL v2 or later, see file LICENSE for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9*/ 9*/
10 10
11#include "libbb.h" 11#include "libbb.h"
diff --git a/util-linux/rdev.c b/util-linux/rdev.c
index 33abd39dc..2fbb4d377 100644
--- a/util-linux/rdev.c
+++ b/util-linux/rdev.c
@@ -5,7 +5,7 @@
5 * Copyright (c) 2008 Nuovation System Designs, LLC 5 * Copyright (c) 2008 Nuovation System Designs, LLC
6 * Grant Erickson <gerickson@nuovations.com> 6 * Grant Erickson <gerickson@nuovations.com>
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 * 9 *
10 */ 10 */
11 11
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 219654496..00b3382d8 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it) 5 * Copyright (C) 1994,1996 Alessandro Rubini (rubini@ipvvis.unipv.it)
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9 9
10/* 10/*
diff --git a/util-linux/rev.c b/util-linux/rev.c
index 8d5ac2f2d..e1e004437 100644
--- a/util-linux/rev.c
+++ b/util-linux/rev.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com> 4 * Copyright (C) 2010 Marek Polacek <mmpolacek@gmail.com>
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8 8
9//applet:IF_REV(APPLET(rev, _BB_DIR_BIN, _BB_SUID_DROP)) 9//applet:IF_REV(APPLET(rev, _BB_DIR_BIN, _BB_SUID_DROP))
diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c
index b16376655..26e5b4724 100644
--- a/util-linux/rtcwake.c
+++ b/util-linux/rtcwake.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * This version was taken from util-linux and scrubbed down for busybox. 4 * This version was taken from util-linux and scrubbed down for busybox.
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 * 7 *
8 * This uses cross-platform Linux interfaces to enter a system sleep state, 8 * This uses cross-platform Linux interfaces to enter a system sleep state,
9 * and leave it no later than a specified time. It uses any RTC framework 9 * and leave it no later than a specified time. It uses any RTC framework
diff --git a/util-linux/script.c b/util-linux/script.c
index ba90b065d..0860bb083 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -8,7 +8,7 @@
8 * Copyright (c) 1980 8 * Copyright (c) 1980
9 * The Regents of the University of California. All rights reserved. 9 * The Regents of the University of California. All rights reserved.
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13#include "libbb.h" 13#include "libbb.h"
14 14
diff --git a/util-linux/scriptreplay.c b/util-linux/scriptreplay.c
index c87e44dfb..6eaba43fa 100644
--- a/util-linux/scriptreplay.c
+++ b/util-linux/scriptreplay.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * pascal.bellard@ads-lu.com 5 * pascal.bellard@ads-lu.com
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10#include "libbb.h" 10#include "libbb.h"
diff --git a/util-linux/setarch.c b/util-linux/setarch.c
index 776caf909..7d5dc247c 100644
--- a/util-linux/setarch.c
+++ b/util-linux/setarch.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright 2002 Andi Kleen, SuSE Labs. 5 * Copyright 2002 Andi Kleen, SuSE Labs.
6 * 6 *
7 * Licensed under GPL v2 or later, see file LICENSE for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8*/ 8*/
9 9
10#include <sys/personality.h> 10#include <sys/personality.h>
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index f2f52fb88..e2c060f30 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10#include "libbb.h" 10#include "libbb.h"
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index e2da119de..d471437fd 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Switch from rootfs to another filesystem as the root of the mount tree. 4 * Switch from rootfs to another filesystem as the root of the mount tree.
5 * 5 *
6 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8#include <sys/vfs.h> 8#include <sys/vfs.h>
9#include <sys/mount.h> 9#include <sys/mount.h>
diff --git a/util-linux/umount.c b/util-linux/umount.c
index a19f86c3a..7ba46eeb0 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * Copyright (C) 2005 by Rob Landley <rob@landley.net> 6 * Copyright (C) 2005 by Rob Landley <rob@landley.net>
7 * 7 *
8 * Licensed under GPL version 2, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10#include <mntent.h> 10#include <mntent.h>
11#include <sys/mount.h> 11#include <sys/mount.h>
diff --git a/util-linux/volume_id/Kbuild.src b/util-linux/volume_id/Kbuild.src
index 8af3ccd81..70da65482 100644
--- a/util-linux/volume_id/Kbuild.src
+++ b/util-linux/volume_id/Kbuild.src
@@ -2,7 +2,7 @@
2# 2#
3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org> 3# Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
4# 4#
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under GPLv2, see file LICENSE in this source tree.
6 6
7lib-y:= 7lib-y:=
8 8
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 4d9f9ecd0..bf32e6a8c 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -5,7 +5,7 @@
5 * Copyright (C) 2006 by Jason Schoon <floydpink@gmail.com> 5 * Copyright (C) 2006 by Jason Schoon <floydpink@gmail.com>
6 * Some portions cribbed from e2fsprogs, util-linux, dosfstools 6 * Some portions cribbed from e2fsprogs, util-linux, dosfstools
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10#include <sys/mount.h> /* BLKGETSIZE64 */ 10#include <sys/mount.h> /* BLKGETSIZE64 */
11#if !defined(BLKGETSIZE64) 11#if !defined(BLKGETSIZE64)