comparison lib-src/gnuclient.c @ 4684:15c42a3f4065

Do not move cursor position in gnuclient started buffer if user did not requested..
author It's me FKtPp \;) <m_pupil@yahoo.com.cn>
date Sat, 29 Aug 2009 22:37:50 +0800
parents 2161ac78b41e
children aa5ed11f473b
comparison
equal deleted inserted replaced
4683:0cc9d22c3732 4684:15c42a3f4065
297 } 297 }
298 298
299 int 299 int
300 main (int argc, char *argv[]) 300 main (int argc, char *argv[])
301 { 301 {
302 int starting_line = 1; /* line to start editing at */ 302 int starting_line = 0; /* line to start editing at */
303 char command[QXE_PATH_MAX+50];/* emacs command buffer */ 303 char command[QXE_PATH_MAX+50];/* emacs command buffer */
304 char fullpath[QXE_PATH_MAX+1];/* full pathname to file */ 304 char fullpath[QXE_PATH_MAX+1];/* full pathname to file */
305 char *eval_form = NULL; /* form to evaluate with `-eval' */ 305 char *eval_form = NULL; /* form to evaluate with `-eval' */
306 char *eval_function = NULL; /* function to evaluate with `-f' */ 306 char *eval_function = NULL; /* function to evaluate with `-f' */
307 char *load_library = NULL; /* library to load */ 307 char *load_library = NULL; /* library to load */
659 659
660 for (; argv[i]; i++) 660 for (; argv[i]; i++)
661 { 661 {
662 if (i < argc - 1 && *argv[i] == '+') 662 if (i < argc - 1 && *argv[i] == '+')
663 starting_line = atoi (argv[i++]); 663 starting_line = atoi (argv[i++]);
664 else 664
665 starting_line = 1;
666 /* If the last argument is +something, treat it as a file. */ 665 /* If the last argument is +something, treat it as a file. */
667 if (i == argc) 666 if (i == argc) --i;
668 { 667
669 starting_line = 1;
670 --i;
671 }
672 filename_expand (fullpath, argv[i]); 668 filename_expand (fullpath, argv[i]);
673 #ifdef INTERNET_DOMAIN_SOCKETS 669 #ifdef INTERNET_DOMAIN_SOCKETS
674 path = (char *) malloc (strlen (remotepath) + strlen (fullpath) + 1); 670 path = (char *) malloc (strlen (remotepath) + strlen (fullpath) + 1);
675 sprintf (path, "%s%s", remotepath, fullpath); 671 sprintf (path, "%s%s", remotepath, fullpath);
676 #else 672 #else
677 path = my_strdup (fullpath); 673 path = my_strdup (fullpath);
678 #endif 674 #endif
679 sprintf (command, "(%d . %s)", starting_line, clean_string (path)); 675 if ( starting_line ) {
676 sprintf (command, "(%d . %s)", starting_line, clean_string (path));
677 } else {
678 sprintf (command, "(nil . %s)", clean_string (path));
679 }
680
680 send_string (s, command); 681 send_string (s, command);
681 free (path); 682 free (path);
682 } /* for */ 683 } /* for */
683 684
684 sprintf (command, ")%s%s", 685 sprintf (command, ")%s%s",