librsync  2.0.2
command.c
1 /*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2  *
3  * librsync -- the library for network deltas
4  *
5  * Copyright (C) 2000 by Martin Pool <mbp@sourcefrog.net>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 
22 #include "config.h"
23 
24 #include <assert.h>
25 #include <stdlib.h>
26 #include <stdio.h>
27 
28 #include "librsync.h"
29 #include "command.h"
30 
31 /* For debugging purposes, here are some human-readable forms. */
32 struct rs_op_kind_name const rs_op_kind_names[] = {
33  {"END", RS_KIND_END},
34  {"COPY", RS_KIND_COPY},
35  {"LITERAL", RS_KIND_LITERAL},
36  {"SIGNATURE", RS_KIND_SIGNATURE},
37  {"CHECKSUM", RS_KIND_CHECKSUM},
38  {"INVALID", RS_KIND_INVALID},
39  {NULL, 0}
40 };
41 
42 /** Return a human-readable name for KIND. */
43 char const *rs_op_kind_name(enum rs_op_kind kind)
44 {
45  const struct rs_op_kind_name *k;
46 
47  for (k = rs_op_kind_names; k->kind; k++) {
48  if (k->kind == kind) {
49  return k->name;
50  }
51  }
52 
53  return NULL;
54 }
rs_op_kind_name
Definition: command.h:43
rs_op_kind
rs_op_kind
Classes of operation that can be present.
Definition: command.h:30
librsync.h
command.h
rs_op_kind_name
const char * rs_op_kind_name(enum rs_op_kind)
Return a human-readable name for KIND.
Definition: command.c:43