create.c (38020) | create.c (42561) |
---|---|
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[] = | 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.10 1998/06/05 14:43:39 peter Exp $"; | 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> | 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> |
|
55#include "mtree.h" 56#include "extern.h" 57 58#define INDENTNAMELEN 15 59#define MAXLINELEN 80 60 61extern long int crc_total; 62extern int ftsoptions; --- 70 unchanged lines hidden (view full) --- 133statf(indent, p) 134 int indent; 135 FTSENT *p; 136{ 137 struct group *gr; 138 struct passwd *pw; 139 u_long len, val; 140 int fd, offset; | 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; |
|
141 | 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 |
|
142 if (iflag || S_ISDIR(p->fts_statp->st_mode)) | 149 if (iflag || S_ISDIR(p->fts_statp->st_mode)) |
143 offset = printf("%*s%s", indent, "", p->fts_name); | 150 offset = printf("%*s%s", indent, "", escaped_name); |
144 else | 151 else |
145 offset = printf("%*s %s", indent, "", p->fts_name); | 152 offset = printf("%*s %s", indent, "", escaped_name); 153 154 free(escaped_name); |
146 147 if (offset > (INDENTNAMELEN + indent)) 148 offset = MAXLINELEN; 149 else 150 offset += printf("%*s", (INDENTNAMELEN + indent) - offset, ""); 151 152 if (!S_ISREG(p->fts_statp->st_mode) && !dflag) 153 output(indent, &offset, "type=%s", inotype(p->fts_statp->st_mode)); --- 201 unchanged lines hidden --- | 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 --- |