mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
arj: add new recipe
This commit is contained in:
53
app-arch/arj/arj-3.10.22.recipe
Normal file
53
app-arch/arj/arj-3.10.22.recipe
Normal file
@@ -0,0 +1,53 @@
|
||||
SUMMARY="Free and portable clone of the ARJ archiver"
|
||||
DESCRIPTION="A portable version of the ARJ archiver, available for \
|
||||
a growing number of DOS-like and UNIX-like platforms on a variety o\
|
||||
f architectures."
|
||||
HOMEPAGE="https://arj.sourceforge.net/"
|
||||
COPYRIGHT="1998-2019 ARJ Software"
|
||||
LICENSE="GNU GPL v2"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://sourceforge.net/projects/arj/files/arj/2.78_3.10%20build%2022/arj-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="589e4c9bccc8669e7b6d8d6fcd64e01f6a2c21fe10aad56a83304ecc3b96a7db"
|
||||
PATCHES="arj-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="x86 x86_gcc2 x86_64"
|
||||
|
||||
PROVIDES="
|
||||
$portName = $portVersion
|
||||
cmd:arj = $portVersion
|
||||
cmd:arj_register = $portVersion
|
||||
cmd:arjdisp = $portVersion
|
||||
cmd:rearj = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:gcc
|
||||
cmd:ld
|
||||
cmd:make
|
||||
cmd:autoconf
|
||||
cmd:libtoolize
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
cd gnu
|
||||
|
||||
libtoolize --force --copy --install
|
||||
autoconf -f
|
||||
|
||||
runConfigure ./configure
|
||||
|
||||
cd ..
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
}
|
||||
787
app-arch/arj/patches/arj-3.10.22.patchset
Normal file
787
app-arch/arj/patches/arj-3.10.22.patchset
Normal file
@@ -0,0 +1,787 @@
|
||||
From ef134cb35ae2632338ccfda551bbe636659273c3 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Thu, 24 Sep 2020 10:58:07 +1000
|
||||
Subject: Patches from archlinux build
|
||||
|
||||
|
||||
diff --git a/arj.c b/arj.c
|
||||
index 022b269..b0efcc8 100644
|
||||
--- a/arj.c
|
||||
+++ b/arj.c
|
||||
@@ -1169,7 +1169,7 @@ int main(int argc, char *argv[])
|
||||
if(strlen(tmp_ptr)<=121)
|
||||
tmp_ptr[0]='\0';
|
||||
else if(tmp_ptr[120]==' ')
|
||||
- strcpy(tmp_ptr, tmp_ptr+121);
|
||||
+ safe_strcpy(tmp_ptr, tmp_ptr+121);
|
||||
}
|
||||
if(cmd==ARJ_CMD_ORDER&&strpbrk(tmp_ptr, wildcard_pattern)!=NULL)
|
||||
error(M_ORDER_WILDCARD);
|
||||
diff --git a/arj_arcv.c b/arj_arcv.c
|
||||
index cb82659..eba3079 100644
|
||||
--- a/arj_arcv.c
|
||||
+++ b/arj_arcv.c
|
||||
@@ -59,27 +59,27 @@ static char idxid_fault[]="?";
|
||||
#define setup_hput(ptr) (tmp_hptr=(ptr))
|
||||
|
||||
#define hget_byte() (*(tmp_hptr++)&0xFF)
|
||||
-#define hput_byte(c) (*(tmp_hptr++)=(char) (c))
|
||||
+#define hput_byte(c) (*(tmp_hptr++)=(uint8_t) (c))
|
||||
|
||||
/* Reads two bytes from the header, incrementing the pointer */
|
||||
|
||||
-static unsigned int hget_word()
|
||||
+static uint16_t hget_word()
|
||||
{
|
||||
- unsigned int result;
|
||||
+ uint16_t result;
|
||||
|
||||
result=mget_word(tmp_hptr);
|
||||
- tmp_hptr+=sizeof(short);
|
||||
+ tmp_hptr+=sizeof(uint16_t);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Reads four bytes from the header, incrementing the pointer */
|
||||
|
||||
-static unsigned long hget_longword()
|
||||
+static uint32_t hget_longword()
|
||||
{
|
||||
- unsigned long result;
|
||||
+ uint32_t result;
|
||||
|
||||
result=mget_dword(tmp_hptr);
|
||||
- tmp_hptr+=sizeof(unsigned long);
|
||||
+ tmp_hptr+=sizeof(uint32_t);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -87,18 +87,18 @@ static unsigned long hget_longword()
|
||||
|
||||
/* Writes two bytes to the header, incrementing the pointer */
|
||||
|
||||
-static void hput_word(unsigned int w)
|
||||
+static void hput_word(uint16_t w)
|
||||
{
|
||||
mput_word(w,tmp_hptr);
|
||||
- tmp_hptr+=sizeof(unsigned short);
|
||||
+ tmp_hptr+=sizeof(uint16_t);
|
||||
}
|
||||
|
||||
/* Writes four bytes to the header, incrementing the pointer */
|
||||
|
||||
-static void hput_longword(unsigned long l)
|
||||
+static void hput_longword(uint32_t l)
|
||||
{
|
||||
mput_dword(l,tmp_hptr);
|
||||
- tmp_hptr+=sizeof(unsigned long);
|
||||
+ tmp_hptr+=sizeof(uint32_t);
|
||||
}
|
||||
|
||||
/* Calculates and stores the basic header size */
|
||||
@@ -913,13 +913,13 @@ int supply_comment(char *cmtname, char *name)
|
||||
else
|
||||
{
|
||||
strcat(tmp_comment, tmp_cmtline);
|
||||
- strcat(tmp_comment, lf);
|
||||
+ strcat(tmp_comment, "\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcat(tmp_comment, tmp_cmtline);
|
||||
- strcat(tmp_comment, lf);
|
||||
+ strcat(tmp_comment, "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1846,7 +1846,7 @@ int pack_file(int is_update, int is_replace)
|
||||
raw_eh=eh_lookup(eh, UXSPECIAL_ID)->raw;
|
||||
uxspecial_stats(raw_eh, UXSTATS_SHORT);
|
||||
}
|
||||
- msg_cprintf(0, lf);
|
||||
+ msg_cprintf(0, "\n");
|
||||
}
|
||||
if(err_id==0&&user_wants_fail)
|
||||
{
|
||||
@@ -2523,9 +2523,9 @@ int unpack_validation()
|
||||
{
|
||||
msg_cprintf(0, (FMSG *)strform, misc_buf);
|
||||
if(search_mode==SEARCH_DEFAULT)
|
||||
- msg_cprintf(0, (FMSG *)lf);
|
||||
+ msg_cprintf(0, "\n");
|
||||
if(search_mode==SEARCH_BRIEF)
|
||||
- msg_cprintf(0, (FMSG *)cr);
|
||||
+ msg_cprintf(0, "\r");
|
||||
}
|
||||
for(pattern=0; pattern<SEARCH_STR_MAX; search_occurences[pattern++]=0);
|
||||
reserve_size=0;
|
||||
@@ -3652,7 +3652,7 @@ void archive_cleanup()
|
||||
{
|
||||
if(msg_fprintf(idxstream, M_TESTING, archive_name)<0)
|
||||
error(M_DISK_FULL);
|
||||
- if(fprintf(idxstream, lf)<0)
|
||||
+ if(fprintf(idxstream, "\n")<0)
|
||||
error(M_DISK_FULL);
|
||||
}
|
||||
cmd_verb=ARJ_CMD_TEST;
|
||||
diff --git a/arj_proc.c b/arj_proc.c
|
||||
index 3974069..3d98031 100644
|
||||
--- a/arj_proc.c
|
||||
+++ b/arj_proc.c
|
||||
@@ -585,7 +585,7 @@ int search_for_extension(char *name, char *ext_list)
|
||||
/* Returns the exact amount of data that could be safely written to the
|
||||
destination volume */
|
||||
|
||||
-unsigned long get_volfree(unsigned int increment)
|
||||
+unsigned long get_volfree(unsigned long increment)
|
||||
{
|
||||
unsigned long pvol;
|
||||
unsigned int arjsec_overhead;
|
||||
@@ -605,7 +605,7 @@ unsigned long get_volfree(unsigned int increment)
|
||||
remain=volume_limit-ftell(aostream)-pvol-(long)arjsec_overhead-
|
||||
(long)out_bytes-(long)cpos-(long)ext_voldata-
|
||||
MULTIVOLUME_RESERVE-t_volume_offset;
|
||||
- return((unsigned long)min(remain, (unsigned long)increment));
|
||||
+ return((unsigned long)min(remain, increment));
|
||||
}
|
||||
|
||||
/* Performs various checks when multivolume data is packed to predict an
|
||||
@@ -2466,14 +2466,14 @@ static int get_str_from_jq()
|
||||
*tsptr='\0';
|
||||
endptr=tsptr;
|
||||
tsptr=sptr;
|
||||
- while((unsigned int)tsptr<(unsigned int)endptr&&patterns<SEARCH_STR_MAX)
|
||||
+ while((intptr_t)tsptr<(intptr_t)endptr&&patterns<SEARCH_STR_MAX)
|
||||
{
|
||||
while(*tsptr=='\0')
|
||||
tsptr++;
|
||||
- if((unsigned int)tsptr<(unsigned int)endptr)
|
||||
+ if((intptr_t)tsptr<(intptr_t)endptr)
|
||||
{
|
||||
search_str[patterns++]=tsptr;
|
||||
- while(*tsptr!='\0'&&(unsigned int)tsptr<(unsigned int)endptr)
|
||||
+ while(*tsptr!='\0'&&(intptr_t)tsptr<(intptr_t)endptr)
|
||||
tsptr++;
|
||||
}
|
||||
}
|
||||
@@ -2898,12 +2898,12 @@ char *ltrim(char *str)
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(WORDS_BIGENDIAN)&&!defined(ARJDISP)&&!defined(REGISTER)
|
||||
+#if (defined(WORDS_BIGENDIAN) || defined(ALIGN_POINTERS)) && !defined(ARJDISP) && !defined(REGISTER)
|
||||
/* Model-independent routine to get 2 bytes from far RAM */
|
||||
|
||||
-unsigned int mget_word(char FAR *p)
|
||||
+uint16_t mget_word(char FAR *p)
|
||||
{
|
||||
- unsigned int b0, b1;
|
||||
+ uint16_t b0, b1;
|
||||
|
||||
b0=mget_byte(p);
|
||||
b1=mget_byte(p+1);
|
||||
@@ -2912,9 +2912,9 @@ unsigned int mget_word(char FAR *p)
|
||||
|
||||
/* Model-independent routine to get 4 bytes from far RAM */
|
||||
|
||||
-unsigned long mget_dword(char FAR *p)
|
||||
+uint32_t mget_dword(char FAR *p)
|
||||
{
|
||||
- unsigned long w0, w1;
|
||||
+ uint32_t w0, w1;
|
||||
|
||||
w0=mget_word(p);
|
||||
w1=mget_word(p+2);
|
||||
@@ -2923,7 +2923,7 @@ unsigned long mget_dword(char FAR *p)
|
||||
|
||||
/* Model-independent routine to store 2 bytes in far RAM */
|
||||
|
||||
-void mput_word(unsigned int w, char FAR *p)
|
||||
+void mput_word(uint16_t w, char FAR *p)
|
||||
{
|
||||
mput_byte(w&0xFF, p);
|
||||
mput_byte(w>>8 , p+1);
|
||||
@@ -2931,7 +2931,7 @@ void mput_word(unsigned int w, char FAR *p)
|
||||
|
||||
/* Model-independent routine to store 4 bytes in far RAM */
|
||||
|
||||
-void mput_dword(unsigned long d, char FAR *p)
|
||||
+void mput_dword(uint32_t d, char FAR *p)
|
||||
{
|
||||
mput_word(d&0xFFFF, p);
|
||||
mput_word(d>>16 , p+2);
|
||||
diff --git a/arj_proc.h b/arj_proc.h
|
||||
index ff68f00..66b90f2 100644
|
||||
--- a/arj_proc.h
|
||||
+++ b/arj_proc.h
|
||||
@@ -8,15 +8,17 @@
|
||||
#ifndef ARJ_PROC_INCLUDED
|
||||
#define ARJ_PROC_INCLUDED
|
||||
|
||||
+#include <stdint.h>
|
||||
+
|
||||
/* Helper macros */
|
||||
|
||||
-#define mget_byte(p) (*(unsigned char FAR *)(p)&0xFF)
|
||||
-#define mput_byte(c, p) *(unsigned char FAR *)(p)=(unsigned char)(c)
|
||||
-#ifndef WORDS_BIGENDIAN
|
||||
-#define mget_word(p) (*(unsigned short *)(p)&0xFFFF)
|
||||
-#define mput_word(w,p) (*(unsigned short *)(p)=(unsigned short)(w))
|
||||
-#define mget_dword(p) (*(unsigned long *)(p))
|
||||
-#define mput_dword(w,p) (*(unsigned long *)(p)=(unsigned long)(w))
|
||||
+#define mget_byte(p) (*(uint8_t FAR *)(p)&0xFF)
|
||||
+#define mput_byte(c, p) *(uint8_t FAR *)(p)=(uint8_t)(c)
|
||||
+#if !defined(ALIGN_POINTERS) && !defined(WORDS_BIGENDIAN)
|
||||
+#define mget_word(p) (*(uint16_t *)(p)&0xFFFF)
|
||||
+#define mput_word(w,p) (*(uint16_t *)(p)=(uint16_t)(w))
|
||||
+#define mget_dword(p) (*(uint32_t *)(p))
|
||||
+#define mput_dword(w,p) (*(uint32_t *)(p)=(uint32_t)(w))
|
||||
#endif
|
||||
|
||||
/* Prototypes */
|
||||
@@ -31,7 +33,7 @@ void copy_bytes(unsigned long nbytes);
|
||||
int translate_path(char *name);
|
||||
void restart_proc(char *dest);
|
||||
int search_for_extension(char *name, char *ext_list);
|
||||
-unsigned long get_volfree(unsigned int increment);
|
||||
+unsigned long get_volfree(unsigned long increment);
|
||||
unsigned int check_multivolume(unsigned int increment);
|
||||
void store();
|
||||
void hollow_encode();
|
||||
@@ -60,11 +62,11 @@ void pack_mem(struct mempack *mempack);
|
||||
void unpack_mem(struct mempack *mempack);
|
||||
void strip_lf(char *str);
|
||||
char *ltrim(char *str);
|
||||
-#ifdef WORDS_BIGENDIAN
|
||||
-unsigned int mget_word(char FAR *p);
|
||||
-unsigned long mget_dword(char FAR *p);
|
||||
-void mput_word(unsigned int w, char FAR *p);
|
||||
-void mput_dword(unsigned long d, char FAR *p);
|
||||
+#if defined(ALIGN_POINTERS) || defined(WORDS_BIGENDIAN)
|
||||
+uint16_t mget_word(char FAR *p);
|
||||
+uint32_t mget_dword(char FAR *p);
|
||||
+void mput_word(uint16_t w, char FAR *p);
|
||||
+void mput_dword(uint32_t d, char FAR *p);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
diff --git a/arj_user.c b/arj_user.c
|
||||
index 7434671..0c26779 100644
|
||||
--- a/arj_user.c
|
||||
+++ b/arj_user.c
|
||||
@@ -1059,7 +1059,7 @@ static void finish_processing(int cmd)
|
||||
if(recover_file(tmp_archive_name, nullstr, tmp_tmp_filename, protected, eof_pos))
|
||||
{
|
||||
msg_cprintf(H_HL, M_CANT_FIND_DAMAGE, archive_name);
|
||||
- printf(lf);
|
||||
+ printf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1294,7 +1294,7 @@ static void finish_processing(int cmd)
|
||||
if(recover_file(archive_name, nullstr, nullstr, protected, eof_pos))
|
||||
{
|
||||
msg_cprintf(H_HL, M_CANT_FIND_DAMAGE, archive_name);
|
||||
- printf(lf);
|
||||
+ printf("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1327,7 +1327,7 @@ static void finish_processing(int cmd)
|
||||
msg_cprintf(0, M_CHAPTERS_ON);
|
||||
else if(chapter_mode==CHAP_REMOVE)
|
||||
msg_cprintf(0, M_CHAPTERS_OFF);
|
||||
- msg_cprintf(0, strform, lf);
|
||||
+ msg_cprintf(0, strform, "\n");
|
||||
}
|
||||
if(cmd==ARJ_CMD_COPY&&protfile_option&&!arjprot_tail)
|
||||
msg_cprintf(0, M_ARJPROT_DISABLED);
|
||||
@@ -2303,7 +2303,7 @@ void process_archive()
|
||||
timestamp_to_str(timetext, &ftime_stamp);
|
||||
msg_cprintf(H_HL|H_NFMT, M_ARCHIVE_CREATED, timetext);
|
||||
if(show_ansi_comments)
|
||||
- printf(cmt_ptr);
|
||||
+ fputs(cmt_ptr, stdout);
|
||||
else
|
||||
display_comment(cmt_ptr);
|
||||
/* The sfx_setup() occurs here */
|
||||
diff --git a/arjdata.c b/arjdata.c
|
||||
index b803ad3..f07c48c 100644
|
||||
--- a/arjdata.c
|
||||
+++ b/arjdata.c
|
||||
@@ -204,13 +204,6 @@ void date_fmt(char *dest)
|
||||
#endif
|
||||
}
|
||||
|
||||
-/* A safe strcpy() */
|
||||
-
|
||||
-static void safe_strcpy(char *dest, char *src)
|
||||
-{
|
||||
- memmove(dest, src, strlen(src)+1);
|
||||
-}
|
||||
-
|
||||
/* Context substitution routine */
|
||||
|
||||
char *expand_tags(char *str, int limit)
|
||||
@@ -232,7 +225,7 @@ char *expand_tags(char *str, int limit)
|
||||
{
|
||||
if(*(p+1)==TAG_CHAR)
|
||||
{
|
||||
- strcpy(p, p+1);
|
||||
+ safe_strcpy(p, p+1);
|
||||
p++;
|
||||
}
|
||||
else if(*(p+1)==TAG_SPECIAL_BEGIN&&(et=strchr(p+3, TAG_SPECIAL_END))!=NULL)
|
||||
diff --git a/arjdisp.c b/arjdisp.c
|
||||
index 59e317f..28d2a41 100644
|
||||
--- a/arjdisp.c
|
||||
+++ b/arjdisp.c
|
||||
@@ -20,8 +20,6 @@ static long bytes;
|
||||
static long compsize;
|
||||
static char cmd_verb;
|
||||
static char msg_lf[]="\n";
|
||||
-char strform[]="%s"; /* Export it for scrnio.c, too
|
||||
- (a byte saved is a byte gained) */
|
||||
|
||||
/* Pseudographical controls */
|
||||
|
||||
@@ -54,19 +52,19 @@ static void show_init_scrn()
|
||||
textcolor(7);
|
||||
clrscr();
|
||||
gotoxy(2, 2);
|
||||
- scrprintf(win_top);
|
||||
+ fputs(win_top, stdout);
|
||||
for(i=3; i<24; i++)
|
||||
{
|
||||
- gotoxy(2, i); scrprintf(win_border);
|
||||
- gotoxy(79, i); scrprintf(win_border);
|
||||
+ gotoxy(2, i); fputs(win_border, stdout);
|
||||
+ gotoxy(79, i); fputs(win_border, stdout);
|
||||
}
|
||||
- gotoxy(2, 24); scrprintf(win_bottom);
|
||||
+ gotoxy(2, 24); fputs(win_bottom, stdout);
|
||||
gotoxy(10, 5);
|
||||
- scrprintf(M_ARJDISP_COPYRIGHT);
|
||||
+ fputs(M_ARJDISP_COPYRIGHT, stdout);
|
||||
gotoxy(10, 6);
|
||||
- scrprintf(M_ARJDISP_DISTRIBUTION);
|
||||
+ fputs(M_ARJDISP_DISTRIBUTION, stdout);
|
||||
gotoxy(10, 7);
|
||||
- scrprintf(M_ARJDISP_LICENSE);
|
||||
+ fputs(M_ARJDISP_LICENSE, stdout);
|
||||
gotoxy(16, 10);
|
||||
scrprintf(M_PROCESSING_ARCHIVE, archive_name);
|
||||
t=strtok(M_ARJDISP_INFO, msg_lf);
|
||||
@@ -74,11 +72,11 @@ static void show_init_scrn()
|
||||
while(t!=NULL&&i<=23)
|
||||
{
|
||||
gotoxy(10, i++);
|
||||
- scrprintf(strform, t);
|
||||
+ scrprintf("%s", t);
|
||||
t=strtok(NULL, msg_lf);
|
||||
}
|
||||
gotoxy(16, 20);
|
||||
- scrprintf(M_PRESS_ANY_KEY);
|
||||
+ fputs(M_PRESS_ANY_KEY, stdout);
|
||||
uni_getch();
|
||||
gotoxy(1, 24);
|
||||
}
|
||||
@@ -96,19 +94,19 @@ static void show_proc_scrn()
|
||||
{
|
||||
clrscr();
|
||||
gotoxy(2, 2);
|
||||
- scrprintf(win_top);
|
||||
+ fputs(win_top, stdout);
|
||||
for(i=3; i<24; i++)
|
||||
{
|
||||
- gotoxy(2, i); scrprintf(win_border);
|
||||
- gotoxy(79, i); scrprintf(win_border);
|
||||
+ gotoxy(2, i); fputs(win_border, stdout);
|
||||
+ gotoxy(79, i); fputs(win_border, stdout);
|
||||
}
|
||||
- gotoxy(2, 24); scrprintf(win_bottom);
|
||||
+ gotoxy(2, 24); fputs(win_bottom, stdout);
|
||||
gotoxy(10, 5);
|
||||
- scrprintf(M_ARJDISP_COPYRIGHT);
|
||||
+ fputs(M_ARJDISP_COPYRIGHT, stdout);
|
||||
gotoxy(10, 6);
|
||||
- scrprintf(M_ARJDISP_DISTRIBUTION);
|
||||
+ fputs(M_ARJDISP_DISTRIBUTION, stdout);
|
||||
gotoxy(10, 7);
|
||||
- scrprintf(M_ARJDISP_LICENSE);
|
||||
+ fputs(M_ARJDISP_LICENSE, stdout);
|
||||
gotoxy(16, 10);
|
||||
scrprintf(M_PROCESSING_ARCHIVE, archive_name);
|
||||
gotoxy(16, 12);
|
||||
@@ -132,13 +130,13 @@ static void show_proc_scrn()
|
||||
break;
|
||||
}
|
||||
gotoxy(15, 14);
|
||||
- scrprintf(ind_top);
|
||||
+ fputs(ind_top, stdout);
|
||||
gotoxy(15, 15);
|
||||
- scrprintf(ind_middle);
|
||||
+ fputs(ind_middle, stdout);
|
||||
gotoxy(15, 16);
|
||||
- scrprintf(ind_bottom);
|
||||
+ fputs(ind_bottom, stdout);
|
||||
gotoxy(16, 18);
|
||||
- scrprintf(M_ARJDISP_CTR_START);
|
||||
+ fputs(M_ARJDISP_CTR_START, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -146,7 +144,7 @@ static void show_proc_scrn()
|
||||
gotoxy(16, 15);
|
||||
memset(progress, indo, i);
|
||||
progress[i]='\0';
|
||||
- scrprintf(progress);
|
||||
+ fputs(progress, stdout);
|
||||
gotoxy(16, 18);
|
||||
scrprintf(M_ARJDISP_CTR, calc_percentage(bytes, uncompsize)/10);
|
||||
}
|
||||
@@ -165,19 +163,19 @@ static void show_ending_scrn()
|
||||
textcolor(7);
|
||||
clrscr();
|
||||
gotoxy(2, 2);
|
||||
- scrprintf(win_top);
|
||||
+ fputs(win_top, stdout);
|
||||
for(i=3; i<24; i++)
|
||||
{
|
||||
- gotoxy(2, i); scrprintf(win_border);
|
||||
- gotoxy(79, i); scrprintf(win_border);
|
||||
+ gotoxy(2, i); fputs(win_border, stdout);
|
||||
+ gotoxy(79, i); fputs(win_border, stdout);
|
||||
}
|
||||
- gotoxy(2, 24); scrprintf(win_bottom);
|
||||
+ gotoxy(2, 24); fputs(win_bottom, stdout);
|
||||
gotoxy(10, 5);
|
||||
- scrprintf(M_ARJDISP_COPYRIGHT);
|
||||
+ fputs(M_ARJDISP_COPYRIGHT, stdout);
|
||||
gotoxy(10, 6);
|
||||
- scrprintf(M_ARJDISP_DISTRIBUTION);
|
||||
+ fputs(M_ARJDISP_DISTRIBUTION, stdout);
|
||||
gotoxy(10, 7);
|
||||
- scrprintf(M_ARJDISP_LICENSE);
|
||||
+ fputs(M_ARJDISP_LICENSE, stdout);
|
||||
gotoxy(16, 10);
|
||||
scrprintf(M_FINISHED_PROCESSING, archive_name);
|
||||
gotoxy(1, 24);
|
||||
diff --git a/arjsfx.c b/arjsfx.c
|
||||
index bd852bd..bdc30ec 100644
|
||||
--- a/arjsfx.c
|
||||
+++ b/arjsfx.c
|
||||
@@ -214,7 +214,7 @@ static void final_cleanup(void)
|
||||
freopen(dev_con, m_w, stdout);
|
||||
#if SFX_LEVEL>=ARJSFXV
|
||||
if(ferror(stdout))
|
||||
- msg_fprintf(stderr, M_DISK_FULL);
|
||||
+ msg_fprintf(stderr, "Can't write file. Disk full?");
|
||||
if(debug_enabled&&strchr(debug_opt, 't')!=NULL)
|
||||
{
|
||||
ticks=get_ticks()-ticks;
|
||||
diff --git a/decode.c b/decode.c
|
||||
index b474cef..4413510 100644
|
||||
--- a/decode.c
|
||||
+++ b/decode.c
|
||||
@@ -255,7 +255,7 @@ void read_pt_len(int nn, int nbit, int i_special)
|
||||
if(i==i_special)
|
||||
{
|
||||
c=getbits(2);
|
||||
- while(--c>=0)
|
||||
+ while(--c>=0&&i<nn)
|
||||
pt_len[i++]=0;
|
||||
}
|
||||
}
|
||||
@@ -314,10 +314,10 @@ void read_c_len()
|
||||
c=getbits(CBIT);
|
||||
c+=20;
|
||||
}
|
||||
- while(--c>=0)
|
||||
+ while(--c>=0&&i<NC)
|
||||
c_len[i++]=0;
|
||||
}
|
||||
- else
|
||||
+ else if (i<NC)
|
||||
c_len[i++]=(unsigned char)(c-2);
|
||||
}
|
||||
while(i<NC)
|
||||
diff --git a/ea_mgr.c b/ea_mgr.c
|
||||
index af96da0..9e90d57 100644
|
||||
--- a/ea_mgr.c
|
||||
+++ b/ea_mgr.c
|
||||
@@ -696,7 +696,7 @@ int resolve_longname(char *dest, char *name)
|
||||
tmp_name[st_len]='\0';
|
||||
if(tmp_name[0]==0xFD&&tmp_name[1]==0xFF)
|
||||
{
|
||||
- strcpy(tmp_name, (char *)tmp_name+4);
|
||||
+ safe_strcpy(tmp_name, (char *)tmp_name+4);
|
||||
st_len-=4;
|
||||
}
|
||||
if(st_len==0||st_len+entry>=FILENAME_MAX)
|
||||
diff --git a/environ.c b/environ.c
|
||||
index ba747a6..af708ff 100644
|
||||
--- a/environ.c
|
||||
+++ b/environ.c
|
||||
@@ -1087,6 +1087,8 @@ static char *validate_path(char *name)
|
||||
if(action!=VALIDATE_DRIVESPEC)
|
||||
{
|
||||
#endif
|
||||
+ while (name[0]!='\0'&&
|
||||
+ (name[0]=='.'||name[0]==PATHSEP_DEFAULT||name[0]==PATHSEP_UNIX)) {
|
||||
if(name[0]=='.')
|
||||
{
|
||||
if(name[1]=='.'&&(name[2]==PATHSEP_DEFAULT||name[2]==PATHSEP_UNIX))
|
||||
@@ -1096,6 +1098,7 @@ static char *validate_path(char *name)
|
||||
}
|
||||
if(name[0]==PATHSEP_DEFAULT||name[0]==PATHSEP_UNIX)
|
||||
name++; /* "\\" - revert to root */
|
||||
+ }
|
||||
#if SFX_LEVEL>=ARJSFXV
|
||||
}
|
||||
}
|
||||
diff --git a/fardata.c b/fardata.c
|
||||
index 984f770..fe04ab4 100644
|
||||
--- a/fardata.c
|
||||
+++ b/fardata.c
|
||||
@@ -13,7 +13,6 @@
|
||||
/* ASR fix 02/05/2003: need that regardless of COLOR_OUTPUT to support -jp
|
||||
correctly */
|
||||
#if SFX_LEVEL>=ARJ
|
||||
- #define CUSTOM_PRINTF
|
||||
#define CHUNK_SIZE 512 /* Size of the output block */
|
||||
#define CHUNK_THRESHOLD (CHUNK_SIZE-256) /* Safety bound */
|
||||
#endif
|
||||
@@ -52,7 +51,7 @@ int error_proc(FMSG *errmsg, ...)
|
||||
/* Check if the message could have a standard error code */
|
||||
if(errno!=0&&is_std_error(errmsg))
|
||||
{
|
||||
- msg_cprintf(0, lf);
|
||||
+ msg_cprintf(0, "\n");
|
||||
error_report();
|
||||
}
|
||||
#endif
|
||||
@@ -377,10 +376,10 @@ static void flush_cbuf(int ccode, char *text)
|
||||
{
|
||||
#if SFX_LEVEL>=ARJSFXV
|
||||
fprintf(new_stdout, strform, n_text);
|
||||
- fprintf(new_stdout, lf);
|
||||
+ fprintf(new_stdout, "\n");
|
||||
#else
|
||||
printf(strform, n_text);
|
||||
- printf(lf);
|
||||
+ printf("\n");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -391,13 +390,13 @@ static void flush_cbuf(int ccode, char *text)
|
||||
#ifdef NEED_CRLF
|
||||
scr_out("\r");
|
||||
#endif
|
||||
- scr_out(lf);
|
||||
+ scr_out("\n");
|
||||
}
|
||||
if(!no_colors)
|
||||
textcolor(color_table[ccode&H_COLORMASK].color);
|
||||
#else
|
||||
printf(strform, n_text);
|
||||
- printf(lf);
|
||||
+ printf("\n");
|
||||
#endif
|
||||
n_text=t_text+1;
|
||||
#if SFX_LEVEL>=ARJ
|
||||
diff --git a/gnu/makefile.in b/gnu/makefile.in
|
||||
index af9a3a1..ab1748d 100644
|
||||
--- a/gnu/makefile.in
|
||||
+++ b/gnu/makefile.in
|
||||
@@ -191,6 +191,15 @@ timestamp: $(TOOLS_DIR)/today$x
|
||||
|
||||
dispose:
|
||||
|
||||
+#
|
||||
+# XXX: Do not use -O2, it removes the static const variable with gcc 4.x
|
||||
+#
|
||||
+
|
||||
+INTEGR_DIRS = $(ARJ_DIR) $(REARJ_DIR) $(ARJCRYPT_DIR) $(REGISTER_DIR)
|
||||
+
|
||||
+$(patsubst %,%/integr.o, $(INTEGR_DIRS)): $(SRC_DIR)/integr.c
|
||||
+ $(CC) -Wall -g -c -o$@ $<
|
||||
+
|
||||
#
|
||||
# The tools
|
||||
#
|
||||
diff --git a/misc.h b/misc.h
|
||||
index b419482..0c70b4f 100644
|
||||
--- a/misc.h
|
||||
+++ b/misc.h
|
||||
@@ -11,6 +11,10 @@
|
||||
#include "arjtypes.h"
|
||||
#include "filelist.h"
|
||||
|
||||
+/* A safe strcpy() */
|
||||
+
|
||||
+#define safe_strcpy(dest, src) memmove(dest, src, strlen(src)+1);
|
||||
+
|
||||
/* ASCIIZ string copy macro */
|
||||
|
||||
#define strcpyn(dest, src, n) \
|
||||
diff --git a/msgbind.c b/msgbind.c
|
||||
index 4954ca7..343243c 100644
|
||||
--- a/msgbind.c
|
||||
+++ b/msgbind.c
|
||||
@@ -578,7 +578,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
strcat(pool[tpool].data, msgname);
|
||||
strcat(pool[tpool].data, ", ");
|
||||
- strcpy(msg_buffer, msg_buffer+1);
|
||||
+ safe_strcpy(msg_buffer, msg_buffer+1);
|
||||
buf_len=strlen(msg_buffer);
|
||||
msg_buffer[--buf_len]='\0';
|
||||
patch_string(msg_buffer);
|
||||
diff --git a/packager.c b/packager.c
|
||||
index 48865a1..47cfefc 100644
|
||||
--- a/packager.c
|
||||
+++ b/packager.c
|
||||
@@ -347,7 +347,7 @@ int main(int argc, char **argv)
|
||||
expand_tags(buf, sizeof(buf)-1);
|
||||
if((p=strchr(buf, '.'))!=NULL)
|
||||
{
|
||||
- strcpy(p, p+1);
|
||||
+ safe_strcpy(p, p+1);
|
||||
if((p=strchr(buf, '.'))!=NULL)
|
||||
*p='\0';
|
||||
}
|
||||
diff --git a/rearj.c b/rearj.c
|
||||
index 86a4996..494ac79 100644
|
||||
--- a/rearj.c
|
||||
+++ b/rearj.c
|
||||
@@ -935,7 +935,7 @@ static int convert_archive(char *name)
|
||||
msg_cprintf(H_HL|H_NFMT, M_OLD_SIZE, old_fsize);
|
||||
msg_cprintf(H_HL|H_NFMT, M_NEW_SIZE, new_fsize);
|
||||
msg_cprintf(H_HL|H_NFMT, M_SAVINGS_SIZE, gain);
|
||||
- printf(lf);
|
||||
+ printf("\n");
|
||||
total_old_fsize+=old_fsize;
|
||||
total_new_fsize+=new_fsize;
|
||||
total_files++;
|
||||
diff --git a/register.c b/register.c
|
||||
index a4bc4d6..73e8920 100644
|
||||
--- a/register.c
|
||||
+++ b/register.c
|
||||
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
|
||||
char reg_source[200];
|
||||
int i;
|
||||
|
||||
- printf(M_REGISTER_BANNER);
|
||||
+ fputs(M_REGISTER_BANNER, stdout);
|
||||
integrity_pattern[0]--;
|
||||
build_crc32_table();
|
||||
if(argc!=2)
|
||||
diff --git a/uxspec.c b/uxspec.c
|
||||
index d1f2c48..521588f 100644
|
||||
--- a/uxspec.c
|
||||
+++ b/uxspec.c
|
||||
@@ -120,6 +120,58 @@ int query_uxspecial(char FAR **dest, char *name, struct file_properties *props)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#if TARGET==UNIX
|
||||
+static int is_link_traversal(const char *name)
|
||||
+{
|
||||
+ enum {
|
||||
+ STATE_NONE,
|
||||
+ STATE_DOTS,
|
||||
+ STATE_NAME,
|
||||
+ } state = STATE_NONE;
|
||||
+ int ndir = 0;
|
||||
+ int dots = 0;
|
||||
+
|
||||
+ while(*name) {
|
||||
+ int c = *name++;
|
||||
+
|
||||
+ if (c == '/')
|
||||
+ {
|
||||
+ if ((state == STATE_DOTS) && (dots == 2))
|
||||
+ ndir--;
|
||||
+ if (ndir < 0)
|
||||
+ return 1;
|
||||
+ if ((state == STATE_DOTS && dots == 1) && ndir == 0)
|
||||
+ return 1;
|
||||
+ if (state == STATE_NONE && ndir == 0)
|
||||
+ return 1;
|
||||
+ if ((state == STATE_DOTS) && (dots > 2))
|
||||
+ ndir++;
|
||||
+ state = STATE_NONE;
|
||||
+ dots = 0;
|
||||
+ }
|
||||
+ else if (c == '.')
|
||||
+ {
|
||||
+ if (state == STATE_NONE)
|
||||
+ state = STATE_DOTS;
|
||||
+ dots++;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (state == STATE_NONE)
|
||||
+ ndir++;
|
||||
+ state = STATE_NAME;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if ((state == STATE_DOTS) && (dots == 2))
|
||||
+ ndir--;
|
||||
+ if ((state == STATE_DOTS) && (dots > 2))
|
||||
+ ndir++;
|
||||
+
|
||||
+ return ndir < 0;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* Restores the UNIX special file data */
|
||||
|
||||
int set_uxspecial(char FAR *storage, char *name)
|
||||
@@ -156,6 +208,8 @@ int set_uxspecial(char FAR *storage, char *name)
|
||||
l=sizeof(tmp_name)-1;
|
||||
far_memmove((char FAR *)tmp_name, dptr, l);
|
||||
tmp_name[l]='\0';
|
||||
+ if (is_link_traversal(tmp_name))
|
||||
+ return(UXSPEC_RC_ERROR);
|
||||
rc=(id==UXSB_HLNK)?link(tmp_name, name):symlink(tmp_name, name);
|
||||
if(!rc)
|
||||
return(0);
|
||||
--
|
||||
2.28.0
|
||||
|
||||
|
||||
From b3c2320d86183353dfa2e534b93e0f0c693262eb Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Thu, 24 Sep 2020 11:31:15 +1000
|
||||
Subject: Use statvfs
|
||||
|
||||
|
||||
diff --git a/environ.c b/environ.c
|
||||
index af708ff..061b2d7 100644
|
||||
--- a/environ.c
|
||||
+++ b/environ.c
|
||||
@@ -61,7 +61,7 @@
|
||||
#elif defined(__FreeBSD__)||defined(__NetBSD__)
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
- #elif defined(__QNXNTO__)
|
||||
+ #elif defined(__QNXNTO__)||defined(__HAIKU__)
|
||||
#include <sys/statvfs.h>
|
||||
#else
|
||||
#include <sys/statfs.h>
|
||||
@@ -2289,7 +2289,7 @@ unsigned long file_getfree(char *name)
|
||||
else
|
||||
return((LONG_MAX/(spclu*bps)<fclu)?LONG_MAX:spclu*bps*fclu);
|
||||
#elif TARGET==UNIX
|
||||
- #if defined(__QNXNTO__)||defined(__sco__)||defined(SUNOS)
|
||||
+ #if defined(__QNXNTO__)||defined(__sco__)||defined(SUNOS)||defined(__HAIKU__)
|
||||
struct statvfs vfs;
|
||||
|
||||
if(statvfs(name, &vfs)==-1)
|
||||
--
|
||||
2.28.0
|
||||
|
||||
Reference in New Issue
Block a user