Skip to content

Commit

Permalink
open() fuct to int
Browse files Browse the repository at this point in the history
  • Loading branch information
abranhe committed Jan 23, 2019
1 parent 7a430f5 commit 36e1155
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License 2019
MIT License

Copyright (c) Abraham Hernandez <abraham@abranhe.com> (abranhe.com)

Expand Down
11 changes: 6 additions & 5 deletions open.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ create_cmd(const char * cmd, const char * link) {
return url;
}

void
open(const char * url) {
int
open(const char *url) {

const char * platform = operating_system();
const char * cmd = NULL;
const char *platform = operating_system();
const char *cmd = NULL;

// Hanlde macOS
if (!strcmp(platform, "macOS")) {
Expand All @@ -42,8 +42,9 @@ open(const char * url) {
cmd = "xdg-open";
}

char * script = create_cmd(cmd, url);
char *script = create_cmd(cmd, url);

system(script);
free(script);
return 0;
}
2 changes: 1 addition & 1 deletion open.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
extern "C" {
#endif

void open(const char * url);
int open(const char *url);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ $ make run-example

## API

#### `void open(char * url);`
#### `int open(const char *link);`

*Open a URL on the default browser.*

###### Params:

- `url`: The url you whish to be opened
- `link`: The url you whish to be opened

## Related

Expand Down

0 comments on commit 36e1155

Please sign in to comment.