gaudreau@juggler.East.Sun.COM (Joe Gaudreau (Spaced for Rent)) (03/06/91)
/*
cc -g -o weird weird.c
*/
main(argc, argv)
int argc;
char **argv;
{
int n;
char *p, *x;
for (x = *argv; *argv; argv++) {
for (p = *argv; *p; p++) {
*p = ' ';
}
}
strcpy(x, "x");
while (1);
} /*weird*/
Hack on dudes,
Joe
-=-qpliu@PHOENIX.PRINCETON.EDU (q.p.liu) (03/07/91)
In article <4669@eastapps.East.Sun.COM> gaudreau@juggler.East.Sun.COM (Joe Gaudreau (Spaced for Rent)) writes: > for (x = *argv; *argv; argv++) { > for (p = *argv; *p; p++) { > *p = ' '; > } > } > strcpy(x, "x"); Already done by [t]csh: [2 lyman:11:33:12] csh lyman% ps PID TT STAT TIME COMMAND 15926 p0 S 0:00 /usr/gnu/bin/bash -i 15930 p0 S 0:00 -sh (csh) 15931 p0 R 0:00 ps 15855 q7 I 0:01 -bash (bash) 15890 q7 S 0:27 emacs -f vm lyman% [2 lyman:11:33:56]
brendan@CS.WIDENER.EDU (Brendan Kehoe) (03/07/91)
In <QPLIU.91Mar6113841@lyman.phoenix.princeton.edu>, q.p.liu wrote: > Already done by [t]csh: > > [2 lyman:11:33:12] csh > lyman% ps > PID TT STAT TIME COMMAND > 15926 p0 S 0:00 /usr/gnu/bin/bash -i > 15930 p0 S 0:00 -sh (csh) > 15931 p0 R 0:00 ps > 15855 q7 I 0:01 -bash (bash) > 15890 q7 S 0:27 emacs -f vm > lyman% [2 lyman:11:33:56] Bzz .. check out ps -x. I think sps includes a program called argv0 that does what Joe's program did. ObHack: installed a DecStation 2100 & for some reason setld was dying when trying to load the mandatory subsets. Turns out install.tmp/whoami was core dumping. The fix? Replaced it with a shell script that just did "echo root". -- Brendan Kehoe - Widener Sun Network Manager - brendan@cs.widener.edu Widener University in Chester, PA A Bloody Sun-Dec War Zone -- Brendan Kehoe - Widener Sun Network Manager - brendan@cs.widener.edu Widener University in Chester, PA A Bloody Sun-Dec War Zone
estdwha@warwick.ac.uk (CrisP) (03/07/91)
In article <4669@eastapps.East.Sun.COM> gaudreau@juggler.East.Sun.COM (Joe Gaudreau (Spaced for Rent)) writes: >/* >cc -g -o weird weird.c >*/ > >main(argc, argv) >int argc; >char **argv; >{ > int n; > char *p, *x; > > for (x = *argv; *argv; argv++) { > for (p = *argv; *p; p++) { ^^^^ Shouldn't this be x? > *p = ' '; > } > } > strcpy(x, "x"); > > while (1); > >} /*weird*/ > > >Hack on dudes, > >Joe >-=- -- -------------------------------------------------------------------- crisp@uk.ac.warwick.cs | I didn't do it. Nobody saw me do it. estdwha@uk.ac.warwick.cu | You can't prove anything. - Bart Simpson. --------------------------------------------------------------------
gill@boris.mscs.mu.edu (Vijay (Ender) Gill) (03/07/91)
In article <K3C&ZQ*@warwick.ac.uk> estdwha@warwick.ac.uk (CrisP) writes: [---deleted---] >> for (x = *argv; *argv; argv++) { >> for (p = *argv; *p; p++) { > ^^^^ >Shouldn't this be x? > [---deleted---] >> strcpy(x, "x"); ^^^^^^^^ --- This here is the key line. x is used as a placeholder, because argv is incremented, at the start, x --> argv[0]; >-------------------------------------------------------------------- >crisp@uk.ac.warwick.cs | I didn't do it. Nobody saw me do it. >estdwha@uk.ac.warwick.cu | You can't prove anything. - Bart Simpson. >-------------------------------------------------------------------- cheers -dicky gill (Violator) -gill@boris.mscs.mu.edu