| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: create.c,v 1.7 2010/03/21 16:30:17 joerg Exp $ */ | | 1 | /* $NetBSD: create.c,v 1.8 2010/03/21 16:32:06 joerg Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1989, 1993 | | 4 | * Copyright (c) 1989, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -34,27 +34,27 @@ | | | @@ -34,27 +34,27 @@ |
34 | #endif | | 34 | #endif |
35 | #if HAVE_NBTOOL_CONFIG_H | | 35 | #if HAVE_NBTOOL_CONFIG_H |
36 | #include "nbtool_config.h" | | 36 | #include "nbtool_config.h" |
37 | #endif | | 37 | #endif |
38 | | | 38 | |
39 | #include <nbcompat.h> | | 39 | #include <nbcompat.h> |
40 | #if HAVE_SYS_CDEFS_H | | 40 | #if HAVE_SYS_CDEFS_H |
41 | #include <sys/cdefs.h> | | 41 | #include <sys/cdefs.h> |
42 | #endif | | 42 | #endif |
43 | #if defined(__RCSID) && !defined(lint) | | 43 | #if defined(__RCSID) && !defined(lint) |
44 | #if 0 | | 44 | #if 0 |
45 | static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; | | 45 | static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; |
46 | #else | | 46 | #else |
47 | __RCSID("$NetBSD: create.c,v 1.7 2010/03/21 16:30:17 joerg Exp $"); | | 47 | __RCSID("$NetBSD: create.c,v 1.8 2010/03/21 16:32:06 joerg Exp $"); |
48 | #endif | | 48 | #endif |
49 | #endif /* not lint */ | | 49 | #endif /* not lint */ |
50 | | | 50 | |
51 | #if HAVE_SYS_PARAM_H | | 51 | #if HAVE_SYS_PARAM_H |
52 | #include <sys/param.h> | | 52 | #include <sys/param.h> |
53 | #endif | | 53 | #endif |
54 | #if HAVE_SYS_STAT_H | | 54 | #if HAVE_SYS_STAT_H |
55 | #include <sys/stat.h> | | 55 | #include <sys/stat.h> |
56 | #endif | | 56 | #endif |
57 | | | 57 | |
58 | #if ! HAVE_NBTOOL_CONFIG_H | | 58 | #if ! HAVE_NBTOOL_CONFIG_H |
59 | #if HAVE_DIRENT_H | | 59 | #if HAVE_DIRENT_H |
60 | #include <dirent.h> | | 60 | #include <dirent.h> |
| @@ -411,27 +411,27 @@ statd(FTS *t, FTSENT *parent, uid_t *pui | | | @@ -411,27 +411,27 @@ statd(FTS *t, FTSENT *parent, uid_t *pui |
411 | | | 411 | |
412 | static int | | 412 | static int |
413 | dsort(const FTSENT **a, const FTSENT **b) | | 413 | dsort(const FTSENT **a, const FTSENT **b) |
414 | { | | 414 | { |
415 | | | 415 | |
416 | if (S_ISDIR((*a)->fts_statp->st_mode)) { | | 416 | if (S_ISDIR((*a)->fts_statp->st_mode)) { |
417 | if (!S_ISDIR((*b)->fts_statp->st_mode)) | | 417 | if (!S_ISDIR((*b)->fts_statp->st_mode)) |
418 | return (1); | | 418 | return (1); |
419 | } else if (S_ISDIR((*b)->fts_statp->st_mode)) | | 419 | } else if (S_ISDIR((*b)->fts_statp->st_mode)) |
420 | return (-1); | | 420 | return (-1); |
421 | return (strcmp((*a)->fts_name, (*b)->fts_name)); | | 421 | return (strcmp((*a)->fts_name, (*b)->fts_name)); |
422 | } | | 422 | } |
423 | | | 423 | |
424 | void | | 424 | static void |
425 | output(int *offset, const char *fmt, ...) | | 425 | output(int *offset, const char *fmt, ...) |
426 | { | | 426 | { |
427 | va_list ap; | | 427 | va_list ap; |
428 | char buf[1024]; | | 428 | char buf[1024]; |
429 | | | 429 | |
430 | va_start(ap, fmt); | | 430 | va_start(ap, fmt); |
431 | vsnprintf(buf, sizeof(buf), fmt, ap); | | 431 | vsnprintf(buf, sizeof(buf), fmt, ap); |
432 | va_end(ap); | | 432 | va_end(ap); |
433 | | | 433 | |
434 | if (*offset + strlen(buf) > MAXLINELEN - 3) { | | 434 | if (*offset + strlen(buf) > MAXLINELEN - 3) { |
435 | printf(" \\\n%*s", INDENTNAMELEN, ""); | | 435 | printf(" \\\n%*s", INDENTNAMELEN, ""); |
436 | *offset = INDENTNAMELEN; | | 436 | *offset = INDENTNAMELEN; |
437 | } | | 437 | } |