Don't attempt to parse %c

This commit is contained in:
Andrey A. Chernov 2001-03-21 20:47:43 +00:00
parent 6ab831378a
commit f1b3d82406
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74596

View File

@ -32,6 +32,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef lint
@ -45,6 +47,7 @@ static const char sccsid[] = "@(#)contents.c 8.3 (Berkeley) 4/2/94";
#include <ar.h>
#include <dirent.h>
#include <fcntl.h>
#include <langinfo.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@ -63,7 +66,7 @@ contents(argv)
{
int afd, all;
struct tm *tp;
char *file, buf[25];
char *file, buf[80];
afd = open_archive(O_RDONLY);
@ -73,14 +76,20 @@ contents(argv)
else if (!(file = files(argv)))
goto next;
if (options & AR_V) {
static int d_first = -1;
(void)strmode(chdr.mode, buf);
(void)printf("%s %6d/%-6d %8qd ",
buf + 1, chdr.uid, chdr.gid, chdr.size);
if (d_first < 0)
d_first = (*nl_langinfo(D_MD_ORDER) == 'd');
tp = localtime(&chdr.date);
(void)strftime(buf, sizeof(buf), "%c", tp);
buf[16] = '\0';
buf[24] = '\0';
(void)printf("%s %s %s\n", buf + 4, buf + 20, file);
(void)strftime(buf, sizeof(buf),
d_first ? "%e %b %R %Y" :
"%b %e %R %Y",
tp);
(void)printf("%s %s\n", buf, file);
} else
(void)printf("%s\n", file);
if (!all && !*argv)