SCCS-vsn: usr.bin/rdist/defs.h 4.12
SCCS-vsn: usr.bin/rdist/docmd.c 4.19
SCCS-vsn: usr.bin/rdist/gram.y 4.9
SCCS-vsn: usr.bin/rdist/main.c 4.11
-/* defs.h 4.11 84/02/24 */
+/* defs.h 4.12 84/04/06 */
#include <stdio.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#define RP 3
#define SM 4
#define ARROW 5
#define RP 3
#define SM 4
#define ARROW 5
-#define DCOLON 6
-#define NAME 7
-#define STRING 8
-#define INSTALL 9
-#define NOTIFY 10
-#define EXCEPT 11
-#define SPECIAL 12
-#define OPTION 13
+#define COLON 6
+#define DCOLON 7
+#define NAME 8
+#define STRING 9
+#define INSTALL 10
+#define NOTIFY 11
+#define EXCEPT 12
+#define SPECIAL 13
+#define OPTION 14
/* lexical definitions */
#define QUOTE 0200 /* used internally for quoted characters */
/* lexical definitions */
#define QUOTE 0200 /* used internally for quoted characters */
struct cmd {
int c_type; /* type - ARROW,DCOLON */
char *c_name; /* hostname or time stamp file name */
struct cmd {
int c_type; /* type - ARROW,DCOLON */
char *c_name; /* hostname or time stamp file name */
+ char *c_label; /* label for partial update */
struct namelist *c_files;
struct subcmd *c_cmds;
struct cmd *c_next;
struct namelist *c_files;
struct subcmd *c_cmds;
struct cmd *c_next;
extern int nerrs; /* number of errors seen */
extern int rem; /* remote file descriptor */
extern int iamremote; /* acting as remote server */
extern int nerrs; /* number of errors seen */
extern int rem; /* remote file descriptor */
extern int iamremote; /* acting as remote server */
-extern int filec; /* number of files to update */
-extern char **filev; /* list of files/directories to update */
extern char tmpfile[]; /* file name for logging changes */
extern struct passwd *pw; /* pointer to static area used by getpwent */
extern struct group *gr; /* pointer to static area used by getgrent */
extern char tmpfile[]; /* file name for logging changes */
extern struct passwd *pw; /* pointer to static area used by getpwent */
extern struct group *gr; /* pointer to static area used by getgrent */
-static char *sccsid = "@(#)docmd.c 4.18 (Berkeley) 84/03/19";
+static char *sccsid = "@(#)docmd.c 4.19 (Berkeley) 84/04/06";
char **argv;
{
register struct cmd *c;
char **argv;
{
register struct cmd *c;
+ register struct namelist *f;
+ register char **cpp;
extern struct cmd *cmds;
signal(SIGHUP, cleanup);
extern struct cmd *cmds;
signal(SIGHUP, cleanup);
signal(SIGTERM, cleanup);
for (c = cmds; c != NULL; c = c->c_next) {
signal(SIGTERM, cleanup);
for (c = cmds; c != NULL; c = c->c_next) {
+ if (argc) {
+ for (cpp = argv; *cpp; cpp++) {
+ if (c->c_label != NULL &&
+ strcmp(c->c_label, (*cpp)+1) == 0) {
+ cpp = NULL;
+ goto found;
+ }
+ for (f = c->c_files; f != NULL; f = f->n_next)
+ if (strcmp(f->n_name, *cpp) == 0)
+ goto found;
+ }
+ continue;
+ } else
+ cpp = NULL;
+ found:
switch (c->c_type) {
case ARROW:
switch (c->c_type) {
case ARROW:
- doarrow(c->c_files, c->c_name, c->c_cmds);
+ doarrow(cpp, c->c_files, c->c_name, c->c_cmds);
- dodcolon(c->c_files, c->c_name, c->c_cmds);
+ dodcolon(cpp, c->c_files, c->c_name, c->c_cmds);
break;
default:
fatal("illegal command type %d\n", c->c_type);
break;
default:
fatal("illegal command type %d\n", c->c_type);
/*
* Process commands for sending files to other machines.
*/
/*
* Process commands for sending files to other machines.
*/
-doarrow(files, rhost, cmds)
+doarrow(filev, files, rhost, cmds)
+ char **filev;
struct namelist *files;
char *rhost;
struct subcmd *cmds;
{
register struct namelist *f;
register struct subcmd *sc;
struct namelist *files;
char *rhost;
struct subcmd *cmds;
{
register struct namelist *f;
register struct subcmd *sc;
}
}
for (f = files; f != NULL; f = f->n_next) {
}
}
for (f = files; f != NULL; f = f->n_next) {
-#ifdef notdef
- if (filec) {
- register char **cpp;
-
for (cpp = filev; *cpp; cpp++)
for (cpp = filev; *cpp; cpp++)
- if (!strcmp(f->b_name, *cpp))
+ if (strcmp(f->n_name, *cpp) == 0)
goto found;
if (!nflag)
(void) fclose(lfp);
continue;
}
found:
goto found;
if (!nflag)
(void) fclose(lfp);
continue;
}
found:
n = 0;
for (sc = cmds; sc != NULL; sc = sc->sc_next) {
if (sc->sc_type != INSTALL)
n = 0;
for (sc = cmds; sc != NULL; sc = sc->sc_next) {
if (sc->sc_type != INSTALL)
/*
* Process commands for comparing files to time stamp files.
*/
/*
* Process commands for comparing files to time stamp files.
*/
-dodcolon(files, stamp, cmds)
+dodcolon(filev, files, stamp, cmds)
+ char **filev;
struct namelist *files;
char *stamp;
struct subcmd *cmds;
struct namelist *files;
char *stamp;
struct subcmd *cmds;
}
for (f = files; f != NULL; f = f->n_next) {
}
for (f = files; f != NULL; f = f->n_next) {
-#ifdef notdef
- if (filec) {
for (cpp = filev; *cpp; cpp++)
for (cpp = filev; *cpp; cpp++)
- if (!strcmp(b->b_name, *cpp))
+ if (strcmp(f->n_name, *cpp) == 0)
goto found;
continue;
}
found:
goto found;
continue;
}
found:
tp = NULL;
cmptime(f->n_name);
}
tp = NULL;
cmptime(f->n_name);
}
-static char *sccsid = "@(#)gram.y 4.8 (Berkeley) 84/02/09";
+static char *sccsid = "@(#)gram.y 4.9 (Berkeley) 84/04/06";
%term RP 3
%term SM 4
%term ARROW 5
%term RP 3
%term SM 4
%term ARROW 5
-%term DCOLON 6
-%term NAME 7
-%term STRING 8
-%term INSTALL 9
-%term NOTIFY 10
-%term EXCEPT 11
-%term SPECIAL 12
-%term OPTION 13
+%term COLON 6
+%term DCOLON 7
+%term NAME 8
+%term STRING 9
+%term INSTALL 10
+%term NOTIFY 11
+%term EXCEPT 12
+%term SPECIAL 13
+%term OPTION 14
(void) lookup($1, INSERT, $3);
}
| namelist ARROW namelist cmdlist = {
(void) lookup($1, INSERT, $3);
}
| namelist ARROW namelist cmdlist = {
+ insert(NULL, $1, $3, $4);
+ }
+ | NAME COLON namelist ARROW namelist cmdlist = {
+ insert($1, $3, $5, $6);
}
| namelist DCOLON NAME cmdlist = {
}
| namelist DCOLON NAME cmdlist = {
+ append(NULL, $1, $3, $4);
+ }
+ | NAME COLON namelist DCOLON NAME cmdlist = {
+ append($1, $3, $5, $6);
+ if (c == '\n') {
+ yylineno++;
c = ' '; /* can't send '\n' */
c = ' '; /* can't send '\n' */
*cp1++ = c;
}
if (c != '"')
*cp1++ = c;
}
if (c != '"')
yylval.string = makestr(yytext);
return(STRING);
yylval.string = makestr(yytext);
return(STRING);
+ case ':': /* : or :: */
if ((c = getc(fin)) == ':')
return(DCOLON);
ungetc(c, fin);
if ((c = getc(fin)) == ':')
return(DCOLON);
ungetc(c, fin);
}
cp1 = yytext;
cp2 = &yytext[INMAX - 1];
}
cp1 = yytext;
cp2 = &yytext[INMAX - 1];
}
*cp1++ = c;
c = getc(fin);
}
*cp1++ = c;
c = getc(fin);
- if (c == EOF || any(c, " \t()=;\n")) {
+ if (c == EOF || any(c, " \"'\t()=;:\n")) {
/*
* Insert or append ARROW command to list of hosts to be updated.
*/
/*
* Insert or append ARROW command to list of hosts to be updated.
*/
-insert(files, hosts, subcmds)
+insert(label, files, hosts, subcmds)
+ char *label;
struct namelist *files, *hosts;
struct subcmd *subcmds;
{
struct namelist *files, *hosts;
struct subcmd *subcmds;
{
fatal("ran out of memory\n");
nc->c_type = ARROW;
nc->c_name = h->n_name;
fatal("ran out of memory\n");
nc->c_type = ARROW;
nc->c_name = h->n_name;
nc->c_files = files;
nc->c_cmds = subcmds;
nc->c_next = c;
nc->c_files = files;
nc->c_cmds = subcmds;
nc->c_next = c;
* Append DCOLON command to the end of the command list since these are always
* executed in the order they appear in the distfile.
*/
* Append DCOLON command to the end of the command list since these are always
* executed in the order they appear in the distfile.
*/
-append(files, stamp, subcmds)
+append(label, files, stamp, subcmds)
+ char *label;
struct namelist *files;
char *stamp;
struct subcmd *subcmds;
struct namelist *files;
char *stamp;
struct subcmd *subcmds;
fatal("ran out of memory\n");
c->c_type = DCOLON;
c->c_name = stamp;
fatal("ran out of memory\n");
c->c_type = DCOLON;
c->c_name = stamp;
c->c_files = expand(files, E_ALL);
c->c_cmds = subcmds;
c->c_next = NULL;
c->c_files = expand(files, E_ALL);
c->c_cmds = subcmds;
c->c_next = NULL;
-static char *sccsid = "@(#)main.c 4.10 (Berkeley) 84/02/09";
+static char *sccsid = "@(#)main.c 4.11 (Berkeley) 84/04/06";