jcs's openbsd hax
openbsd

strcpy/strcat/sprintf removal in all bootblocks. various testing by various people. outside of some messy things in src/gnu, only one thing in the main tree now violates this rule: bind

deraadt 1ee9984c 8de48e6d

+476 -401
+3 -3
sys/arch/hp300/stand/libkern/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.4 1997/07/15 07:52:21 downsj Exp $ 1 + # $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:34 deraadt Exp $ 2 2 3 3 LIB= kern 4 4 ··· 12 12 -I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libkern 13 13 14 14 # kern routines 15 - SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.S strcat.S strcmp.S \ 16 - strcpy.S strncmp.S umoddi3.c 15 + SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.S strcmp.S \ 16 + strncmp.S umoddi3.c 17 17 18 18 ${OBJS}: ${.CURDIR}/../Makefile.inc 19 19
+2 -2
sys/arch/hp300/stand/libsa/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.12 1999/08/16 09:43:09 downsj Exp $ 1 + # $OpenBSD: Makefile,v 1.13 2003/06/01 17:00:34 deraadt Exp $ 2 2 3 3 LIB= sa 4 4 ··· 11 11 12 12 # stand routines 13 13 SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \ 14 - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c 14 + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c 15 15 16 16 # io routines 17 17 SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
+2 -2
sys/arch/hp300/stand/libsaz/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.1 1999/08/16 09:43:10 downsj Exp $ 1 + # $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:34 deraadt Exp $ 2 2 3 3 LIB= saz 4 4 ··· 11 11 12 12 # stand routines 13 13 SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \ 14 - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c 14 + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c 15 15 16 16 # io routines 17 17 SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
+3 -2
sys/arch/hppa/stand/libsa/dev_hppa.c
··· 1 - /* $OpenBSD: dev_hppa.c,v 1.8 2003/04/16 07:20:50 mickey Exp $ */ 1 + /* $OpenBSD: dev_hppa.c,v 1.9 2003/06/01 17:00:34 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1998 Michael Shalayeff ··· 219 219 ttyname(fd) 220 220 int fd; 221 221 { 222 - sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)], 222 + snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d", 223 + cdevs[major(cn_tab->cn_dev)], 223 224 minor(cn_tab->cn_dev)); 224 225 return (ttyname_buf); 225 226 }
+3 -3
sys/arch/i386/stand/libsa/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.40 2003/04/17 03:43:18 drahn Exp $ 1 + # $OpenBSD: Makefile,v 1.41 2003/06/01 17:00:35 deraadt Exp $ 2 2 3 3 .include "${.CURDIR}/../Makefile.inc" 4 4 ··· 28 28 29 29 # stand routines 30 30 SRCS+= alloc.c exit.c getfile.c gets.c globals.c strcmp.c strlen.c \ 31 - strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c \ 32 - strtol.c ctime.c 31 + strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \ 32 + strerror.c strncpy.c strtol.c ctime.c strlcpy.c strlcat.c 33 33 34 34 # io routines 35 35 SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
+3 -2
sys/arch/i386/stand/libsa/dev_i386.c
··· 1 - /* $OpenBSD: dev_i386.c,v 1.24 2001/09/11 06:06:15 fgsch Exp $ */ 1 + /* $OpenBSD: dev_i386.c,v 1.25 2003/06/01 17:00:35 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1996-1999 Michael Shalayeff ··· 167 167 ttyname(fd) 168 168 int fd; 169 169 { 170 - sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)], 170 + snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d", 171 + cdevs[major(cn_tab->cn_dev)], 171 172 minor(cn_tab->cn_dev)); 172 173 return (ttyname_buf); 173 174 }
+6 -6
sys/arch/macppc/stand/boot.c
··· 1 - /* $OpenBSD: boot.c,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */ 1 + /* $OpenBSD: boot.c,v 1.9 2003/06/01 17:00:36 deraadt Exp $ */ 2 2 /* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */ 3 3 4 4 /* ··· 181 181 /* 182 182 * Get the boot arguments from Openfirmware 183 183 */ 184 - if ((chosen = OF_finddevice("/chosen")) == -1 185 - || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 186 - || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { 184 + if ((chosen = OF_finddevice("/chosen")) == -1 || 185 + OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || 186 + OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { 187 187 printf("Invalid Openfirmware environment\n"); 188 188 exit(); 189 189 } ··· 206 206 OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1); 207 207 cp = bootline; 208 208 #else 209 - strcpy(bootline, opened_name); 209 + strlcpy(bootline, opened_name, sizeof bootline); 210 210 cp = bootline + strlen(bootline); 211 211 *cp++ = ' '; 212 212 #endif ··· 234 234 ssym = (void *)marks[MARK_SYM]; 235 235 esym = (void *)marks[MARK_END]; 236 236 237 - chain ((void *)entry, bootline, ssym, esym); 237 + chain((void *)entry, bootline, ssym, esym); 238 238 239 239 _rtt(); 240 240 return 0;
+3 -5
sys/arch/macppc/stand/hfs.c
··· 1 - /* $OpenBSD: hfs.c,v 1.1 2001/09/01 15:39:02 drahn Exp $ */ 1 + /* $OpenBSD: hfs.c,v 1.2 2003/06/01 17:00:36 deraadt Exp $ */ 2 2 /* $NetBSD: hfs.c,v 1.1 2000/11/14 11:25:35 tsubai Exp $ */ 3 3 4 4 /*- ··· 44 44 int chosen; 45 45 char bootpath[128], *cp; 46 46 47 - 48 47 if ((chosen = OF_finddevice("/chosen")) == -1) 49 48 return ENXIO; 50 49 bzero(bootpath, sizeof bootpath); ··· 54 53 cp = strrchr(bootpath, ','); 55 54 #else 56 55 cp = bootpath; 57 - cp += strlen (bootpath); 56 + cp += strlen(bootpath); 58 57 for (; *cp != ','; cp--) { 59 58 if (cp == bootpath) { 60 59 cp = NULL; ··· 65 64 if (cp == NULL) 66 65 return ENXIO; 67 66 68 - strcpy(cp + 1, path); 67 + strlcpy(cp + 1, path, bootpath + sizeof bootpath - (cp + 1)); 69 68 OF_fd = OF_open(bootpath); 70 69 if (OF_fd == -1) 71 70 return ENOENT; 72 - 73 71 return 0; 74 72 } 75 73
+2 -2
sys/arch/mvme68k/stand/installboot/installboot.c
··· 1 - /* $OpenBSD: installboot.c,v 1.7 2002/03/14 03:15:56 millert Exp $ */ 1 + /* $OpenBSD: installboot.c,v 1.8 2003/06/01 17:00:36 deraadt Exp $ */ 2 2 /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ 3 3 4 4 /* ··· 121 121 boot = argv[optind]; 122 122 proto = argv[optind + 1]; 123 123 dev = argv[optind + 2]; 124 - strcpy(cdev, dev); 124 + strlcpy(cdev, dev, sizeof cdev); 125 125 cdev[strlen(cdev)-1] = 'c'; 126 126 127 127 if (verbose) {
+4 -4
sys/arch/mvme68k/stand/wrtvid/wrtvid.c
··· 1 - /* $OpenBSD: wrtvid.c,v 1.3 1996/04/28 10:49:49 deraadt Exp $ */ 1 + /* $OpenBSD: wrtvid.c,v 1.4 2003/06/01 17:00:37 deraadt Exp $ */ 2 2 3 3 #include <sys/types.h> 4 4 #include <sys/stat.h> ··· 35 35 perror(filename); 36 36 exit(2); 37 37 } 38 - sprintf(fileext, "%c%cboot", filename[4], filename[5]); 38 + snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]); 39 39 tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644); 40 - sprintf(fileext, "boot%c%c", filename[4], filename[5]); 40 + snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]); 41 41 tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); 42 42 43 43 pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); 44 44 bzero(pcpul, sizeof(struct cpu_disklabel)); 45 45 46 - strcpy(pcpul->vid_id, "NBSD"); 46 + memcpy(pcpul->vid_id, "NBSD", sizeof pcpul->vid_id); 47 47 48 48 fstat(exe_file, &stat); 49 49 /* size in 256 byte blocks round up after a.out header removed */
+3 -3
sys/arch/mvme88k/stand/installboot/installboot.c
··· 1 - /* $OpenBSD: installboot.c,v 1.6 2002/03/14 03:15:57 millert Exp $ */ 1 + /* $OpenBSD: installboot.c,v 1.7 2003/06/01 17:00:37 deraadt Exp $ */ 2 2 /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ 3 3 4 4 /* ··· 121 121 boot = argv[optind]; 122 122 proto = argv[optind + 1]; 123 123 dev = argv[optind + 2]; 124 - strcpy(cdev, dev); 124 + strlcpy(cdev, dev, sizeof cdev); 125 125 cdev[strlen(cdev)-1] = 'c'; 126 126 127 127 if (verbose) { ··· 423 423 424 424 425 425 pcpul->version = 1; 426 - strcpy(pcpul->vid_id, "M88K"); 426 + memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id); 427 427 428 428 fstat(exe_file, &stat); 429 429
+4 -4
sys/arch/mvme88k/stand/wrtvid/wrtvid.c
··· 1 - /* $OpenBSD: wrtvid.c,v 1.3 1998/08/22 08:52:56 smurph Exp $ */ 1 + /* $OpenBSD: wrtvid.c,v 1.4 2003/06/01 17:00:37 deraadt Exp $ */ 2 2 #include <sys/types.h> 3 3 #include <sys/stat.h> 4 4 #include <fcntl.h> ··· 38 38 perror(filename); 39 39 exit(2); 40 40 } 41 - sprintf(fileext, "%c%cboot", filename[4], filename[5]); 41 + snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]); 42 42 tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644); 43 - sprintf(fileext, "boot%c%c", filename[4], filename[5]); 43 + snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]); 44 44 tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644); 45 45 46 46 pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel)); 47 47 bzero(pcpul, sizeof(struct cpu_disklabel)); 48 48 49 49 pcpul->version = 1; 50 - strcpy(pcpul->vid_id, "M88K"); 50 + memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id); 51 51 52 52 fstat(exe_file, &stat); 53 53 /* size in 256 byte blocks round up after a.out header removed */
+3 -3
sys/arch/mvmeppc/stand/installboot/installboot.c
··· 1 - /* $OpenBSD: installboot.c,v 1.4 2002/03/14 03:15:58 millert Exp $ */ 1 + /* $OpenBSD: installboot.c,v 1.5 2003/06/01 17:00:38 deraadt Exp $ */ 2 2 /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ 3 3 4 4 /* ··· 121 121 boot = argv[optind]; 122 122 proto = argv[optind + 1]; 123 123 dev = argv[optind + 2]; 124 - strcpy(cdev, dev); 124 + strlcpy(cdev, dev, sizeof cdev); 125 125 cdev[strlen(cdev)-1] = 'c'; 126 126 127 127 if (verbose) { ··· 423 423 424 424 425 425 pcpul->version = 1; 426 - strcpy(pcpul->vid_id, "M88K"); 426 + memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id); 427 427 428 428 fstat(exe_file, &stat); 429 429
+2 -2
sys/arch/mvmeppc/stand/libsa/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.1 2001/06/26 21:58:06 smurph Exp $ 1 + # $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:38 deraadt Exp $ 2 2 3 3 LIB=sa 4 4 ··· 21 21 lseek.c open.c nullfs.c read.c fstat.c \ 22 22 ufs.c cread.c 23 23 24 - SRC_kern= ashrdi3.c bzero.c strcpy.c 24 + SRC_kern= ashrdi3.c bzero.c 25 25 26 26 SRC_mvme= exec_mvme.c 27 27
+8 -5
sys/arch/mvmeppc/stand/libsa/bugdev.c
··· 1 - /* $OpenBSD: bugdev.c,v 1.1 2001/06/26 21:58:07 smurph Exp $ */ 1 + /* $OpenBSD: bugdev.c,v 1.2 2003/06/01 17:00:38 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1993 Paul Kranenburg ··· 425 425 printf(" IO @ %x\n", io); 426 426 printf("MEM @ %x\n", mem); 427 427 428 - #define PRINT_REG(regname, x) printf("%s = 0x%x\n", regname, md_swap_long(*(unsigned *)(io + x))) 428 + #define PRINT_REG(regname, x) printf("%s = 0x%x\n", regname, \ 429 + md_swap_long(*(unsigned *)(io + x))) 429 430 430 431 PRINT_REG("CSR0", 0x00); 431 432 PRINT_REG("CSR1", 0x08); ··· 472 473 va_end(ap); 473 474 474 475 #ifdef DEBUG 475 - printf("net_open: using mvmebug ctrl %d dev %d, filename: %s\n", pp->clun, pp->dlun, filename); 476 + printf("net_open: using mvmebug ctrl %d dev %d, filename: %s\n", 477 + pp->clun, pp->dlun, filename); 476 478 #endif 477 479 nfo.clun = pp->clun; 478 480 nfo.dlun = pp->dlun; 479 481 nfo.status = 0; 480 - strcpy(nfo.filename, filename); 482 + strlcpy(nfo.filename, filename, sizeof filename); 481 483 /* .NETFOPN syscall */ 482 484 mvmeprom_netfopen(&nfo); 483 485 484 486 #ifdef DEBUG 485 487 if (nfo.status) { 486 488 nfoerr = nfo.status; 487 - printf("net_open: ci err = 0x%x, cd err = 0x%x\n", ((nfoerr >> 8) & 0x0F), (nfoerr & 0x0F)); 489 + printf("net_open: ci err = 0x%x, cd err = 0x%x\n", 490 + ((nfoerr >> 8) & 0x0F), (nfoerr & 0x0F)); 488 491 } 489 492 #endif 490 493 return (nfo.status);
+3 -3
sys/arch/mvmeppc/stand/libsa/tftpfs.c
··· 1 - /* $OpenBSD: tftpfs.c,v 1.2 2002/03/14 01:26:41 millert Exp $ */ 1 + /* $OpenBSD: tftpfs.c,v 1.3 2003/06/01 17:00:38 deraadt Exp $ */ 2 2 3 3 /*- 4 4 * Copyright (c) 2001 Steve Murphree, Jr. ··· 119 119 * and start again. 120 120 */ 121 121 char filename[64]; 122 - strcpy(filename, fp->filename); 122 + strlcpy(filename, fp->filename, sizeof filename); 123 123 tftpfs_close(f); 124 124 tftpfs_open(filename, f); 125 125 for (i = 1; i <= file_block; i++) { ··· 171 171 bzero(fp->f_buf, TFTP_BLOCK_SIZE); 172 172 fp->f_buf_size = 0; 173 173 174 - strcpy(fp->filename, path); 174 + strlcpy(fp->filename, path, sizeof fp->filename); 175 175 176 176 if (f->f_dev->dv_open == NULL) { 177 177 panic("No device open()!");
+2 -2
sys/arch/sparc/stand/common/promdev.c
··· 1 - /* $OpenBSD: promdev.c,v 1.7 2002/08/15 15:41:35 millert Exp $ */ 1 + /* $OpenBSD: promdev.c,v 1.8 2003/06/01 17:00:39 deraadt Exp $ */ 2 2 /* $NetBSD: promdev.c,v 1.16 1995/11/14 15:04:01 pk Exp $ */ 3 3 4 4 /* ··· 534 534 (void)(*promvec->pv_enaddr)(fd, (char *)ea); 535 535 } else { 536 536 char buf[64]; 537 - sprintf(buf, "%x mac-address drop swap 6 cmove", ea); 537 + snprintf(buf, sizeof buf, "%x mac-address drop swap 6 cmove", ea); 538 538 promvec->pv_fortheval.v2_eval(buf); 539 539 } 540 540 }
+3 -3
sys/arch/sparc/stand/libkern/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.2 1999/12/10 10:40:47 deraadt Exp $ 1 + # $OpenBSD: Makefile,v 1.3 2003/06/01 17:00:39 deraadt Exp $ 2 2 3 3 LIB= kern 4 4 ··· 16 16 -I${.CURDIR}/../../../../lib/libkern/arch/sparc 17 17 18 18 # kern routines 19 - SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S strcat.c \ 20 - strcmp.c strcpy.c strncmp.c umoddi3.c 19 + SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S \ 20 + strcmp.c strncmp.c umoddi3.c 21 21 22 22 SRCS+= umul.S mul.S rem.S sdiv.S udiv.S urem.S 23 23 SRCS+= saveregs.S
+2 -2
sys/arch/sparc/stand/libsa/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.1 1997/09/17 10:46:23 downsj Exp $ 1 + # $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:39 deraadt Exp $ 2 2 3 3 LIB= sa 4 4 ··· 11 11 12 12 # stand routines 13 13 SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \ 14 - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c 14 + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c 15 15 16 16 # io routines 17 17 SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
+3 -3
sys/arch/sparc64/stand/libkern/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.4 2003/04/09 10:35:04 sturm Exp $ 1 + # $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:39 deraadt Exp $ 2 2 3 3 LIB= kern 4 4 ··· 16 16 -I${.CURDIR}/../../../../lib/libkern/arch/sparc 17 17 18 18 # kern routines 19 - SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S strcat.c \ 20 - strcmp.c strcpy.c strlcat.c strlcpy.c strncmp.c umoddi3.c 19 + SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S \ 20 + strcmp.c strlcat.c strlcpy.c strncmp.c umoddi3.c 21 21 22 22 SRCS+= umul.S mul.S rem.S sdiv.S udiv.S urem.S 23 23 SRCS+= saveregs.S
+2 -2
sys/arch/sparc64/stand/libsa/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.4 2001/10/10 20:41:40 miod Exp $ 1 + # $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:40 deraadt Exp $ 2 2 3 3 LIB= sa 4 4 ··· 16 16 17 17 # stand routines 18 18 SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \ 19 - memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c 19 + memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c 20 20 21 21 # io routines 22 22 SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
+17 -18
sys/arch/sparc64/stand/ofwboot/boot.c
··· 1 - /* $OpenBSD: boot.c,v 1.7 2003/05/11 20:22:20 mdw Exp $ */ 1 + /* $OpenBSD: boot.c,v 1.8 2003/06/01 17:00:40 deraadt Exp $ */ 2 2 /* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */ 3 3 /* 4 4 * Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved. ··· 209 209 210 210 #ifdef DEBUG 211 211 printf("chain: calling OF_chain(%x, %x, %x, %x, %x)\n", 212 - (void *)RELOC, end - (char *)RELOC, entry, args, l); 212 + (void *)RELOC, end - (char *)RELOC, entry, args, l); 213 213 #endif 214 214 /* if -D is set then pause in the PROM. */ 215 215 if (debug > 1) OF_enter(); ··· 248 248 printf("read header: %s\n", strerror(errno)); 249 249 else 250 250 printf("read header: short read (only %d of %d)\n", 251 - rval, sizeof(hdr)); 251 + rval, sizeof(hdr)); 252 252 rval = 1; 253 253 goto err; 254 254 } ··· 263 263 if (bcmp(hdr.elf32.e_ident, ELFMAG, SELFMAG) == 0 && 264 264 hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) { 265 265 rval = elf32_exec(fd, &hdr.elf32, &entry, &ssym, &esym); 266 - } else 267 - if (bcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 && 266 + } else if (bcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 && 268 267 hdr.elf64.e_ident[EI_CLASS] == ELFCLASS64) { 269 268 rval = elf64_exec(fd, &hdr.elf64, &entry, &ssym, &esym); 270 269 } else ··· 476 475 for (i = 0; i < elf->e_shnum; i++, shp++) { 477 476 if (shp->sh_type == SHT_NULL) 478 477 continue; 479 - if (shp->sh_type != SHT_SYMTAB 480 - && shp->sh_type != SHT_STRTAB) { 478 + if (shp->sh_type != SHT_SYMTAB && 479 + shp->sh_type != SHT_STRTAB) { 481 480 shp->sh_offset = 0; 482 481 shp->sh_type = SHT_NOBITS; 483 482 continue; ··· 511 510 addr += sizeof(Elf32_Ehdr) + (elf->e_shnum * sizeof(Elf32_Shdr)); 512 511 off = sizeof(Elf32_Ehdr) + (elf->e_shnum * sizeof(Elf32_Shdr)); 513 512 for (first = 1, i = 0; i < elf->e_shnum; i++, shp++) { 514 - if (shp->sh_type == SHT_SYMTAB 515 - || shp->sh_type == SHT_STRTAB) { 513 + if (shp->sh_type == SHT_SYMTAB || 514 + shp->sh_type == SHT_STRTAB) { 516 515 if (first) 517 516 printf("symbols @ 0x%lx ", (u_long)addr); 518 517 printf("%s%d", first ? "" : "+", shp->sh_size); ··· 552 551 /* 553 552 * Get the boot arguments from Openfirmware 554 553 */ 555 - if ((chosen = OF_finddevice("/chosen")) == -1 556 - || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 557 - || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { 554 + if ((chosen = OF_finddevice("/chosen")) == -1 || 555 + OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 || 556 + OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) { 558 557 printf("Invalid Openfirmware environment\n"); 559 558 exit(); 560 559 } ··· 569 568 */ 570 569 571 570 bootlp = kernels; 572 - if (parseargs(bootline, &boothowto) == -1 573 - || (boothowto & RB_ASKNAME)) { 571 + if (parseargs(bootline, &boothowto) == -1 || 572 + (boothowto & RB_ASKNAME)) { 574 573 bootlp = 0; 575 574 } else if (*bootline) { 576 575 just_bootline[0] = bootline; ··· 586 585 kernels[0] = 0; /* no more iteration */ 587 586 } else if (cp != bootline) { 588 587 printf(": trying %s...\n", cp); 589 - strcpy(bootline, cp); 588 + strlcpy(bootline, cp, sizeof bootline); 590 589 } 591 590 } 592 591 if (!bootlp) { ··· 598 597 bootlp = kernels; 599 598 continue; 600 599 } 601 - if (strcmp(bootline, "exit") == 0 602 - || strcmp(bootline, "halt") == 0) { 600 + if (strcmp(bootline, "exit") == 0 || 601 + strcmp(bootline, "halt") == 0) { 603 602 _rtt(); 604 603 } 605 604 } ··· 611 610 OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1); 612 611 cp = bootline; 613 612 #else 614 - strcpy(bootline, opened_name); 613 + strlcpy(bootline, opened_name, sizeof bootline); 615 614 cp = bootline + strlen(bootline); 616 615 *cp++ = ' '; 617 616 #endif
+2 -2
sys/lib/libkern/arch/alpha/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.12 2002/04/28 20:55:14 pvalchev Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.13 2003/06/01 17:00:30 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.9 1996/08/27 00:44:24 cgd Exp $ 3 3 4 4 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 5 5 memchr.c memcmp.c memset.c \ 6 - bcmp.c bzero.S ffs.S softfloat.c strcat.c strcmp.c strcpy.c \ 6 + bcmp.c bzero.S ffs.S softfloat.c strcmp.c \ 7 7 strlcat.c strlcpy.c strlen.c strncmp.c \ 8 8 strncpy.c scanc.c skpc.c htonl.S htons.S ntohl.S ntohs.S \ 9 9 random.c strncasecmp.c
+3 -3
sys/lib/libkern/arch/hppa/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.16 2003/01/28 22:55:53 mickey Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.17 2003/06/01 17:00:30 deraadt Exp $ 2 2 3 3 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 4 4 random.c ashrdi3.c divdi3.c strncpy.c strncmp.c strcmp.c memchr.c \ 5 - memcmp.c memset.c strlen.c strcpy.c strlcpy.c strlcat.c \ 6 - strcat.c skpc.c strncasecmp.c \ 5 + memcmp.c memset.c strlen.c strlcpy.c strlcat.c \ 6 + skpc.c strncasecmp.c \ 7 7 bcmp.c scanc.c ffs.c 8 8 9 9 SRCS+= milli.S
+2 -2
sys/lib/libkern/arch/i386/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.7 2000/12/18 18:40:46 provos Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.8 2003/06/01 17:00:30 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.10 1996/04/13 01:17:41 cgd Exp $ 3 3 4 4 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 5 5 memchr.S memcmp.S \ 6 - bcmp.S ffs.S memset.S strcat.S strcmp.S strcpy.S strlcat.c strlcpy.c \ 6 + bcmp.S ffs.S memset.S strcmp.S strlcat.c strlcpy.c \ 7 7 strlen.S strncmp.c \ 8 8 strncpy.c scanc.S skpc.S locc.S htonl.S htons.S ntohl.S ntohs.S \ 9 9 strncasecmp.c
+2 -2
sys/lib/libkern/arch/m68k/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.7 2000/12/18 18:40:46 provos Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.8 2003/06/01 17:00:30 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.7 1996/04/18 01:53:04 cgd Exp $ 3 3 4 4 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 5 5 memchr.c memcmp.S memset.S \ 6 - bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlcat.c strlcpy.c \ 6 + bcmp.S bzero.S ffs.S strcmp.S strlcat.c strlcpy.c \ 7 7 strlen.S strncmp.S \ 8 8 strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S \ 9 9 strncasecmp.c
+2 -2
sys/lib/libkern/arch/m88k/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.5 2001/02/01 03:25:42 smurph Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.6 2003/06/01 17:00:30 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $ 3 3 4 4 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 5 5 memchr.c memcmp.c memset.c bcmp.c random.c \ 6 - strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c \ 6 + strcmp.c strlcat.c strlcpy.c strlen.c strncmp.c \ 7 7 strncpy.c scanc.c skpc.c strncasecmp.c ffs.c
+2 -2
sys/lib/libkern/arch/mips/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.9 2000/12/18 18:40:46 provos Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.10 2003/06/01 17:00:31 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.4 1996/04/13 01:17:46 cgd Exp $ 3 3 # 4 4 # There are likely more that we will notice when we go native 5 5 6 6 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 7 7 memchr.c memcmp.c memset.c strcmp.c \ 8 - bcmp.S bcopy.S bzero.S strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \ 8 + bcmp.S bcopy.S bzero.S strcmp.c strlcat.c strlcpy.c \ 9 9 ffs.S htonl.S \ 10 10 htons.S strcmp.S strlen.S strncmp.c random.c scanc.c skpc.c strncpy.c \ 11 11 strncasecmp.c
+2 -2
sys/lib/libkern/arch/powerpc/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.9 2002/11/11 16:32:48 drahn Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.10 2003/06/01 17:00:31 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.6 1994/10/26 06:39:03 cgd Exp $ 3 3 4 4 CFLAGS += -D_KERNEL ··· 6 6 SRCS+= __main.c __eabi.c \ 7 7 imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 8 8 memchr.c memcmp.c memset.c \ 9 - bcmp.c ffs.c strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \ 9 + bcmp.c ffs.c strcmp.c strlcat.c strlcpy.c \ 10 10 strlen.c strncmp.c \ 11 11 strncpy.c scanc.c skpc.c locc.c \ 12 12 memcpy.c random.c strncasecmp.c
+2 -2
sys/lib/libkern/arch/sparc/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.10 2002/08/11 12:21:33 art Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.11 2003/06/01 17:00:31 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.12 1996/04/23 23:05:22 christos Exp $ 3 3 4 4 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 5 5 memchr.c memcmp.c memset.c \ 6 - bcmp.c bzero.S strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \ 6 + bcmp.c bzero.S strcmp.c strlcat.c strlcpy.c \ 7 7 strlen.S strncmp.c \ 8 8 strncpy.c htonl.S htons.S ntohl.S ntohs.S scanc.c skpc.c \ 9 9 strncasecmp.c
+2 -2
sys/lib/libkern/arch/sparc64/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.4 2002/09/06 22:59:58 art Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.5 2003/06/01 17:00:31 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.4 2000/11/01 19:37:20 thorpej Exp $ 3 3 4 4 SRCS+= __main.c \ 5 5 imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 6 6 bcmp.c ffs.S \ 7 7 memchr.c memcmp.c \ 8 - strcat.c strcmp.c strcpy.c strlen.S strlcpy.c strlcat.c \ 8 + strcmp.c strlen.S strlcpy.c strlcat.c \ 9 9 strncasecmp.c strncmp.c strncpy.c \ 10 10 scanc.c skpc.c \ 11 11 htonl.S htons.S ntohl.S ntohs.S
+2 -2
sys/lib/libkern/arch/vax/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.6 2000/12/18 18:40:47 provos Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.7 2003/06/01 17:00:32 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $ 3 3 4 4 SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ 5 5 memchr.c memcmp.c \ 6 - strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c \ 6 + strcmp.c strlcat.c strlcpy.c strlen.c strncmp.c \ 7 7 strncpy.c scanc.c skpc.c strncasecmp.c
+2
sys/lib/libkern/funcs.h
··· 1 + size_t strlcpy(char *, const char *, int); 2 + size_t strlcat(char *, const char *, int);
+4 -3
sys/lib/libsa/Makefile
··· 1 - # $OpenBSD: Makefile,v 1.20 2001/06/23 01:47:39 drahn Exp $ 1 + # $OpenBSD: Makefile,v 1.21 2003/06/01 17:00:32 deraadt Exp $ 2 2 # $NetBSD: Makefile,v 1.13 1996/10/02 16:19:51 ws Exp $ 3 3 4 4 LIB= sa ··· 25 25 .endif 26 26 27 27 # stand routines 28 - SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c printf.c \ 29 - strerror.c strcmp.c memset.c memcmp.c strncpy.c strncmp.c strchr.c 28 + SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c \ 29 + printf.c snprintf.c strerror.c strcmp.c memset.c memcmp.c \ 30 + strncpy.c strncmp.c strchr.c 30 31 31 32 # math from libkern 32 33 SRCS+= divdi3.c qdivrem.c
+2 -2
sys/lib/libsa/Makefile.inc
··· 1 - # $OpenBSD: Makefile.inc,v 1.11 2002/04/29 01:02:28 hugh Exp $ 1 + # $OpenBSD: Makefile.inc,v 1.12 2003/06/01 17:00:32 deraadt Exp $ 2 2 # $NetBSD: Makefile.inc,v 1.5 1996/09/30 16:01:18 ws Exp $ 3 3 # 4 4 # NOTE: $S must correspond to the top of the 'sys' tree ··· 31 31 @echo making sure the stand-alone library is up to date... 32 32 @${SAMAKE} libsa.a 33 33 34 - clean:: .NOTMAIN __always_make_salib 34 + clean:: .NOTMAIN __always_make_salib 35 35 @echo cleaning the stand-alone library objects 36 36 @${SAMAKE} clean 37 37 -rmdir -p ${SADST}
+7 -7
sys/lib/libsa/alloc.c
··· 1 - /* $OpenBSD: alloc.c,v 1.6 2002/03/14 03:16:09 millert Exp $ */ 1 + /* $OpenBSD: alloc.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */ 3 3 4 4 /* ··· 40 40 * SUCH DAMAGE. 41 41 * 42 42 * @(#)alloc.c 8.1 (Berkeley) 6/11/93 43 - * 43 + * 44 44 * 45 45 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 46 46 * All Rights Reserved. 47 47 * 48 48 * Author: Alessandro Forin 49 - * 49 + * 50 50 * Permission to use, copy, modify and distribute this software and its 51 51 * documentation is hereby granted, provided that both the copyright 52 52 * notice and this permission notice appear in all copies of the 53 53 * software, derivative works or modified versions, and any portions 54 54 * thereof, and that both notices appear in supporting documentation. 55 - * 55 + * 56 56 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 57 57 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 58 58 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 59 - * 59 + * 60 60 * Carnegie Mellon requests users of this software to return to 61 - * 61 + * 62 62 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 63 63 * School of Computer Science 64 64 * Carnegie Mellon University 65 65 * Pittsburgh PA 15213-3890 66 - * 66 + * 67 67 * any improvements or extensions that they make and grant Carnegie the 68 68 * rights to redistribute these changes. 69 69 */
+9 -9
sys/lib/libsa/arp.c
··· 1 - /* $OpenBSD: arp.c,v 1.9 2002/03/14 03:16:09 millert Exp $ */ 1 + /* $OpenBSD: arp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: arp.c,v 1.15 1996/10/13 02:28:58 christos Exp $ */ 3 3 4 4 /* ··· 80 80 struct ether_header eh; 81 81 struct { 82 82 struct ether_arp arp; 83 - u_char pad[18]; /* 60 - sizeof(...) */ 83 + u_char pad[18]; /* 60 - sizeof(...) */ 84 84 } data; 85 85 } wbuf; 86 86 struct { 87 87 struct ether_header eh; 88 88 struct { 89 89 struct ether_arp arp; 90 - u_char pad[24]; /* extra space */ 90 + u_char pad[24]; /* extra space */ 91 91 } data; 92 92 } rbuf; 93 93 ··· 103 103 } 104 104 105 105 #ifdef ARP_DEBUG 106 - if (debug) 107 - printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); 106 + if (debug) 107 + printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); 108 108 #endif 109 109 110 110 bzero((char *)&wbuf.data, sizeof(wbuf.data)); ··· 132 132 /* Store ethernet address in cache */ 133 133 ah = &rbuf.data.arp; 134 134 #ifdef ARP_DEBUG 135 - if (debug) { 135 + if (debug) { 136 136 printf("arp: response from %s\n", 137 137 ether_sprintf(rbuf.eh.ether_shost)); 138 138 printf("arp: cacheing %s --> %s\n", ··· 153 153 { 154 154 155 155 #ifdef ARP_DEBUG 156 - if (debug) 156 + if (debug) 157 157 printf("arpsend: called\n"); 158 158 #endif 159 159 ··· 176 176 u_int16_t etype; /* host order */ 177 177 178 178 #ifdef ARP_DEBUG 179 - if (debug) 179 + if (debug) 180 180 printf("arprecv: "); 181 181 #endif 182 182 ··· 244 244 245 245 /* We have our answer. */ 246 246 #ifdef ARP_DEBUG 247 - if (debug) 247 + if (debug) 248 248 printf("got it\n"); 249 249 #endif 250 250 return (n);
+4 -4
sys/lib/libsa/bootp.c
··· 1 - /* $OpenBSD: bootp.c,v 1.9 2002/03/14 01:27:07 millert Exp $ */ 1 + /* $OpenBSD: bootp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: bootp.c,v 1.10 1996/10/13 02:28:59 christos Exp $ */ 3 3 4 4 /* ··· 80 80 } rbuf; 81 81 82 82 #ifdef BOOTP_DEBUG 83 - if (debug) 83 + if (debug) 84 84 printf("bootp: socket=%d\n", sock); 85 85 #endif 86 86 if (!bot) 87 87 bot = getsecs(); 88 - 88 + 89 89 if (!(d = socktodesc(sock))) { 90 90 printf("bootp: bad socket. %d\n", sock); 91 91 return; 92 92 } 93 93 #ifdef BOOTP_DEBUG 94 - if (debug) 94 + if (debug) 95 95 printf("bootp: d=%x\n", (u_int)d); 96 96 #endif 97 97
+17 -17
sys/lib/libsa/cd9660.c
··· 1 - /* $OpenBSD: cd9660.c,v 1.8 2003/04/15 18:41:19 mickey Exp $ */ 1 + /* $OpenBSD: cd9660.c,v 1.9 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: cd9660.c,v 1.1 1996/09/30 16:01:19 ws Exp $ */ 3 3 4 4 /* ··· 81 81 { 82 82 char *cp; 83 83 int i; 84 - 84 + 85 85 cp = pp->name; 86 86 for (i = isonum_711(pp->namlen); --i >= 0; path++, cp++) { 87 87 if (toupper(*path) == *cp) ··· 145 145 struct ptable_ent *pp; 146 146 struct iso_directory_record *dp; 147 147 int rc; 148 - 148 + 149 149 /* First find the volume descriptor */ 150 150 buf = alloc(buf_size = ISO_DEFAULT_BLOCK_SIZE); 151 151 dp = (struct iso_directory_record *)buf; ··· 170 170 } 171 171 if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE) 172 172 goto out; 173 - 173 + 174 174 /* Now get the path table and lookup the directory of the file */ 175 175 bno = isonum_732(vd->type_m_path_table); 176 176 psize = isonum_733(vd->path_table_size); 177 - 177 + 178 178 if (psize > ISO_DEFAULT_BLOCK_SIZE) { 179 179 free(buf, ISO_DEFAULT_BLOCK_SIZE); 180 180 buf = alloc(buf_size = roundup(psize, ISO_DEFAULT_BLOCK_SIZE)); ··· 189 189 rc = EIO; 190 190 goto out; 191 191 } 192 - 192 + 193 193 parent = 1; 194 194 pp = (struct ptable_ent *)buf; 195 195 ent = 1; 196 196 bno = isonum_732(pp->block) + isonum_711(pp->extlen); 197 - 197 + 198 198 rc = ENOENT; 199 199 /* 200 200 * Remove extra separators ··· 261 261 rc = ENOENT; 262 262 goto out; 263 263 } 264 - 264 + 265 265 /* allocate file system specific data structure */ 266 266 fp = alloc(sizeof(struct file)); 267 267 bzero(fp, sizeof(struct file)); ··· 271 271 fp->bno = isonum_733(dp->extent); 272 272 fp->size = isonum_733(dp->size); 273 273 free(buf, buf_size); 274 - 274 + 275 275 return 0; 276 - 276 + 277 277 out: 278 278 if (fp) 279 279 free(fp, sizeof(struct file)); 280 280 free(buf, buf_size); 281 - 281 + 282 282 return rc; 283 283 } 284 284 ··· 287 287 struct open_file *f; 288 288 { 289 289 struct file *fp = (struct file *)f->f_fsdata; 290 - 290 + 291 291 f->f_fsdata = 0; 292 292 free(fp, sizeof *fp); 293 - 293 + 294 294 return 0; 295 295 } 296 296 ··· 307 307 char buf[ISO_DEFAULT_BLOCK_SIZE]; 308 308 char *dp; 309 309 size_t read, off; 310 - 310 + 311 311 while (size) { 312 312 if (fp->off < 0 || fp->off >= fp->size) 313 313 break; ··· 317 317 dp = buf; 318 318 else 319 319 dp = start; 320 - twiddle(); 320 + twiddle(); 321 321 rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), 322 322 ISO_DEFAULT_BLOCK_SIZE, dp, &read); 323 323 if (rc) ··· 361 361 int where; 362 362 { 363 363 struct file *fp = (struct file *)f->f_fsdata; 364 - 364 + 365 365 switch (where) { 366 366 case SEEK_SET: 367 367 fp->off = offset; ··· 384 384 struct stat *sb; 385 385 { 386 386 struct file *fp = (struct file *)f->f_fsdata; 387 - 387 + 388 388 /* only importatn stuff */ 389 389 sb->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; 390 390 sb->st_uid = sb->st_gid = 0;
+7 -7
sys/lib/libsa/close.c
··· 1 - /* $OpenBSD: close.c,v 1.5 1997/02/06 02:56:44 downsj Exp $ */ 1 + /* $OpenBSD: close.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)close.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+7 -7
sys/lib/libsa/closeall.c
··· 1 - /* $OpenBSD: closeall.c,v 1.2 1996/09/23 14:18:50 mickey Exp $ */ 1 + /* $OpenBSD: closeall.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)close.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+2 -2
sys/lib/libsa/ctime.c
··· 1 - /* $OpenBSD: ctime.c,v 1.2 1998/06/11 01:34:10 mickey Exp $ */ 1 + /* $OpenBSD: ctime.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1998 Michael Shalayeff ··· 73 73 tt--; 74 74 75 75 /* no field widths in printf() */ 76 - sprintf(buf, "%s %s %d %d:%d:%d %d\n", 76 + snprintf(buf, sizeof buf, "%s %s %d %d:%d:%d %d\n", 77 77 ((wday < 0 || wday >= 7)? "???": wdays[wday]), 78 78 ((month < 0 || month >= 12)? "???": months[month]), 79 79 (int)tt, hh, mm, ss, year);
+3 -3
sys/lib/libsa/ether.c
··· 1 - /* $OpenBSD: ether.c,v 1.5 1998/02/23 20:32:23 niklas Exp $ */ 1 + /* $OpenBSD: ether.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: ether.c,v 1.8 1996/10/13 02:29:00 christos Exp $ */ 3 3 4 4 /* ··· 67 67 register struct ether_header *eh; 68 68 69 69 #ifdef ETHER_DEBUG 70 - if (debug) 70 + if (debug) 71 71 printf("sendether: called\n"); 72 72 #endif 73 73 ··· 103 103 register struct ether_header *eh; 104 104 105 105 #ifdef ETHER_DEBUG 106 - if (debug) 106 + if (debug) 107 107 printf("readether: called\n"); 108 108 #endif 109 109
+3 -3
sys/lib/libsa/exec.c
··· 1 - /* $OpenBSD: exec.c,v 1.22 1998/07/14 14:26:18 mickey Exp $ */ 1 + /* $OpenBSD: exec.c,v 1.23 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */ 3 3 4 4 /*- ··· 138 138 sz = i - sizeof(int); 139 139 addr += sizeof(int); 140 140 if (read(io, addr, sz) != sz) 141 - goto shread; 141 + goto shread; 142 142 addr += sz; 143 143 } 144 144 ··· 166 166 167 167 #ifdef EXEC_DEBUG 168 168 printf("loadaddr=%p etxt=%p daddr=%p ssym=%p esym=%p\n", 169 - loadaddr, etxt, daddr, ssym, esym); 169 + loadaddr, etxt, daddr, ssym, esym); 170 170 printf("\n\nReturn to boot...\n"); 171 171 getchar(); 172 172 #endif
+19 -19
sys/lib/libsa/exit.c
··· 1 - /* $OpenBSD: exit.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */ 1 + /* $OpenBSD: exit.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: exit.c,v 1.11 1996/12/01 20:22:19 pk Exp $ */ 3 3 4 4 /*- 5 5 * Copyright (c) 1993 John Brezak 6 6 * All rights reserved. 7 - * 7 + * 8 8 * Redistribution and use in source and binary forms, with or without 9 9 * modification, are permitted provided that the following conditions 10 10 * are met: ··· 15 15 * documentation and/or other materials provided with the distribution. 16 16 * 3. The name of the author may not be used to endorse or promote products 17 17 * derived from this software without specific prior written permission. 18 - * 18 + * 19 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 20 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ··· 36 36 __dead void 37 37 panic(const char *fmt, ...) 38 38 { 39 - extern void closeall(void); 40 - va_list ap; 41 - static int paniced; 42 - 43 - if (!paniced) { 44 - paniced = 1; 45 - closeall(); 46 - } 39 + extern void closeall(void); 40 + va_list ap; 41 + static int paniced; 47 42 48 - va_start(ap, fmt); 49 - vprintf(fmt, ap); 50 - printf("\n"); 51 - va_end(ap); 52 - _rtt(); 53 - /*NOTREACHED*/ 43 + if (!paniced) { 44 + paniced = 1; 45 + closeall(); 46 + } 47 + 48 + va_start(ap, fmt); 49 + vprintf(fmt, ap); 50 + printf("\n"); 51 + va_end(ap); 52 + _rtt(); 53 + /*NOTREACHED*/ 54 54 } 55 55 56 56 void 57 57 exit() 58 58 { 59 - panic("exit"); 60 - /*NOTREACHED*/ 59 + panic("exit"); 60 + /*NOTREACHED*/ 61 61 }
+7 -7
sys/lib/libsa/ioctl.c
··· 1 - /* $OpenBSD: ioctl.c,v 1.2 1996/09/23 14:18:55 mickey Exp $ */ 1 + /* $OpenBSD: ioctl.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: ioctl.c,v 1.4 1994/10/30 21:48:24 cgd Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)ioctl.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+2 -2
sys/lib/libsa/iodesc.h
··· 1 - /* $OpenBSD: iodesc.h,v 1.2 1996/09/23 14:18:56 mickey Exp $ */ 1 + /* $OpenBSD: iodesc.h,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ 2 2 /* $NetBSD: iodesc.h,v 1.4 1995/09/23 03:31:50 gwr Exp $ */ 3 3 4 4 /* 5 - * Copyright (c) 1993 Adam Glass 5 + * Copyright (c) 1993 Adam Glass 6 6 * Copyright (c) 1992 Regents of the University of California. 7 7 * All rights reserved. 8 8 *
+3 -3
sys/lib/libsa/loadfile.c
··· 1 1 /* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */ 2 - /* $OpenBSD: loadfile.c,v 1.4 2003/05/07 18:11:37 mickey Exp $ */ 2 + /* $OpenBSD: loadfile.c,v 1.5 2003/06/01 17:00:32 deraadt Exp $ */ 3 3 4 4 /*- 5 5 * Copyright (c) 1997 The NetBSD Foundation, Inc. ··· 127 127 #ifdef BOOT_AOUT 128 128 struct exec aout; 129 129 #endif 130 - 130 + 131 131 } hdr; 132 132 ssize_t nr; 133 133 int fd, rval; ··· 457 457 sub = 0; 458 458 else 459 459 sub = sizeof(*x); 460 - 460 + 461 461 minp = maxp = ALIGNENTRY(entry); 462 462 463 463 if (lseek(fd, sizeof(*x), SEEK_SET) == -1) {
+7 -7
sys/lib/libsa/lseek.c
··· 1 - /* $OpenBSD: lseek.c,v 1.4 1997/02/06 02:56:45 downsj Exp $ */ 1 + /* $OpenBSD: lseek.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: lseek.c,v 1.3 1996/06/21 20:09:03 pk Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)lseek.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+2 -2
sys/lib/libsa/net.c
··· 1 - /* $OpenBSD: net.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */ 1 + /* $OpenBSD: net.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: net.c,v 1.14 1996/10/13 02:29:02 christos Exp $ */ 3 3 4 4 /* ··· 72 72 struct ip tip; 73 73 74 74 #ifdef NET_DEBUG 75 - if (debug) { 75 + if (debug) { 76 76 printf("sendudp: d=%x called.\n", (u_int)d); 77 77 if (d) { 78 78 printf("saddr: %s:%d",
+2 -2
sys/lib/libsa/net.h
··· 1 - /* $OpenBSD: net.h,v 1.5 2002/03/14 03:16:10 millert Exp $ */ 1 + /* $OpenBSD: net.h,v 1.6 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: net.h,v 1.10 1995/10/20 00:46:30 cgd Exp $ */ 3 3 4 4 /* 5 - * Copyright (c) 1993 Adam Glass 5 + * Copyright (c) 1993 Adam Glass 6 6 * Copyright (c) 1992 Regents of the University of California. 7 7 * All rights reserved. 8 8 *
+7 -7
sys/lib/libsa/netif.c
··· 1 - /* $OpenBSD: netif.c,v 1.6 1999/01/11 05:12:26 millert Exp $ */ 1 + /* $OpenBSD: netif.c,v 1.7 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: netif.c,v 1.7 1996/10/13 02:29:03 christos Exp $ */ 3 3 4 4 /* ··· 60 60 { 61 61 struct netif_driver *drv; 62 62 int d, i; 63 - 63 + 64 64 #ifdef NETIF_DEBUG 65 65 if (netif_debug) 66 66 printf("netif_init: called\n"); ··· 113 113 for (u = 0; u < drv->netif_nifs; u++) { 114 114 cur_if.nif_unit = u; 115 115 unit_done = 0; 116 - 116 + 117 117 #ifdef NETIF_DEBUG 118 118 if (netif_debug) 119 119 printf("\t%s%d:", drv->netif_bname, ··· 189 189 if (netif_debug) 190 190 printf("%s%d: netif_attach\n", drv->netif_bname, nif->nif_unit); 191 191 #endif 192 - desc->io_netif = nif; 192 + desc->io_netif = nif; 193 193 #ifdef PARANOID 194 194 if (drv->netif_init == NULL) 195 195 panic("%s%d: no netif_init support", drv->netif_bname, 196 196 nif->nif_unit); 197 197 #endif 198 198 drv->netif_init(desc, machdep_hint); 199 - bzero(drv->netif_ifs[nif->nif_unit].dif_stats, 199 + bzero(drv->netif_ifs[nif->nif_unit].dif_stats, 200 200 sizeof(struct netif_stats)); 201 201 } 202 202 ··· 297 297 int fd; 298 298 register struct iodesc *s; 299 299 struct netif *nif; 300 - 300 + 301 301 /* find a free socket */ 302 302 for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++) 303 303 if (s->io_netif == (struct netif *)0) ··· 309 309 bzero(s, sizeof(*s)); 310 310 netif_init(); 311 311 nif = netif_select(machdep_hint); 312 - if (!nif) 312 + if (!nif) 313 313 panic("netboot: no interfaces left untried"); 314 314 if (netif_probe(nif, machdep_hint)) { 315 315 printf("netboot: couldn't probe %s%d\n",
+2 -2
sys/lib/libsa/netif.h
··· 1 - /* $OpenBSD: netif.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */ 1 + /* $OpenBSD: netif.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */ 3 3 4 4 #ifndef __SYS_LIBNETBOOT_NETIF_H ··· 60 60 int netif_close(int); 61 61 62 62 struct iodesc *socktodesc(int); 63 - 63 + 64 64 #endif /* __SYS_LIBNETBOOT_NETIF_H */
+21 -21
sys/lib/libsa/nfs.c
··· 1 - /* $OpenBSD: nfs.c,v 1.8 1997/03/25 20:30:43 niklas Exp $ */ 1 + /* $OpenBSD: nfs.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: nfs.c,v 1.19 1996/10/13 02:29:04 christos Exp $ */ 3 3 4 4 /*- 5 5 * Copyright (c) 1993 John Brezak 6 6 * All rights reserved. 7 - * 7 + * 8 8 * Redistribution and use in source and binary forms, with or without 9 9 * modification, are permitted provided that the following conditions 10 10 * are met: ··· 15 15 * documentation and/or other materials provided with the distribution. 16 16 * 3. The name of the author may not be used to endorse or promote products 17 17 * derived from this software without specific prior written permission. 18 - * 18 + * 19 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR 20 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ··· 126 126 struct repl d; 127 127 } rdata; 128 128 size_t cc; 129 - 129 + 130 130 #ifdef NFS_DEBUG 131 131 if (debug) 132 132 printf("nfs_getrootfh: %s\n", path); ··· 191 191 struct repl d; 192 192 } rdata; 193 193 ssize_t cc; 194 - 194 + 195 195 #ifdef NFS_DEBUG 196 196 if (debug) 197 197 printf("lookupfh: called\n"); ··· 259 259 260 260 if (cc < 4) 261 261 return (EIO); 262 - 262 + 263 263 if (rdata.d.errno) 264 264 return (ntohl(rdata.d.errno)); 265 265 ··· 390 390 int error = 0; 391 391 392 392 #ifdef NFS_DEBUG 393 - if (debug) 394 - printf("nfs_open: %s\n", path); 393 + if (debug) 394 + printf("nfs_open: %s\n", path); 395 395 #endif 396 396 if (nfs_root_node.iodesc == NULL) { 397 397 printf("nfs_open: must mount first.\n"); ··· 400 400 401 401 currfd = &nfs_root_node; 402 402 newfd = 0; 403 - 403 + 404 404 cp = path; 405 405 while (*cp) { 406 406 /* ··· 418 418 error = ENOTDIR; 419 419 goto out; 420 420 } 421 - 421 + 422 422 /* allocate file system specific data structure */ 423 423 newfd = alloc(sizeof(*newfd)); 424 424 newfd->iodesc = currfd->iodesc; 425 425 newfd->off = 0; 426 - 426 + 427 427 /* 428 428 * Get next component of path name. 429 429 */ 430 430 { 431 431 register int len = 0; 432 - 432 + 433 433 ncp = cp; 434 434 while ((c = *cp) != '\0' && c != '/') { 435 435 if (++len > NFS_MAXNAMLEN) { ··· 440 440 } 441 441 *cp = '\0'; 442 442 } 443 - 443 + 444 444 /* lookup a file handle */ 445 445 error = nfs_lookupfh(currfd, ncp, newfd); 446 446 *cp = c; 447 447 if (error) 448 448 goto out; 449 - 449 + 450 450 /* 451 451 * Check for symbolic link 452 452 */ 453 453 if (newfd->fa.fa_type == htonl(NFLNK)) { 454 454 int link_len, len; 455 - 455 + 456 456 error = nfs_readlink(newfd, linkbuf); 457 457 if (error) 458 458 goto out; ··· 468 468 469 469 bcopy(cp, &namebuf[link_len], len + 1); 470 470 bcopy(linkbuf, namebuf, link_len); 471 - 471 + 472 472 /* 473 473 * If absolute pathname, restart at root. 474 474 * If relative pathname, restart at parent directory. ··· 482 482 483 483 free(newfd, sizeof(*newfd)); 484 484 newfd = 0; 485 - 485 + 486 486 continue; 487 487 } 488 - 488 + 489 489 if (currfd != &nfs_root_node) 490 490 free(currfd, sizeof(*currfd)); 491 491 currfd = newfd; ··· 499 499 f->f_fsdata = (void *)currfd; 500 500 return (0); 501 501 } 502 - 502 + 503 503 #ifdef NFS_DEBUG 504 504 if (debug) 505 505 printf("nfs_open: %s lookupfh failed: %s\n", ··· 527 527 if (fp) 528 528 free(fp, sizeof(struct nfs_iodesc)); 529 529 f->f_fsdata = (void *)0; 530 - 530 + 531 531 return (0); 532 532 } 533 533 ··· 544 544 register struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata; 545 545 register ssize_t cc; 546 546 register char *addr = buf; 547 - 547 + 548 548 #ifdef NFS_DEBUG 549 549 if (debug) 550 550 printf("nfs_read: size=%d off=%d\n", size, (int)fp->off);
+7 -7
sys/lib/libsa/nullfs.c
··· 1 - /* $OpenBSD: nullfs.c,v 1.4 1997/05/04 22:41:24 millert Exp $ */ 1 + /* $OpenBSD: nullfs.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: open.c,v 1.9 1995/09/19 09:16:52 thorpej Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)open.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+7 -7
sys/lib/libsa/open.c
··· 1 - /* $OpenBSD: open.c,v 1.7 1998/09/11 01:41:18 millert Exp $ */ 1 + /* $OpenBSD: open.c,v 1.8 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: open.c,v 1.12 1996/09/30 16:01:21 ws Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)open.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+5 -29
sys/lib/libsa/printf.c
··· 1 - /* $OpenBSD: printf.c,v 1.18 2003/05/20 19:23:01 jason Exp $ */ 1 + /* $OpenBSD: printf.c,v 1.19 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */ 3 3 4 4 /*- ··· 65 65 66 66 #include "stand.h" 67 67 68 - static void kprintn(void (*)(int), u_long, int); 69 - static void kdoprnt(void (*)(int), const char *, va_list); 70 - 71 - #ifndef STRIPPED 72 - static void sputchar(int); 73 - static char *sbuf; 74 - 75 - static void 76 - sputchar(c) 77 - int c; 78 - { 79 - *sbuf++ = c; 80 - } 81 - 82 - void 83 - sprintf(char *buf, const char *fmt, ...) 84 - { 85 - va_list ap; 86 - 87 - sbuf = buf; 88 - va_start(ap, fmt); 89 - kdoprnt(sputchar, fmt, ap); 90 - va_end(ap); 91 - *sbuf = '\0'; 92 - } 93 - #endif /* NO_SPRINTF */ 68 + void kprintn(void (*)(int), u_long, int); 69 + void kdoprnt(void (*)(int), const char *, va_list); 94 70 95 71 void 96 72 printf(const char *fmt, ...) ··· 108 84 kdoprnt(putchar, fmt, ap); 109 85 } 110 86 111 - static void 87 + void 112 88 kdoprnt(put, fmt, ap) 113 89 void (*put)(int); 114 90 const char *fmt; ··· 201 177 va_end(ap); 202 178 } 203 179 204 - static void 180 + void 205 181 kprintn(put, ul, base) 206 182 void (*put)(int); 207 183 unsigned long ul;
+8 -8
sys/lib/libsa/rarp.c
··· 1 - /* $OpenBSD: rarp.c,v 1.8 2002/03/14 03:16:10 millert Exp $ */ 1 + /* $OpenBSD: rarp.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: rarp.c,v 1.13 1996/10/13 02:29:05 christos Exp $ */ 3 3 4 4 /* ··· 67 67 u_char header[ETHER_SIZE]; 68 68 struct { 69 69 struct ether_arp arp; 70 - u_char pad[18]; /* 60 - sizeof(arp) */ 70 + u_char pad[18]; /* 60 - sizeof(arp) */ 71 71 } data; 72 72 } wbuf; 73 73 struct { 74 74 u_char header[ETHER_SIZE]; 75 75 struct { 76 76 struct ether_arp arp; 77 - u_char pad[24]; /* extra space */ 77 + u_char pad[24]; /* extra space */ 78 78 } data; 79 79 } rbuf; 80 80 81 81 #ifdef RARP_DEBUG 82 - if (debug) 82 + if (debug) 83 83 printf("rarp: socket=%d\n", sock); 84 84 #endif 85 85 if (!(d = socktodesc(sock))) { ··· 87 87 return (-1); 88 88 } 89 89 #ifdef RARP_DEBUG 90 - if (debug) 90 + if (debug) 91 91 printf("rarp: d=%x\n", (u_int)d); 92 92 #endif 93 93 ··· 139 139 { 140 140 141 141 #ifdef RARP_DEBUG 142 - if (debug) 142 + if (debug) 143 143 printf("rarpsend: called\n"); 144 144 #endif 145 145 ··· 162 162 u_int16_t etype; /* host order */ 163 163 164 164 #ifdef RARP_DEBUG 165 - if (debug) 165 + if (debug) 166 166 printf("rarprecv: "); 167 167 #endif 168 168 ··· 216 216 217 217 /* We have our answer. */ 218 218 #ifdef RARP_DEBUG 219 - if (debug) 219 + if (debug) 220 220 printf("got it\n"); 221 221 #endif 222 222 return (n);
+7 -7
sys/lib/libsa/read.c
··· 1 - /* $OpenBSD: read.c,v 1.4 1997/02/06 02:56:46 downsj Exp $ */ 1 + /* $OpenBSD: read.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: read.c,v 1.7 1996/06/21 20:29:28 pk Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)read.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */
+4 -4
sys/lib/libsa/readdir.c
··· 1 - /* $OpenBSD: readdir.c,v 1.4 1997/07/21 15:43:54 mickey Exp $ */ 1 + /* $OpenBSD: readdir.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1996 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ··· 68 68 69 69 return fd; 70 70 } 71 - 71 + 72 72 int 73 73 readdir(fd, dest) 74 74 int fd;
+7 -7
sys/lib/libsa/rpc.c
··· 1 - /* $OpenBSD: rpc.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */ 1 + /* $OpenBSD: rpc.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: rpc.c,v 1.16 1996/10/13 02:29:06 christos Exp $ */ 3 3 4 4 /* ··· 62 62 #include "rpc.h" 63 63 64 64 struct auth_info { 65 - int32_t authtype; /* auth type */ 65 + int32_t authtype; /* auth type */ 66 66 u_int32_t authlen; /* auth length */ 67 67 }; 68 68 ··· 76 76 77 77 struct rpc_call { 78 78 u_int32_t rp_xid; /* request transaction id */ 79 - int32_t rp_direction; /* call direction (0) */ 79 + int32_t rp_direction; /* call direction (0) */ 80 80 u_int32_t rp_rpcvers; /* rpc version (2) */ 81 81 u_int32_t rp_prog; /* program */ 82 82 u_int32_t rp_vers; /* version */ ··· 85 85 86 86 struct rpc_reply { 87 87 u_int32_t rp_xid; /* request transaction id */ 88 - int32_t rp_direction; /* call direction (1) */ 89 - int32_t rp_astatus; /* accept status (0: accepted) */ 88 + int32_t rp_direction; /* call direction (1) */ 89 + int32_t rp_astatus; /* accept status (0: accepted) */ 90 90 union { 91 91 u_int32_t rpu_errno; 92 92 struct { ··· 321 321 struct in_addr addr; /* server, net order */ 322 322 u_int prog; /* host order */ 323 323 u_int vers; /* host order */ 324 - int port; /* host order */ 324 + int port; /* host order */ 325 325 } rpc_pmap_list[PMAP_NUM]; 326 326 327 327 /* return port number in host order, or -1 */ ··· 348 348 struct in_addr addr; /* server, net order */ 349 349 u_int prog; /* host order */ 350 350 u_int vers; /* host order */ 351 - int port; /* host order */ 351 + int port; /* host order */ 352 352 { 353 353 struct pmap_list *pl; 354 354
+83
sys/lib/libsa/snprintf.c
··· 1 + /* $OpenBSD: snprintf.c,v 1.1 2003/06/01 17:00:33 deraadt Exp $ */ 2 + /* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */ 3 + 4 + /*- 5 + * Copyright (c) 1993 6 + * The Regents of the University of California. All rights reserved. 7 + * 8 + * Redistribution and use in source and binary forms, with or without 9 + * modification, are permitted provided that the following conditions 10 + * are met: 11 + * 1. Redistributions of source code must retain the above copyright 12 + * notice, this list of conditions and the following disclaimer. 13 + * 2. Redistributions in binary form must reproduce the above copyright 14 + * notice, this list of conditions and the following disclaimer in the 15 + * documentation and/or other materials provided with the distribution. 16 + * 3. All advertising materials mentioning features or use of this software 17 + * must display the following acknowledgement: 18 + * This product includes software developed by the University of 19 + * California, Berkeley and its contributors. 20 + * 4. Neither the name of the University nor the names of its contributors 21 + * may be used to endorse or promote products derived from this software 22 + * without specific prior written permission. 23 + * 24 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 + * SUCH DAMAGE. 35 + * 36 + * @(#)printf.c 8.1 (Berkeley) 6/11/93 37 + */ 38 + 39 + #include <sys/cdefs.h> 40 + #include <sys/types.h> 41 + #include <machine/stdarg.h> 42 + 43 + #include "stand.h" 44 + 45 + extern void kprintn(void (*)(int), u_long, int); 46 + extern void kdoprnt(void (*)(int), const char *, va_list); 47 + 48 + #ifndef STRIPPED 49 + static void sputchar(int); 50 + 51 + static char *sbuf, *sbuf_end; 52 + static size_t sbuf_len; 53 + 54 + void 55 + sputchar(c) 56 + int c; 57 + { 58 + if (sbuf < sbuf_end) 59 + *sbuf = c; 60 + sbuf++; 61 + } 62 + 63 + int 64 + snprintf(char *buf, size_t len, const char *fmt, ...) 65 + { 66 + va_list ap; 67 + 68 + sbuf = buf; 69 + sbuf_len = len; 70 + sbuf_end = sbuf + len; 71 + va_start(ap, fmt); 72 + kdoprnt(sputchar, fmt, ap); 73 + va_end(ap); 74 + 75 + if (sbuf < sbuf_end) 76 + *sbuf = '\0'; 77 + else if (len > 0) 78 + *(sbuf_end - 1) = '\0'; 79 + 80 + return sbuf - buf; 81 + } 82 + 83 + #endif /* STRIPPED */
+3 -3
sys/lib/libsa/stand.h
··· 1 - /* $OpenBSD: stand.h,v 1.39 2002/03/15 18:19:52 millert Exp $ */ 1 + /* $OpenBSD: stand.h,v 1.40 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */ 3 3 4 4 /*- ··· 139 139 u_int dkcksum(struct disklabel *); 140 140 141 141 void printf(const char *, ...); 142 - void sprintf(char *, const char *, ...); 142 + int snprintf(char *, size_t, const char *, ...); 143 143 void vprintf(const char *, _BSD_VA_LIST_); 144 144 void twiddle(void); 145 145 void gets(char *); ··· 195 195 void usleep(u_int); 196 196 char *ctime(const time_t *); 197 197 198 - void putchar(int); 198 + void putchar(int); 199 199 int getchar(void); 200 200 201 201 #ifdef __INTERNAL_LIBSA_CREAD
+3 -3
sys/lib/libsa/strcmp.c
··· 1 - /* $OpenBSD: strcmp.c,v 1.2 1996/10/16 11:32:07 mickey Exp $ */ 1 + /* $OpenBSD: strcmp.c,v 1.3 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 3 3 /*- 4 4 * Copyright (c) 1996 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+3 -3
sys/lib/libsa/strerror.c
··· 1 - /* $OpenBSD: strerror.c,v 1.5 1997/06/10 16:39:16 millert Exp $ */ 1 + /* $OpenBSD: strerror.c,v 1.6 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: strerror.c,v 1.11 1996/10/13 02:29:08 christos Exp $ */ 3 3 4 4 /*- ··· 42 42 strerror(err) 43 43 int err; 44 44 { 45 - static char ebuf[64]; 45 + static char ebuf[64]; 46 46 47 47 switch (err) { 48 48 case EADAPT: ··· 75 75 return "Invalid argument"; 76 76 77 77 default: 78 - sprintf(ebuf, "Unknown error: code %d", err); 78 + snprintf(ebuf, sizeof ebuf, "Unknown error: code %d", err); 79 79 return ebuf; 80 80 } 81 81 }
+3 -3
sys/lib/libsa/strncmp.c
··· 1 - /* $OpenBSD: strncmp.c,v 1.1 1997/02/06 06:47:00 mickey Exp $ */ 1 + /* $OpenBSD: strncmp.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 3 3 /*- 4 4 * Copyright (c) 1996 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+3 -3
sys/lib/libsa/strncpy.c
··· 1 - /* $OpenBSD: strncpy.c,v 1.1 1996/10/16 11:32:07 mickey Exp $ */ 1 + /* $OpenBSD: strncpy.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 3 3 /*- 4 4 * Copyright (c) 1996 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+21 -23
sys/lib/libsa/ufs.c
··· 1 - /* $OpenBSD: ufs.c,v 1.13 2002/03/14 01:27:07 millert Exp $ */ 1 + /* $OpenBSD: ufs.c,v 1.14 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */ 3 3 4 4 /*- ··· 35 35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 37 * SUCH DAMAGE. 38 - * 38 + * 39 39 * 40 40 * Copyright (c) 1990, 1991 Carnegie Mellon University 41 41 * All Rights Reserved. 42 42 * 43 43 * Author: David Golub 44 - * 44 + * 45 45 * Permission to use, copy, modify and distribute this software and its 46 46 * documentation is hereby granted, provided that both the copyright 47 47 * notice and this permission notice appear in all copies of the 48 48 * software, derivative works or modified versions, and any portions 49 49 * thereof, and that both notices appear in supporting documentation. 50 - * 50 + * 51 51 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 52 52 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 53 53 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 54 - * 54 + * 55 55 * Carnegie Mellon requests users of this software to return to 56 - * 56 + * 57 57 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 58 58 * School of Computer Science 59 59 * Carnegie Mellon University 60 60 * Pittsburgh PA 15213-3890 61 - * 61 + * 62 62 * any improvements or extensions that they make and grant Carnegie the 63 63 * rights to redistribute these changes. 64 64 */ ··· 125 125 buf = alloc(fs->fs_bsize); 126 126 twiddle(); 127 127 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 128 - fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, 129 - buf, &rsize); 128 + fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, 129 + buf, &rsize); 130 130 if (rc) 131 131 goto out; 132 132 if (rsize != (size_t)fs->fs_bsize) { ··· 153 153 } 154 154 out: 155 155 free(buf, fs->fs_bsize); 156 - return (rc); 156 + return (rc); 157 157 } 158 158 159 159 /* ··· 232 232 if (fp->f_blkno[level] != ind_block_num) { 233 233 if (fp->f_blk[level] == (char *)0) 234 234 fp->f_blk[level] = 235 - alloc(fs->fs_bsize); 235 + alloc(fs->fs_bsize); 236 236 twiddle(); 237 237 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 238 - fsbtodb(fp->f_fs, ind_block_num), 239 - fs->fs_bsize, 240 - fp->f_blk[level], 241 - &fp->f_blksize[level]); 238 + fsbtodb(fp->f_fs, ind_block_num), fs->fs_bsize, 239 + fp->f_blk[level], &fp->f_blksize[level]); 242 240 if (rc) 243 241 return (rc); 244 242 if (fp->f_blksize[level] != (size_t)fs->fs_bsize) ··· 298 296 } else { 299 297 twiddle(); 300 298 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 301 - fsbtodb(fs, disk_block), 302 - block_size, fp->f_buf, &fp->f_buf_size); 299 + fsbtodb(fs, disk_block), 300 + block_size, fp->f_buf, &fp->f_buf_size); 303 301 if (rc) 304 302 return (rc); 305 303 } ··· 404 402 fp->f_fs = fs; 405 403 twiddle(); 406 404 rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, 407 - SBLOCK, SBSIZE, (char *)fs, &buf_size); 405 + SBLOCK, SBSIZE, (char *)fs, &buf_size); 408 406 if (rc) 409 407 goto out; 410 408 ··· 507 505 508 506 if (link_len < fs->fs_maxsymlinklen) { 509 507 bcopy(fp->f_di.di_shortlink, namebuf, 510 - (unsigned) link_len); 508 + (unsigned) link_len); 511 509 } else { 512 510 /* 513 511 * Read file for symbolic link ··· 521 519 rc = block_map(f, (daddr_t)0, &disk_block); 522 520 if (rc) 523 521 goto out; 524 - 522 + 525 523 twiddle(); 526 524 rc = (f->f_dev->dv_strategy)(f->f_devdata, 527 - F_READ, fsbtodb(fs, disk_block), 528 - fs->fs_bsize, buf, &buf_size); 525 + F_READ, fsbtodb(fs, disk_block), 526 + fs->fs_bsize, buf, &buf_size); 529 527 if (rc) 530 528 goto out; 531 529 ··· 707 705 while (dp < edp && dp->d_ino == (ino_t)0) 708 706 dp = (struct direct *)((char *)dp + dp->d_reclen); 709 707 fp->f_seekp += buf_size - 710 - ((u_int8_t *)edp - (u_int8_t *)dp); 708 + ((u_int8_t *)edp - (u_int8_t *)dp); 711 709 } while (dp >= edp); 712 710 713 711 #if BYTE_ORDER == LITTLE_ENDIAN
+10 -8
sys/lib/libsa/unixdev.c
··· 1 - /* $OpenBSD: unixdev.c,v 1.4 1998/05/25 18:37:30 mickey Exp $ */ 1 + /* $OpenBSD: unixdev.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1996-1998 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ··· 56 56 57 57 #ifdef UNIX_DEBUG 58 58 printf("unixstrategy: %s %d bytes @ %d\n", 59 - (rw==F_READ?"reading":"writing"), size, blk); 59 + (rw==F_READ?"reading":"writing"), size, blk); 60 60 #endif 61 61 if ((rc = ulseek((int)devdata, blk * DEV_BSIZE, 0)) >= 0) 62 - rc = rw==F_READ? uread((int)devdata, buf, size) : 63 - uwrite((int)devdata, buf, size); 62 + rc = (rw==F_READ) ? uread((int)devdata, buf, size) : 63 + uwrite((int)devdata, buf, size); 64 64 65 65 if (rc >= 0) { 66 66 *rsize = (size_t)rc; ··· 88 88 89 89 if (strncmp("/dev/", *file, 5) == 0) { 90 90 /* p = strchr(p + 5, '/') */ 91 - for (p = *file + 5; *p != '\0' && *p != '/'; p++); 91 + for (p = *file + 5; *p != '\0' && *p != '/'; p++) 92 + ; 92 93 if (*p == '/') 93 94 *p = '\0'; 94 95 } ··· 99 100 if (p != NULL) 100 101 *p = '/'; 101 102 102 - return fd<0? -1: 0; 103 + return fd < 0 ? -1 : 0; 103 104 } 104 105 105 106 int ··· 171 172 return 1; 172 173 } else { 173 174 char c; 175 + 174 176 return uread(0, &c, 1)<1? -1: c; 175 177 } 176 178 }
+3 -3
sys/lib/libsa/unixdev.h
··· 1 - /* $OpenBSD: unixdev.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */ 1 + /* $OpenBSD: unixdev.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1996 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+8 -8
sys/lib/libsa/write.c
··· 1 - /* $OpenBSD: write.c,v 1.3 1996/12/08 15:15:59 niklas Exp $ */ 1 + /* $OpenBSD: write.c,v 1.4 2003/06/01 17:00:33 deraadt Exp $ */ 2 2 /* $NetBSD: write.c,v 1.7 1996/06/21 20:29:30 pk Exp $ */ 3 3 4 4 /*- ··· 37 37 * SUCH DAMAGE. 38 38 * 39 39 * @(#)write.c 8.1 (Berkeley) 6/11/93 40 - * 40 + * 41 41 * 42 42 * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University 43 43 * All Rights Reserved. 44 44 * 45 45 * Author: Alessandro Forin 46 - * 46 + * 47 47 * Permission to use, copy, modify and distribute this software and its 48 48 * documentation is hereby granted, provided that both the copyright 49 49 * notice and this permission notice appear in all copies of the 50 50 * software, derivative works or modified versions, and any portions 51 51 * thereof, and that both notices appear in supporting documentation. 52 - * 52 + * 53 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 55 55 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 - * 56 + * 57 57 * Carnegie Mellon requests users of this software to return to 58 - * 58 + * 59 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 60 * School of Computer Science 61 61 * Carnegie Mellon University 62 62 * Pittsburgh PA 15213-3890 63 - * 63 + * 64 64 * any improvements or extensions that they make and grant Carnegie the 65 65 * rights to redistribute these changes. 66 66 */ ··· 84 84 if (f->f_flags & F_RAW) { 85 85 twiddle(); 86 86 errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, 87 - btodb(f->f_offset), bcount, dest, &resid); 87 + btodb(f->f_offset), bcount, dest, &resid); 88 88 if (errno) 89 89 return (-1); 90 90 f->f_offset += resid;
+8 -7
sys/stand/boot/boot.c
··· 1 - /* $OpenBSD: boot.c,v 1.26 2003/05/19 08:18:25 mickey Exp $ */ 1 + /* $OpenBSD: boot.c,v 1.27 2003/06/01 17:00:26 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 2003 Dale Rahn ··· 19 19 * 4. The name of the author may not be used to endorse or promote products 20 20 * derived from this software without specific prior written permission. 21 21 * 22 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ··· 38 38 #include <sys/stat.h> 39 39 #include <libsa.h> 40 40 #include <lib/libsa/loadfile.h> 41 + #include <lib/libkern/funcs.h> 41 42 42 43 #include "cmd.h" 43 - 44 44 45 45 static const char *const kernels[] = { 46 46 "/bsd", ··· 66 66 printf(">> OpenBSD/" MACHINE " BOOT %s\n", version); 67 67 68 68 devboot(bootdev, cmd.bootdev); 69 - strncpy(cmd.image, bootfile, sizeof(cmd.image)); 69 + strlcpy(cmd.image, bootfile, sizeof(cmd.image)); 70 70 cmd.boothowto = 0; 71 71 cmd.conf = "/etc/boot.conf"; 72 72 cmd.addr = (void *)DEFAULT_KERNEL_ADDRESS; ··· 74 74 75 75 st = read_conf(); 76 76 if (!bootprompt) 77 - sprintf(cmd.path, "%s:%s", cmd.bootdev, cmd.image); 77 + snprintf(cmd.path, sizeof cmd.path, "%s:%s", 78 + cmd.bootdev, cmd.image); 78 79 79 80 while (1) { 80 81 /* no boot.conf, or no boot cmd in there */ ··· 95 96 bootfile = kernels[i=0]; 96 97 } else 97 98 bootfile = kernels[i]; 98 - strncpy(cmd.image, bootfile, sizeof(cmd.image)); 99 + strlcpy(cmd.image, bootfile, sizeof(cmd.image)); 99 100 printf(" failed(%d). will try %s\n", errno, bootfile); 100 101 101 102 if (try < 2)
+3 -3
sys/stand/boot/bootarg.c
··· 1 - /* $OpenBSD: bootarg.c,v 1.7 2002/03/14 03:16:12 millert Exp $ */ 1 + /* $OpenBSD: bootarg.c,v 1.8 2003/06/01 17:00:27 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1997,1998 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+2 -2
sys/stand/boot/bootarg.h
··· 1 - /* $OpenBSD: bootarg.h,v 1.9 2002/03/14 01:27:13 millert Exp $ */ 1 + /* $OpenBSD: bootarg.h,v 1.10 2003/06/01 17:00:27 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1996-1999 Michael Shalayeff ··· 50 50 51 51 #if defined(_KERNEL) || defined(_STANDALONE) 52 52 extern void *bootargv; 53 - extern int bootargc; 53 + extern int bootargc; 54 54 extern bootarg_t *bootargp; 55 55 #endif 56 56
+18 -13
sys/stand/boot/cmd.c
··· 1 - /* $OpenBSD: cmd.c,v 1.48 2002/07/14 09:19:17 mdw Exp $ */ 1 + /* $OpenBSD: cmd.c,v 1.49 2003/06/01 17:00:27 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1997-1999 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ··· 35 35 #include <sys/param.h> 36 36 #include <libsa.h> 37 37 #include <sys/reboot.h> 38 + #include <lib/libkern/funcs.h> 38 39 #include "cmd.h" 39 40 40 41 #define CTRL(c) ((c)&0x1f) ··· 122 123 123 124 cmd.cmd = NULL; 124 125 125 - do 126 + do { 126 127 eof = read(fd, p, 1); 127 - while (eof > 0 && *p++ != '\n'); 128 + } while (eof > 0 && *p++ != '\n'); 128 129 129 130 if (eof < 0) 130 131 printf("%s: %s\n", cmd.path, strerror(errno)); ··· 239 240 break; 240 241 241 242 if (!cnischar()) { 242 - strncpy(buf, "boot", 5); 243 + strlcpy(buf, "boot", 5); 243 244 putchar('\n'); 244 245 return strlen(buf); 245 246 } 246 247 } else 247 - while (!cnischar()) ; 248 + while (!cnischar()) 249 + ; 248 250 249 251 while (1) { 250 252 switch ((ch = getchar())) { ··· 283 285 /* 284 286 * Search for spaces/tabs after the current word. If found, \0 the 285 287 * first one. Then pass a pointer to the first character of the 286 - * next word, or NULL if there is no next word. 288 + * next word, or NULL if there is no next word. 287 289 */ 288 290 char * 289 291 nextword(p) ··· 407 409 } 408 410 409 411 /* no strlen in lib !!! */ 410 - for (p = cmd.path; *p; p++); 412 + for (p = cmd.path; *p; p++) 413 + ; 411 414 *p++ = '/'; 412 415 *p = '\0'; 413 416 ··· 439 442 lsrwx(sb->st_mode , (sb->st_mode & S_ISTXT? "tT" : "x-")); 440 443 441 444 printf (" %u,%u\t%lu\t%s\n", sb->st_uid, sb->st_gid, 442 - (u_long)sb->st_size, name); 445 + (u_long)sb->st_size, name); 443 446 } 444 447 #undef lsrwx 445 448 ··· 466 469 } else { 467 470 if (bootparse(1)) 468 471 return 0; 469 - sprintf(cmd.path, "%s:%s", cmd.bootdev, cmd.image); 472 + snprintf(cmd.path, sizeof cmd.path, "%s:%s", 473 + cmd.bootdev, cmd.image); 470 474 } 471 475 472 476 return 1; ··· 486 490 if (*p == ':') 487 491 break; 488 492 if (*p == ':') 489 - strncpy(cmd.path, name, sizeof(cmd.path)); 493 + strlcpy(cmd.path, name, sizeof(cmd.path)); 490 494 else 491 - sprintf(cmd.path, "%s:%s", cmd.bootdev, name); 495 + snprintf(cmd.path, sizeof cmd.path, "%s:%s", 496 + cmd.bootdev, name); 492 497 return cmd.path; 493 498 } 494 499
+3 -3
sys/stand/boot/cmd.h
··· 1 - /* $OpenBSD: cmd.h,v 1.11 2002/03/14 01:27:13 millert Exp $ */ 1 + /* $OpenBSD: cmd.h,v 1.12 2003/06/01 17:00:27 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1997 Michael Shalayeff ··· 18 18 * 4. The name of the author may not be used to endorse or promote products 19 19 * derived from this software without specific prior written permission. 20 20 * 21 - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+14 -9
sys/stand/boot/vars.c
··· 1 - /* $OpenBSD: vars.c,v 1.7 2002/03/14 01:27:13 millert Exp $ */ 1 + /* $OpenBSD: vars.c,v 1.8 2003/06/01 17:00:27 deraadt Exp $ */ 2 2 3 3 /* 4 4 * Copyright (c) 1998-2000 Michael Shalayeff ··· 35 35 #include <sys/param.h> 36 36 #include <libsa.h> 37 37 #include <sys/reboot.h> 38 + #include <lib/libkern/funcs.h> 38 39 #include "cmd.h" 39 40 40 41 extern const char version[]; ··· 55 56 const struct cmd_table cmd_set[] = { 56 57 {"addr", CMDT_VAR, Xaddr}, 57 58 {"howto", CMDT_VAR, Xhowto}, 58 - #ifdef DEBUG 59 + #ifdef DEBUG 59 60 {"debug", CMDT_VAR, Xdebug}, 60 61 #endif 61 62 {"device", CMDT_VAR, Xdevice}, ··· 109 110 if (cmd.argc != 2) 110 111 printf("%s\n", cmd.bootdev); 111 112 else 112 - strncpy(cmd.bootdev, cmd.argv[1], sizeof(cmd.bootdev)); 113 + strlcpy(cmd.bootdev, cmd.argv[1], sizeof(cmd.bootdev)); 113 114 return 0; 114 115 } 115 116 ··· 119 120 if (cmd.argc != 2) 120 121 printf("%s\n", cmd.image); 121 122 else 122 - strncpy(cmd.image, cmd.argv[1], sizeof(cmd.image)); 123 + strlcpy(cmd.image, cmd.argv[1], sizeof(cmd.image)); 123 124 return 0; 124 125 } 125 126 ··· 232 233 * terminated by the usual '\0' 233 234 */ 234 235 char *environ; 236 + 235 237 int 236 238 Xenv() 237 239 { ··· 245 247 int l; 246 248 for (p = environ; p && *p; p = q) { 247 249 l = strlen(cmd.argv[1]); 248 - for (q = p; *q != '='; q++); 250 + for (q = p; *q != '='; q++) 251 + ; 249 252 l = max(l, q - p) + 1; 250 - for (q = p; *q != '\n'; q++); 253 + for (q = p; *q != '\n'; q++) 254 + ; 251 255 if (*q) 252 256 q++; 253 257 if (!strncmp(p, cmd.argv[1], l)) { 254 - while((*p++ = *q++)); 258 + while((*p++ = *q++)) 259 + ; 255 260 p--; 256 261 } 257 262 } 258 263 if (!p) 259 264 p = environ = alloc(4096); 260 - sprintf(p, "%s=%s\n", 261 - cmd.argv[1], (cmd.argc==3?cmd.argv[2]:"")); 265 + snprintf(p, environ + 4096 - p, "%s=%s\n", 266 + cmd.argv[1], (cmd.argc==3?cmd.argv[2]:"")); 262 267 } 263 268 264 269 return 0;