mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 10:50:28 +00:00
Move curl
from the examples/
folder to tool/net/
, and make it available in cocmd
.
You can now use include it conveniently for use with popen()/system() with STATIC_YOINK("_curl")
This commit is contained in:
parent
dd04aeba1c
commit
aa4a1a4618
5 changed files with 20 additions and 4 deletions
|
@ -38,6 +38,7 @@
|
|||
#include "third_party/awk/cmd.h"
|
||||
#include "third_party/sed/cmd.h"
|
||||
#include "third_party/tr/cmd.h"
|
||||
#include "tool/net/curl.h"
|
||||
|
||||
/**
|
||||
* @fileoverview Cosmopolitan Command Interpreter
|
||||
|
@ -417,6 +418,7 @@ static int TryBuiltin(void) {
|
|||
if (_weaken(_tr) && !strcmp(args[0], "tr")) return Fake(_weaken(_tr));
|
||||
if (_weaken(_sed) && !strcmp(args[0], "sed")) return Fake(_weaken(_sed));
|
||||
if (_weaken(_awk) && !strcmp(args[0], "awk")) return Fake(_weaken(_awk));
|
||||
if (_weaken(_curl) && !strcmp(args[0], "curl")) return Fake(_weaken(_curl));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
5
tool/net/curl.c
Normal file
5
tool/net/curl.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "curl.inc"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
return _curl(argc, argv);
|
||||
}
|
10
tool/net/curl.h
Normal file
10
tool/net/curl.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef COSMOPOLITAN_TOOL_NET_CURL_CMD_H_
|
||||
#define COSMOPOLITAN_TOOL_NET_CURL_CMD_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
int _curl(int, char *[]);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_TOOL_NET_CURL_CMD_H_ */
|
|
@ -52,12 +52,10 @@
|
|||
#include "third_party/mbedtls/pk.h"
|
||||
#include "third_party/mbedtls/ssl.h"
|
||||
#include "third_party/mbedtls/ssl_ticket.h"
|
||||
#include "tool/net/curl.h"
|
||||
|
||||
/**
|
||||
* @fileoverview Downloads HTTP URL to stdout.
|
||||
*
|
||||
* make -j8 o//examples/curl.com
|
||||
* o//examples/curl.com http://justine.lol/ape.html
|
||||
*/
|
||||
|
||||
#define HasHeader(H) (!!msg.headers[H].a)
|
||||
|
@ -121,7 +119,7 @@ static wontreturn void PrintUsage(FILE *f, int rc) {
|
|||
exit(rc);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int _curl(int argc, char *argv[]) {
|
||||
if (!NoDebug()) ShowCrashReports();
|
||||
|
||||
/*
|
|
@ -15,6 +15,7 @@ TOOL_NET_BINS = \
|
|||
$(TOOL_NET_COMS:%=%.dbg)
|
||||
|
||||
TOOL_NET_COMS = \
|
||||
o/$(MODE)/tool/net/curl.com \
|
||||
o/$(MODE)/tool/net/dig.com \
|
||||
o/$(MODE)/tool/net/redbean.com \
|
||||
o/$(MODE)/tool/net/redbean-demo.com \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue