[BACK]Return to getlog.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Annotation of src/usr.bin/cvs/getlog.c, Revision 1.91

1.91    ! joris       1: /*     $OpenBSD: getlog.c,v 1.90 2008/09/12 13:38:35 tobias Exp $      */
1.1       jfb         2: /*
1.66      xsa         3:  * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
1.57      joris       4:  * Copyright (c) 2006 Joris Vink <joris@openbsd.org>
1.1       jfb         5:  *
1.57      joris       6:  * Permission to use, copy, modify, and distribute this software for any
                      7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
1.1       jfb         9:  *
1.57      joris      10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     15:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     16:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       jfb        17:  */
                     18:
1.71      otto       19: #include <unistd.h>
                     20: #include <string.h>
1.72      niallo     21: #include <errno.h>
1.91    ! joris      22: #include <ctype.h>
1.1       jfb        23:
                     24: #include "cvs.h"
1.65      joris      25: #include "remote.h"
1.1       jfb        26:
1.66      xsa        27: #define L_HEAD         0x01
                     28: #define L_HEAD_DESCR   0x02
                     29: #define L_NAME         0x04
                     30: #define L_NOTAGS       0x08
1.67      xsa        31: #define L_LOGINS       0x10
                     32: #define L_STATES       0x20
1.66      xsa        33:
1.91    ! joris      34: #define LDATE_LATER    0x01
        !            35: #define LDATE_EARLIER  0x02
        !            36: #define LDATE_SINGLE   0x04
        !            37: #define LDATE_RANGE    0x08
        !            38: #define LDATE_INCLUSIVE        0x10
        !            39:
        !            40: void            cvs_log_local(struct cvs_file *);
        !            41: static void     log_rev_print(struct rcs_delta *);
        !            42: static char    *push_date(char *dest, const char *);
        !            43: static u_int    date_select(RCSFILE *, char *);
1.67      xsa        44:
1.66      xsa        45: int     runflags = 0;
1.85      joris      46: char   *logrev = NULL;
1.91    ! joris      47: char   *logdate = NULL;
1.67      xsa        48: char   *slist = NULL;
                     49: char   *wlist = NULL;
1.1       jfb        50:
1.29      jfb        51: struct cvs_cmd cvs_cmd_log = {
1.81      tobias     52:        CVS_OP_LOG, CVS_USE_WDIR, "log",
1.29      jfb        53:        { "lo" },
                     54:        "Print out history information for files",
                     55:        "[-bhlNRt] [-d dates] [-r revisions] [-s states] [-w logins]",
1.68      xsa        56:        "bd:hlNRr:s:tw:",
1.29      jfb        57:        NULL,
1.57      joris      58:        cvs_getlog
1.16      joris      59: };
                     60:
1.72      niallo     61: struct cvs_cmd cvs_cmd_rlog = {
                     62:        CVS_OP_RLOG, 0, "rlog",
                     63:        { "rlo" },
                     64:        "Print out history information for files",
                     65:        "[-bhlNRt] [-d dates] [-r revisions] [-s states] [-w logins]",
                     66:        "bd:hlNRr:s:tw:",
                     67:        NULL,
                     68:        cvs_getlog
                     69: };
                     70:
1.57      joris      71: int
                     72: cvs_getlog(int argc, char **argv)
