main.c (60401) | main.c (80286) |
---|---|
1/*- 2 * Copyright (c) 1992 Diomidis Spinellis. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Diomidis Spinellis of Imperial College, University of London. 8 * --- 32 unchanged lines hidden (view full) --- 41 The Regents of the University of California. All rights reserved.\n"; 42#endif /* not lint */ 43 44#ifndef lint 45#if 0 46static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; 47#endif 48static const char rcsid[] = | 1/*- 2 * Copyright (c) 1992 Diomidis Spinellis. 3 * Copyright (c) 1992, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Diomidis Spinellis of Imperial College, University of London. 8 * --- 32 unchanged lines hidden (view full) --- 41 The Regents of the University of California. All rights reserved.\n"; 42#endif /* not lint */ 43 44#ifndef lint 45#if 0 46static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/3/94"; 47#endif 48static const char rcsid[] = |
49 "$FreeBSD: head/usr.bin/sed/main.c 60401 2000-05-11 20:15:16Z nsayer $"; | 49 "$FreeBSD: head/usr.bin/sed/main.c 80286 2001-07-24 14:05:21Z obrien $"; |
50#endif /* not lint */ 51 52#include <sys/types.h> 53 54#include <err.h> 55#include <errno.h> 56#include <fcntl.h> 57#include <locale.h> --- 67 unchanged lines hidden (view full) --- 125 case 'E': 126 rflags = REG_EXTENDED; 127 break; 128 case 'a': 129 aflag = 1; 130 break; 131 case 'e': 132 eflag = 1; | 50#endif /* not lint */ 51 52#include <sys/types.h> 53 54#include <err.h> 55#include <errno.h> 56#include <fcntl.h> 57#include <locale.h> --- 67 unchanged lines hidden (view full) --- 125 case 'E': 126 rflags = REG_EXTENDED; 127 break; 128 case 'a': 129 aflag = 1; 130 break; 131 case 'e': 132 eflag = 1; |
133 temp_arg = xmalloc(strlen(optarg) + 2); | 133 if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL) 134 err(1, "malloc"); |
134 strcpy(temp_arg, optarg); 135 strcat(temp_arg, "\n"); 136 add_compunit(CU_STRING, temp_arg); 137 break; 138 case 'f': 139 fflag = 1; 140 add_compunit(CU_FILE, optarg); 141 break; --- 215 unchanged lines hidden (view full) --- 357 */ 358static void 359add_compunit(type, s) 360 enum e_cut type; 361 char *s; 362{ 363 struct s_compunit *cu; 364 | 135 strcpy(temp_arg, optarg); 136 strcat(temp_arg, "\n"); 137 add_compunit(CU_STRING, temp_arg); 138 break; 139 case 'f': 140 fflag = 1; 141 add_compunit(CU_FILE, optarg); 142 break; --- 215 unchanged lines hidden (view full) --- 358 */ 359static void 360add_compunit(type, s) 361 enum e_cut type; 362 char *s; 363{ 364 struct s_compunit *cu; 365 |
365 cu = xmalloc(sizeof(struct s_compunit)); | 366 if ((cu = malloc(sizeof(struct s_compunit))) == NULL) 367 err(1, "malloc"); |
366 cu->type = type; 367 cu->s = s; 368 cu->next = NULL; 369 *cu_nextp = cu; 370 cu_nextp = &cu->next; 371} 372 373/* 374 * Add a file to the linked list 375 */ 376static void 377add_file(s) 378 char *s; 379{ 380 struct s_flist *fp; 381 | 368 cu->type = type; 369 cu->s = s; 370 cu->next = NULL; 371 *cu_nextp = cu; 372 cu_nextp = &cu->next; 373} 374 375/* 376 * Add a file to the linked list 377 */ 378static void 379add_file(s) 380 char *s; 381{ 382 struct s_flist *fp; 383 |
382 fp = xmalloc(sizeof(struct s_flist)); | 384 if ((fp = malloc(sizeof(struct s_flist))) == NULL) 385 err(1, "malloc"); |
383 fp->next = NULL; 384 *fl_nextp = fp; 385 fp->fname = s; 386 fl_nextp = &fp->next; 387} | 386 fp->next = NULL; 387 *fl_nextp = fp; 388 fp->fname = s; 389 fl_nextp = &fp->next; 390} |