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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
--- astrolog.c.orig 1998-12-23 23:29:03.000000000 +0300
+++ astrolog.c 2007-06-26 15:44:04.000000000 +0400
@@ -35,6 +35,7 @@
** Last code change made 12/20/1998.
*/
+#include <ctype.h>
#include "astrolog.h"
@@ -234,7 +235,7 @@
char *pch = szLine;
/* Split the entered line up into its individual switch strings. */
- while (*pch >= ' ' || *pch == chTab) {
+ while (!iscntrl((_char)*pch) || *pch == chTab) {
if (*pch == ' ' || *pch == chTab) {
if (fSpace)
/* Skip over the current run of spaces between strings. */
@@ -1146,8 +1147,18 @@
case 'z':
if (ch1 == '0') {
if (argc <= 1 || RParseSz(argv[1], pmZon) == rLarge) {
- i = us.dstDef != 0.0;
- SwitchF(i);
+ if (argc > 1 && strcasecmp(argv[1], "current") == 0) {
+ time_t t;
+ struct tm *tm;
+
+ (void) time(&t);
+ tm = localtime(&t);
+ i = tm->tm_isdst != 0;
+ argc--; argv++;
+ } else {
+ i = us.dstDef != 0.0;
+ SwitchF(i);
+ }
SS = us.dstDef = i ? 1.0 : 0.0;
} else {
SS = us.dstDef = RParseSz(argv[1], pmZon);
@@ -1232,13 +1243,39 @@
return fFalse;
}
ciCore.nam = SzPersist(argv[1]);
+ if (CchSz(ciCore.nam) > 29) /* see charts1.c */
+ ciCore.nam[29] = chNull;
+ for (pch = ciCore.nam; *pch; pch++) {
+ if (*pch == '"') /* see io.c */
+ *pch = '\'';
+ else if (iscntrl((_char)*pch)) /* see xgeneral.c */
+ *pch = ' ';
+ }
ciCore.loc = SzPersist(argv[2]);
+ if (CchSz(ciCore.loc) > 29) /* see charts1.c */
+ ciCore.loc[29] = chNull;
+ for (pch = ciCore.loc; *pch; pch++) {
+ if (*pch == '"') /* see io.c */
+ *pch = '\'';
+ else if (iscntrl((_char)*pch)) /* see xgeneral.c */
+ *pch = ' ';
+ }
argc -= 2; argv += 2;
break;
}
- if (argc <= 1 || RParseSz(argv[1], pmZon) == rLarge)
- ZZ -= 1.0;
- else {
+ if (argc <= 1 || RParseSz(argv[1], pmZon) == rLarge) {
+ if (argc > 1 && strcasecmp(argv[1], "current") == 0) {
+ time_t t;
+ struct tm *tm;
+
+ (void) time(&t);
+ tm = localtime(&t);
+ ZZ = us.zonDef = (tm->tm_isdst ? 1 : 0) -
+ (real)tm->tm_gmtoff/(60*60);
+ argc--; argv++;
+ } else
+ ZZ -= 1.0;
+ } else {
ZZ = us.zonDef = RParseSz(argv[1], pmZon);
if (!FValidZon(us.zonDef)) {
ErrorValR("z", us.zonDef);
|