]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include xalloc.h.
authorJim Meyering <jim@meyering.net>
Fri, 8 Dec 2000 07:55:05 +0000 (07:55 +0000)
committerJim Meyering <jim@meyering.net>
Fri, 8 Dec 2000 07:55:05 +0000 (07:55 +0000)
(main): Use dir_name rather than the underlying dir_name_r.
The former now handles cwd-relative names with drive-letter prefixes.

src/dirname.c

index be1fc455906cfbc42a4fb9a21cd09581b1d0bd43..58c2013d10f61f138102dc177ce704bea9fa05b1 100644 (file)
@@ -26,6 +26,7 @@
 #include "error.h"
 #include "dirname.h"
 #include "closeout.h"
+#include "xalloc.h"
 
 /* The official name of this program (e.g., no `g' prefix).  */
 #define PROGRAM_NAME "dirname"
@@ -92,9 +93,11 @@ main (int argc, char **argv)
       usage (1);
     }
 
-  len = dir_name_r (argv[1], &result);
-  fwrite (result, 1, len, stdout);
-  putchar ('\n');
+  result = dir_name (argv[1]);
+  if (result == NULL)
+    xalloc_die ();
+  puts (result);
+  free (result);
 
   exit (0);
 }