spec.c (114601) | spec.c (121299) |
---|---|
1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 23 unchanged lines hidden (view full) --- 32 */ 33 34#if 0 35#ifndef lint 36static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93"; 37#endif /* not lint */ 38#endif 39#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 23 unchanged lines hidden (view full) --- 32 */ 33 34#if 0 35#ifndef lint 36static char sccsid[] = "@(#)spec.c 8.1 (Berkeley) 6/6/93"; 37#endif /* not lint */ 38#endif 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/usr.sbin/mtree/spec.c 114601 2003-05-03 21:06:42Z obrien $"); | 40__FBSDID("$FreeBSD: head/usr.sbin/mtree/spec.c 121299 2003-10-21 07:58:52Z phk $"); |
41 42#include <sys/types.h> 43#include <sys/stat.h> 44#include <ctype.h> 45#include <err.h> 46#include <errno.h> 47#include <fts.h> 48#include <grp.h> --- 5 unchanged lines hidden (view full) --- 54#include "extern.h" 55 56int lineno; /* Current spec line number. */ 57 58static void set(char *, NODE *); 59static void unset(char *, NODE *); 60 61NODE * | 41 42#include <sys/types.h> 43#include <sys/stat.h> 44#include <ctype.h> 45#include <err.h> 46#include <errno.h> 47#include <fts.h> 48#include <grp.h> --- 5 unchanged lines hidden (view full) --- 54#include "extern.h" 55 56int lineno; /* Current spec line number. */ 57 58static void set(char *, NODE *); 59static void unset(char *, NODE *); 60 61NODE * |
62spec() | 62spec(void) |
63{ | 63{ |
64 register NODE *centry, *last; 65 register char *p; | 64 NODE *centry, *last; 65 char *p; |
66 NODE ginfo, *root; 67 int c_cur, c_next; 68 char buf[2048]; 69 70 centry = last = root = NULL; 71 bzero(&ginfo, sizeof(ginfo)); 72 c_cur = c_next = 0; 73 for (lineno = 1; fgets(buf, sizeof(buf), stdin); --- 91 unchanged lines hidden (view full) --- 165 centry->prev = last; 166 last = last->next = centry; 167 } 168 } 169 return (root); 170} 171 172static void | 66 NODE ginfo, *root; 67 int c_cur, c_next; 68 char buf[2048]; 69 70 centry = last = root = NULL; 71 bzero(&ginfo, sizeof(ginfo)); 72 c_cur = c_next = 0; 73 for (lineno = 1; fgets(buf, sizeof(buf), stdin); --- 91 unchanged lines hidden (view full) --- 165 centry->prev = last; 166 last = last->next = centry; 167 } 168 } 169 return (root); 170} 171 172static void |
173set(t, ip) 174 char *t; 175 NODE *ip; | 173set(char *t, NODE *ip) |
176{ | 174{ |
177 register int type; | 175 int type; |
178 char *kw, *val = NULL; 179 struct group *gr; 180 struct passwd *pw; 181 mode_t *m; 182 int value; 183 char *ep; 184 185 for (; (kw = strtok(t, "= \t\n")); t = NULL) { --- 121 unchanged lines hidden (view full) --- 307 errx(1, "line %d: unknown user %s", lineno, val); 308 ip->st_uid = pw->pw_uid; 309 break; 310 } 311 } 312} 313 314static void | 176 char *kw, *val = NULL; 177 struct group *gr; 178 struct passwd *pw; 179 mode_t *m; 180 int value; 181 char *ep; 182 183 for (; (kw = strtok(t, "= \t\n")); t = NULL) { --- 121 unchanged lines hidden (view full) --- 305 errx(1, "line %d: unknown user %s", lineno, val); 306 ip->st_uid = pw->pw_uid; 307 break; 308 } 309 } 310} 311 312static void |
315unset(t, ip) 316 char *t; 317 register NODE *ip; | 313unset(char *t, NODE *ip) |
318{ | 314{ |
319 register char *p; | 315 char *p; |
320 321 while ((p = strtok(t, "\n\t "))) 322 ip->flags &= ~parsekey(p, NULL); 323} | 316 317 while ((p = strtok(t, "\n\t "))) 318 ip->flags &= ~parsekey(p, NULL); 319} |