1/*- 2 * Copyright (c) 1989, 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 --- 22 unchanged lines hidden (view full) --- 31 * SUCH DAMAGE. 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93"; 37#endif 38static const char rcsid[] = |
39 "$Id: create.c,v 1.11 1998/08/02 14:41:34 bde Exp $"; |
40#endif /* not lint */ 41 42#include <sys/param.h> 43#include <sys/stat.h> 44#include <dirent.h> 45#include <err.h> 46#include <errno.h> 47#include <fcntl.h> 48#include <fts.h> 49#include <grp.h> 50#include <md5.h> 51#include <pwd.h> 52#include <stdio.h> 53#include <time.h> 54#include <unistd.h> |
55#include <vis.h> |
56#include "mtree.h" 57#include "extern.h" 58 59#define INDENTNAMELEN 15 60#define MAXLINELEN 80 61 62extern long int crc_total; 63extern int ftsoptions; --- 70 unchanged lines hidden (view full) --- 134statf(indent, p) 135 int indent; 136 FTSENT *p; 137{ 138 struct group *gr; 139 struct passwd *pw; 140 u_long len, val; 141 int fd, offset; |
142 char *escaped_name; |
143 |
144 escaped_name = calloc(1, p->fts_namelen * 4 + 1); 145 if (escaped_name == NULL) 146 errx(1, "statf(): calloc() failed"); 147 strvis(escaped_name, p->fts_name, VIS_WHITE); 148 |
149 if (iflag || S_ISDIR(p->fts_statp->st_mode)) |
150 offset = printf("%*s%s", indent, "", escaped_name); |
151 else |
152 offset = printf("%*s %s", indent, "", escaped_name); 153 154 free(escaped_name); |
155 156 if (offset > (INDENTNAMELEN + indent)) 157 offset = MAXLINELEN; 158 else 159 offset += printf("%*s", (INDENTNAMELEN + indent) - offset, ""); 160 161 if (!S_ISREG(p->fts_statp->st_mode) && !dflag) 162 output(indent, &offset, "type=%s", inotype(p->fts_statp->st_mode)); --- 201 unchanged lines hidden --- |