mkdir.c (225736) | mkdir.c (250084) |
---|---|
1/*- 2 * Copyright (c) 1983, 1992, 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 --- 25 unchanged lines hidden (view full) --- 34 The Regents of the University of California. All rights reserved.\n"; 35#endif /* not lint */ 36 37#ifndef lint 38static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94"; 39#endif /* not lint */ 40#endif 41#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1983, 1992, 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 --- 25 unchanged lines hidden (view full) --- 34 The Regents of the University of California. All rights reserved.\n"; 35#endif /* not lint */ 36 37#ifndef lint 38static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94"; 39#endif /* not lint */ 40#endif 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: stable/9/bin/mkdir/mkdir.c 163213 2006-10-10 20:18:20Z ru $"); | 42__FBSDID("$FreeBSD: stable/9/bin/mkdir/mkdir.c 250084 2013-04-30 00:49:25Z eadler $"); |
43 44#include <sys/types.h> 45#include <sys/stat.h> 46 47#include <err.h> 48#include <errno.h> 49#include <libgen.h> 50#include <stdio.h> --- 79 unchanged lines hidden (view full) --- 130 exit(exitval); 131} 132 133 134/* 135 * Returns 1 if a directory has been created, 136 * 2 if it already existed, and 0 on failure. 137 */ | 43 44#include <sys/types.h> 45#include <sys/stat.h> 46 47#include <err.h> 48#include <errno.h> 49#include <libgen.h> 50#include <stdio.h> --- 79 unchanged lines hidden (view full) --- 130 exit(exitval); 131} 132 133 134/* 135 * Returns 1 if a directory has been created, 136 * 2 if it already existed, and 0 on failure. 137 */ |
138int | 138static int |
139build(char *path, mode_t omode) 140{ 141 struct stat sb; 142 mode_t numask, oumask; 143 int first, last, retval; 144 char *p; 145 146 p = path; --- 56 unchanged lines hidden (view full) --- 203 if (!last) 204 *p = '/'; 205 } 206 if (!first && !last) 207 (void)umask(oumask); 208 return (retval); 209} 210 | 139build(char *path, mode_t omode) 140{ 141 struct stat sb; 142 mode_t numask, oumask; 143 int first, last, retval; 144 char *p; 145 146 p = path; --- 56 unchanged lines hidden (view full) --- 203 if (!last) 204 *p = '/'; 205 } 206 if (!first && !last) 207 (void)umask(oumask); 208 return (retval); 209} 210 |
211void | 211static void |
212usage(void) 213{ 214 215 (void)fprintf(stderr, 216 "usage: mkdir [-pv] [-m mode] directory_name ...\n"); 217 exit (EX_USAGE); 218} | 212usage(void) 213{ 214 215 (void)fprintf(stderr, 216 "usage: mkdir [-pv] [-m mode] directory_name ...\n"); 217 exit (EX_USAGE); 218} |