1.1       jfb        73: {
1.79      tobias     74:        int ch, flags, i;
1.57      joris      75:        char *arg = ".";
                     76:        struct cvs_recursion cr;
1.1       jfb        77:
1.57      joris      78:        flags = CR_RECURSE_DIRS;
                     79:
1.84      tobias     80:        while ((ch = getopt(argc, argv, cvs_cmdop == CVS_OP_LOG ?
                     81:            cvs_cmd_log.cmd_opts : cvs_cmd_rlog.cmd_opts)) != -1) {
1.16      joris      82:                switch (ch) {
1.91    ! joris      83:                case 'd':
        !            84:                        logdate = push_date(logdate, optarg);
        !            85:                        break;
1.66      xsa        86:                case 'h':
                     87:                        runflags |= L_HEAD;
                     88:                        break;
1.1       jfb        89:                case 'l':
1.57      joris      90:                        flags &= ~CR_RECURSE_DIRS;
1.1       jfb        91:                        break;
1.66      xsa        92:                case 'N':
                     93:                        runflags |= L_NOTAGS;
                     94:                        break;
                     95:                case 'R':
                     96:                        runflags |= L_NAME;
1.80      tobias     97:                        break;
1.1       jfb        98:                case 'r':
1.57      joris      99:                        logrev = optarg;
1.25      xsa       100:                        break;
1.67      xsa       101:                case 's':
                    102:                        runflags |= L_STATES;
                    103:                        slist = optarg;
                    104:                        break;
1.66      xsa       105:                case 't':
                    106:                        runflags |= L_HEAD_DESCR;
                    107:                        break;
1.67      xsa       108:                case 'w':
                    109:                        runflags |= L_LOGINS;
                    110:                        wlist = optarg;
                    111:                        break;
1.1       jfb       112:                default:
1.87      tobias    113:                        fatal("%s", cvs_cmdop == CVS_OP_LOG ?
                    114:                            cvs_cmd_log.cmd_synopsis :
                    115:                            cvs_cmd_rlog.cmd_synopsis);
1.1       jfb       116:                }
                    117:        }
                    118:
1.91    ! joris     119:        cvs_printf("dates: %s\n", logdate);
        !           120:
1.57      joris     121:        argc -= optind;
                    122:        argv += optind;
1.6       jfb       123:
1.79      tobias    124:        if (cvs_cmdop == CVS_OP_RLOG) {
1.81      tobias    125:                flags |= CR_REPO;
                    126:
1.79      tobias    127:                if (argc == 0)
                    128:                        return 0;
                    129:
                    130:                for (i = 0; i < argc; i++)
                    131:                        if (argv[i][0] == '/')
                    132:                                fatal("Absolute path name is invalid: %s",
                    133:                                    argv[i]);
                    134:        }
                    135:
1.57      joris     136:        cr.enterdir = NULL;
                    137:        cr.leavedir = NULL;
1.65      joris     138:
                    139:        if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
1.69      joris     140:                cvs_client_connect_to_server();
1.65      joris     141:                cr.fileproc = cvs_client_sendfile;
                    142:
1.91    ! joris     143:                if (logdate != NULL)
        !           144:                        cvs_client_send_request("Argument -d%s", logdate);
        !           145:
1.66      xsa       146:                if (runflags & L_HEAD)
                    147:                        cvs_client_send_request("Argument -h");
                    148:
1.65      joris     149:                if (!(flags & CR_RECURSE_DIRS))
                    150:                        cvs_client_send_request("Argument -l");
                    151:
1.66      xsa       152:                if (runflags & L_NOTAGS)
                    153:                        cvs_client_send_request("Argument -N");
                    154:
                    155:                if (runflags & L_NAME)
                    156:                        cvs_client_send_request("Argument -R");
                    157:
1.65      joris     158:                if (logrev != NULL)
                    159:                        cvs_client_send_request("Argument -r%s", logrev);
1.66      xsa       160:
1.67      xsa       161:                if (runflags & L_STATES)
                    162:                        cvs_client_send_request("Argument -s%s", slist);
                    163:
1.66      xsa       164:                if (runflags & L_HEAD_DESCR)
                    165:                        cvs_client_send_request("Argument -t");
1.67      xsa       166:
                    167:                if (runflags & L_LOGINS)
                    168:                        cvs_client_send_request("Argument -w%s", wlist);
1.65      joris     169:        } else {
1.75      xsa       170:                if (cvs_cmdop == CVS_OP_RLOG &&
1.72      niallo    171:                    chdir(current_cvsroot->cr_dir) == -1)
1.76      xsa       172:                        fatal("cvs_getlog: %s", strerror(errno));
1.72      niallo    173:
1.65      joris     174:                cr.fileproc = cvs_log_local;
                    175:        }
                    176:
1.57      joris     177:        cr.flags = flags;
                    178:
1.79      tobias    179:        if (cvs_cmdop == CVS_OP_LOG ||
                    180:            current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
                    181:                if (argc > 0)
                    182:                        cvs_file_run(argc, argv, &cr);
                    183:                else
                    184:                        cvs_file_run(1, &arg, &cr);
                    185:        }
1.5       jfb       186:
1.65      joris     187:        if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
                    188:                cvs_client_send_files(argv, argc);
                    189:                cvs_client_senddir(".");
