Skip to content

Commit

Permalink
support for specific querying
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 21, 2023
1 parent 66c213a commit 039437c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func main() {
log.Fatalf("Error: %s", err)
}
}
if opts.ListQueryMatches {
_, err := assembuddy.QueryInfo(opts.Arch)
if opts.Arch != "" && opts.Syscall != "" {
_, err := assembuddy.GetSyscallData(opts.Arch, opts.Syscall, opts.PrettyPrint)
if err != nil {
log.Fatalf("Error: %s", err)
}
Expand Down
13 changes: 1 addition & 12 deletions pkg/assembuddy/requestTable.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func GetSyscallData(arch string, name string, prettyp bool) ([]Syscall, error) {
url := "https://api.syscall.sh/v1/syscalls/"
// if arch is x64, x86, arm, or arm64, concat to endpointURL
if arch == "x64" || arch == "x86" || arch == "arm" || arch == "arm64" {
url += arch
url += arch + "/"
// if arch is not empty, return error
} else if arch != "" {
return nil, errors.New("invalid architecture")
Expand All @@ -65,14 +65,3 @@ func ArchInfo() ([]Syscall, error) {
url := "https://api.syscall.sh/v1/conventions"
return fetchData(url, true)
}

func QueryInfo(arch string) ([]Syscall, error) {
url := "https://api.syscall.sh/v1/syscalls/"
if arch == "x64" || arch == "x86" || arch == "arm" || arch == "arm64" {
url += arch
} else if arch != "" {
return nil, errors.New("invalid architecture")
}
return fetchData(url, true)
// TODO:
}

0 comments on commit 039437c

Please sign in to comment.