mkdir.c (50870) | mkdir.c (71029) |
---|---|
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 --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94"; 43#endif 44static const char rcsid[] = | 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 --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94"; 43#endif 44static const char rcsid[] = |
45 "$FreeBSD: head/bin/mkdir/mkdir.c 50870 1999-09-04 03:19:38Z mharo $"; | 45 "$FreeBSD: head/bin/mkdir/mkdir.c 71029 2001-01-14 12:08:50Z alfred $"; |
46#endif /* not lint */ 47 48#include <sys/types.h> 49#include <sys/stat.h> 50 51#include <err.h> 52#include <errno.h> | 46#endif /* not lint */ 47 48#include <sys/types.h> 49#include <sys/stat.h> 50 51#include <err.h> 52#include <errno.h> |
53#include <libgen.h> |
|
53#include <stdio.h> 54#include <stdlib.h> 55#include <string.h> 56#include <sysexits.h> 57#include <unistd.h> 58 59int build __P((char *, mode_t)); 60void usage __P((void)); --- 42 unchanged lines hidden (view full) --- 103 } 104 105 for (exitval = 0; *argv != NULL; ++argv) { 106 success = 1; 107 if (pflag) { 108 if (build(*argv, omode)) 109 success = 0; 110 } else if (mkdir(*argv, omode) < 0) { | 54#include <stdio.h> 55#include <stdlib.h> 56#include <string.h> 57#include <sysexits.h> 58#include <unistd.h> 59 60int build __P((char *, mode_t)); 61void usage __P((void)); --- 42 unchanged lines hidden (view full) --- 104 } 105 106 for (exitval = 0; *argv != NULL; ++argv) { 107 success = 1; 108 if (pflag) { 109 if (build(*argv, omode)) 110 success = 0; 111 } else if (mkdir(*argv, omode) < 0) { |
111 warn("%s", *argv); | 112 if (errno == ENOTDIR || errno == ENOENT) 113 warn("%s", dirname(*argv)); 114 else 115 warn("%s", *argv); |
112 success = 0; 113 } else if (vflag) 114 (void)printf("%s\n", *argv); 115 116 if (!success) 117 exitval = 1; 118 /* 119 * The mkdir() and umask() calls both honor only the low --- 90 unchanged lines hidden --- | 116 success = 0; 117 } else if (vflag) 118 (void)printf("%s\n", *argv); 119 120 if (!success) 121 exitval = 1; 122 /* 123 * The mkdir() and umask() calls both honor only the low --- 90 unchanged lines hidden --- |