1.75      xsa       190:
                    191:                cvs_client_send_request((cvs_cmdop == CVS_OP_RLOG) ?
                    192:                    "rlog" : "log");
                    193:
1.65      joris     194:                cvs_client_get_responses();
                    195:        }
                    196:
1.49      joris     197:        return (0);
1.6       jfb       198: }
1.5       jfb       199:
1.57      joris     200: void
                    201: cvs_log_local(struct cvs_file *cf)
1.1       jfb       202: {
1.57      joris     203:        u_int nrev;
1.86      joris     204:        RCSNUM *rev;
1.20      jfb       205:        struct rcs_sym *sym;
1.57      joris     206:        struct rcs_lock *lkp;
1.1       jfb       207:        struct rcs_delta *rdp;
1.21      jfb       208:        struct rcs_access *acp;
1.73      xsa       209:        char numb[CVS_REV_BUFSZ];
1.60      joris     210:
                    211:        cvs_log(LP_TRACE, "cvs_log_local(%s)", cf->file_path);
1.20      jfb       212:
1.78      joris     213:        cvs_file_classify(cf, cvs_directory_tag);
1.39      xsa       214:
1.89      tobias    215:        if (cf->file_rcs == NULL) {
1.57      joris     216:                return;
                    217:        } else if (cf->file_status == FILE_ADDED) {
1.39      xsa       218:                if (verbosity > 0)
1.62      david     219:                        cvs_log(LP_ERR, "%s has been added, but not committed",
1.57      joris     220:                            cf->file_path);
1.59      joris     221:                return;
                    222:        }
                    223:
                    224:        if (cf->file_type == CVS_DIR) {
                    225:                if (verbosity > 1)
                    226:                        cvs_log(LP_NOTICE, "Logging %s", cf->file_path);
1.57      joris     227:                return;
1.39      xsa       228:        }
                    229:
1.66      xsa       230:        if (runflags & L_NAME) {
                    231:                cvs_printf("%s\n", cf->file_rpath);
                    232:                return;
                    233:        }
                    234:
1.90      tobias    235:        if (logrev != NULL)
                    236:                nrev = cvs_revision_select(cf->file_rcs, logrev);
1.91    ! joris     237:        else if (logdate != NULL)
        !           238:                nrev = date_select(cf->file_rcs, logdate);
1.90      tobias    239:        else
                    240:                nrev = cf->file_rcs->rf_ndelta;
                    241:
1.65      joris     242:        cvs_printf("\nRCS file: %s", cf->file_rpath);
1.74      xsa       243:
                    244:        if (cvs_cmdop != CVS_OP_RLOG)
                    245:                cvs_printf("\nWorking file: %s", cf->file_path);
                    246:
1.65      joris     247:        cvs_printf("\nhead:");
1.57      joris     248:        if (cf->file_rcs->rf_head != NULL)
1.65      joris     249:                cvs_printf(" %s", rcsnum_tostr(cf->file_rcs->rf_head,
1.57      joris     250:                    numb, sizeof(numb)));
                    251:
1.65      joris     252:        cvs_printf("\nbranch:");
1.57      joris     253:        if (rcs_branch_get(cf->file_rcs) != NULL) {
1.65      joris     254:                cvs_printf(" %s", rcsnum_tostr(rcs_branch_get(cf->file_rcs),
1.57      joris     255:                    numb, sizeof(numb)));
1.20      jfb       256:        }
1.1       jfb       257:
1.65      joris     258:        cvs_printf("\nlocks: %s", (cf->file_rcs->rf_flags & RCS_SLOCK)
1.57      joris     259:            ? "strict" : "");
                    260:        TAILQ_FOREACH(lkp, &(cf->file_rcs->rf_locks), rl_list)
1.65      joris     261:                cvs_printf("\n\t%s: %s", lkp->rl_name,
1.57      joris     262:                    rcsnum_tostr(lkp->rl_num, numb, sizeof(numb)));
1.20      jfb       263:
1.65      joris     264:        cvs_printf("\naccess list:\n");
1.57      joris     265:        TAILQ_FOREACH(acp, &(cf->file_rcs->rf_access), ra_list)
1.65      joris     266:                cvs_printf("\t%s\n", acp->ra_name);
1.20      jfb       267:
1.66      xsa       268:        if (!(runflags & L_NOTAGS)) {
                    269:                cvs_printf("symbolic names:\n");
                    270:                TAILQ_FOREACH(sym, &(cf->file_rcs->rf_symbols), rs_list) {
1.86      joris     271:                        rev = rcsnum_alloc();
                    272:                        rcsnum_cpy(sym->rs_num, rev, 0);
1.85      joris     273:                        if (RCSNUM_ISBRANCH(sym->rs_num))
1.86      joris     274:                                rcsnum_addmagic(rev);
1.85      joris     275:
1.66      xsa       276:                        cvs_printf("\t%s: %s\n", sym->rs_name,
1.86      joris     277:                            rcsnum_tostr(rev, numb, sizeof(numb)));
                    278:                        rcsnum_free(rev);
1.66      xsa       279:                }
1.21      jfb       280:        }
                    281:
1.65      joris     282:        cvs_printf("keyword substitution: %s\n",
1.57      joris     283:            cf->file_rcs->rf_expand == NULL ? "kv" : cf->file_rcs->rf_expand);
                    284:
1.65      joris     285:        cvs_printf("total revisions: %u", cf->file_rcs->rf_ndelta);
1.21      jfb       286:
1.66      xsa       287:        if (cf->file_rcs->rf_head != NULL &&
                    288:            !(runflags & L_HEAD) && !(runflags & L_HEAD_DESCR))
                    289:                cvs_printf(";\tselected revisions: %u", nrev);
                    290:
1.65      joris     291:        cvs_printf("\n");
1.1       jfb       292:
1.66      xsa       293:        if (!(runflags & L_HEAD) || (runflags & L_HEAD_DESCR))
                    294:                cvs_printf("description:\n%s", cf->file_rcs->rf_desc);
                    295:
                    296:        if (!(runflags & L_HEAD) && !(runflags & L_HEAD_DESCR)) {
                    297:                TAILQ_FOREACH(rdp, &(cf->file_rcs->rf_delta), rd_list) {
1.67      xsa       298:                        /*
                    299:                         * if selections are enabled verify that entry is
                    300:                         * selected.
                    301:                         */
1.91    ! joris     302:                        if ((logrev == NULL && logdate == NULL) ||
        !           303:                            (rdp->rd_flags & RCS_RD_SELECT))
1.67      xsa       304:                                log_rev_print(rdp);
1.66      xsa       305:                }
1.57      joris     306:        }
1.20      jfb       307:
1.65      joris     308:        cvs_printf("%s\n", LOG_REVEND);
1.67      xsa       309: }
                    310:
                    311: static void
                    312: log_rev_print(struct rcs_delta *rdp)
                    313: {
                    314:        int i, found;
1.73      xsa       315:        char numb[CVS_REV_BUFSZ], timeb[CVS_TIME_BUFSZ];
1.67      xsa       316:        struct cvs_argvector *sargv, *wargv;
1.82      joris     317:        struct rcs_branch *rb;
                    318:        struct rcs_delta *nrdp;
1.67      xsa       319:
                    320:        i = found = 0;
                    321:
                    322:        /* -s states */
                    323:        if (runflags & L_STATES) {
                    324:                sargv = cvs_strsplit(slist, ",");
                    325:                for (i = 0; sargv->argv[i] != NULL; i++) {
                    326:                        if (strcmp(rdp->rd_state, sargv->argv[i]) == 0) {
                    327:                                found++;
                    328:                                break;
                    329:                        }
                    330:                        found = 0;
                    331:                }
                    332:                cvs_argv_destroy(sargv);
                    333:        }
                    334:
                    335:        /* -w[logins] */
                    336:        if (runflags & L_LOGINS) {
                    337:                wargv = cvs_strsplit(wlist, ",");
                    338:                for (i = 0; wargv->argv[i] != NULL; i++) {
                    339:                        if (strcmp(rdp->rd_author, wargv->argv[i]) == 0) {
                    340:                                found++;
                    341:                                break;
                    342:                        }
                    343:                        found = 0;
                    344:                }
                    345:                cvs_argv_destroy(wargv);
                    346:        }
                    347:
1.68      xsa       348:        if ((runflags & (L_STATES|L_LOGINS)) && found == 0)
1.67      xsa       349:                return;
                    350:
                    351:        cvs_printf("%s\n", LOG_REVSEP);
                    352:
                    353:        rcsnum_tostr(rdp->rd_num, numb, sizeof(numb));
                    354:        cvs_printf("revision %s", numb);
                    355:
                    356:        strftime(timeb, sizeof(timeb), "%Y/%m/%d %H:%M:%S", &rdp->rd_date);
1.82      joris     357:        cvs_printf("\ndate: %s;  author: %s;  state: %s;",
1.67      xsa       358:            timeb, rdp->rd_author, rdp->rd_state);
1.82      joris     359:
                    360:        /*
                    361:         * If we are a branch revision, the diff of this revision is stored
                    362:         * in place.
                    363:         * Otherwise, it is stored in the previous revision as a reversed diff.
                    364:         */
                    365:        if (RCSNUM_ISBRANCHREV(rdp->rd_num))
                    366:                nrdp = rdp;
                    367:        else
                    368:                nrdp = TAILQ_NEXT(rdp, rd_list);
                    369:
                    370:        /*
                    371:         * We do not write diff stats for the first revision of the default
                    372:         * branch, since it was not a diff but a full text.
                    373:         */
                    374:        if (nrdp != NULL && rdp->rd_num->rn_len == nrdp->rd_num->rn_len) {
                    375:                int added, removed;
                    376:                rcs_delta_stats(nrdp, &added, &removed);
                    377:                if (RCSNUM_ISBRANCHREV(rdp->rd_num))
                    378:                        cvs_printf("  lines: +%d -%d", added, removed);
                    379:                else
                    380:                        cvs_printf("  lines: +%d -%d", removed, added);
                    381:        }
                    382:        cvs_printf("\n");
                    383:
                    384:        if (!TAILQ_EMPTY(&(rdp->rd_branches))) {
                    385:                cvs_printf("branches:");
                    386:                TAILQ_FOREACH(rb, &(rdp->rd_branches), rb_list) {
                    387:                        RCSNUM *branch;
                    388:                        branch = rcsnum_revtobr(rb->rb_num);
                    389:                        rcsnum_tostr(branch, numb, sizeof(numb));
                    390:                        cvs_printf("  %s;", numb);
                    391:                        rcsnum_free(branch);
                    392:                }
                    393:                cvs_printf("\n");
                    394:        }
1.83      xsa       395:
1.67      xsa       396:        cvs_printf("%s", rdp->rd_log);
1.91    ! joris     397: }
        !           398:
        !           399: static char *
        !           400: push_date(char *dest, const char *src)
        !           401: {
        !           402:        size_t len;
        !           403:
        !           404:        if (dest == NULL)
        !           405:                return (xstrdup(src));
        !           406:
        !           407:        /* 2 = ; and '\0' */
        !           408:        len = strlen(dest) + strlen(src) + 2;
        !           409:
        !           410:        dest[strlen(dest)] = ';';
        !           411:        dest = xrealloc(dest, len, 1);
        !           412:        strlcat(dest, src, len);
        !           413:        return (dest);
        !           414: }
        !           415:
        !           416: static u_int
        !           417: date_select(RCSFILE *file, char *date)
        !           418: {
        !           419:        int i, nrev, flags;
        !           420:        struct rcs_delta *rdp;
        !           421:        struct cvs_argvector *args;
        !           422:        char *first, *last, delim;
        !           423:        time_t firstdate, lastdate, rcsdate;
        !           424:
        !           425:        nrev = 0;
        !           426:        args = cvs_strsplit(date, ";");
        !           427:
        !           428:        for (i = 0; args->argv[i] != NULL; i++) {
        !           429:                flags = 0;
        !           430:                firstdate = lastdate = -1;
        !           431:
        !           432:                first = args->argv[i];
        !           433:                last = strchr(args->argv[i], '<');
        !           434:                if (last != NULL) {
        !           435:                        delim = *last;
        !           436:                        *last++ = '\0';
        !           437:
        !           438:                        if (*last == '=') {
        !           439:                                last++;
        !           440:                                flags |= LDATE_INCLUSIVE;
        !           441:                        }
        !           442:                } else {
        !           443:                        last = strchr(args->argv[i], '>');
        !           444:                        if (last != NULL) {
        !           445:                                delim = *last;
        !           446:                                *last++ = '\0';
        !           447:
        !           448:                                if (*last == '=') {
        !           449:                                        last++;
        !           450:                                        flags |= LDATE_INCLUSIVE;
        !           451:                                }
        !           452:                        }
        !           453:                }
        !           454:
        !           455:                if (last == NULL) {
        !           456:                        flags |= LDATE_SINGLE;
        !           457:                        firstdate = cvs_date_parse(first);
        !           458:                        delim = '\0';
        !           459:                        last = "\0";
        !           460:                } else {
        !           461:                        while (*last && isspace(*last))
        !           462:                                last++;
        !           463:                }
        !           464:
        !           465:                if (delim == '>' && *last == '\0') {
        !           466:                        flags |= LDATE_EARLIER;
        !           467:                        firstdate = cvs_date_parse(first);
        !           468:                }
        !           469:
        !           470:                if (delim == '>' && *first == '\0' && *last != '\0') {
        !           471:                        flags |= LDATE_LATER;
        !           472:                        firstdate = cvs_date_parse(last);
        !           473:                }
        !           474:
        !           475:                if (delim == '<' && *last == '\0') {
        !           476:                        flags |= LDATE_LATER;
        !           477:                        firstdate = cvs_date_parse(first);
        !           478:                }
        !           479:
        !           480:                if (delim == '<' && *first == '\0' && *last != '\0') {
        !           481:                        flags |= LDATE_EARLIER;
        !           482:                        firstdate = cvs_date_parse(last);
        !           483:                }
        !           484:
        !           485:                if (*first != '\0' && *last != '\0') {
        !           486:                        flags |= LDATE_RANGE;
        !           487:
        !           488:                        if (delim == '<') {
        !           489:                                firstdate = cvs_date_parse(first);
        !           490:                                lastdate = cvs_date_parse(last);
        !           491:                        } else {
        !           492:                                firstdate = cvs_date_parse(last);
        !           493:                                lastdate = cvs_date_parse(first);
        !           494:                        }
        !           495:                }
        !           496:
        !           497:                TAILQ_FOREACH(rdp, &(file->rf_delta), rd_list) {
        !           498:                        rcsdate = mktime(&(rdp->rd_date));
        !           499:
        !           500:                        if (flags & LDATE_SINGLE) {
        !           501:                                if (rcsdate <= firstdate) {
        !           502:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           503:                                        nrev++;
        !           504:                                        break;
        !           505:                                }
        !           506:                        }
        !           507:
        !           508:                        if (flags & LDATE_EARLIER) {
        !           509:                                if (rcsdate < firstdate) {
        !           510:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           511:                                        nrev++;
        !           512:                                        continue;
        !           513:                                }
        !           514:
        !           515:                                if (flags & LDATE_INCLUSIVE &&
        !           516:                                    (rcsdate <= firstdate)) {
        !           517:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           518:                                        nrev++;
        !           519:                                        continue;
        !           520:                                }
        !           521:                        }
        !           522:
        !           523:                        if (flags & LDATE_LATER) {
        !           524:                                if (rcsdate > firstdate) {
        !           525:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           526:                                        nrev++;
        !           527:                                        continue;
        !           528:                                }
        !           529:
        !           530:                                if (flags & LDATE_INCLUSIVE &&
        !           531:                                    (rcsdate >= firstdate)) {
        !           532:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           533:                                        nrev++;
        !           534:                                        continue;
        !           535:                                }
        !           536:                        }
        !           537:
        !           538:                        if (flags & LDATE_RANGE) {
        !           539:                                if ((rcsdate > firstdate) &&
        !           540:                                    (rcsdate < lastdate)) {
        !           541:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           542:                                        nrev++;
        !           543:                                        continue;
        !           544:                                }
        !           545:
        !           546:                                if (flags & LDATE_INCLUSIVE &&
        !           547:                                    ((rcsdate >= firstdate) &&
        !           548:                                    (rcsdate <= lastdate))) {
        !           549:                                        rdp->rd_flags |= RCS_RD_SELECT;
        !           550:                                        nrev++;
        !           551:                                        continue;
        !           552:                                }
        !           553:                        }
        !           554:                }
        !           555:        }
        !           556:
        !           557:        cvs_argv_destroy(args);
        !           558:
        !           559:        return (nrev);
1.1       jfb       560: }