mkheaders.c (61640) | mkheaders.c (69004) |
---|---|
1/* 2 * Copyright (c) 1980, 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[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93"; 37#endif 38static const char rcsid[] = | 1/* 2 * Copyright (c) 1980, 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[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93"; 37#endif 38static const char rcsid[] = |
39 "$FreeBSD: head/usr.sbin/config/mkheaders.c 61640 2000-06-13 22:28:50Z peter $"; | 39 "$FreeBSD: head/usr.sbin/config/mkheaders.c 69004 2000-11-21 19:58:55Z imp $"; |
40#endif /* not lint */ 41 42/* 43 * Make all the .h files for the optional entries 44 */ 45 46#include <ctype.h> 47#include <err.h> 48#include <stdio.h> 49#include <string.h> | 40#endif /* not lint */ 41 42/* 43 * Make all the .h files for the optional entries 44 */ 45 46#include <ctype.h> 47#include <err.h> 48#include <stdio.h> 49#include <string.h> |
50#include <sys/param.h> |
|
50#include "config.h" 51#include "y.tab.h" 52 53static void do_header(char *, int); 54static void do_count(char *); 55static char *toheader(char *); 56static char *tomacro(char *); 57 --- 126 unchanged lines hidden (view full) --- 184} 185 186/* 187 * convert a dev name to a .h file name 188 */ 189static char * 190toheader(char *dev) 191{ | 51#include "config.h" 52#include "y.tab.h" 53 54static void do_header(char *, int); 55static void do_count(char *); 56static char *toheader(char *); 57static char *tomacro(char *); 58 --- 126 unchanged lines hidden (view full) --- 185} 186 187/* 188 * convert a dev name to a .h file name 189 */ 190static char * 191toheader(char *dev) 192{ |
192 static char hbuf[80]; | 193 static char hbuf[MAXPATHLEN]; |
193 | 194 |
194 (void) strcpy(hbuf, path(dev)); 195 (void) strcat(hbuf, ".h"); | 195 snprintf(hbuf, sizeof(hbuf), "%s.h", path(dev)); |
196 return (hbuf); 197} 198 199/* 200 * convert a dev name to a macro name 201 */ 202static char * 203tomacro(char *dev) 204{ 205 static char mbuf[20]; 206 char *cp; 207 208 cp = mbuf; 209 *cp++ = 'N'; 210 while (*dev) 211 *cp++ = islower(*dev) ? toupper(*dev++) : *dev++; 212 *cp++ = 0; 213 return (mbuf); 214} | 196 return (hbuf); 197} 198 199/* 200 * convert a dev name to a macro name 201 */ 202static char * 203tomacro(char *dev) 204{ 205 static char mbuf[20]; 206 char *cp; 207 208 cp = mbuf; 209 *cp++ = 'N'; 210 while (*dev) 211 *cp++ = islower(*dev) ? toupper(*dev++) : *dev++; 212 *cp++ = 0; 213 return (mbuf); 214} |