Skip to content

Commit

Permalink
Merge pull request #11 from libdriver/dev
Browse files Browse the repository at this point in the history
fix: fix getopt errors
  • Loading branch information
libdriver authored Jan 5, 2025
2 parents 2c70495 + 580da37 commit 7141c49
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 39 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 1.0.4 (2025-01-05)

## Bug Fixes

- fix getopt errors

## 1.0.3 (2025-01-01)

## Bug Fixes
Expand Down
12 changes: 4 additions & 8 deletions project/stm32f407/MDK/stm32f407.uvprojx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<TargetName>stm32f407</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>6140000::V6.14::ARMCLANG</pCCUsed>
<pCCUsed>6220000::V6.22::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F407ZGTx</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F4xx_DFP.2.14.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<PackID>Keil.STM32F4xx_DFP.3.0.0</PackID>
<PackURL>https://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00020000) IRAM2(0x10000000,0x00010000) IROM(0x08000000,0x00100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
Expand Down Expand Up @@ -186,6 +186,7 @@
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>1</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
Expand Down Expand Up @@ -959,11 +960,6 @@
<Layers>
<Layer>
<LayName>&lt;Project Info&gt;</LayName>
<LayDesc></LayDesc>
<LayUrl></LayUrl>
<LayKeys></LayKeys>
<LayCat></LayCat>
<LayLic></LayLic>
<LayTarg>0</LayTarg>
<LayPrjMark>1</LayPrjMark>
</Layer>
Expand Down
52 changes: 21 additions & 31 deletions project/stm32f407/usr/src/getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,15 @@ static char *my_index (const char *str, int chr);
extern char *getenv ();
#endif

static int
my_strlen (str)
const char *str;
static int my_strlen(const char *str)
{
int n = 0;
while (*str++)
n++;
return n;
}

static char *
my_index (str, chr)
const char *str;
int chr;
static char *my_index(const char *str, int chr)
{
while (*str)
{
Expand Down Expand Up @@ -234,12 +229,10 @@ static int last_nonopt;
*/

#if __STDC__ || defined(PROTO)
static void exchange (char **argv);
static void exchange(char **argv);
#endif

static void
exchange (argv)
char **argv;
static void exchange(char **argv)
{
char *temp, **first, **last;

Expand Down Expand Up @@ -322,14 +315,13 @@ exchange (argv)
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */

int
_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
int argc;
char *const *argv;
const char *optstring;
const struct option *longopts;
int *longind;
int long_only;
int _getopt_internal(int argc,
char *const *argv,
const char *optstring,
const struct option *longopts,
int *longind,
int long_only
)
{
int option_index;

Expand Down Expand Up @@ -656,25 +648,23 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
}
}

int
getopt (argc, argv, optstring)
int argc;
char *const *argv;
const char *optstring;
int getopt(int argc,
char *const *argv,
const char *optstring
)
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}

int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
int getopt_long(int argc,
char *const *argv,
const char *options,
const struct option *long_options,
int *opt_index
)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
Expand Down

0 comments on commit 7141c49

Please sign in to comment.