]> git.mdlowis.com Git - projs/tide.git/commitdiff
added flag for specifying line number
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 9 Oct 2018 01:02:49 +0000 (21:02 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 9 Oct 2018 01:02:49 +0000 (21:02 -0400)
tide.c

diff --git a/tide.c b/tide.c
index 092af286bd6c8e850bec5dabc85c2e9914a31434..b6721ec75cb28a9d794b04b90f51659350ff6438 100644 (file)
--- a/tide.c
+++ b/tide.c
@@ -472,8 +472,10 @@ static void usage(void) {
 
 #ifndef TEST
 int main(int argc, char** argv) {
+    long int line_num = 0;
     #define BOOLARG() (EOPTARG(usage()), optarg_[0] == '0' ? 0 : 1)
     #define STRARG()  (EOPTARG(usage()))
+    #define NUMARG()  (strtoul(EOPTARG(usage()),0,0))
     OPTBEGIN {
         case 'I': CopyIndent  = BOOLARG(); break;
         case 'W': TrimOnSave  = BOOLARG(); break;
@@ -481,6 +483,7 @@ int main(int argc, char** argv) {
         case 'N': DosLineFeed = BOOLARG(); break;
         case 'T': TagString   = STRARG();  break;
         case 'C': ShellCmd[0] = STRARG();  break;
+        case 'l': line_num    = NUMARG();  break;
     } OPTEND;
 
     /* setup the shell */
@@ -495,6 +498,7 @@ int main(int argc, char** argv) {
         char* path = realpath(*argv, NULL);
         if (!path) path = *argv; /* if file doesnt exist, use the original name */
         view_init(win_view(EDIT), path);
+        view_setln(win_view(EDIT), line_num);
         win_title(path);
         win_prop_set("TIDE_FILE", "file", path);
     } else {