Fossil SCM
For 'fossil diff', allow --context to be 0, per request in [forum:806f1296d8 | forum post 806f1296d8].
Commit
ea6f9a84aca1d1b0e7f4f0cb2788bde9e6daa7bcc30ae219126e4787db976ab8
Parent
dc0e0543569ce26…
1 file changed
+7
-3
+7
-3
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -3157,13 +3157,17 @@ | ||
| 3157 | 3157 | /* Undocumented and unsupported flags used for development |
| 3158 | 3158 | ** debugging and analysis: */ |
| 3159 | 3159 | if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG; |
| 3160 | 3160 | if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW; |
| 3161 | 3161 | } |
| 3162 | - if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){ | |
| 3163 | - pCfg->nContext = f; | |
| 3164 | - diffFlags |= DIFF_CONTEXT_EX; | |
| 3162 | + if( (z = find_option("context","c",1))!=0 ){ | |
| 3163 | + char *zEnd; | |
| 3164 | + f = (int)strtol(z, &zEnd, 10); | |
| 3165 | + if( zEnd[0]==0 && errno!=ERANGE ){ | |
| 3166 | + pCfg->nContext = f; | |
| 3167 | + diffFlags |= DIFF_CONTEXT_EX; | |
| 3168 | + } | |
| 3165 | 3169 | } |
| 3166 | 3170 | if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){ |
| 3167 | 3171 | pCfg->wColumn = f; |
| 3168 | 3172 | } |
| 3169 | 3173 | if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO; |
| 3170 | 3174 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -3157,13 +3157,17 @@ | |
| 3157 | /* Undocumented and unsupported flags used for development |
| 3158 | ** debugging and analysis: */ |
| 3159 | if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG; |
| 3160 | if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW; |
| 3161 | } |
| 3162 | if( (z = find_option("context","c",1))!=0 && (f = atoi(z))!=0 ){ |
| 3163 | pCfg->nContext = f; |
| 3164 | diffFlags |= DIFF_CONTEXT_EX; |
| 3165 | } |
| 3166 | if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){ |
| 3167 | pCfg->wColumn = f; |
| 3168 | } |
| 3169 | if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO; |
| 3170 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -3157,13 +3157,17 @@ | |
| 3157 | /* Undocumented and unsupported flags used for development |
| 3158 | ** debugging and analysis: */ |
| 3159 | if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG; |
| 3160 | if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW; |
| 3161 | } |
| 3162 | if( (z = find_option("context","c",1))!=0 ){ |
| 3163 | char *zEnd; |
| 3164 | f = (int)strtol(z, &zEnd, 10); |
| 3165 | if( zEnd[0]==0 && errno!=ERANGE ){ |
| 3166 | pCfg->nContext = f; |
| 3167 | diffFlags |= DIFF_CONTEXT_EX; |
| 3168 | } |
| 3169 | } |
| 3170 | if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){ |
| 3171 | pCfg->wColumn = f; |
| 3172 | } |
| 3173 | if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO; |
| 3174 |