Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Error #1

Open
Michael-Bell opened this issue Oct 17, 2017 · 4 comments
Open

Syntax Error #1

Michael-Bell opened this issue Oct 17, 2017 · 4 comments

Comments

@Michael-Bell
Copy link

Get this error

./gpioIrq: line 1: syntax error: unexpected "("

Have tried compiling on/off device. Same result

@greenbreakfast
Copy link
Contributor

Can you share the command you used to compile this? Was it compiled on the Omega or cross-compiled with the LEDE Build System?

@Michael-Bell
Copy link
Author

Setup build environment (cross compile and on Omega) per instructions on the website.

git clone https://github.com/OnionIoT/gpioIrq/

cd gpioIrq

make

chmod +x gpioIrq

./gpioIrq 05

syntax error

@LocutusOfBorg
Copy link

@Michael-Bell @greenbreakfast
Having a quick look at the command invocation, and at the main c function, I can see that atoi("05") is returning just 5.

So the code

cat main.c 
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char** argv)
{
	unsigned int gpio=atoi(argv[1]);
        int fd, len;
        char buf[100];

        len = snprintf(buf, sizeof(buf), "/gpio%d/direction", gpio);

	printf("Value is: %s\n", buf);
        return 0;
}

will run as:

gcc main.c -o main && ./a.out 05
Value is: /gpio5/direction

LocutusOfBorg added a commit to LocutusOfBorg/gpioIrq that referenced this issue Nov 12, 2019
…r and back into a string, to avoid stripping initial zeros

This addresses issue: OnionIoT#1
@LocutusOfBorg
Copy link

this should be addressed in #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants