File: misc.h

package info (click to toggle)
arj 3.10.22-13
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,352 kB
  • ctags: 4,701
  • sloc: ansic: 32,990; makefile: 2,034; sh: 1,547; asm: 436
file content (106 lines) | stat: -rw-r--r-- 3,568 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 * $Id: misc.h,v 1.2 2004/02/20 23:18:59 andrew_belov Exp $
 * ---------------------------------------------------------------------------
 * Prototypes of the functions located in MISC.C are declared here.
 *
 */

#ifndef MISC_INCLUDED
#define MISC_INCLUDED

#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)      \
{                                  \
 strncpy(dest, src, n-1);          \
 (dest)[n-1]='\0';                 \
}

/* Numerical variables exchange macro */

#define swap(a, b)        b^=a^=b^=a

/* Prototypes */

void unix_path_to_dos(char *path);
void *malloc_str(char *str);
void *malloc_far_str(char FAR *str);
void cur_time_stamp(struct timestamp *dest);
#if !defined(TILED)
 #define far_strchr(str, chr) strchr(str, chr)
 #define far_strcmp(str1, str2) strcmp(str1, str2)
 #define far_stricmp(str1, str2) stricmp(str1, str2)
 #define far_strcat(dest, src) strcat(dest, src)
 #define far_strcpy(dest, src) strcpy(dest, src)
 #define far_strlen(str) strlen(str)
 #define far_memset(buf, filler, size) memset(buf, filler, size)
#elif COMPILER==MSC
 #define far_strchr(str, chr) _fstrchr(str, chr)
 #define far_strcmp(str1, str2) _fstrcmp(str1, str2)
 #define far_stricmp(str1, str2) _fstricmp(str1, str2)
 #define far_strcat(dest, src) _fstrcat(dest, src)
 #define far_strcpy(dest, src) _fstrcpy(dest, src)
 #define far_strlen(str) _fstrlen(str)
 #define far_memset(buf, filler, size) _fmemset(buf, filler, size)
#else
 char FAR *far_strchr(char FAR *str, char chr);
 int far_strcmp(char FAR *str1, char FAR *str2);
 int far_stricmp(char FAR *str1, char FAR *str2);
 char FAR *far_strcat(char FAR *dest, char FAR *src);
 char FAR *far_strcpy(char FAR *dest, char FAR *src);
 unsigned int far_strlen(char FAR *str);
 void FAR *far_memset(void FAR *buf, int filler, unsigned int size);
#endif
char FAR *far_strcpyn(char FAR *dest, char FAR *src, int limit);
void to_7bit(char *str);
void strupper(char *s);
void strlower(char *s);

#if SFX_LEVEL>=ARJ
int flist_find(struct flist_root *root, char *name);
int flist_is_in_archive(struct flist_root *root, char *name);
int match_attrib(struct file_properties *properties);
void flist_cleanup(struct flist_root *root);
int flist_add(struct flist_root *root, struct flist_root *search_flist, char *name, FILE_COUNT *count, struct file_properties *properties);
void flist_init(struct flist_root *root, FILE_COUNT maxfiles, char type);
void flist_retrieve(char *dest, struct file_properties *properties, struct flist_root *root, FILE_COUNT entry);
#endif
#if SFX_LEVEL>=ARJSFXV
int flist_add_files(struct flist_root *root, struct flist_root *search_flist, char *name, int expand_wildcards, int recurse_subdirs, int file_type, FILE_COUNT *count);
#endif

/* Compact/tradidional internal filelists. For some reason, the compact
   filelist feature is not used in ARJSFXV v 2.72. This hasn't been verified
   since then and is now being dropped -- ASR 17/01/2001 */

void cfa_shutdown();
int cfa_get(FILE_COUNT num);
void cfa_store(FILE_COUNT num, int value);
int cfa_init(FILE_COUNT capacity);

void *malloc_msg(unsigned int size);
void FAR *farmalloc_msg(unsigned long size);
void FAR *farrealloc_msg(void FAR *memblock, unsigned long size);

#ifdef REARJ

char *tokenize_lf(char *str);

#endif

/* A platform-neutral far_strcmp substitution */

#ifdef CASE_SENSITIVE
 #define far_strccmp    far_stricmp
#else
 #define far_strccmp    far_strcmp
#endif

#endif