![]() |
Newbie with some questions
Hello all,
I'm new to the mac / unix world. I recently just purchased a powerbook 12 inch and installed the developer tools. I have a few questions: When i am in the unix terminal, I've logged into unix as the root user and i get the message: tcsh: cannot open /etc/termcap tcsh: using dumb terminal settings. also, i'm using gcc and i can compile and make just fine, but when i'm running my program i get a: terminal database is inaccessible. The code works because i've tested it in linux. What i'm doing is writing and reading from files (.txt and .dat.) One of the kids in school said in might be a permissions problem. I would apreciate any and all advice on this matter. Eldwin |
details needed
How about some more details of what you are doing?
Are you by any chance using a xterm under X Windows? (If so, this query is more suited for the X Windows section of the forums.) Does your program make use of a curses-based user interface? If you are 'root', then it is very unlikely that you are having permission problems. The more basic problem is that something in the software you are using (your own program or the terminal it is running in) is looking for the file /etc/termcap. This file does not exist on a standard OS X system. |
I'm not sure what you mean by xterm and X window.
I'm in a software engineering class and we've put together a text based role playing game. During execution of the program, you are required to create or choose a previously created player. (Both will require to read info from a .txt file and .dat file.) The program does write to file properly, but it bails out when trying to read from file. Like i said, it works on Linux as far as reading, writing, playing the game. I'm just unfamiliar with these error messages. Thanks for your help Eldwin |
Quote:
|
Terminal
Quote:
Quote:
Quote:
That is why I asked above about the user-interface of the game. A program with straight text-input from a prompt and straight text-output will work without changes on any UNIX system. But if you do anything fancy in the user-interface, like positioning text at a certain place on the screen (as opposed to just letting it scroll up in the Terminal) then you have to be careful to avoid system dependencies. It sounds like some part of your program has such system dependencies, otherwise it wouldn't be looking for the file /etc/termcap. This may be a library that you are linking against - not necessarily just the code that you wrote. Here's a test program, just to check that your basic input & output is working. Try compiling and running this program and let us know what happens with it. (Not sure if you are using C or C++, so I stuck to plain C.) Code:
#include <stdio.h> |
I've narrowed down the problem to reading and writing from/to binary .dat files.
In an attempt to prevent hacking of the game, we stored all the info of players/monsters/equipment in binary.dat files. Obviously when someone opens one of these files up in a notepad, its going to look like a bunch of garbage. As far as input, its just taking straight text input and displaying straight text output. |
answers?
You still haven't answered some of the questions I asked.
- are you using the Terminal program from Utilities? - are you linking with any libraries? What exactly are the problems you are having with these binary files? What does the reading & writing of binary files have to do with termcap - or are we now talking about a different problem? |
Ok when I start Darwin (yes it is a terminal from utilities), I type in 'login' and enter my user name and password.
After I do so, I get the file/etc/termcap line. The folder, where the source files are located, are on the desktop. I can compile the program using the makefile. The program does start up and runs until it is required to read from the .dat file. BTW, What is termcap? Again i appreciate your help on this matter. Eldwin |
Maybe there's a command in your ~/.tcsh that's trying to access the /etc/termcap. Just a suggestion...
|
Quote:
(added afterwards:) Oh - now I see that you said that you type in the command 'login'. Don't do that - you are already logged in. (I tried typing 'login' as you do and I see that same error about termcap - strange - I'll investigate why this happens but anyway, just avoid the 'login' and all should be well.) Quote:
Quote:
Quote:
|
FWIW, this condition can be invoked thusly:
Code:
# normal login |
TERM=network
Right. So it seems (I looked at the source for tcsh) that this is partly a case of a bad error message. The code is using the function 'tgetent' which queries the terminfo database (which is what replaces /etc/termcap on OS X - and many other UNIX variants).
Since for some reason the environment variable TERM is set to "network" when the /usr/bin/login program is run, it is looking for a terminfo entry for "network" and such doesn't exist. The tcsh code then complains about /etc/termcap not existing - which is a bogus error message. All the above was perhaps not of interest to anyone but myself - but the bottom line regarding the original poster's problem remains the same: Don't use the 'login' command when you are already logged in. |
thank you, sir.
|
Not just login?
Unless su calls login.:D
Code:
[dreamersound:~] williamt% su root |
su
I don't see that problem when I su to another user:
su fred I don't have root enabled, so can't try that but maybe you can try su-ing to some other user than root to see if this is only a difficulty with root. |
Every user it seems.
Code:
[dreamersound:~] williamt% su tester |
what about 'su -' ?
What happens if you use 'su -' instead of 'su' ?
E.g.: su - fred This effectively does a login as that user. You might be seeing this "termcap" problem with su due to your 700 permissions. |
Need .termcap
Here's the problem:
Code:
[dreamersound:~] williamt% setenvYes and su - works for the Permission denied message. So I put my .termcap and my .terminfo dir into the other users home dir and I can su - cleanly. The TERM=vt100-color thing is part of the color ls mod. Which now works for each user. (dang its hard to remember all the little hacks we do) I found this when I logged in as tester and started Terminal.app and up pops the "Cannot open /etc/termcap" message. I think I remember fighting this back when I first installed Jaguar too. Thanks |
| All times are GMT -5. The time now is 05:57 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.