ksh: Drop support for systems without <sys/stat.h>

In future the order of includes will be normalized with KNF.

No functional change intended.
This commit is contained in:
kamil 2017-06-30 03:56:12 +00:00
parent 1dacfa0dd2
commit fac4b39487
19 changed files with 58 additions and 121 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $ */
/* $NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $ */
/*
* built-in Korn commands: c_*
@ -6,13 +6,14 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: c_ksh.c,v 1.24 2017/06/22 19:41:07 kamil Exp $");
__RCSID("$NetBSD: c_ksh.c,v 1.25 2017/06/30 03:56:12 kamil Exp $");
#endif
#include "sh.h"
#include "ksh_stat.h"
#include <sys/stat.h>
#include <ctype.h>
#include "sh.h"
int
c_cd(wp)
char **wp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $ */
/* $NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $ */
/*
* built-in Bourne commands
@ -6,16 +6,15 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: c_sh.c,v 1.21 2017/06/30 03:43:57 kamil Exp $");
__RCSID("$NetBSD: c_sh.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/times.h>
#include <time.h>
#include "sh.h"
#include "ksh_stat.h" /* umask() */
static char *clocktos ARGS((clock_t t));

View File

@ -1,4 +1,4 @@
/* $NetBSD: c_test.c,v 1.6 2005/06/26 19:09:00 christos Exp $ */
/* $NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $ */
/*
* test(1); version 7-like -- author Erik Baalbergen
@ -11,12 +11,12 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: c_test.c,v 1.6 2005/06/26 19:09:00 christos Exp $");
__RCSID("$NetBSD: c_test.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include "sh.h"
#include "ksh_stat.h"
#include "c_test.h"
/* test(1) accepts the following grammar:

View File

@ -1,4 +1,4 @@
/* $NetBSD: config.h,v 1.50 2017/06/30 03:43:57 kamil Exp $ */
/* $NetBSD: config.h,v 1.51 2017/06/30 03:56:12 kamil Exp $ */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
@ -11,9 +11,6 @@
#ifndef CONFIG_H
#define CONFIG_H
/* Define if your struct stat has st_rdev. */
#define HAVE_ST_RDEV 1
/* Define if on MINIX. */
/* #undef _MINIX */
@ -27,9 +24,6 @@
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define if `sys_siglist' is declared by <signal.h>. */
#define SYS_SIGLIST_DECLARED 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: edit.c,v 1.30 2017/06/22 14:20:46 kamil Exp $ */
/* $NetBSD: edit.c,v 1.31 2017/06/30 03:56:12 kamil Exp $ */
/*
* Command line editing - common code
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: edit.c,v 1.30 2017/06/22 14:20:46 kamil Exp $");
__RCSID("$NetBSD: edit.c,v 1.31 2017/06/30 03:56:12 kamil Exp $");
#endif
@ -20,8 +20,8 @@ __RCSID("$NetBSD: edit.c,v 1.30 2017/06/22 14:20:46 kamil Exp $");
#include "edit.h"
#undef EXTERN
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <ctype.h>
#include "ksh_stat.h"
#if defined(TIOCGWINSZ)

View File

@ -1,4 +1,4 @@
/* $NetBSD: emacs.c,v 1.35 2017/06/22 14:20:46 kamil Exp $ */
/* $NetBSD: emacs.c,v 1.36 2017/06/30 03:56:12 kamil Exp $ */
/*
* Emacs-like command line editing and history
@ -10,18 +10,18 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: emacs.c,v 1.35 2017/06/22 14:20:46 kamil Exp $");
__RCSID("$NetBSD: emacs.c,v 1.36 2017/06/30 03:56:12 kamil Exp $");
#endif
#include "config.h"
#ifdef EMACS
#include "sh.h"
#include "ksh_stat.h"
#include "ksh_dir.h"
#include <sys/stat.h>
#include <ctype.h>
#include <locale.h>
#include "sh.h"
#include "ksh_dir.h"
#include "edit.h"
static Area aedit;

View File

@ -1,4 +1,4 @@
/* $NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $ */
/* $NetBSD: eval.c,v 1.21 2017/06/30 03:56:12 kamil Exp $ */
/*
* Expansion - quoting, separation, substitution, globbing
@ -6,15 +6,15 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: eval.c,v 1.20 2017/06/30 02:06:59 kamil Exp $");
__RCSID("$NetBSD: eval.c,v 1.21 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include <stdint.h>
#include <pwd.h>
#include "sh.h"
#include "ksh_dir.h"
#include "ksh_stat.h"
/*
* string expansion

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $ */
/* $NetBSD: exec.c,v 1.22 2017/06/30 03:56:12 kamil Exp $ */
/*
* execute command tree
@ -6,14 +6,14 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: exec.c,v 1.21 2017/06/30 02:38:10 kamil Exp $");
__RCSID("$NetBSD: exec.c,v 1.22 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include <ctype.h>
#include "sh.h"
#include "c_test.h"
#include <ctype.h>
#include "ksh_stat.h"
/* Does ps4 get parameter substitutions done? */
#ifdef KSH

View File

@ -1,4 +1,4 @@
/* $NetBSD: history.c,v 1.15 2017/06/22 14:20:46 kamil Exp $ */
/* $NetBSD: history.c,v 1.16 2017/06/30 03:56:12 kamil Exp $ */
/*
* command history
@ -19,12 +19,12 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: history.c,v 1.15 2017/06/22 14:20:46 kamil Exp $");
__RCSID("$NetBSD: history.c,v 1.16 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include "sh.h"
#include "ksh_stat.h"
#ifdef HISTORY
# ifdef EASY_HISTORY

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.15 2017/06/30 02:51:14 kamil Exp $ */
/* $NetBSD: io.c,v 1.16 2017/06/30 03:56:12 kamil Exp $ */
/*
* shell buffered IO and formatted output
@ -6,13 +6,12 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: io.c,v 1.15 2017/06/30 02:51:14 kamil Exp $");
__RCSID("$NetBSD: io.c,v 1.16 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include <ctype.h>
#include "sh.h"
#include "ksh_stat.h"
static int initio_done;

View File

@ -1,4 +1,4 @@
/* $NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $ */
/* $NetBSD: jobs.c,v 1.18 2017/06/30 03:56:12 kamil Exp $ */
/*
* Process and job control
@ -21,14 +21,14 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: jobs.c,v 1.17 2017/06/30 03:23:18 kamil Exp $");
__RCSID("$NetBSD: jobs.c,v 1.18 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include <sys/times.h>
#include <sys/wait.h>
#include "sh.h"
#include "ksh_stat.h"
#include "tty.h"
/* Start of system configuration stuff */

View File

@ -1,56 +0,0 @@
/* $NetBSD: ksh_stat.h,v 1.3 2017/06/30 03:35:16 kamil Exp $ */
/* Wrapper around the ugly sys/stat includes/ifdefs */
/* $NetBSD: ksh_stat.h,v 1.3 2017/06/30 03:35:16 kamil Exp $ */
/* assumes <sys/types.h> already included */
#include <sys/stat.h>
#ifdef STAT_MACROS_BROKEN
# undef S_ISREG
# undef S_ISDIR
# undef S_ISCHR
# undef S_ISBLK
# undef S_ISFIFO
# undef S_ISSOCK
# undef S_ISLNK
#endif /* STAT_MACROS_BROKEN */
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif /* S_ISREG */
#if !defined(S_ISDIR) && defined(S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif /* S_ISDIR */
#if !defined(S_ISCHR) && defined(S_IFCHR)
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif /* S_ISCHR */
#if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif /* S_ISBLK */
#if !defined(S_ISFIFO) && defined(S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif /* S_ISFIFO */
#if !defined(S_ISLNK) && defined(S_IFLNK)
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
#endif /* S_ISLNK */
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif /* S_ISSOCK */
#if !defined(S_ISCDF) && defined(S_CDF)
# define S_ISCDF(m) (S_ISDIR(m) && ((m) & S_CDF))
#endif /* S_ISSOCK */
#ifndef S_ISVTX
# define S_ISVTX 01000 /* sticky bit */
#endif /* S_ISVTX */
#ifndef S_IXUSR
# define S_IXUSR 00100 /* user execute bit */
#endif /* S_IXUSR */
#ifndef S_IXGRP
# define S_IXGRP 00010 /* user execute bit */
#endif /* S_IXGRP */
#ifndef S_IXOTH
# define S_IXOTH 00001 /* user execute bit */
#endif /* S_IXOTH */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $ */
/* $NetBSD: mail.c,v 1.7 2017/06/30 03:56:12 kamil Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@ -7,17 +7,17 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mail.c,v 1.6 2017/06/30 03:43:57 kamil Exp $");
__RCSID("$NetBSD: mail.c,v 1.7 2017/06/30 03:56:12 kamil Exp $");
#endif
#include "config.h"
#ifdef KSH
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include "sh.h"
#include "ksh_stat.h"
#define MBMESSAGE "You have mail in $_"

View File

@ -1,22 +1,22 @@
/* $NetBSD: main.c,v 1.19 2017/06/30 03:43:57 kamil Exp $ */
/* $NetBSD: main.c,v 1.20 2017/06/30 03:56:12 kamil Exp $ */
/*
* startup, main loop, environments and error handling
*/
#include <sys/cdefs.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <locale.h>
#include <time.h>
#ifndef lint
__RCSID("$NetBSD: main.c,v 1.19 2017/06/30 03:43:57 kamil Exp $");
__RCSID("$NetBSD: main.c,v 1.20 2017/06/30 03:56:12 kamil Exp $");
#endif
#define EXTERN /* define EXTERNs in sh.h */
#include "sh.h"
#include "ksh_stat.h"
extern char **environ;

View File

@ -1,13 +1,13 @@
/* $NetBSD: path.c,v 1.12 2017/06/22 14:20:46 kamil Exp $ */
/* $NetBSD: path.c,v 1.13 2017/06/30 03:56:12 kamil Exp $ */
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: path.c,v 1.12 2017/06/22 14:20:46 kamil Exp $");
__RCSID("$NetBSD: path.c,v 1.13 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include "sh.h"
#include "ksh_stat.h"
/*
* Contains a routine to search a : separated list of

View File

@ -1,4 +1,4 @@
/* $NetBSD: shf.c,v 1.12 2017/06/30 02:51:14 kamil Exp $ */
/* $NetBSD: shf.c,v 1.13 2017/06/30 03:56:12 kamil Exp $ */
/*
* Shell file I/O routines
@ -6,12 +6,12 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: shf.c,v 1.12 2017/06/30 02:51:14 kamil Exp $");
__RCSID("$NetBSD: shf.c,v 1.13 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include "sh.h"
#include "ksh_stat.h"
#include "ksh_limval.h"

View File

@ -1,14 +1,14 @@
/* $NetBSD: tty.c,v 1.7 2017/06/23 00:11:01 kamil Exp $ */
/* $NetBSD: tty.c,v 1.8 2017/06/30 03:56:12 kamil Exp $ */
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: tty.c,v 1.7 2017/06/23 00:11:01 kamil Exp $");
__RCSID("$NetBSD: tty.c,v 1.8 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include "sh.h"
#include "ksh_stat.h"
#define EXTERN
#include "tty.h"
#undef EXTERN

View File

@ -1,18 +1,18 @@
/* $NetBSD: var.c,v 1.18 2017/06/30 03:43:57 kamil Exp $ */
/* $NetBSD: var.c,v 1.19 2017/06/30 03:56:12 kamil Exp $ */
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: var.c,v 1.18 2017/06/30 03:43:57 kamil Exp $");
__RCSID("$NetBSD: var.c,v 1.19 2017/06/30 03:56:12 kamil Exp $");
#endif
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <ctype.h>
#include "sh.h"
#include "ksh_limval.h"
#include "ksh_stat.h"
/*
* Variables

View File

@ -1,4 +1,4 @@
/* $NetBSD: vi.c,v 1.16 2017/06/22 14:20:46 kamil Exp $ */
/* $NetBSD: vi.c,v 1.17 2017/06/30 03:56:12 kamil Exp $ */
/*
* vi command editing
@ -9,15 +9,15 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: vi.c,v 1.16 2017/06/22 14:20:46 kamil Exp $");
__RCSID("$NetBSD: vi.c,v 1.17 2017/06/30 03:56:12 kamil Exp $");
#endif
#include "config.h"
#ifdef VI
#include "sh.h"
#include <sys/stat.h>
#include <ctype.h>
#include "ksh_stat.h" /* completion */
#include "edit.h"
#define CMDLEN 1024