Newbie X/C program question

Newbie X/C program question

Post by Steve Wolf » Mon, 05 Apr 1999 05:00:00



Hello all, I have a question. It is probably a very simple one for all
you guru's out there, but here goes...

I am running red hat linux 5.1, using gcc and afterstep window manager
under x. I am annoyed by the fact that the xterms all have the title
"xterm" - regardless of how many are open - so I started peeking at the
xterm man page and saw a -T option will allow a title to be specified.
So I thought as a little c programming project, I'd write a piece of
code that accepts a title, forks a child and execl()'s the xterm passing
all the args and the title as the last option. I tested out the fork()
and execl() code with a ls command first and it worked fine. I changed
the args to be the xterm and was sure to terminate the arg list with a
NULL value (sorry, I'm a c programming novice...) :)

When I run the program, I get an XT error: unable to open the display. I
am running the code as the same user that owns the console. Here is the
execl() - any ideas??? Thanks!

rc = execl("/usr/X11R6/bin/nxterm",
        "nxterm",
        "-bg black",
        "-fg peachpuff",
        "-sl 500",
        "-vb",
        "-T silly_title",
        "&",
        NULL);

Thanks for any help!
Steve

 
 
 

Newbie X/C program question

Post by Vlad Peterse » Mon, 05 Apr 1999 05:00:00


....

Quote:> I am running red hat linux 5.1, using gcc and afterstep window manager
> under x. I am annoyed by the fact that the xterms all have the title
> "xterm" - regardless of how many are open - so I started peeking at the
> xterm man page and saw a -T option will allow a title to be specified.
> So I thought as a little c programming project, I'd write a piece of
> code that accepts a title, forks a child and execl()'s the xterm passing

If you don't mind a solution using other than C, here's something I
found somewhere on Usenet a long time ago and have used since:

# all this should be appended to your ~/.bashrc

# set the title of an xterm to $PWD
xtitle(){
        if [ "$TERM" = "xterm" ]; then
              # echo -e "\033]2;shell: `pwd`\007$ "

        fi

Quote:}

#Change cd commands to use xtitle()
cd(){
  builtin cd $1
  xtitle
Quote:}

pushd(){
  builtin pushd $1
  xtitle
Quote:}

popd(){
  builtin popd $1
  xtitle

Quote:}

##

 
 
 

1. Newbie question on setting an initial program

Hi all,

        Recently, a user without any AIX knowledge request me to write a
menu script for him to operate when he logs in the system. I've written the
script and put it in /home/user/, I've verified that the script can run
properly by ./script under that directory. But problem comes out when I try
to set this script as the initial program for that user, I've tried two
different ways to do so but neither success.

         Here are the two ways I've try,

1)I just simply "smitty user" and input the full path of the script at the
INITIAL PROGRAM field, but it turns out
            3004-703 Check "/etc/security/login.cfg" file
            3004-692 Error changing "shell" to "/home/user1/menu.opersh" :
Value is invalid

2)I try to change the settings in /etc/passwd to
user1:!:201::/home/user1:/home/user1/menu.opersh
   but when the user logs in, it gives
     3004-009 Failed running login-shell

Could somebody kindly give me some advices on that and have I missed some
procedures that I must do in setting an initial program?

Thanks a lot.

Regards,
Frankie

2. Dns newbie question

3. Newbie question, menus and programs in KDE

4. Java on Linux Netscape Communicator 4.51

5. NEWBIE Question: Is there a free database program for Linux

6. Help with SCSI Please...

7. newbie question: I want to compile and run programs on a solaris SPARC m/c

8. SB 16 PnP

9. Newbie questions on file syn between programs?

10. newbie programming questions

11. newbie's question on graphical programming

12. Newbie question : Background program after logout ...

13. Extremely newbie programming question.