Lines Matching refs:cp

40 static char	*strmatch(/*char *cp, char *string*/);
41 static char *yearmatch(/*char *cp, char *format, struct tm *tm,
43 static char *cvtnum(/*char *cp, int *nump*/);
55 register char *cp, *p;
64 cp = buf;
70 if (*cp++ != '%')
77 if ((p = strmatch(cp,
80 || (p = strmatch(cp,
89 cp = p;
96 if ((p = strmatch(cp,
99 || (p = strmatch(cp,
108 cp = p;
112 cp = strptime(cp, "%x %X", tm);
113 if (cp == NULL)
118 cp = strptime(cp, dtcp->ldate_format, tm);
119 if (cp == NULL)
125 cp = cvtnum(cp, &tm->tm_mday);
126 if (cp == NULL)
130 if ((c = *cp) == '\0'
136 cp = strptime(cp, "%m/%d/%y", tm);
137 if (cp == NULL)
143 cp = cvtnum(cp, &tm->tm_hour);
144 if (cp == NULL)
148 if ((c = *cp) == '\0'
155 cp = cvtnum(cp, &tm->tm_hour);
156 if (cp == NULL)
162 if ((c = *cp) == '\0'
168 cp = cvtnum(cp, &tm->tm_yday);
169 if (cp == NULL)
176 cp = cvtnum(cp, &tm->tm_mon);
177 if (cp == NULL)
182 if ((c = *cp) == '\0'
193 if ((c = *cp) != '\0'
195 cp = cvtnum(cp, &tm->tm_min);
196 if (cp == NULL)
201 if ((c = *cp) == '\0'
207 if ((p = strmatch(cp, dtcp->am_string,
214 cp = p;
215 } else if ((p = strmatch(cp, dtcp->pm_string,
224 cp = p;
229 cp = strptime(cp, "%I:%M:%S %p", tm);
230 if (cp == NULL)
235 cp = strptime(cp, "%H:%M", tm);
236 if (cp == NULL)
246 if ((c = *cp) != '\0'
248 cp = cvtnum(cp, &tm->tm_sec);
249 if (cp == NULL)
254 if ((c = *cp) == '\0'
260 cp = strptime(cp, "%H:%M:%S", tm);
261 if (cp == NULL)
266 cp = strptime(cp, dtcp->sdate_format, tm);
267 if (cp == NULL)
272 cp = strptime(cp, dtcp->time_format, tm);
273 if (cp == NULL)
278 cp = yearmatch(cp, format, tm, &hadyear);
279 if (cp == NULL)
285 return (cp); /* match is complete */
288 cp = yearmatch(cp, format, tm, &hadyear);
289 if (cp == NULL)
296 return (cp); /* match is complete */
303 while ((ch = *cp++) != '\0'
306 cp--;
308 if (*cp++ != c)
313 return (cp);
317 * Try to match the beginning of the string pointed to by "cp" with the string
329 strmatch(cp, string, termc)
330 register char *cp;
337 * Match the beginning portion of "cp" with "string".
340 c = *cp++;
349 if ((c = *cp) != '\0') {
358 return (cp);
373 yearmatch(cp, format, tm, hadyearp)
374 register char *cp;
388 if ((c = *cp) != '\0' && !isspace((unsigned char)c)) {
389 savecp = cp;
391 cp = cvtnum(cp, &tm->tm_year);
392 if (cp == NULL)
394 if ((c = *cp) == '\0'
406 cp = strptime(cp, format, tm);
407 if (cp != NULL)
411 cp = savecp;
414 cp = strptime(cp, format, tm);
418 if ((c = *cp) == '\0'
421 cp = strptime(cp, format, tm);
424 return (cp);
428 * Try to match a (decimal) number in the string pointed to by "cp".
434 cvtnum(cp, nump)
435 register char *cp;
441 c = (unsigned char)*cp++;
447 c = (unsigned char)*cp++;
450 return (cp - 1);