mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-09-27 22:49:02 +00:00
"fix" some tabbing
This commit is contained in:
parent
24d027e0b7
commit
5c9785b32e
33
lsyncd.c
33
lsyncd.c
@ -49,10 +49,10 @@
|
|||||||
enum lsyncd_exit_code
|
enum lsyncd_exit_code
|
||||||
{
|
{
|
||||||
LSYNCD_SUCCESS = 0,
|
LSYNCD_SUCCESS = 0,
|
||||||
|
|
||||||
/* out-of memory */
|
/* out-of memory */
|
||||||
LSYNCD_OUTOFMEMORY = 1,
|
LSYNCD_OUTOFMEMORY = 1,
|
||||||
|
|
||||||
/* file was not found, or failed to write */
|
/* file was not found, or failed to write */
|
||||||
LSYNCD_FILENOTFOUND = 2,
|
LSYNCD_FILENOTFOUND = 2,
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ enum lsyncd_exit_code
|
|||||||
|
|
||||||
/* command-line arguments given to lsyncd are bad */
|
/* command-line arguments given to lsyncd are bad */
|
||||||
LSYNCD_BADPARAMETERS = 4,
|
LSYNCD_BADPARAMETERS = 4,
|
||||||
|
|
||||||
/* Too many excludes files were specified */
|
/* Too many excludes files were specified */
|
||||||
LSYNCD_TOOMANYDIRECTORYEXCLUDES = 5,
|
LSYNCD_TOOMANYDIRECTORYEXCLUDES = 5,
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ bool remove_tosync_pos(int p) {
|
|||||||
tosync_pos--;
|
tosync_pos--;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an option text, replacing all '%' specifiers with
|
* Parses an option text, replacing all '%' specifiers with
|
||||||
* elaborated stuff. duh, currently there is only one, so this
|
* elaborated stuff. duh, currently there is only one, so this
|
||||||
@ -714,7 +714,7 @@ bool action(struct dir_conf * dir_conf,
|
|||||||
} else if (WEXITSTATUS(status)) {
|
} else if (WEXITSTATUS(status)) {
|
||||||
printlogf(LOG_NORMAL,
|
printlogf(LOG_NORMAL,
|
||||||
"Forked binary process returned non-zero return code: %i",
|
"Forked binary process returned non-zero return code: %i",
|
||||||
WEXITSTATUS(status));
|
WEXITSTATUS(status));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,7 +955,7 @@ int add_dirwatch(char const * dirname, int parent, struct dir_conf * dir_conf)
|
|||||||
// use traditional means to determine if its a directory.
|
// use traditional means to determine if its a directory.
|
||||||
isdir = buildpath(subdir, sizeof(subdir), dw, de->d_name, NULL) &&
|
isdir = buildpath(subdir, sizeof(subdir), dw, de->d_name, NULL) &&
|
||||||
!stat(subdir, &st) &&
|
!stat(subdir, &st) &&
|
||||||
S_ISDIR(st.st_mode);
|
S_ISDIR(st.st_mode);
|
||||||
} else {
|
} else {
|
||||||
isdir = false;
|
isdir = false;
|
||||||
}
|
}
|
||||||
@ -988,7 +988,8 @@ bool remove_dirwatch(const char * name, int parent)
|
|||||||
// look for the child with the name
|
// look for the child with the name
|
||||||
for (i = 0; i < dir_watch_num; i++) {
|
for (i = 0; i < dir_watch_num; i++) {
|
||||||
if (dir_watches[i].wd >= 0 && dir_watches[i].parent == parent &&
|
if (dir_watches[i].wd >= 0 && dir_watches[i].parent == parent &&
|
||||||
!strcmp(name, dir_watches[i].dirname)) {
|
!strcmp(name, dir_watches[i].dirname)
|
||||||
|
) {
|
||||||
dw = i;
|
dw = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1071,7 +1072,7 @@ bool handle_event(struct inotify_event *event)
|
|||||||
int subwatch = -1;
|
int subwatch = -1;
|
||||||
|
|
||||||
struct inotify_mask_text *p;
|
struct inotify_mask_text *p;
|
||||||
|
|
||||||
for (p = mask_texts; p->mask; p++) {
|
for (p = mask_texts; p->mask; p++) {
|
||||||
if (mask & p->mask) {
|
if (mask & p->mask) {
|
||||||
if (strlen(masktext) + strlen(p->text) + 3 >= sizeof(masktext)) {
|
if (strlen(masktext) + strlen(p->text) + 3 >= sizeof(masktext)) {
|
||||||
@ -1295,7 +1296,7 @@ struct call_option * parse_callopts(xmlNodePtr node) {
|
|||||||
xc = xmlGetProp(cnode, BAD_CAST "text");
|
xc = xmlGetProp(cnode, BAD_CAST "text");
|
||||||
if (xc == NULL) {
|
if (xc == NULL) {
|
||||||
fprintf(stderr, "error in config file: text attribute missing from <option/>\n");
|
fprintf(stderr, "error in config file: text attribute missing from <option/>\n");
|
||||||
exit(LSYNCD_BADCONFIGFILE);
|
exit(LSYNCD_BADCONFIGFILE);
|
||||||
}
|
}
|
||||||
asw[opt_n].kind = CO_TEXT;
|
asw[opt_n].kind = CO_TEXT;
|
||||||
asw[opt_n].text = s_strdup((char *) xc);
|
asw[opt_n].text = s_strdup((char *) xc);
|
||||||
@ -1330,11 +1331,11 @@ bool parse_directory(xmlNodePtr node) {
|
|||||||
xc = xmlGetProp(dnode, BAD_CAST "path");
|
xc = xmlGetProp(dnode, BAD_CAST "path");
|
||||||
if (xc == NULL) {
|
if (xc == NULL) {
|
||||||
fprintf(stderr, "error in config file: attribute path missing from <source>\n");
|
fprintf(stderr, "error in config file: attribute path missing from <source>\n");
|
||||||
exit(LSYNCD_BADCONFIGFILE);
|
exit(LSYNCD_BADCONFIGFILE);
|
||||||
}
|
}
|
||||||
if (dc->source) {
|
if (dc->source) {
|
||||||
fprintf(stderr, "error in config file: cannot have more than one source in one <directory>\n");
|
fprintf(stderr, "error in config file: cannot have more than one source in one <directory>\n");
|
||||||
exit(LSYNCD_BADCONFIGFILE);
|
exit(LSYNCD_BADCONFIGFILE);
|
||||||
}
|
}
|
||||||
// TODO: use realdir() on xc
|
// TODO: use realdir() on xc
|
||||||
dc->source = s_strdup((char *) xc);
|
dc->source = s_strdup((char *) xc);
|
||||||
@ -1349,13 +1350,13 @@ bool parse_directory(xmlNodePtr node) {
|
|||||||
xc = xmlGetProp(dnode, BAD_CAST "filename");
|
xc = xmlGetProp(dnode, BAD_CAST "filename");
|
||||||
if (xc == NULL) {
|
if (xc == NULL) {
|
||||||
fprintf(stderr, "error in config file: attribute filename missing from <binary>\n");
|
fprintf(stderr, "error in config file: attribute filename missing from <binary>\n");
|
||||||
exit(LSYNCD_BADCONFIGFILE);
|
exit(LSYNCD_BADCONFIGFILE);
|
||||||
}
|
}
|
||||||
dc->exclude_file = s_strdup((char *) xc);
|
dc->exclude_file = s_strdup((char *) xc);
|
||||||
} else if (!xmlStrcmp(dnode->name, BAD_CAST "callopts")) {
|
} else if (!xmlStrcmp(dnode->name, BAD_CAST "callopts")) {
|
||||||
if (dc->callopts) {
|
if (dc->callopts) {
|
||||||
fprintf(stderr, "error in config file: there is more than one <callopts> in a <directory>\n");
|
fprintf(stderr, "error in config file: there is more than one <callopts> in a <directory>\n");
|
||||||
exit(LSYNCD_BADCONFIGFILE);
|
exit(LSYNCD_BADCONFIGFILE);
|
||||||
}
|
}
|
||||||
dc->callopts = parse_callopts(dnode);
|
dc->callopts = parse_callopts(dnode);
|
||||||
} else {
|
} else {
|
||||||
@ -1623,11 +1624,11 @@ bool parse_options(int argc, char **argv)
|
|||||||
dir_conf_add_target(odc, *target);
|
dir_conf_add_target(odc, *target);
|
||||||
if (first_target) {
|
if (first_target) {
|
||||||
printlogf(LOG_NORMAL, "command line options: syncing %s -> %s\n",
|
printlogf(LOG_NORMAL, "command line options: syncing %s -> %s\n",
|
||||||
odc->source, *target);
|
odc->source, *target);
|
||||||
first_target = false;
|
first_target = false;
|
||||||
} else {
|
} else {
|
||||||
printlogf(LOG_NORMAL, " and -> %s\n",
|
printlogf(LOG_NORMAL, " and -> %s\n",
|
||||||
*target);
|
*target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1784,7 +1785,7 @@ int main(int argc, char **argv)
|
|||||||
for (target = dir_confs[i].targets; *target; ++target) {
|
for (target = dir_confs[i].targets; *target; ++target) {
|
||||||
if (!action(&dir_confs[i], dir_confs[i].source, *target, true)) {
|
if (!action(&dir_confs[i], dir_confs[i].source, *target, true)) {
|
||||||
printlogf(LOG_ERROR, "Initial rsync from %s to %s failed",
|
printlogf(LOG_ERROR, "Initial rsync from %s to %s failed",
|
||||||
dir_confs[i].source, *target);
|
dir_confs[i].source, *target);
|
||||||
exit(LSYNCD_EXECFAIL);
|
exit(LSYNCD_EXECFAIL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user