Google Answers Logo
View Question
 
Q: Bash shell source code ( No Answer,   0 Comments )
Question  
Subject: Bash shell source code
Category: Computers > Programming
Asked by: ga1000-ga
List Price: $10.00
Posted: 25 Feb 2003 17:01 PST
Expires: 18 Mar 2003 20:21 PST
Question ID: 167137
Would like to know where in the Linux 2.4.2 source code the shell
interpreter is implemented. (please indicate the directory and file
name also if it is a separate file)

As well the paragraph of code that let the shell send out the shell
prompt back to the logged on user.

Request for Question Clarification by studboy-ga on 25 Feb 2003 18:14 PST
Hi

The bash shell src is independent--you can compile it yourself.
Try looking in /usr/src /usr/local/src or /tools/src
under gnu.

May I ask whether you want to just change the prompt?
If all you want is to change the prompt you can set the PS1 variable
upon login (.bashrc).

Clarification of Question by ga1000-ga on 25 Feb 2003 19:20 PST
Not to change the prompt sign, but to send out the prompt twice, to
see whether I can get at least one shell prompt to solve my 'missing
prompt' problem mentioned in an earlier question.

Request for Question Clarification by studboy-ga on 25 Feb 2003 23:26 PST
OK, I looked back at your questions--I think it's better to solve th
eproblem at the root rather than hacking bash to send out two shell
prompts...  Can I ask a question?  After you do a Ctrl-Z to bring back
the shell prompt, can you do a:

ps -ef 

and tell me the output?

I'm guessing your program might not have terminated properly--ie, it's
still running, that's why you didn't get the prompt back.

Clarification of Question by ga1000-ga on 26 Feb 2003 08:11 PST
The missing prompt occurs with the standard shell command like 'dir'
or 'ls', as well as my programs.

The hardware uses a special device driver. You can take a look at it
(see my previous questions). I checked this device driver with the
Linux kernel RS232 device driver, called rs232.c (it is in the
user/src's character folder).

There is a section in rs232.c that my device driver does not have. Do
you think it has anything to do with the problem? (see below)



==============================================================================
static void serial_console_write(struct console *co, const char *s,
				unsigned count)
{
	static struct async_struct *info = &async_sercons;
	int ier;
	unsigned i;

	/*
	 *	First save the IER then disable the interrupts
	 */
	ier = serial_in(info, UART_IER);
	serial_out(info, UART_IER, 0x00);

	/*
	 *	Now, do each character
	 */
	for (i = 0; i < count; i++, s++) {
		wait_for_xmitr(info);

		/*
		 *	Send the character out.
		 *	If a LF, also do CR...
		 */
		serial_out(info, UART_TX, *s);
		if (*s == 10) {
			wait_for_xmitr(info);
			serial_out(info, UART_TX, 13);
		}
	}

	/*
	 *	Finally, Wait for transmitter & holding register to empty
	 * 	and restore the IER
	 */
	wait_for_xmitr(info);
	serial_out(info, UART_IER, ier);
}

Clarification of Question by ga1000-ga on 26 Feb 2003 08:21 PST
Below please find the output of ps -ef. I use getty for ttyM0 and
agetty for ttyM1. ttyM1 (port 2 of the serial port is used here)

=============================================================================
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 10:12 ?        00:00:04 init [5] 
root         2     1  0 10:12 ?        00:00:00 [keventd]
root         3     1  0 10:12 ?        00:00:00 [kapm-idled]
root         4     1  0 10:12 ?        00:00:00 [kswapd]
root         5     1  0 10:12 ?        00:00:00 [kreclaimd]
root         6     1  0 10:12 ?        00:00:00 [bdflush]
root         7     1  0 10:12 ?        00:00:00 [kupdated]
root         8     1  0 10:13 ?        00:00:00 [mdrecoveryd]
root        17     1  6 10:13 ?        00:00:36 [loop1]
root        82     1  0 10:13 ?        00:00:00 [khubd]
root       511     1  0 10:14 ?        00:00:00 syslogd -m 0
root       516     1  0 10:14 ?        00:00:00 klogd -2
rpc        530     1  0 10:14 ?        00:00:00 portmap
rpcuser    545     1  0 10:14 ?        00:00:00 rpc.statd
root       629     1  0 10:14 ?        00:00:00 /usr/sbin/apmd -p 10
-w 5 -W -P
root       678     1  0 10:14 ?        00:00:00 /usr/sbin/automount
--timeout 60
daemon     693     1  0 10:14 ?        00:00:00 /usr/sbin/atd
root       740     1  0 10:14 ?        00:00:00 sendmail: accepting
connections
root       753     1  0 10:14 ?        00:00:00 gpm -t ps/2 -m
/dev/mouse
root       765     1  0 10:14 ?        00:00:00 crond
xfs        801     1  0 10:14 ?        00:00:00 xfs -droppriv -daemon
root       830     1  0 10:14 tty1     00:00:00 /sbin/mingetty tty1
root       831     1  0 10:14 tty2     00:00:00 /sbin/mingetty tty2
root       832     1  0 10:14 tty3     00:00:00 /sbin/mingetty tty3
root       833     1  0 10:14 tty4     00:00:00 /sbin/mingetty tty4
root       834     1  0 10:14 tty5     00:00:00 /sbin/mingetty tty5
root       835     1  0 10:14 tty6     00:00:00 /sbin/mingetty tty6
root       836     1  0 10:14 ttyM0    00:00:00 /sbin/getty ttyM0
DT19200 wy60
root       837     1  0 10:14 ttyM1    00:00:00 login -- root
root       838     1  0 10:14 ?        00:00:00 /usr/bin/gdm -nodaemon
root       845   838  0 10:14 ?        00:00:02 /etc/X11/X -auth
/var/gdm/:0.Xau
root       846   838  0 10:14 ?        00:00:00 /usr/bin/gdm -nodaemon
root       857   846  0 10:14 ?        00:00:00 /usr/bin/gnome-session
root       920     1  0 10:14 ?        00:00:00 gnome-smproxy
--sm-client-id def
root       924     1  0 10:14 ?        00:00:01 sawfish
--sm-client-id=default2
root       942     1  1 10:15 ?        00:00:07 magicdev
--sm-client-id=default1
root       953     1  0 10:15 ?        00:00:00 gnome-name-service
root       957     1  0 10:15 ?        00:00:00 panel --sm-client-id
default7
root       960     1  0 10:15 ?        00:00:00 gmc --nowindows
--sm-client-id d
root       967     1  0 10:15 ?        00:00:00 tasklist_applet
--activate-goad-
root       969     1  0 10:15 ?        00:00:00 deskguide_applet
--activate-goad
root      1112   837  0 10:21 ttyM1    00:00:00 -bash
root      1142  1112  5 10:22 ttyM1    00:00:00 ps -ef

Request for Question Clarification by studboy-ga on 26 Feb 2003 09:36 PST
Let me take a closer look at the code...  I think the saving and
restoring IER oart might have something to do with it.

Clarification of Question by ga1000-ga on 26 Feb 2003 10:58 PST
If you would explain the purpose of this code section in serial.c,
including what is ier and why it needs to be saved, why Lf needs to be
added by the device driver, then please consider the question
answered.

I will ask new questions if this code section needs to be inserted
into my board's device driver code.

Clarification of Question by ga1000-ga on 18 Mar 2003 20:20 PST
My problem turns out to be device driver related.

So I will close the question. Thank you.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy