1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-18 08:02:48 +00:00
freebsd-ports/misc/astrolog/files/patch-ac
2007-06-26 11:49:51 +00:00

84 lines
2.3 KiB
Plaintext

--- 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);