utilities.c (23685) | utilities.c (35852) |
---|---|
1/* 2 * Copyright (c) 1983, 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 --- 131 unchanged lines hidden (view full) --- 140newnode(np) 141 struct entry *np; 142{ 143 char *cp; 144 145 if (np->e_type != NODE) 146 badentry(np, "newnode: not a node"); 147 cp = myname(np); | 1/* 2 * Copyright (c) 1983, 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 --- 131 unchanged lines hidden (view full) --- 140newnode(np) 141 struct entry *np; 142{ 143 char *cp; 144 145 if (np->e_type != NODE) 146 badentry(np, "newnode: not a node"); 147 cp = myname(np); |
148 if (!Nflag && mkdir(cp, 0777) < 0) { | 148 if (!Nflag && mkdir(cp, 0777) < 0 && !uflag) { |
149 np->e_flags |= EXISTED; 150 fprintf(stderr, "warning: %s: %s\n", cp, strerror(errno)); 151 return; 152 } 153 vprintf(stdout, "Make node %s\n", cp); 154} 155 156/* --- 44 unchanged lines hidden (view full) --- 201 * Create a link. 202 */ 203int 204linkit(existing, new, type) 205 char *existing, *new; 206 int type; 207{ 208 | 149 np->e_flags |= EXISTED; 150 fprintf(stderr, "warning: %s: %s\n", cp, strerror(errno)); 151 return; 152 } 153 vprintf(stdout, "Make node %s\n", cp); 154} 155 156/* --- 44 unchanged lines hidden (view full) --- 201 * Create a link. 202 */ 203int 204linkit(existing, new, type) 205 char *existing, *new; 206 int type; 207{ 208 |
209 /* if we want to unlink first, do it now so *link() won't fail */ 210 if (uflag && !Nflag) 211 (void)unlink(new); 212 |
|
209 if (type == SYMLINK) { 210 if (!Nflag && symlink(existing, new) < 0) { 211 fprintf(stderr, 212 "warning: cannot create symbolic link %s->%s: %s\n", 213 new, existing, strerror(errno)); 214 return (FAIL); 215 } 216 } else if (type == HARDLINK) { --- 218 unchanged lines hidden --- | 213 if (type == SYMLINK) { 214 if (!Nflag && symlink(existing, new) < 0) { 215 fprintf(stderr, 216 "warning: cannot create symbolic link %s->%s: %s\n", 217 new, existing, strerror(errno)); 218 return (FAIL); 219 } 220 } else if (type == HARDLINK) { --- 218 unchanged lines hidden --- |