Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5731 → Rev 5730

/contrib/other/kpm/kpm.c
12,7 → 12,6
 
#define BUFFSIZE (64*1024)
 
char conbuf[256];
 
char *make_url(const char *name)
{
92,10 → 91,6
memcpy(buf, http->content_ptr+count, tail);
offset = tail;
}
 
sprintf(conbuf, "%d bytes loaded\r", http->content_received);
con_write_asciiz(conbuf);
 
}
received = http->content_received;
}
124,6 → 119,7
return received;
}
 
 
int main(int argc, char *argv[])
{
int count;
133,8 → 129,6
if(http_init())
goto err_init;
 
con_init(80, 25, 80, 250, "Kolibri package manager");
 
tmp_path = make_tmp_path("packages.xml");
 
count = http_load_file(tmp_path, make_url("packages.xml"));
157,10 → 151,7
remove_missing_packages(&install_list, &download_list);
 
list_for_each_entry(pkg, &install_list, list)
{
sprintf(conbuf,"install package %s-%s\n", pkg->name, pkg->version);
con_write_asciiz(conbuf);
};
printf("install package %s-%s\n", pkg->name, pkg->version);
 
set_cwd("/tmp0/1");
 
168,8 → 159,6
};
}
 
con_exit(0);
 
return 0;
 
err_init:
238,12 → 227,10
 
list_for_each_entry_safe(pkg, tmp, download_list, list)
{
sprintf(conbuf,"package %s-%s\n", pkg->name, pkg->version);
con_write_asciiz(conbuf);
printf("package %s-%s\n", pkg->name, pkg->version);
cache_path = make_cache_path(pkg->filename);
count = http_load_file(cache_path, make_url(pkg->filename));
sprintf(conbuf,"%s %d bytes loaded\n",cache_path, count);
con_write_asciiz(conbuf);
printf("%s loaded %d bytes\n",cache_path, count);
if( !test_archive(cache_path))
list_del_pkg(pkg);
else
261,8 → 248,7
{
if(ipkg->id == mpkg->id)
{
sprintf(conbuf,"skip missing package %s-%s\n", ipkg->name, ipkg->version);
con_write_asciiz(conbuf);
printf("skip missing package %s-%s\n", ipkg->name, ipkg->version);
list_del_pkg(ipkg);
};
}
/contrib/other/kpm/http.asm
7,13 → 7,6
public _http_receive@4
public _http_free@4
 
public _con_init@20
public _con_exit@4
public _con_get_flags
public _con_set_flags@4
public _con_cls
public _con_write_asciiz@4
 
section '.text' align 16
 
 
136,20 → 129,9
 
align 4
_http_init:
push ebx
mov eax, 40
mov ebx, 1 shl 8
int 0x40
pop ebx
 
push @IMPORT
call dll_load
test eax, eax
jnz .fail
push 1
call [con_start]
xor eax, eax
.fail:
ret
 
align 4
164,24 → 146,6
_http_free@4:
jmp [HTTP_free]
 
align 4
_con_init@20:
jmp [con_init]
 
align 4
_con_exit@4:
jmp [con_exit]
 
align 4
_con_write_asciiz@4:
jmp [con_write_asciiz]
 
_con_get_flags:
_con_set_flags@4:
_con_cls:
ret
 
 
proc mem.Alloc, size
push ebx ecx
mov ecx, [size]
260,8 → 224,7
align 4
@IMPORT:
 
library lib_http, 'http.obj', \
console, 'console.obj'
library lib_http, 'http.obj'
 
import lib_http, \
HTTP_get, 'get', \
268,19 → 231,6
HTTP_receive, 'receive', \
HTTP_free, 'free'
 
import console, \
con_start, 'START', \
con_init, 'con_init', \
con_write_asciiz,'con_write_asciiz',\
con_exit, 'con_exit', \
con_gets, 'con_gets', \
con_cls, 'con_cls', \
con_getch2, 'con_getch2', \
con_set_cursor_pos, 'con_set_cursor_pos',\
con_write_string, 'con_write_string',\
con_get_flags, 'con_get_flags', \
con_set_flags, 'con_set_flags'
 
s_libdir:
db '/sys/lib/'
.fname rb 32
/contrib/other/kpm/http.h
26,9 → 26,9
int http_init();
int http_load(char *buf, const char *path);
 
http_t* __stdcall http_get(const char *url, http_t *conn, int flags, const char *header);
int __stdcall http_receive(http_t *conn);
void __stdcall http_free(http_t *conn);
http_t* __attribute__ ((stdcall)) http_get(const char *url, http_t *conn, int flags, const char *header);
int __attribute__ ((stdcall)) http_receive(http_t *conn);
void __attribute__ ((stdcall)) http_free(http_t *conn);
 
static inline int http_receive_with_retry(http_t *http, int retry_count)
{
36,9 → 36,8
 
do
{
err = http_receive(http);
if(err)
wait_for_event(1);
if(err = http_receive(http))
delay(1);
 
}while(err && --retry_count);
 
45,12 → 44,4
return err;
}
 
void __stdcall con_init(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
void __stdcall con_exit(char bCloseWindow);
unsigned __stdcall con_get_flags(void);
unsigned __stdcall con_set_flags(unsigned new_flags);
void __stdcall con_cls(void);
void __stdcall con_write_asciiz(const char* string);
 
 
#endif /* __HTTP_H__ */