11 #define mySKIPSPACE(s) { while (*(s) && isspace(*(s))) (s)++; }
12 #define mySKIPNONSPACE(s) { while (*(s) && !isspace(*(s))) (s)++; }
14 #define CVS_RCSID "$""Log: "
15 #define CVS_REVISION "Revision "
40 char * p, * pe, * q, ** idx;
41 char * date = strcpy(
alloca(strlen(datestr) + 1), datestr);
42 static char * days[] =
43 {
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat", NULL };
44 static char * months[] =
45 {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
46 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec", NULL };
47 static char lengths[] =
48 { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
50 memset(&time, 0,
sizeof(time));
56 if (*p ==
'\0')
return -1;
58 for (idx = days; *idx && strcmp(*idx, p); idx++)
60 if (*idx == NULL)
return -1;
64 if (*p ==
'\0')
return -1;
66 for (idx = months; *idx && strcmp(*idx, p); idx++)
68 if (*idx == NULL)
return -1;
69 time.tm_mon = idx - months;
73 if (*p ==
'\0')
return -1;
79 time.tm_mday = strtol(p, &q, 10);
80 if (!(q && *q ==
'\0'))
return -1;
81 if (time.tm_mday < 0 || time.tm_mday > lengths[time.tm_mon])
return -1;
85 if (*p ==
'\0')
return -1;
87 time.tm_year = strtol(p, &q, 10);
88 if (!(q && *q ==
'\0'))
return -1;
89 if (time.tm_year < 1990 || time.tm_year >= 3000)
return -1;
92 *secs = mktime(&time);
93 if (*secs == -1)
return -1;
103 extern time_t
get_date(
const char * p,
void * now);
119 char *date, *
name, *text;
124 static time_t last = 0;
125 static int oneshot = 0;
130 char * t =
rpmExpand(
"%{?_changelog_truncate}", NULL);
133 long res = strtol(t, &te, 0);
134 if (res >= 0 && *te ==
'\0') {
155 _(
"%%changelog entries must start with *\n"));
161 while(*s && *s !=
'\n') s++;
174 for (i = 0; i < 4; i++) {
183 if (lastTime && lastTime < time) {
185 _(
"%%changelog not in descending chronological order\n"));
198 while (*s !=
'\0') s++;
199 while (s > name && isspace(*s))
218 }
while (*s && (*(s-1) !=
'\n' || *s !=
'*'));
226 if (numchangelog && (s = strstr(text,
CVS_RCSID))) {
228 while(*s && *s !=
'\n') s++;
241 if (i++ == numchangelog) {
245 while(*s && *s !=
'\n') s++;
255 while ((s > text) && (*s ==
'\n' ||
xisspace(*s))) {
266 || (last < 1000 && nentries < last)
267 || (last > 1000 && time >= last))
280 int nextPart, res, rc;
308 return (res) ? res : nextPart;