parse.c (80290) | parse.c (87203) |
---|---|
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[] = "@(#)parse.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[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93"; 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/usr.bin/hexdump/parse.c 80290 2001-07-24 14:11:09Z obrien $"; | 39 "$FreeBSD: head/usr.bin/hexdump/parse.c 87203 2001-12-02 12:09:41Z markm $"; |
40#endif /* not lint */ 41 42#include <sys/types.h> 43 44#include <err.h> 45#include <fcntl.h> 46#include <stdio.h> 47#include <stdlib.h> --- 26 unchanged lines hidden (view full) --- 74 continue; 75 add(p); 76 } 77 (void)fclose(fp); 78} 79 80void 81add(fmt) | 40#endif /* not lint */ 41 42#include <sys/types.h> 43 44#include <err.h> 45#include <fcntl.h> 46#include <stdio.h> 47#include <stdlib.h> --- 26 unchanged lines hidden (view full) --- 74 continue; 75 add(p); 76 } 77 (void)fclose(fp); 78} 79 80void 81add(fmt) |
82 char *fmt; | 82 const char *fmt; |
83{ | 83{ |
84 unsigned char *p, *savep; | 84 unsigned const char *p, *savep; |
85 static FS **nextfs; 86 FS *tfs; 87 FU *tfu, **nextfu; 88 89 /* start new linked list of format units */ 90 if ((tfs = calloc(1, sizeof(FS))) == NULL) 91 err(1, NULL); 92 if (!fshead) --- 53 unchanged lines hidden (view full) --- 146 err(1, NULL); 147 (void) strncpy(tfu->fmt, savep, p - savep); 148 tfu->fmt[p - savep] = '\0'; 149 escape(tfu->fmt); 150 p++; 151 } 152} 153 | 85 static FS **nextfs; 86 FS *tfs; 87 FU *tfu, **nextfu; 88 89 /* start new linked list of format units */ 90 if ((tfs = calloc(1, sizeof(FS))) == NULL) 91 err(1, NULL); 92 if (!fshead) --- 53 unchanged lines hidden (view full) --- 146 err(1, NULL); 147 (void) strncpy(tfu->fmt, savep, p - savep); 148 tfu->fmt[p - savep] = '\0'; 149 escape(tfu->fmt); 150 p++; 151 } 152} 153 |
154static char *spec = ".#-+ 0123456789"; | 154static char spec[] = ".#-+ 0123456789"; |
155 156int 157size(fs) 158 FS *fs; 159{ 160 register FU *fu; 161 register int bcnt, cursize; 162 register unsigned char *fmt; --- 333 unchanged lines hidden (view full) --- 496void 497badsfmt() 498{ 499 errx(1, "%%s: requires a precision or a byte count"); 500} 501 502void 503badfmt(fmt) | 155 156int 157size(fs) 158 FS *fs; 159{ 160 register FU *fu; 161 register int bcnt, cursize; 162 register unsigned char *fmt; --- 333 unchanged lines hidden (view full) --- 496void 497badsfmt() 498{ 499 errx(1, "%%s: requires a precision or a byte count"); 500} 501 502void 503badfmt(fmt) |
504 char *fmt; | 504 const char *fmt; |
505{ 506 errx(1, "\"%s\": bad format", fmt); 507} 508 509void 510badconv(ch) 511 char *ch; 512{ 513 errx(1, "%%%s: bad conversion character", ch); 514} | 505{ 506 errx(1, "\"%s\": bad format", fmt); 507} 508 509void 510badconv(ch) 511 char *ch; 512{ 513 errx(1, "%%%s: bad conversion character", ch); 514} |