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

Annotation of src/usr.bin/cvs/edit.c, Revision 1.14

1.14    ! xsa         1: /*     $OpenBSD$       */
1.1       jfb         2: /*
1.14    ! xsa         3:  * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
1.1       jfb         4:  *
1.14    ! xsa         5:  * Permission to use, copy, modify, and distribute this software for any
        !             6:  * purpose with or without fee is hereby granted, provided that the above
        !             7:  * copyright notice and this permission notice appear in all copies.
        !             8:  *
        !             9:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            12:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            13:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
        !            14:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
        !            15:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       jfb        16:  */
                     17:
1.11      xsa        18: #include "includes.h"
1.1       jfb        19:
                     20: #include "cvs.h"
                     21: #include "log.h"
1.14    ! xsa        22: #include "remote.h"
1.1       jfb        23:
1.14    ! xsa        24: static void    cvs_editors_local(struct cvs_file *);
1.1       jfb        25:
                     26: struct cvs_cmd cvs_cmd_editors = {
1.14    ! xsa        27:        CVS_OP_EDITORS, 0, "editors",
1.1       jfb        28:        { },
1.14    ! xsa        29:        "See who is editing a watched file",
1.3       xsa        30:        "[-lR] [file ...]",
1.1       jfb        31:        "lR",
                     32:        NULL,
1.14    ! xsa        33:        cvs_editors
1.1       jfb        34: };
                     35:
1.14    ! xsa        36: int
        !            37: cvs_editors(int argc, char **argv)
1.1       jfb        38: {
1.12      xsa        39:        int ch;
1.14    ! xsa        40:        int flags;
        !            41:        struct cvs_recursion cr;
        !            42:
        !            43:        flags = CR_RECURSE_DIRS;
1.1       jfb        44:
1.14    ! xsa        45:        while ((ch = getopt(argc, argv, cvs_cmd_editors.cmd_opts)) != -1) {
1.1       jfb        46:                switch (ch) {
                     47:                case 'l':
1.14    ! xsa        48:                        flags &= ~CR_RECURSE_DIRS;
1.1       jfb        49:                        break;
                     50:                case 'R':
                     51:                        break;
                     52:                default:
1.14    ! xsa        53:                        fatal("%s", cvs_cmd_editors.cmd_synopsis);
1.1       jfb        54:                }
                     55:        }
                     56:
1.14    ! xsa        57:        argc -= optind;
        !            58:        argv += optind;
1.1       jfb        59:
1.14    ! xsa        60:        if (argc == 0)
        !            61:                fatal("%s", cvs_cmd_editors.cmd_synopsis);
1.1       jfb        62:
1.14    ! xsa        63:        cr.enterdir = NULL;
        !            64:        cr.leavedir = NULL;
1.1       jfb        65:
1.14    ! xsa        66:        if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
        !            67:                cr.fileproc = cvs_client_sendfile;
        !            68:
        !            69:                if (!(flags & CR_RECURSE_DIRS))
        !            70:                        cvs_client_send_request("Argument -l");
        !            71:        } else {
        !            72:                cr.fileproc = cvs_editors_local;
        !            73:        }
1.1       jfb        74:
1.14    ! xsa        75:        cr.flags = flags;
1.9       xsa        76:
1.14    ! xsa        77:        cvs_file_run(argc, argv, &cr);
1.9       xsa        78:
1.14    ! xsa        79:        if (current_cvsroot->cr_method != CVS_METHOD_LOCAL) {
        !            80:                cvs_client_send_files(argv, argc);
        !            81:                cvs_client_senddir(".");
        !            82:                cvs_client_send_request("editors");
        !            83:                cvs_client_get_responses();
1.9       xsa        84:        }
                     85:
1.14    ! xsa        86:        return (0);
        !            87: }
1.9       xsa        88:
1.14    ! xsa        89: static void
        !            90: cvs_editors_local(struct cvs_file *cf)
        !            91: {
1.1       jfb        92: }