summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-02-09 08:25:12 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-02-09 08:25:12 +0000
commit778638d6cf3ab378b1015453117e3758d94dce6a (patch)
tree396f71947c13ed0b6a456d6e56aaef6d42f05de0
parent56371c0e71a65c3481cfc1ebb2d8c93889cee374 (diff)
this removes just a few ifdef checks for things that should always be enabled,
and which we definitely don't want to workaround. no change in the compiled code (yet). some of these, like the first chunk are plain silly. the compiler used to compile asctime has nothing to do with the format strings strftime should support. ok deraadt
-rw-r--r--lib/libc/time/asctime.c15
-rw-r--r--lib/libc/time/localtime.c15
-rw-r--r--lib/libc/time/private.h8
-rw-r--r--lib/libc/time/zdump.c10
-rw-r--r--lib/libc/time/zic.c25
5 files changed, 8 insertions, 65 deletions
diff --git a/lib/libc/time/asctime.c b/lib/libc/time/asctime.c
index 4c7c9237003..85336a69511 100644
--- a/lib/libc/time/asctime.c
+++ b/lib/libc/time/asctime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asctime.c,v 1.16 2010/08/23 22:35:34 millert Exp $ */
+/* $OpenBSD: asctime.c,v 1.17 2015/02/09 08:25:11 tedu Exp $ */
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@@ -34,22 +34,15 @@
** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year,
** but many implementations pad anyway; most likely the standards are buggy.
*/
-#ifdef __GNUC__
#define ASCTIME_FMT "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n"
-#else /* !defined __GNUC__ */
-#define ASCTIME_FMT "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n"
-#endif /* !defined __GNUC__ */
+
/*
** For years that are more than four digits we put extra spaces before the year
** so that code trying to overwrite the newline won't end up overwriting
** a digit within a year and truncating the year (operating on the assumption
** that no output is better than wrong output).
*/
-#ifdef __GNUC__
#define ASCTIME_FMT_B "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %s\n"
-#else /* !defined __GNUC__ */
-#define ASCTIME_FMT_B "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s\n"
-#endif /* !defined __GNUC__ */
#define STD_ASCTIME_BUF_SIZE 26
/*
@@ -109,11 +102,7 @@ int bufsize;
if (len != -1 && len < bufsize) {
return buf;
} else {
-#ifdef EOVERFLOW
errno = EOVERFLOW;
-#else /* !defined EOVERFLOW */
- errno = EINVAL;
-#endif /* !defined EOVERFLOW */
return NULL;
}
}
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c
index 0d57ea4daa3..9098773c73d 100644
--- a/lib/libc/time/localtime.c
+++ b/lib/libc/time/localtime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: localtime.c,v 1.38 2013/04/17 17:40:35 tedu Exp $ */
+/* $OpenBSD: localtime.c,v 1.39 2015/02/09 08:25:11 tedu Exp $ */
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
@@ -30,17 +30,6 @@
#define TZ_ABBR_ERR_CHAR '_'
#endif /* !defined TZ_ABBR_ERR_CHAR */
-/*
-** SunOS 4.1.1 headers lack O_BINARY.
-*/
-
-#ifdef O_BINARY
-#define OPEN_MODE (O_RDONLY | O_BINARY)
-#endif /* defined O_BINARY */
-#ifndef O_BINARY
-#define OPEN_MODE O_RDONLY
-#endif /* !defined O_BINARY */
-
#ifndef WILDABBR
/*
** Someone might make incorrect use of a time zone abbreviation:
@@ -390,7 +379,7 @@ register const int doextend;
}
if (doaccess && access(name, R_OK) != 0)
goto oops;
- if ((fid = open(name, OPEN_MODE)) == -1)
+ if ((fid = open(name, O_RDONLY)) == -1)
goto oops;
}
nread = read(fid, up->buf, sizeof up->buf);
diff --git a/lib/libc/time/private.h b/lib/libc/time/private.h
index b859f8edea8..a248325a31d 100644
--- a/lib/libc/time/private.h
+++ b/lib/libc/time/private.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: private.h,v 1.26 2014/05/06 15:49:45 tedu Exp $ */
+/* $OpenBSD: private.h,v 1.27 2015/02/09 08:25:11 tedu Exp $ */
#ifndef PRIVATE_H
#define PRIVATE_H
@@ -95,9 +95,7 @@
#include "libintl.h"
#endif /* HAVE_GETTEXT */
-#if HAVE_SYS_WAIT_H
#include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
-#endif /* HAVE_SYS_WAIT_H */
#ifndef WIFEXITED
#define WIFEXITED(status) (((status) & 0xff) == 0)
@@ -106,9 +104,7 @@
#define WEXITSTATUS(status) (((status) >> 8) & 0xff)
#endif /* !defined WEXITSTATUS */
-#if HAVE_UNISTD_H
#include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
-#endif /* HAVE_UNISTD_H */
#ifndef F_OK
#define F_OK 0
@@ -120,9 +116,7 @@
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
-#if HAVE_STDINT_H
#include "stdint.h"
-#endif /* !HAVE_STDINT_H */
#ifndef INT_FAST64_MAX
/* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */
diff --git a/lib/libc/time/zdump.c b/lib/libc/time/zdump.c
index 02a986ec3e0..f141e3b9eda 100644
--- a/lib/libc/time/zdump.c
+++ b/lib/libc/time/zdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zdump.c,v 1.22 2010/08/23 22:35:34 millert Exp $ */
+/* $OpenBSD: zdump.c,v 1.23 2015/02/09 08:25:11 tedu Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2009-05-17 by Arthur David Olson.
@@ -42,14 +42,6 @@
#define FALSE 0
#endif /* !defined FALSE */
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif /* !defined EXIT_SUCCESS */
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif /* !defined EXIT_FAILURE */
-
#ifndef SECSPERMIN
#define SECSPERMIN 60
#endif /* !defined SECSPERMIN */
diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c
index 07187ec72e2..d46582268dc 100644
--- a/lib/libc/time/zic.c
+++ b/lib/libc/time/zic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zic.c,v 1.35 2013/11/24 23:51:29 deraadt Exp $ */
+/* $OpenBSD: zic.c,v 1.36 2015/02/09 08:25:11 tedu Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2006-07-17 by Arthur David Olson.
@@ -16,14 +16,8 @@ typedef int_fast64_t zic_t;
#define ZIC_MAX_ABBR_LEN_WO_WARN 6
#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
-#if HAVE_SYS_STAT_H
-#include "sys/stat.h"
-#endif
-#ifdef S_IRUSR
+#include <sys/stat.h>
#define MKDIR_UMASK (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
-#else
-#define MKDIR_UMASK 0755
-#endif
/*
** On some ancient hosts, predicates like `isspace(C)' are defined
@@ -34,9 +28,6 @@ typedef int_fast64_t zic_t;
** If isascii is not defined, the isascii check succeeds trivially.
*/
#include "ctype.h"
-#ifndef isascii
-#define isascii(x) 1
-#endif
#define OFFSET_STRLEN_MAXIMUM (7 + INT_STRLEN_MAXIMUM(long))
#define RULE_STRLEN_MAXIMUM 8 /* "Mdd.dd.d" */
@@ -475,9 +466,7 @@ char * argv[];
register int j;
register int c;
-#ifdef unix
(void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
-#endif /* defined unix */
#if HAVE_GETTEXT
(void) setlocale(LC_ALL, "");
#ifdef TZ_DOMAINDIR
@@ -2716,16 +2705,6 @@ char * argname;
cp = name = ecpyalloc(argname);
while ((cp = strchr(cp + 1, '/')) != 0) {
*cp = '\0';
-#ifndef unix
- /*
- ** DOS drive specifier?
- */
- if (isalpha((unsigned char) name[0]) &&
- name[1] == ':' && name[2] == '\0') {
- *cp = '/';
- continue;
- }
-#endif /* !defined unix */
if (!itsdir(name)) {
/*
** It doesn't seem to exist, so we try to create it.