[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.5

1.1       jfb         1: /*     $OpenBSD$       */
                      2: /*
                      3:  * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
                      4:  * All rights reserved.
                      5:  *
                      6:  * Redistribution and use in source and binary forms, with or without
                      7:  * modification, are permitted provided that the following conditions
                      8:  * are met:
                      9:  *
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. The name of the author may not be used to endorse or promote products
                     13:  *    derived from this software without specific prior written permission.
                     14:  *
                     15:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
                     16:  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
                     17:  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
                     18:  * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
                     19:  * EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
                     20:  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
                     21:  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
                     22:  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
                     23:  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
                     24:  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     25:  */
                     26:
                     27: #include <sys/param.h>
                     28:
                     29: #include <stdlib.h>
                     30: #include <stdio.h>
                     31: #include <unistd.h>
                     32: #include <errno.h>
                     33: #include <string.h>
                     34: #include <paths.h>
                     35: #include <sysexits.h>
                     36:
                     37: #include "cvs.h"
                     38: #include "log.h"
                     39: #include "rcs.h"
                     40: #include "sock.h"
1.3       jfb        41: #include "proto.h"
1.1       jfb        42:
                     43:
                     44: #define CVS_GLOG_RFONLY    0x01
                     45: #define CVS_GLOG_HDONLY    0x02
                     46:
                     47:
                     48: #define CVS_GETLOG_REVSEP   "----------------------------"
                     49: #define CVS_GETLOG_REVEND \
                     50:  "============================================================================="
                     51:
1.5     ! jfb        52: #ifdef notyet
1.1       jfb        53: static void cvs_getlog_print   (const char *, RCSFILE *, u_int);
1.5     ! jfb        54: #endif
1.1       jfb        55:
                     56:
                     57:
                     58:
                     59: /*
                     60:  * cvs_getlog()
                     61:  *
                     62:  * Implement the `cvs log' command.
                     63:  */
                     64:
                     65: int
                     66: cvs_getlog(int argc, char **argv)
                     67: {
1.5     ! jfb        68:        int i, rfonly, honly, flags;
1.1       jfb        69:
1.5     ! jfb        70:        flags = CF_RECURSE;
1.1       jfb        71:        rfonly = 0;
                     72:        honly = 0;
                     73:
                     74:        while ((i = getopt(argc, argv, "d:hlRr:")) != -1) {
                     75:                switch (i) {
                     76:                case 'd':
                     77:                        break;
                     78:                case 'h':
                     79:                        honly = 1;
                     80:                        break;
                     81:                case 'l':
1.5     ! jfb        82:                        flags &= ~CF_RECURSE;
1.1       jfb        83:                        break;
                     84:                case 'R':
                     85:                        rfonly = 1;
                     86:                        break;
                     87:                case 'r':
                     88:                        break;
                     89:                default:
                     90:                        return (EX_USAGE);
                     91:                }
                     92:        }
                     93:
                     94:        argc -= optind;
                     95:        argv += optind;
                     96:
1.4       jfb        97:        if (argc == 0) {
1.5     ! jfb        98:                cvs_files = cvs_file_get(".", flags);
1.4       jfb        99:        }
                    100:        else {
1.5     ! jfb       101:                cvs_files = cvs_file_getspec(argv, argc, flags);
1.1       jfb       102:        }
1.5     ! jfb       103:        if (cvs_files == NULL)
        !           104:                return (EX_DATAERR);
1.1       jfb       105:
                    106:        return (0);
                    107: }
                    108:
                    109:
1.5     ! jfb       110:
        !           111:
        !           112:
        !           113: #ifdef notyet
1.1       jfb       114: static void
                    115: cvs_getlog_print(const char *file, RCSFILE *rfp, u_int flags)
                    116: {
                    117:        char numbuf[64], datebuf[64], *sp;
                    118:        struct rcs_delta *rdp;
                    119:
                    120:        printf("RCS file: %s\nWorking file: %s\n",
                    121:            rfp->rf_path, file);
1.5     ! jfb       122:        printf("Working file: %s\n", (char *)NULL);
1.1       jfb       123:        printf("head: %s\nbranch:\nlocks:\naccess list:\n");
                    124:        printf("symbolic names:\nkeyword substitutions:\n");
                    125:        printf("total revisions: %u;\tselected revisions: %u\n", 1, 1);
                    126:
                    127:        printf("description:\n");
                    128:
                    129:        for (;;) {
                    130:                printf(CVS_GETLOG_REVSEP "\n");
1.5     ! jfb       131:                rcsnum_tostr(rdp->rd_num, numbuf, sizeof(numbuf));
1.1       jfb       132:                printf("revision %s\n", numbuf);
                    133:                printf("date: %d/%02d/%d %02d:%02d:%02d;  author: %s;"
                    134:                    "  state: %s;  lines:",
                    135:                    rdp->rd_date.tm_year, rdp->rd_date.tm_mon + 1,
                    136:                    rdp->rd_date.tm_mday, rdp->rd_date.tm_hour,
                    137:                    rdp->rd_date.tm_min, rdp->rd_date.tm_sec,
                    138:                    rdp->rd_author, rdp->rd_state);
                    139:        }
                    140:
                    141:        printf(CVS_GETLOG_REVEND "\n");
                    142:
                    143: }
1.5     ! jfb       144: #endif