Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: (OT) Fixing Line Endings - patch the shell (kernel)

by jbert (Priest)
on Nov 30, 2006 at 17:26 UTC ( #587019=note: print w/ replies, xml ) Need Help??


in reply to Re^3: (OT) Fixing Line Endings - patch the shell (kernel)
in thread (OT) Fixing Line Endings

Interestingly, the kernel code in question (C, not perl I'm afraid :-) already does this:

while (cp > bprm->buf) { cp--; if ((*cp == ' ') || (*cp == '\t')) *cp = '\0'; else break; }
i.e. it finished the executable name at the first space or tab. I guess a better patch would be to change that if test to also null out '\r' (hmm...and probably form-feed and others whilst we're at it).

I wonder how loudly people would scream if this were proposed as a kosher kernel patch. It breaks backwards compatability quite badly, but perhaps only for people who deserve it...


Comment on Re^4: (OT) Fixing Line Endings - patch the shell (kernel)
Select or Download Code
Re^5: (OT) Fixing Line Endings - patch the shell (kernel)
by Tanktalus (Canon) on Nov 30, 2006 at 18:38 UTC

    Just change that to:

    if (isspace(*cp)) *cp = '\0';
    Don't forget to #include <linux/ctype.h> up top, though, to get this macro...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://587019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2015-07-07 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls