⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parse.c

📁 Linux下的MUD客户端程序
💻 C
📖 第 1 页 / 共 2 页
字号:
/*  read_complete();  */  else if(is_abrev(command, "return"))    return_command(ses);  else if(is_abrev(command, "read"))    ses=read_command(arg, ses);  else if(is_abrev(command, "savepath"))    savepath_command(arg, ses);  else if(is_abrev(command, "session"))    ses=session_command(arg, ses);  else if(is_abrev(command, "showme"))    showme_command(arg,ses);      else if(is_abrev(command, "snoop"))    snoop_command(arg, ses);  else if(is_abrev(command, "speedwalk"))    speedwalk_command(ses);  else if(is_abrev(command, "split"))    split_command(arg, ses);  else if(is_abrev(command, "statusline"))    statusline_command(arg, ses);  /* CHANGED to allow suspending from within tintin. */  /* I know, I know, this is a hack *yawn* */  else if(is_abrev(command, "suspend"))    tstphandler(SIGTSTP,0,NULL,NULL);   /* changed for readline support */  else if(is_abrev(command, "tablist"))    rltab_list();/*  tablist(complete_head);  */  /* changed for readline support */  else if(is_abrev(command, "tabadd"))    do_tabadd(arg);/*  tab_add(arg);  */  /* changed for readline support */  else if(is_abrev(command, "tabdelete"))    do_tabdel(arg);/*  tab_delete(arg);  */  /* new with readline */  else if (is_abrev(command, "tabsave"))    do_tabsave();  else if(is_abrev(command, "textin"))    read_file(arg, ses);    else if(is_abrev(command, "unsplit"))    unsplit_command();    else if(is_abrev(command, "substitute"))    parse_sub(arg, ses);  else if(is_abrev(command, "gag")) {    if (*arg!='{') {      strcpy(command,arg);      strcpy(arg,"{");      strcat(arg,command);      strcat(arg,"} ");    }    strcat(arg, " .");    parse_sub(arg,ses);  }    else if(is_abrev(command, "getitemnr"))    getitemnr_command(arg, ses);  else if(is_abrev(command, "getlistlength"))    getlistlength_command(arg, ses);  else if(is_abrev(command, system_com))    system_command(arg, ses);  else if(is_abrev(command, "tick"))     tick_command(ses);  else if(is_abrev(command, "tickoff"))     tickoff_command(ses);  else if(is_abrev(command, "tickon"))     tickon_command(ses);  else if(is_abrev(command, "tickset"))    tickset_command(ses);  else if(is_abrev(command, "ticksize"))     ticksize_command(arg, ses);  else if (is_abrev(command, "tolower"))    tolower_command(arg, ses);  else if(is_abrev(command, "togglesubs"))    togglesubs_command(ses);  else if (is_abrev(command, "toupper"))    toupper_command(arg, ses);  else if(is_abrev(command, "unaction"))    unaction_command(arg, ses);  else if(is_abrev(command, "unalias"))    unalias_command(arg, ses);  else if(is_abrev(command, "unantisubstitute"))    unantisubstitute_command(arg,ses);      else if(is_abrev(command, "unhighlight"))    unhighlight_command(arg,ses);    else if(is_abrev(command, "unsubstitute"))    unsubstitute_command(arg, ses);  else if(is_abrev(command, "ungag"))    unsubstitute_command(arg,ses);  else if(is_abrev(command, "unpath"))     unpath_command(ses);  else if(is_abrev(command, "variable"))    var_command(arg,ses);  else if(is_abrev(command, "version"))    version_command();  else if(is_abrev(command, "unvariable"))    unvar_command(arg,ses);  else if(is_abrev(command, "wizlist"))     wizlist_command(ses);  else if(is_abrev(command, "write"))    ses=write_command(arg, ses);  else if(is_abrev(command, "writesession"))    ses=writesession_command(arg, ses);  else if(is_abrev(command, "zap"))    ses=zap_command(ses);  else {    tintin_puts("#UNKNOWN TINTIN-COMMAND.", ses);    prompt(NULL);  }  return(ses);}/**********************************************//* get all arguments - don't remove "s and \s *//**********************************************/char *get_arg_all(s, arg)     char *s;     char *arg;{  /* int inside=FALSE; */  int nest=0;  s=space_out(s);  while(*s) {    if(*s=='\\') {      *arg++=*s++;      if(*s)	*arg++=*s++;    }    else if(*s==';' && nest<1) {	break;    }    else if(*s==DEFAULT_OPEN) {      nest++;      *arg++=*s++;    }    else if(*s==DEFAULT_CLOSE) {      nest--;      *arg++=*s++;    }    else      *arg++=*s++;  }  *arg='\0';  return s;}/**************************************//* get all arguments - remove "s etc. *//* Example:                           *//* In: "this is it" way way hmmm;     *//* Out: this is it way way hmmm       */ /**************************************/char *get_arg_with_spaces(s, arg)     char *s;     char *arg;{  int nest=0;  /* int inside=FALSE; */  s=space_out(s);  while(*s) {    if(*s=='\\') {      if(*++s)	*arg++=*s++;    }    else if(*s==';' && nest==0) {	break;    }    else if(*s==DEFAULT_OPEN) {      nest++;      *arg++=*s++;    }    else if(*s==DEFAULT_CLOSE) {      *arg++=*s++;      nest--;    }    else      *arg++=*s++;  }*arg='\0'; return s;}/********************//* my own routine   *//********************/char *get_arg_in_braces(s, arg, flag)     char *s;     char *arg;     int flag;{   int nest=0;   char *ptr;   s=space_out(s);   ptr=s;   if (*s!=DEFAULT_OPEN) {     if (flag==0)        s=get_arg_stop_spaces(ptr,arg);     else       s=get_arg_with_spaces(ptr,arg);     return s;   }   s++;     while(*s!='\0' && !(*s==DEFAULT_CLOSE && nest==0)) {       if(*s==DEFAULT_OPEN) {         nest++;       }            else if(*s==DEFAULT_CLOSE) {         nest--;       }        *arg++=*s++;     }   if (!*s)     tintin_puts2("#Unmatched braces error!", (struct session *)NULL);   else     s++;   *arg='\0';   return s;   }/**********************************************//* get one arg, stop at spaces                *//* remove quotes                              *//**********************************************/char *get_arg_stop_spaces(s, arg)     char *s;     char *arg;{  int inside=FALSE;  s=space_out(s);    while(*s) {    if(*s=='\\') {      if(*++s)	*arg++=*s++;    }    else if(*s=='"') {      s++;      inside=!inside;    }    else if(*s==';') {      if(inside)	*arg++=*s++;      else	break;    }    else if(!inside && *s==' ')      break;    else      *arg++=*s++;  }  *arg='\0';  return s;}/*********************************************//* spaceout - advance ptr to next none-space *//* return: ptr to the first none-space       *//*********************************************/ char *space_out(s)     char *s;{  while(isspace(*s))    s++;  return s;}/************************************//* send command+argument to the mud *//************************************/void write_com_arg_mud(command, argument, ses)     char *command;     char *argument;     struct session *ses;{  char outtext[BUFFER_SIZE];  int i;  if(!ses) {    char buf[100];    sprintf(buf, "#NO SESSION ACTIVE. USE THE %cSESSION-COMMAND TO START ONE.", tintin_char);    tintin_puts(buf, ses);    prompt(NULL);  }  else {    check_insert_path(command, ses);    strncpy(outtext, command, BUFFER_SIZE);    if(*argument) {      strncat(outtext, " ", BUFFER_SIZE-strlen(command)-1);       strncat(outtext, argument, BUFFER_SIZE-strlen(command)-2);    }    write_line_mud(outtext, ses);    outtext[i=strlen(outtext)]='\n';    if(ses->logfile)      fwrite(outtext, i+1, 1, ses->logfile);  }}/***************************************************************//* show a prompt - mud prompt if we're connected/else just a > *//***************************************************************/void prompt(ses)     struct session *ses;{  char strng[80];  return; /* for readline -- please god, no pseudo prompting... <beg> *//*  if (ses && !PSEUDO_PROMPT)    write_line_mud("", ses);  else if (!is_split)    write(1,"> ", 3);  else {    sprintf(strng,"8> 7[%d;%df", input_row, input_col);    write(1,strng, strlen(strng)+1);    display_col+=2;  } */}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -