No Description

001-debian-libsgm-1.0.10-13.patch 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. --- a/Makefile
  2. +++ b/Makefile
  3. @@ -8,10 +8,12 @@ SASR = -DSASR
  4. ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)
  5. # MULHACK = -DUSE_FLOAT_MUL
  6. +MULHACK =
  7. ######### Define this if your host multiplies floats faster than integers,
  8. ######### e.g. on a SPARCstation.
  9. # FAST = -DFAST
  10. +FAST =
  11. ######### Define together with USE_FLOAT_MUL to enable the GSM library's
  12. ######### approximation option for incorrect, but good-enough results.
  13. @@ -22,8 +24,8 @@ LTP_CUT =
  14. ######### both integer and floating point multiplications.
  15. ######### This flag is still in the experimental stage.
  16. -WAV49 = -DWAV49
  17. -# WAV49 =
  18. +# WAV49 = -DWAV49
  19. +WAV49 =
  20. ######### Define to enable the GSM library's option to pack GSM frames
  21. ######### in the style used by the WAV #49 format. If you want to write
  22. ######### a tool that produces .WAV files which contain GSM-encoded data,
  23. @@ -44,7 +46,8 @@ WAV49 = -DWAV49
  24. # CCFLAGS = -c -O
  25. CC = gcc -ansi -pedantic
  26. -CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1
  27. +COPTS = -O2
  28. +CCFLAGS = -c $(COPTS) -DNeedFunctionPrototypes=1
  29. LD = $(CC)
  30. @@ -78,10 +81,10 @@ INSTALL_ROOT =
  31. # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of
  32. # this directory.
  33. -GSM_INSTALL_ROOT = $(INSTALL_ROOT)
  34. +GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr
  35. GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib
  36. -GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc
  37. -GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3
  38. +GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include
  39. +GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/share/man/man3
  40. # Where do you want to install the toast binaries and their manpage?
  41. @@ -89,14 +92,14 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma
  42. # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside
  43. # of this directory.
  44. -TOAST_INSTALL_ROOT = $(INSTALL_ROOT)
  45. +TOAST_INSTALL_ROOT = $(INSTALL_ROOT)/usr
  46. TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin
  47. -TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1
  48. +TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1
  49. # Other tools
  50. SHELL = /bin/sh
  51. -LN = ln
  52. +LN = ln -s
  53. BASENAME = basename
  54. AR = ar
  55. ARFLAGS = cr
  56. @@ -126,7 +129,7 @@ INC = $(ROOT)/inc
  57. # Flags
  58. -# DEBUG = -DNDEBUG
  59. +DEBUG = -DNDEBUG
  60. ######### Remove -DNDEBUG to enable assertions.
  61. CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \
  62. @@ -140,6 +143,7 @@ LFLAGS = $(LDFLAGS) $(LDINC)
  63. # Targets
  64. LIBGSM = $(LIB)/libgsm.a
  65. +LIBGSMSO= $(LIB)/libgsm.so
  66. TOAST = $(BIN)/toast
  67. UNTOAST = $(BIN)/untoast
  68. @@ -258,6 +262,9 @@ STUFF = ChangeLog \
  69. GSM_INSTALL_TARGETS = \
  70. $(GSM_INSTALL_LIB)/libgsm.a \
  71. + $(GSM_INSTALL_LIB)/libgsm.so \
  72. + $(GSM_INSTALL_LIB)/libgsm.so.1 \
  73. + $(GSM_INSTALL_LIB)/libgsm.so.1.0.10 \
  74. $(GSM_INSTALL_INC)/gsm.h \
  75. $(GSM_INSTALL_MAN)/gsm.3 \
  76. $(GSM_INSTALL_MAN)/gsm_explode.3 \
  77. @@ -279,7 +286,7 @@ TOAST_INSTALL_TARGETS = \
  78. # Target rules
  79. -all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST)
  80. +all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST)
  81. @-echo $(ROOT): Done.
  82. tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result
  83. @@ -299,6 +306,11 @@ install: toastinstall gsminstall
  84. # The basic API: libgsm
  85. +$(LIBGSMSO): $(LIB) $(GSM_OBJECTS)
  86. + $(LD) -o $@.1.0.10 -shared -Xlinker -soname -Xlinker libgsm.so.1 $(GSM_OBJECTS) -lc
  87. + ln -fs libgsm.so.1.0.10 lib/libgsm.so.1
  88. + ln -fs libgsm.so.1.0.10 lib/libgsm.so
  89. +
  90. $(LIBGSM): $(LIB) $(GSM_OBJECTS)
  91. -rm $(RMFLAGS) $(LIBGSM)
  92. $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS)
  93. @@ -308,15 +320,15 @@ $(LIBGSM): $(LIB) $(GSM_OBJECTS)
  94. # Toast, Untoast and Tcat -- the compress-like frontends to gsm.
  95. $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM)
  96. - $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB)
  97. + $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB)
  98. $(UNTOAST): $(BIN) $(TOAST)
  99. -rm $(RMFLAGS) $(UNTOAST)
  100. - $(LN) $(TOAST) $(UNTOAST)
  101. + $(LN) toast $(UNTOAST)
  102. $(TCAT): $(BIN) $(TOAST)
  103. -rm $(RMFLAGS) $(TCAT)
  104. - $(LN) $(TOAST) $(TCAT)
  105. + $(LN) toast $(TCAT)
  106. # The local bin and lib directories
  107. @@ -351,53 +363,66 @@ toastuninstall:
  108. fi
  109. $(TOAST_INSTALL_BIN)/toast: $(TOAST)
  110. - -rm $@
  111. - cp $(TOAST) $@
  112. + mkdir -p $(TOAST_INSTALL_BIN)
  113. + cp -f $(TOAST) $@
  114. chmod 755 $@
  115. $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast
  116. - -rm $@
  117. - ln $? $@
  118. + mkdir -p $(TOAST_INSTALL_BIN)
  119. + ln -sf $? $@
  120. $(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast
  121. - -rm $@
  122. - ln $? $@
  123. + mkdir -p $(TOAST_INSTALL_BIN)
  124. + ln -sf $? $@
  125. $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1
  126. - -rm $@
  127. - cp $? $@
  128. + mkdir -p $(TOAST_INSTALL_MAN)
  129. + cp -f $? $@
  130. chmod 444 $@
  131. $(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3
  132. - -rm $@
  133. - cp $? $@
  134. + mkdir -p $(GSM_INSTALL_MAN)
  135. + cp -f $? $@
  136. chmod 444 $@
  137. $(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3
  138. - -rm $@
  139. - cp $? $@
  140. + mkdir -p $(GSM_INSTALL_MAN)
  141. + cp -f $? $@
  142. chmod 444 $@
  143. $(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3
  144. - -rm $@
  145. - cp $? $@
  146. + mkdir -p $(GSM_INSTALL_MAN)
  147. + cp -f $? $@
  148. chmod 444 $@
  149. $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3
  150. - -rm $@
  151. - cp $? $@
  152. + mkdir -p $(GSM_INSTALL_MAN)
  153. + cp -f $? $@
  154. chmod 444 $@
  155. $(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h
  156. - -rm $@
  157. - cp $? $@
  158. + mkdir -p $(GSM_INSTALL_INC)
  159. + cp -f $? $@
  160. chmod 444 $@
  161. $(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM)
  162. - -rm $@
  163. - cp $? $@
  164. + mkdir -p $(GSM_INSTALL_LIB)
  165. + cp -f $? $@
  166. chmod 444 $@
  167. +$(GSM_INSTALL_LIB)/libgsm.so: $(LIBGSMSO)
  168. + mkdir -p $(GSM_INSTALL_LIB)
  169. + cp -f $? $@
  170. +
  171. +$(GSM_INSTALL_LIB)/libgsm.so.1: $(LIBGSMSO)
  172. + mkdir -p $(GSM_INSTALL_LIB)
  173. + cp -f $? $@
  174. +
  175. +$(GSM_INSTALL_LIB)/libgsm.so.1.0.10: $(LIBGSMSO)
  176. + mkdir -p $(GSM_INSTALL_LIB)
  177. + cp -f $? $@
  178. + chmod 755 $@
  179. +
  180. # Distribution
  181. @@ -426,7 +451,9 @@ semi-clean:
  182. clean: semi-clean
  183. -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \
  184. - $(TOAST) $(TCAT) $(UNTOAST) \
  185. + $(LIBGSMSO) $(LIB)/libgsm.so.1.0.10 \
  186. + $(LIB)libgsm.so.1 \
  187. + $(TOAST) $(TCAT) $(UNTOAST) \
  188. $(ROOT)/gsm-1.0.tar.Z
  189. --- a/inc/config.h
  190. +++ b/inc/config.h
  191. @@ -9,8 +9,8 @@
  192. #ifndef CONFIG_H
  193. #define CONFIG_H
  194. -/*efine SIGHANDLER_T int /* signal handlers are void */
  195. -/*efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */
  196. +/*efine SIGHANDLER_T int *//* signal handlers are void */
  197. +/*efine HAS_SYSV_SIGNAL 1 *//* sigs not blocked/reset? */
  198. #define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */
  199. #define HAS_LIMITS_H 1 /* /usr/include/limits.h */
  200. @@ -22,16 +22,16 @@
  201. #define HAS_CHMOD 1 /* chmod syscall */
  202. #define HAS_FCHOWN 1 /* fchown syscall */
  203. #define HAS_CHOWN 1 /* chown syscall */
  204. -/*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */
  205. +/*efine HAS__FSETMODE 1 *//* _fsetmode -- set file mode */
  206. #define HAS_STRING_H 1 /* /usr/include/string.h */
  207. -/*efine HAS_STRINGS_H 1 /* /usr/include/strings.h */
  208. +/*efine HAS_STRINGS_H 1 *//* /usr/include/strings.h */
  209. #define HAS_UNISTD_H 1 /* /usr/include/unistd.h */
  210. #define HAS_UTIME 1 /* POSIX utime(path, times) */
  211. -/*efine HAS_UTIMES 1 /* use utimes() syscall instead */
  212. +/*efine HAS_UTIMES 1 *//* use utimes() syscall instead */
  213. #define HAS_UTIME_H 1 /* UTIME header file */
  214. #define HAS_UTIMBUF 1 /* struct utimbuf */
  215. -/*efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */
  216. +/*efine HAS_UTIMEUSEC 1 *//* microseconds in utimbuf? */
  217. #endif /* CONFIG_H */
  218. --- a/inc/gsm.h
  219. +++ b/inc/gsm.h
  220. @@ -54,6 +54,10 @@ typedef gsm_byte gsm_frame[33]; /* 33
  221. #define GSM_OPT_FRAME_INDEX 5
  222. #define GSM_OPT_FRAME_CHAIN 6
  223. +#ifdef __cplusplus
  224. +extern "C" {
  225. +#endif
  226. +
  227. extern gsm gsm_create GSM_P((void));
  228. extern void gsm_destroy GSM_P((gsm));
  229. @@ -66,6 +70,10 @@ extern int gsm_decode GSM_P((gsm, gsm_
  230. extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *));
  231. extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *));
  232. +#ifdef __cplusplus
  233. +}
  234. +#endif
  235. +
  236. #undef GSM_P
  237. #endif /* GSM_H */
  238. --- a/inc/toast.h
  239. +++ b/inc/toast.h
  240. @@ -16,11 +16,12 @@
  241. #include <stdio.h>
  242. #include <ctype.h>
  243. +#include <pthread.h>
  244. #include <signal.h>
  245. #include <errno.h>
  246. -#ifndef HAS_ERRNO_DECL
  247. - extern int errno;
  248. +#ifndef errno
  249. + extern int errno;
  250. #endif
  251. #ifdef HAS_LIMITS_H
  252. @@ -37,6 +38,10 @@
  253. # endif
  254. #endif
  255. +#ifdef HAS_STDIO_H
  256. +# include <stdio.h>
  257. +#endif
  258. +
  259. #include "gsm.h"
  260. #ifndef S_ISREG
  261. --- a/src/code.c
  262. +++ b/src/code.c
  263. @@ -9,8 +9,8 @@
  264. #include "config.h"
  265. -#ifdef HAS_STDLIB_H
  266. -#include <stdlib.h>
  267. +#ifdef HAS_STRING_H
  268. +#include <string.h>
  269. #else
  270. # include "proto.h"
  271. extern char * memcpy P((char *, char *, int));
  272. --- a/src/debug.c
  273. +++ b/src/debug.c
  274. @@ -49,7 +49,7 @@ void gsm_debug_longwords P4( (name, from
  275. fprintf( stderr, "%s [%d .. %d]: ", name, from, to );
  276. while (from <= to) {
  277. - fprintf(stderr, "%d ", ptr[ from ] );
  278. + fprintf(stderr, "%ld ", ptr[ from ] );
  279. from++;
  280. if (nprinted++ >= 7) {
  281. nprinted = 0;
  282. @@ -63,14 +63,14 @@ void gsm_debug_longword P2( (name, valu
  283. char * name,
  284. longword value )
  285. {
  286. - fprintf(stderr, "%s: %d\n", name, (long)value );
  287. + fprintf(stderr, "%s: %ld\n", name, (long)value );
  288. }
  289. void gsm_debug_word P2( (name, value),
  290. char * name,
  291. word value )
  292. {
  293. - fprintf(stderr, "%s: %d\n", name, (long)value);
  294. + fprintf(stderr, "%s: %ld\n", name, (long)value);
  295. }
  296. #endif
  297. --- a/src/toast.c
  298. +++ b/src/toast.c
  299. @@ -251,8 +251,8 @@ static char * emalloc P1((len), size_t l
  300. {
  301. char * s;
  302. if (!(s = malloc(len))) {
  303. - fprintf(stderr, "%s: failed to malloc %d bytes -- abort\n",
  304. - progname, len);
  305. + fprintf(stderr, "%s: failed to malloc %ld bytes -- abort\n",
  306. + progname, (long) len);
  307. onintr();
  308. exit(1);
  309. }
  310. @@ -270,7 +270,7 @@ static char* normalname P3((name, want,
  311. maxlen = strlen(name) + 1 + strlen(want) + strlen(cut);
  312. p = strcpy(emalloc(maxlen), name);
  313. - if (s = suffix(p, cut)) strcpy(s, want);
  314. + if ((s = suffix(p, cut))) strcpy(s, want);
  315. else if (*want && !suffix(p, want)) strcat(p, want);
  316. return p;
  317. @@ -386,7 +386,7 @@ static void update_times P0()
  318. ut[0] = instat.st_atime;
  319. ut[1] = instat.st_mtime;
  320. - (void) utime(outname, ut);
  321. + (void) utime(outname, (struct utimbuf *)ut);
  322. #endif /* UTIMBUF */
  323. }
  324. @@ -416,7 +416,7 @@ static int okay_as_input P3((name,f,st),
  325. }
  326. if (st->st_nlink > 1 && !f_cat && !f_precious) {
  327. fprintf(stderr,
  328. - "%s: \"%s\" has %s other link%s -- unchanged.\n",
  329. + "%s: \"%s\" has %d other link%s -- unchanged.\n",
  330. progname,name,st->st_nlink - 1,"s" + (st->st_nlink<=2));
  331. return 0;
  332. }
  333. @@ -585,8 +585,8 @@ static int process_decode P0()
  334. if (cc != sizeof(s)) {
  335. if (cc >= 0) fprintf(stderr,
  336. - "%s: incomplete frame (%d byte%s missing) from %s\n",
  337. - progname, sizeof(s) - cc,
  338. + "%s: incomplete frame (%ld byte%s missing) from %s\n",
  339. + progname, (long) sizeof(s) - cc,
  340. "s" + (sizeof(s) - cc == 1),
  341. inname ? inname : "stdin" );
  342. gsm_destroy(r);
  343. @@ -624,8 +624,6 @@ static int process_decode P0()
  344. static int process P1((name), char * name)
  345. {
  346. - int step = 0;
  347. -
  348. out = (FILE *)0;
  349. in = (FILE *)0;
  350. @@ -779,7 +777,6 @@ int main P2((ac, av), int ac, char **av)
  351. case 'h': help(); exit(0);
  352. default:
  353. - usage:
  354. fprintf(stderr,
  355. "Usage: %s [-fcpdhvuaslFC] [files...] (-h for help)\n",
  356. progname);