C - development under UNIX - XENIX
Brandon S. Allbery
allbery at ncoast.UUCP
Sun May 15 04:51:42 AEST 1988
I saw some posted answers to these, many of which were at least somewhat
inaccurate.
As quoted from <14827 at jplgodo.UUCP> by deutsch at jplgodo.UUCP (Michael Deutsch ):
+---------------
| 1. A UNIX function call equivalent to: "mkdir" command is???
+---------------
BSD4.2/4.3 and System V Release 3 have mkdir(path, mode) system call. Under
Xenix, you have to build a shell command to call /bin/mkdir and system() it.
+---------------
| 2. A programm running with "setuid" privilege, i.e.: -rwsr-xr-x
| tries to create directory and fails when executed by non-root,
| however, it works when executed by root, why???
+---------------
Since /bin/mkdir is setuid, it runs as root/ORIGINAL USER. The setuid on
mkdir overrides the setuid on the calling program. Thus, the ORIGINAL user
must have permission to create the directory. The mkdir() system call doesn't
have this problem.
+---------------
| 3. How to issue an "lp/lpr" command from the program without
| diagnostic popping up on the terminal???
+---------------
The "lp" command has an "-s" option to prevent the "request-id is ..."
message from being displayed. If you actually mean error messages, you
have to redirect standard error to /dev/null (lp ... 2> /dev/null).
+---------------
| 4. Which header file or type contains info on the file, i.e. (size,
| date created, date modified, number of links, etc.).
+---------------
/usr/include/sys/stat.h. Look up stat(S).
+---------------
| 5. While using curses: one program spawns / forks/ issues a shell command
| to start program 2. When the program 2 finishes the control
| comes back to the parent process that tries to refresh the
| screen i.e. restore to the state prior to invoking program 2,
| what curses call will do this? I've tried
| refresh(curscr);
| but it does not seem to work?????????????
+---------------
refresh() doesn't take an argument and always works on stdscr. Use the
call wrefresh(curscr) (note the initial "w"!).
+---------------
| 6. My program uses keypad, and that works fine with all UNIX - terminfo
| based systems; however pre 2.2 releases of XENIX were based on
| the termcap and did not have a:
| keypad( )
| call. I can get around using keypad under XENIX; however why
| the program crashes if a keypad key is pressed under XENIX, how
| to get around this problems????
+---------------
Crashes under which version of Xenix? -- curses/terminfo or termcap? There
is a bug in some Xenixes with terminfo (Altos Xenix 5.2as1) where keypad
keys are not properly recognized; programs don't crash, they simply get the
escape sequence *with parity* instead of the KEY_* code. The curious thing
about it is that when I was testing it, neither my port nor my terminal were
configured for parity.... I'd have to see the program in order to figure
out what was going on.
--
Brandon S. Allbery, moderator of comp.sources.misc
{well!hoptoad,uunet!marque,cbosgd,sun!mandrill}!ncoast!allbery
Delphi: ALLBERY MCI Mail: BALLBERY
More information about the Comp.unix.wizards
mailing list