getopt_long.patch
application/octet-stream
Filename: getopt_long.patch
Type: application/octet-stream
Part: 2
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/port/getopt_long.c | 0 | 0 |
diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c
new file mode 100644
index d624216..5076bbe
*** a/src/port/getopt_long.c
--- b/src/port/getopt_long.c
*************** getopt_long(int argc, char *const argv[]
*** 60,67 ****
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
!
! if (!*place)
{ /* update scanning pointer */
if (optind >= argc)
{
--- 60,71 ----
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
! if (place[0] == '-') /*Check if current argument is another option to be processed instead of path of file for -f */
! {
! place++;
! optopt = (int) *place++;
! }
! if (!*place && (optopt != 'f'))//introduced extra check so that if next argument received is 2nd file for -f it doesn't exit.
{ /* update scanning pointer */
if (optind >= argc)
{
*************** getopt_long(int argc, char *const argv[]
*** 157,162 ****
--- 161,168 ----
}
}
+ if ((optopt != 'f'))
+ {
/* short option */
optopt = (int) *place++;
*************** getopt_long(int argc, char *const argv[]
*** 198,202 ****
--- 204,217 ----
place = EMSG;
++optind;
}
+ }
+ else//to update the list of files to be read
+ {
+ optarg = argv[optind];
+ place = EMSG;
+ ++optind;
+ place = argv[optind];
+
+ }
return optopt;
}