/[qemacs]/qemacs/latex-mode.c
ViewVC logotype

Diff of /qemacs/latex-mode.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by chqrlie, Sun May 8 16:37:42 2005 UTC revision 1.8 by chqrlie, Mon May 9 05:58:47 2005 UTC
# Line 270  static void latex_cmd_run(void *opaque, Line 270  static void latex_cmd_run(void *opaque,
270    
271  static void do_latex(EditState *e, const char *cmd)  static void do_latex(EditState *e, const char *cmd)
272  {  {
273        char bname[MAX_FILENAME_SIZE];
274      char buf[1024];      char buf[1024];
275      int i;      int i, len;
     char *p, *f;  
     char *bname;  
276    
277      /* strip extension from filename, find the last dot after the last      /* strip extension from filename */
278       * slash (ie, the last dot in the filename)      pstrcpy(bname, sizeof(bname), e->b->filename);
279       */      len = extension(bname) - bname;
280      /* CG: should use extension(), also should ignore leading dots */      bname[len] = '\0';
     f = strrchr(e->b->filename, '/');  
     if (f)  
         f++;  
     else  
         f = e->b->filename;  
     p = strrchr(f, '.');  
     if (p) {  
         int len = p - e->b->filename;  
         bname = (char *)malloc(len + 1);  
         pstrncpy(bname, len + 1, e->b->filename, len);  
     } else {  
         bname = strdup(e->b->filename);  
     }  
281    
282      if (!cmd || cmd[0] == '\0')      if (!cmd || cmd[0] == '\0')
283          strcpy(buf, "LaTeX");          cmd = "LaTeX";
     else  
         strcpy(buf, cmd);  
284    
285      /* check what command to run */      /* check what command to run */
286      for (i = 0; latex_funcs[i].name; i++) {      for (i = 0; latex_funcs[i].name; i++) {
287          if (strcasecmp(buf, latex_funcs[i].name) == 0) {          if (strcasecmp(cmd, latex_funcs[i].name) == 0) {
288              /* pass the EditState through to latex_cmd_run() */              /* pass the EditState through to latex_cmd_run() */
289              latex_funcs[i].es = e;              latex_funcs[i].es = e;
290              /* construct the command line to run */              /* construct the command line to run */
# Line 315  static void do_latex(EditState *e, const Line 299  static void do_latex(EditState *e, const
299              } else {              } else {
300                  latex_cmd_run((void *)&latex_funcs[i], buf);                  latex_cmd_run((void *)&latex_funcs[i], buf);
301              }              }
302              break;              return;
303          }          }
304      }      }
305      if (latex_funcs[i].name == 0)      put_status(e, "%s: No match", buf);
         put_status(e, "%s: No match", buf);  
     free(bname);  
306  }  }
307    
308  /* specific LaTeX commands */  /* specific LaTeX commands */

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26