Deleted Added
full compact
main.c (200998) main.c (201053)
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 200998 2009-12-25 20:21:35Z jilles $");
45__FBSDID("$FreeBSD: head/bin/sh/main.c 201053 2009-12-27 18:04:05Z 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>

--- 18 unchanged lines hidden (view full) ---

72#include "mystring.h"
73#include "exec.h"
74#include "cd.h"
75
76int rootpid;
77int rootshell;
78struct jmploc main_handler;
79
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>

--- 18 unchanged lines hidden (view full) ---

72#include "mystring.h"
73#include "exec.h"
74#include "cd.h"
75
76int rootpid;
77int rootshell;
78struct jmploc main_handler;
79
80STATIC void read_profile(char *);
80STATIC void read_profile(const char *);
81STATIC char *find_dot_file(char *);
82
83/*
84 * Main routine. We initialize things, parse the arguments, execute
85 * profiles if we're a login shell, and then call cmdloop to execute
86 * commands. The setjmp call sets up the location to jump to when an
87 * exception occurs. When an exception occurs the variable "state"
88 * is used to figure out how far we had gotten.

--- 154 unchanged lines hidden (view full) ---

243
244
245
246/*
247 * Read /etc/profile or .profile. Return on error.
248 */
249
250STATIC void
81STATIC char *find_dot_file(char *);
82
83/*
84 * Main routine. We initialize things, parse the arguments, execute
85 * profiles if we're a login shell, and then call cmdloop to execute
86 * commands. The setjmp call sets up the location to jump to when an
87 * exception occurs. When an exception occurs the variable "state"
88 * is used to figure out how far we had gotten.

--- 154 unchanged lines hidden (view full) ---

243
244
245
246/*
247 * Read /etc/profile or .profile. Return on error.
248 */
249
250STATIC void
251read_profile(char *name)
251read_profile(const char *name)
252{
253 int fd;
254
255 INTOFF;
256 if ((fd = open(name, O_RDONLY)) >= 0)
257 setinputfd(fd, 1);
258 INTON;
259 if (fd < 0)

--- 69 unchanged lines hidden (view full) ---

329 popfile();
330 return exitstatus;
331}
332
333
334int
335exitcmd(int argc, char **argv)
336{
252{
253 int fd;
254
255 INTOFF;
256 if ((fd = open(name, O_RDONLY)) >= 0)
257 setinputfd(fd, 1);
258 INTON;
259 if (fd < 0)

--- 69 unchanged lines hidden (view full) ---

329 popfile();
330 return exitstatus;
331}
332
333
334int
335exitcmd(int argc, char **argv)
336{
337 extern int oexitstatus;
338
339 if (stoppedjobs())
340 return 0;
341 if (argc > 1)
342 exitstatus = number(argv[1]);
343 else
344 exitstatus = oexitstatus;
345 exitshell(exitstatus);
346 /*NOTREACHED*/
347 return 0;
348}
337 if (stoppedjobs())
338 return 0;
339 if (argc > 1)
340 exitstatus = number(argv[1]);
341 else
342 exitstatus = oexitstatus;
343 exitshell(exitstatus);
344 /*NOTREACHED*/
345 return 0;
346}