static int HelpAndExit(void) { p_stderr("Usage: gist [cgminput] [options] [page list]\n\n"); p_stderr(" options: -in cgminput (open cgminput for input)\n"); p_stderr(" -cgm cgmout (open cgmout for output)\n"); p_stderr(" -ps psout (open psout for output)\n"); p_stderr(" -display host:n.m (connect to X server)\n"); p_stderr(" -75 (default to 75 dpi)\n"); p_stderr(" -100 (default to 100 dpi)\n"); p_stderr(" -gks (default to 8x8 inches)\n"); p_stderr(" -geometry WxH (initial window size in pixels)\n"); p_stderr(" -nd (not even default X server)\n"); p_stderr(" -b (batch mode, implies -nd)\n"); p_stderr(" -x (graphics window only, no keyboard)\n"); p_stderr(" -nowarn (only one warning message printed)\n"); p_stderr(" -f (PostScript to stdout, implies -b)\n"); p_stderr(" -fmbug (if EPS files are for FrameMaker)\n"); p_stderr(" -bg0fg1 (force color 0 to bg, 1 to fg)\n"); p_stderr(" -esc0 (skip ^_! escapes-assumed if -gks)\n"); p_stderr(" -esc1 (handle ^_! text escapes-default)\n"); p_stderr(" page list: [page group] [page group] ...\n"); p_stderr(" page group: n (output page n)\n"); p_stderr(" page group: n-m (output pages n->m inclusive)\n"); p_stderr(" page group: n-m-s (output every s-th page, n-m)\n"); p_quit(); return 1; }
static int MessageAndExit(char *msg) { p_stderr("gist: "); p_stderr(msg); p_stderr("\ngist: try gist -help for usage\n"); p_quit(); return 1; }
int on_idle(void) { int flag; if (!did_startup && do_startup()) return 0; if (need_prompt && !x_only && !amBatch) p_stdout("gist> "); need_prompt = 0; flag = CatalogCGM(); if (!flag && amBatch) p_quit(); return flag; }
/* ARGSUSED */ static void HandleOther(Engine *engine, int k, int md) { XEngine *xEngine= GisXEngine(engine); int go, bad; if (!xEngine) return; go= bad= 0; if (k == '0') xPrefix= 10*xPrefix; else if (k == '1') xPrefix= 10*xPrefix+1; else if (k == '2') xPrefix= 10*xPrefix+2; else if (k == '3') xPrefix= 10*xPrefix+3; else if (k == '4') xPrefix= 10*xPrefix+4; else if (k == '5') xPrefix= 10*xPrefix+5; else if (k == '6') xPrefix= 10*xPrefix+6; else if (k == '7') xPrefix= 10*xPrefix+7; else if (k == '8') xPrefix= 10*xPrefix+8; else if (k == '9') xPrefix= 10*xPrefix+9; else if (k=='f' || k=='F' || (k=='+' && (md&P_KEYPAD))) go= 1; else if (k=='b' || k=='B' || (k=='-' && (md&P_KEYPAD))) go= 2; else if (k=='g' || k=='G' || k=='\r') go= 3; else if (k=='s' || k=='S' || (k=='=' && (md&P_KEYPAD))) go= 4; else if (k=='q' || k=='Q') go= 5; else bad= 1; if ((go==4||go==5) && xPrefix!=0) bad= 1; if (go && !bad) { if (go<4) { if (xPrefix==0) xPrefix= 1; DoSpecial(xPrefix, cSuffices[go-1]); } else if (go==4) { int i, n= 0; for (i=0 ; i<8 ; i++) { if (!outSend[i]) GpDeactivate(outEngines[i]); if (outSend[i] && !GpActivate(outEngines[i])) n++; } nPage[0]= mPage[0]= CGMRelative(0); sPage[0]= 1; nPageGroups= 1; if (n) ReadCGM(mPage, nPage, sPage, nPageGroups); else Warning("no devices active for send command", ""); } else if (go==5) { p_quit(); } xPrefix= 0; warningCount= 0; } else if (bad) { p_feep(xEngine->win); xPrefix= 0; } }
void on_stdin(char *lin) { int cmd; line[0] = '\0'; strncat(line, lin, 255); cmd= GetCommand(strtok(line, " \t\n")); warningCount= xPrefix= 0; if (cmd>=0 && CommandList[cmd](0)) p_quit(); need_prompt = 1; }
void parse_server(char *line) { char *from, *comm, *end; int numeric; char **ArgList; char copy[BIG_BUFFER_SIZE + 1]; char *TrueArgs[MAXPARA + 1] = { NULL }; if (!line || !*line) return; TRACE("srv: %s\n", line); end = strlen(line) + line; if (*--end == '\n') *end-- = '\0'; if (*end == '\r') *end-- = '\0'; if (!line || !*line) return; if (*line == ':') { if (!do_hook(RAW_IRC_LIST, "%s", line + 1)) return; } else if (!do_hook(RAW_IRC_LIST, "* %s", line)) return; ArgList = TrueArgs; strncpy(copy, line, BIG_BUFFER_SIZE); FixColorAnsi(line); BreakArgs(line, &from, ArgList, 0); if (!(comm = (*ArgList++)) || !from || !*ArgList) return; /* Empty line from server - ByeBye */ /* * I reformatted these in may '96 by using the output of /stats m * from a few busy servers. They are arranged so that the most * common types are high on the list (to save the average number * of compares.) I will be doing more testing in the future on * a live client to see if this is a reasonable order. */ if ((numeric = atoi(comm))) numbered_command(from, numeric, ArgList); /* There are the core msgs for most non-numeric traffic. */ else if (!strcmp(comm, "PRIVMSG")) p_privmsg(from, ArgList); else if (!strcmp(comm, "JOIN")) p_channel(from, ArgList); else if (!strcmp(comm, "PART")) p_part(from, ArgList); else if (!strcmp(comm, "MODE")) p_mode(from, ArgList); else if (!strcmp(comm, "QUIT")) p_quit(from, ArgList); else if (!strcmp(comm, "NOTICE")) parse_notice(from, ArgList); else if (!strcmp(comm, "NICK")) p_nick(from, ArgList); else if (!strcmp(comm, "TOPIC")) p_topic(from, ArgList); else if (!strcmp(comm, "KICK")) p_kick(from, ArgList); else if (!strcmp(comm, "INVITE")) p_invite(from, ArgList); /* These are used, but not nearly as much as ones above */ else if (!strcmp(comm, "WALLOPS")) p_wallops(from, ArgList); else if (!strcmp(comm, "ERROR")) p_error(from, ArgList); else if (!strcmp(comm, "ERROR:")) p_error(from, ArgList); else if (!strcmp(comm, "SILENCE")) p_silence(from, ArgList); else if (!strcmp(comm, "KILL")) p_kill(from, ArgList); else if (!strcmp(comm, "PONG")) p_pong(from, ArgList); else if (!strcmp(comm, "PING")) p_ping(ArgList); /* Some kind of unrecognized/unsupported command */ else p_odd(from, comm, ArgList); from_server = -1; }