Sort includes and more cleanup and fixes in util/

This commit is contained in:
FRIGN 2014-11-13 19:54:28 +01:00 committed by sin
parent 0810c61154
commit 7d2683ddf2
48 changed files with 181 additions and 173 deletions

View File

@ -1,12 +1,12 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h> #include <errno.h>
#include <grp.h> #include <grp.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -2,8 +2,9 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "util.h" #include "util.h"
static void chmodr(const char *); static void chmodr(const char *);

View File

@ -1,6 +1,6 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

2
cols.c
View File

@ -4,8 +4,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <unistd.h>
#include "text.h" #include "text.h"
#include "util.h" #include "util.h"

2
comm.c
View File

@ -1,9 +1,9 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <limits.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "util.h" #include "util.h"

14
du.c
View File

@ -1,13 +1,13 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <limits.h> #include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "util.h" #include "util.h"

4
env.c
View File

@ -1,9 +1,9 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <unistd.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <unistd.h>
#include "util.h" #include "util.h"

2
kill.c
View File

@ -1,5 +1,4 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <sys/wait.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
@ -8,6 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <strings.h> #include <strings.h>
#include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include "util.h" #include "util.h"

2
ls.c
View File

@ -7,9 +7,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h>
#include "util.h" #include "util.h"

View File

@ -4,9 +4,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include "util.h"
#include "crypt.h" #include "crypt.h"
#include "md5.h" #include "md5.h"
#include "util.h"
struct md5 s; struct md5 s;
struct crypt_ops md5_ops = { struct crypt_ops md5_ops = {

View File

@ -1,12 +1,11 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -1,8 +1,8 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "util.h" #include "util.h"

2
mv.c
View File

@ -2,8 +2,8 @@
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "fs.h" #include "fs.h"
#include "util.h" #include "util.h"

View File

@ -1,9 +1,9 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "util.h" #include "util.h"

View File

@ -1,9 +1,9 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -1,12 +1,12 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include "util.h"
#include "crypt.h" #include "crypt.h"
#include "sha1.h" #include "sha1.h"
#include "util.h"
struct sha1 s; struct sha1 s;
struct crypt_ops sha1_ops = { struct crypt_ops sha1_ops = {

View File

@ -1,12 +1,12 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include "util.h"
#include "crypt.h" #include "crypt.h"
#include "sha256.h" #include "sha256.h"
#include "util.h"
struct sha256 s; struct sha256 s;
struct crypt_ops sha256_ops = { struct crypt_ops sha256_ops = {

View File

@ -1,12 +1,12 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include "util.h"
#include "crypt.h" #include "crypt.h"
#include "sha512.h" #include "sha512.h"
#include "util.h"
struct sha512 s; struct sha512 s;
struct crypt_ops sha512_ops = { struct crypt_ops sha512_ops = {

View File

@ -1,10 +1,10 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.h" #include "util.h"

View File

@ -1,7 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "util.h" #include "util.h"

14
tar.c
View File

@ -1,15 +1,15 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdlib.h> #include <grp.h>
#include <unistd.h> #include <limits.h>
#include <stdio.h> #include <pwd.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <limits.h> #include <sys/types.h>
#include <grp.h> #include <unistd.h>
#include <pwd.h>
#include "util.h" #include "util.h"

2
test.c
View File

@ -1,10 +1,10 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -3,10 +3,10 @@
#include <fcntl.h> #include <fcntl.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <utime.h> #include <utime.h>
#include <sys/stat.h>
#include "util.h" #include "util.h"

2
tr.c
View File

@ -1,9 +1,9 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <locale.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <locale.h>
#include <wchar.h> #include <wchar.h>
#include "text.h" #include "text.h"

2
tty.c
View File

@ -1,7 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -2,8 +2,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h>
#include "util.h" #include "util.h"

View File

@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include "util.h" #include "util.h"
static void static void

View File

@ -1,11 +1,12 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include "../util.h"
#include "../text.h"
#include "../crypt.h" #include "../crypt.h"
#include "../text.h"
#include "../util.h"
static int static int
hexdec(int c) hexdec(int c)

View File

@ -3,8 +3,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "../util.h" #include "../util.h"

View File

@ -1,3 +1,4 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -1,6 +1,7 @@
/* public domain md5 implementation based on rfc1321 and libtomcrypt */ /* public domain md5 implementation based on rfc1321 and libtomcrypt */
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "../md5.h" #include "../md5.h"
static uint32_t rol(uint32_t n, int k) { return (n << k) | (n >> (32-k)); } static uint32_t rol(uint32_t n, int k) { return (n << k) | (n >> (32-k)); }

View File

@ -1,7 +1,8 @@
#include <unistd.h>
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "../util.h" #include "../util.h"
mode_t mode_t

View File

@ -15,4 +15,3 @@ putword(const char *s)
fputs(s, stdout); fputs(s, stdout);
first = false; first = false;
} }

View File

@ -15,4 +15,3 @@ rm(const char *path)
if (remove(path) == -1 && !rm_fflag) if (remove(path) == -1 && !rm_fflag)
eprintf("remove %s:", path); eprintf("remove %s:", path);
} }

View File

@ -1,6 +1,7 @@
/* public domain sha1 implementation based on rfc3174 and libtomcrypt */ /* public domain sha1 implementation based on rfc3174 and libtomcrypt */
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include "../sha1.h" #include "../sha1.h"
static uint32_t rol(uint32_t n, int k) { return (n << k) | (n >> (32-k)); } static uint32_t rol(uint32_t n, int k) { return (n << k) | (n >> (32-k)); }

View File

@ -1,9 +1,10 @@
/* public domain sha256 implementation based on fips180-3 */ /* public domain sha256 implementation based on fips180-3 */
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../sha256.h" #include "../sha256.h"
static uint32_t ror(uint32_t n, int k) { return (n >> k) | (n << (32-k)); } static uint32_t ror(uint32_t n, int k) { return (n >> k) | (n << (32-k)); }

View File

@ -1,10 +1,11 @@
/* public domain sha256 implementation based on fips180-3 */ /* public domain sha256 implementation based on fips180-3 */
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../sha512.h" #include "../sha512.h"
static uint64_t ror(uint64_t n, int k) { return (n >> k) | (n << (64-k)); } static uint64_t ror(uint64_t n, int k) { return (n >> k) | (n << (64-k)); }

View File

@ -14,8 +14,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <sys/types.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include "../util.h" #include "../util.h"
/* /*

View File

@ -14,8 +14,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#include <sys/types.h>
#include <string.h> #include <string.h>
#include <sys/types.h>
#include "../util.h" #include "../util.h"
/* /*

View File

@ -1,15 +1,15 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <limits.h>
#include "util.h"
#include "text.h" #include "text.h"
#include "util.h"
static void uudecode(FILE *, FILE *); static void uudecode(FILE *, FILE *);
static void parseheader(FILE *, const char *, const char *, mode_t *, char **); static void parseheader(FILE *, const char *, const char *, mode_t *, char **);