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!!
19 void logoff(int code) {
32 if (fgets(cmd, 256, stdin) == NULL) {
36 cmd[strlen(cmd)-1] = 0;
38 /* QUIT commands are handled specially */
39 if (!strncasecmp(cmd, "QUIT", 4)) {
41 printf("%d Proxy says: Bye!\n", OK);
46 /* Other commands, just pass through. */
52 /* Simple command-response... */
53 if ( (resp[0]=='2')||(resp[0]=='3')||(resp[0]=='5') ) {
56 /* Textual output... */
57 else if (resp[0] == '1') {
61 } while (strcmp(buf, "000"));
64 /* Textual input... */
65 else if (resp[0] == '1') {
67 fgets(buf, 256, stdin);
68 buf[strlen(buf)-1] = 0;
70 } while (strcmp(buf, "000"));
73 /* Binary output... */
74 else if (resp[0] == '6') {
75 bytes = atol(&resp[4]);
76 serv_read(buf, bytes);
77 fwrite(buf, bytes, 1, stdout);
81 else if (resp[0] == '7') {
82 bytes = atol(&resp[4]);
83 fread(buf, bytes, 1, stdin);
84 serv_write(buf, bytes);
88 else if (resp[0] == '8') {
91 fgets(buf, 256, stdin);
92 buf[strlen(buf)-1] = 0;
94 } while (strcmp(buf, "000"));
104 void main(int argc, char *argv[]) {
107 attach_to_server(argc, argv);
110 strcat(buf, " (VIA PROXY)");
113 if (buf[0] != '2') exit(0);