-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathcheck_strftime.sh
More file actions
executable file
·56 lines (45 loc) · 932 Bytes
/
check_strftime.sh
File metadata and controls
executable file
·56 lines (45 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# This is an extension of ./configure.
# I am checking to see if I should use GNU strftime
# This is essential of the %z or %Z options used.
CC=$1
check_strftime()
{
retval=""
cat << EOF > /tmp/strftime_try.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
int
main (void)
{
time_t tim;
char buf[100] = {0};
struct tm *timeval;
tim = time(NULL);
timeval = localtime(&tim);
strftime (buf, 99, "%z", timeval);
if (!isdigit(buf[1]))
return (EXIT_FAILURE);
return (EXIT_SUCCESS);
}
EOF
$CC -o /tmp/strftime /tmp/strftime_try.c $LIBS 2>&1 > /dev/null
if [ $? != 0 ]; then
echo "ERROR: Could not compile strftime()."
echo "ERROR: Please make sure you have the latest version of Glibc."
exit;
fi
#Execute program to see if %z worked
/tmp/strftime
if [ $? -eq 0 ]; then
retval=0
else
retval=1
fi
rm -f /tmp/strftime*
return $retval;
}
check_strftime
exit $?