SCCS-vsn: usr.bin/rdist/defs.h 4.15
SCCS-vsn: usr.bin/rdist/expand.c 4.12
SCCS-vsn: usr.bin/rdist/lookup.c 4.6
-/* defs.h 4.14 84/06/28 */
+/* defs.h 4.15 85/02/04 */
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
#include <grp.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
#include <grp.h>
-#include <signal.h>
-#include <sys/types.h>
#include <sys/dir.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/dir.h>
#include <sys/stat.h>
#include <sys/time.h>
/* table sizes */
#define HASHSIZE 1021
#define INMAX 3500
/* table sizes */
#define HASHSIZE 1021
#define INMAX 3500
-#define NCARGS 10240
-#define GAVSIZ NCARGS / 6
/* option flags */
#define VERIFY 0x1
/* option flags */
#define VERIFY 0x1
-static char *sccsid = "@(#)expand.c 4.11 (Berkeley) 84/12/06";
+static char *sccsid = "@(#)expand.c 4.12 (Berkeley) 85/02/04";
+#define GAVSIZ NCARGS / 6
#define LC '{'
#define RC '}'
#define LC '{'
#define RC '}'
* wh = E_SHELL if expanding shell characters.
* wh = E_TILDE if expanding `~'.
* or any of these or'ed together.
* wh = E_SHELL if expanding shell characters.
* wh = E_TILDE if expanding `~'.
* or any of these or'ed together.
+ *
+ * Major portions of this were snarfed from csh/sh.glob.c.
*/
struct namelist *
expand(list, wh)
*/
struct namelist *
expand(list, wh)
if ((which & E_VARS) && (cp = index(s, '$')) != NULL) {
*cp++ = '\0';
if (*cp == '\0') {
if ((which & E_VARS) && (cp = index(s, '$')) != NULL) {
*cp++ = '\0';
if (*cp == '\0') {
- error("no variable name after '$'\n");
+ yyerror("no variable name after '$'");
return;
}
if (*cp == LC) {
cp++;
if ((tail = index(cp, RC)) == NULL) {
return;
}
if (*cp == LC) {
cp++;
if ((tail = index(cp, RC)) == NULL) {
- error("unmatched %c\n", *cp);
+ yyerror("unmatched '{'");
return;
}
*tail++ = savec = '\0';
if (*cp == '\0') {
return;
}
*tail++ = savec = '\0';
if (*cp == '\0') {
- error("no variable name after '$'\n");
+ yyerror("no variable name after '$'");
*cp1 = '\0';
if (pw == NULL || strcmp(pw->pw_name, buf+1) != 0) {
if ((pw = getpwnam(buf+1)) == NULL) {
*cp1 = '\0';
if (pw == NULL || strcmp(pw->pw_name, buf+1) != 0) {
if ((pw = getpwnam(buf+1)) == NULL) {
- error("unknown user %s\n", buf+1);
+ strcat(buf, ": unknown user name");
+ yyerror(buf+1);
patherr1:
closedir(dirp);
patherr2:
patherr1:
closedir(dirp);
patherr2:
- error("%s: %s\n", path, sys_errlist[errno]);
+ strcat(path, ": ");
+ strcat(path, sys_errlist[errno]);
+ yyerror(path);
for (pe++; *pe && *pe != ']'; pe++)
continue;
if (!*pe)
for (pe++; *pe && *pe != ']'; pe++)
continue;
if (!*pe)
+ yyerror("Missing ']'");
- if (brclev || !*pe)
- fatal("Missing }\n");
+ if (brclev || !*pe) {
+ yyerror("Missing '}'");
+ return (0);
+ }
for (pl = pm = p; pm <= pe; pm++)
switch (*pm & (QUOTE|TRIM)) {
for (pl = pm = p; pm <= pe; pm++)
switch (*pm & (QUOTE|TRIM)) {
for (pm++; *pm && *pm != ']'; pm++)
continue;
if (!*pm)
for (pm++; *pm && *pm != ']'; pm++)
continue;
if (!*pm)
+ yyerror("Missing ']'");
if (scc == (lc = cc))
ok++;
}
if (scc == (lc = cc))
ok++;
}
- if (cc == 0)
- fatal("Missing ]\n");
+ if (cc == 0) {
+ yyerror("Missing ']'");
+ return (0);
+ }
return (scc == '\0');
default:
return (scc == '\0');
default:
if (scc == (lc = cc))
ok++;
}
if (scc == (lc = cc))
ok++;
}
- if (cc == 0)
- fatal("Missing ]\n");
+ if (cc == 0) {
+ yyerror("Missing ']'");
+ return (0);
+ }
nleft -= len;
if (nleft <= 0 || ++eargc >= GAVSIZ)
nleft -= len;
if (nleft <= 0 || ++eargc >= GAVSIZ)
- error("Arguments too long\n");
+ yyerror("Arguments too long");
eargv[eargc] = 0;
eargv[eargc - 1] = s = malloc(len);
if (s == NULL)
eargv[eargc] = 0;
eargv[eargc - 1] = s = malloc(len);
if (s == NULL)
{
if (pathp >= lastpathp)
{
if (pathp >= lastpathp)
- fatal("Pathname too long\n");
- *pathp++ = c;
- *pathp = '\0';
+ yyerror("Pathname too long");
+ else {
+ *pathp++ = c;
+ *pathp = '\0';
+ }
s3 = NULL;
if (pw == NULL || strcmp(pw->pw_name, file) != 0) {
if ((pw = getpwnam(file)) == NULL) {
s3 = NULL;
if (pw == NULL || strcmp(pw->pw_name, file) != 0) {
if ((pw = getpwnam(file)) == NULL) {
- error("unknown user %s\n", file);
+ error("%s: unknown user name\n", file);
if (s3 != NULL)
*s3 = '/';
return(NULL);
if (s3 != NULL)
*s3 = '/';
return(NULL);
-static char *sccsid = "@(#)lookup.c 4.5 (Berkeley) 84/02/16";
+static char *sccsid = "@(#)lookup.c 4.6 (Berkeley) 85/02/04";
register unsigned n;
register char *cp;
register struct syment *s;
register unsigned n;
register char *cp;
register struct syment *s;
if (debug)
printf("lookup(%s, %d, %x)\n", name, action, value);
if (debug)
printf("lookup(%s, %d, %x)\n", name, action, value);
if (strcmp(name, s->s_name))
continue;
if (action != LOOKUP) {
if (strcmp(name, s->s_name))
continue;
if (action != LOOKUP) {
- if (action != INSERT || s->s_type != CONST)
- fatal("%s redefined\n", name);
+ if (action != INSERT || s->s_type != CONST) {
+ sprintf(buf, "%s redefined", name);
+ yyerror(buf);
+ }
- if (action == LOOKUP)
- fatal("%s not defined", name);
+ if (action == LOOKUP) {
+ yyerror(sprintf(buf, "%s undefined", name));
+ return(NULL);
+ }
s = ALLOC(syment);
if (s == NULL)
s = ALLOC(syment);
if (s == NULL)