Randy said:
Eric said:
TTroy wrote:
Jimmy Cracker wrote:
Is it completely impossible in UNIX to push an environment
variable to the parent shell? I would like to do something
like this: [...]
Watch out, you're going to get it from clc's wannabe enforcer
Keith Thompson.
No, no: My turn! Let me! Meee!
A quick quiz for Jimmy C.: What is the output of the
following program?
... snip code ...
Answer and advice, all in one neat little package.
I have taken the liberty of reformatting your package:
#define O00 static
#define O0O void
#define O0o test
#define OO0 const
#define OOO char
#define OOo printf
#define Oo0 strcmp
#define OoO int
#define Ooo main
#define o00 return
#include <stdio.h>
#include <string.h>
O00 O0O O0o(OO0 OOO *p, OO0 OOO *q) { OOo ("%s %c= %s\n", p,
Oo0(p, q) ? '!' : '=', q); } OoO Ooo(O0O) { O0o ("C", "UNIX");
O0o ("comp.lang.c", "comp.unix.programmer"); OOo ("Off-topic: ");
O0o ("What you ask", "possible"); o00 0; }
(my id2id package comes in handy here)
I wonder if gnu indent will support this...
indent -falconer foo.c
works fine (v2.2.9):
[1] c:\c\ohohohs>indent -st ohohoh.c
#define O00 static
#define O0O void
#define O0o test
#define OO0 const
#define OOO char
#define OOo printf
#define Oo0 strcmp
#define OoO int
#define Ooo main
#define o00 return
#include <stdio.h>
#include <string.h>
O00 O0O
O0o(OO0 OOO * p, OO0 OOO * q)
{
OOo("%s %c= %s\n", p, Oo0(p, q) ? '!' : '=', q);
}
OoO
Ooo(O0O)
{
O0o("C", "UNIX");
O0o("comp.lang.c", "comp.unix.programmer");
OOo("Off-topic: ");
O0o("What you ask", "possible");
o00 0;
}
In fact, with the file idpairs (related to the #defines) around:
[1] c:\c\ohohohs>type idpairs
O00 static
O0O void
O0o test
OO0 const
OOO char
OOo printf
Oo0 strcmp
OoO int
Ooo main
o00 return
you can do a complete conversion in one line:
[1] c:\c\ohohohs>indent -st ohohoh.c | id2id
#define static static
#define void void
#define test test
#define const const
#define char char
#define printf printf
#define strcmp strcmp
#define int int
#define main main
#define return return
#include <stdio.h>
#include <string.h>
static void
test(const char * p, const char * q)
{
printf("%s %c= %s\n", p, strcmp(p, q) ? '!' : '=', q);
}
int
main(void)
{
test("C", "UNIX");
test("comp.lang.c", "comp.unix.programmer");
printf("Off-topic: ");
test("What you ask", "possible");
return 0;
}
which is much easier than the gyrations I had to go through to make
it in the first place.