Suppose I have a file named 1.sb with this content:#!/usr/local/bin/sbcl --script
(prin1 sb-ext:*posix-argv*) (terpri)
If I invoke it as 1.sb a b c I get this output:("/usr/local/bin/sbcl" "a" "b" "c")
How do I get the name of the script file itself (1.sb)?
(I got no takers on stackoverflow...
This, of course, is criminal.
Agreed.
As long as we're talking about paper documentation and POSIX and threads, two books covering POSIX threads are wildly different, and it's the only time I've been disappointed with an O'Reilly book. That book, Pthreads Programming by Nichols, Buttlar &...
Cool. But I had actually seen that man page, and what I saw was this:
The values for the flag are constructed by a bitwise-inclusive OR of
flags from the following list, defined in <fcntl.h>:
AT_SYMLINK_NOFOLLOW
If path names a symbolic link, the status of the...
I know I can use chflags to change the flags on a file. How do I find out what they are in the first place? I must be staring at the answer in the documentation but not seeing it. I know my C program can do an ls -lo on the file and then parse the returned string, but I don't want to fire up a...
... and no offense taken. In the migration from Linux, I spend a significant amount of time correcting code written (a) when I was a much less mature coder, and (b) when it seemed a safe assumption that I'd be with Linux.
My original code running under Linux, upon wanting to remove something which was either a regular file or a directory, simply tried an unlink; upon success, it was done. Upon getting EISDIR, it did an rmdir (and tested the result, of course). Under Linux, that worked smoothly; the directory got...
For us in userland, the answer lies in making our code POSIX compliant. We all know who (*coughPoetteringcough*) doesn't think much of keeping code POSIX compliant, don't we? That's not the reason I left Linux, but it's closely related.
Agreed. That's been pretty much my guiding principle.
The particular program I'm porting from Linux does indeed handle any error. The way I want it to handle unanticipated errors in this case is to come to a "screeching" (figuratively speaking) "halt" (figuratively speaking, with modern...
According to the unlink man page, if one tries to unlink() a directory, one gets the EISDIR error. But one also gets the EPERM error. Obviously only one can be true, and the one that seems to be true is EPERM; that's apparently what POSIX specifies. So are both errors listed in the man page to...
After some brainstorming:
All the requirements can be met through the following steps. First we show steps which are done just once.
Step one. Since each script which should be run as root has to be marked by user root somehow (otherwise, just any user could do this), the system administrator...
Yes (but it was nonetheless good for you to mention it). The goal is to be able to make a script eligible to be run as root just by changing something about the script itself, without having to update any configuration files and such. This sounds picky, but over the long haul, the more...
I would like to be able to run certain Perl scripts on my system as root, even though the "user" calling them is not running as root.
For each script I can write a C wrapper, setting setuid root for that wrapper; the wrapper would change the UID to 0 and then call the Perl script, which itself...
Sounds like a plan, except that I don't yet have a crossover cable and I already have a hub. It's kinda cool for the grandkids to see the green lights on the hub flicker when there's traffic. :)
/down with emojis
//ascii art for the win
Yes. Really a hub. Went upstairs and pulled it out of a Zip-Loc bag. No configuration necessary, of course. Sometimes simple is good.
I had thought that perhaps there would be a software solution to this problem, because under Linux the connection with an ordinary cable works just fine. So hub...
In the past I've had two Linux hosts; call them tiger and apteryx. Host tiger has a network interface connected to a DSL modem; no problems there. Host tiger has another network interface, with a cable running directly from that interface to host apteryx's only interface; that connection is host...
When a host boots, I don't want DHCP to come up right away; I want that to wait until an arbitrary point later. But what I do want at boot time is a hard IP address (for example, 10.0.0.3) to be automatically associated with the interface. I use ifconfig(8) for that in an rc file, and it works...
I'm an immigrant from Linux, so I was used to Linux's way of doing things. It turns out that the group associated with a new file is not that of the creator, whether or not the -l option was used with su(1).
The rules are these.
As just stated, a new file inherits the group of its enclosing...
I'm using the one without the hyphen. The group on the newly-created file always follows the most recent actual login (which I know the hyphen would simulate), but I don't want to login again. I just want to change the uid and gid, and have that gid be reflected in new files I create without...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.