main.c (206759) | main.c (208630) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 28 unchanged lines hidden (view full) --- 37#endif /* not lint */ 38 39#ifndef lint 40#if 0 41static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/28/95"; 42#endif 43#endif /* not lint */ 44#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 28 unchanged lines hidden (view full) --- 37#endif /* not lint */ 38 39#ifndef lint 40#if 0 41static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/28/95"; 42#endif 43#endif /* not lint */ 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: head/bin/sh/main.c 206759 2010-04-17 14:35:46Z jilles $"); | 45__FBSDID("$FreeBSD: head/bin/sh/main.c 208630 2010-05-28 22:40:24Z jilles $"); |
46 47#include <stdio.h> 48#include <signal.h> 49#include <sys/stat.h> 50#include <unistd.h> 51#include <fcntl.h> 52#include <locale.h> 53#include <errno.h> --- 255 unchanged lines hidden (view full) --- 309 return localname; 310 } 311 return basename; 312} 313 314int 315dotcmd(int argc, char **argv) 316{ | 46 47#include <stdio.h> 48#include <signal.h> 49#include <sys/stat.h> 50#include <unistd.h> 51#include <fcntl.h> 52#include <locale.h> 53#include <errno.h> --- 255 unchanged lines hidden (view full) --- 309 return localname; 310 } 311 return basename; 312} 313 314int 315dotcmd(int argc, char **argv) 316{ |
317 char *fullname; | 317 char *filename, *fullname; |
318 319 if (argc < 2) 320 error("missing filename"); 321 322 exitstatus = 0; 323 | 318 319 if (argc < 2) 320 error("missing filename"); 321 322 exitstatus = 0; 323 |
324 fullname = find_dot_file(argv[1]); | 324 /* 325 * Because we have historically not supported any options, 326 * only treat "--" specially. 327 */ 328 filename = argc > 2 && strcmp(argv[1], "--") == 0 ? argv[2] : argv[1]; 329 330 fullname = find_dot_file(filename); |
325 setinputfile(fullname, 1); 326 commandname = fullname; 327 cmdloop(0); 328 popfile(); 329 return exitstatus; 330} 331 332 --- 13 unchanged lines hidden --- | 331 setinputfile(fullname, 1); 332 commandname = fullname; 333 cmdloop(0); 334 popfile(); 335 return exitstatus; 336} 337 338 --- 13 unchanged lines hidden --- |