2 * Session layer proxy for Citadel
3 * (c) 1998 by Art Cancro, All Rights Reserved, released under GNU GPL v2
7 * NOTE: this isn't finished, so don't use it!!
20 void logoff(int code) {
33 if (fgets(cmd, 256, stdin) == NULL) {
37 cmd[strlen(cmd)-1] = 0;
39 /* QUIT commands are handled specially */
40 if (!strncasecmp(cmd, "QUIT", 4)) {
42 printf("%d Proxy says: Bye!\n", OK);
47 /* Other commands, just pass through. */
55 /* Simple command-response... */
56 if ( (resp[0]=='2')||(resp[0]=='3')||(resp[0]=='5') ) {
59 /* Textual input... */
60 else if (resp[0] == '4') {
62 if (fgets(buf, 256, stdin) == NULL) {
65 buf[strlen(buf)-1] = 0;
67 } while (strcmp(buf, "000"));
70 /* Textual output... */
71 else if (resp[0] == '1') {
75 } while (strcmp(buf, "000"));
78 /* Binary output... */
79 else if (resp[0] == '6') {
80 bytes = atol(&resp[4]);
81 serv_read(buf, bytes);
82 fwrite(buf, bytes, 1, stdout);
87 else if (resp[0] == '7') {
88 bytes = atol(&resp[4]);
89 fread(buf, bytes, 1, stdin);
90 serv_write(buf, bytes);
94 else if (resp[0] == '8') {
98 fgets(buf, 256, stdin);
99 buf[strlen(buf)-1] = 0;
101 } while (strcmp(buf, "000"));
111 void main(int argc, char *argv[]) {
115 attach_to_server(argc, argv);
118 strcat(buf, " (VIA PROXY)");
121 if (buf[0] != '2') exit(0);