OK, that explains what you're trying to do. So let's see if we can explain what's going on.
When you execute anything it does not execute in your current shell, rather, a new shell is created, the program executes and the new shell dies at completion. That new shell inherits all the environment settings from the current shell. The
umask value is a shell environment variable for newly created files (and directories), not a file-by-file mask.
So, what do you do so that any files created by your running program will have the mask
-rw-rw-r-- instead of the default
-rw-r--r--?
Easy way is simply execute
umask 003 then execute your program. That will only "stick" as long as the user is logged in but it's kind of a pain to do.
Another way is to create a little program launcher (a shell program) that sets
umask the executes the program. That may get complicated if there are command line arguments to the program but it's easily handled too. Call it something like, oh,
runprog.
Yet another way is to set the file creation mask in your ADA program every time you create a file in it; no mistakes that way.
The second is probably your best bet, though, because it's easy and nobody who is going to execute your program needs to know that they're simply typing a command with some arguments.
For example,
Code:
#!/bin/sh (or bash or ksh or whatever)
# set umask
umask 003
# execute prog
prog
exit
It's just a shell program that sets an environment value then executes a command using that environment. You'd handle command line arguments as you would in any shell program.
Hope this helps some.