Commit 0a3c9668a98596b5881a8985b45f0317c795499d
1 parent
3a0ae668
Exists in
master
and in
5 other branches
Limpando funções sem uso
Showing
4 changed files
with
43 additions
and
32 deletions
Show diff stats
configure.ac
... | ... | @@ -326,6 +326,7 @@ AC_SUBST(JRE_HOME) |
326 | 326 | AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?])) |
327 | 327 | |
328 | 328 | AC_CHECK_FUNCS(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) ) |
329 | +AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF) ) | |
329 | 330 | |
330 | 331 | PKG_CHECK_EXISTS |
331 | 332 | ... | ... |
src/include/lib3270/config.h.in
src/lib3270/util.c
1 | 1 | /* |
2 | 2 | * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 |
3 | 3 | * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob | |
5 | + * o nome G3270. | |
5 | 6 | * |
6 | 7 | * Copyright (C) <2008> <Banco do Brasil S.A.> |
7 | 8 | * |
... | ... | @@ -18,7 +19,7 @@ |
18 | 19 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
19 | 20 | * St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 21 | * |
21 | - * Este programa está nomeado como util.c e possui 978 linhas de código. | |
22 | + * Este programa está nomeado como util.c e possui - linhas de código. | |
22 | 23 | * |
23 | 24 | * Contatos: |
24 | 25 | * |
... | ... | @@ -35,6 +36,8 @@ |
35 | 36 | * Utility functions for x3270/c3270/s3270/tcl3270 |
36 | 37 | */ |
37 | 38 | |
39 | +#define _GNU_SOURCE | |
40 | + | |
38 | 41 | #if defined(_WIN32) |
39 | 42 | #include <winsock2.h> |
40 | 43 | #include <windows.h> |
... | ... | @@ -230,7 +233,7 @@ xs_error(const char *fmt, ...) |
230 | 233 | lib3270_free(r); |
231 | 234 | } |
232 | 235 | |
233 | -/* Prettyprinter for strings with unprintable data. */ | |
236 | +/* Prettyprinter for strings with unprintable data. */ /* | |
234 | 237 | void |
235 | 238 | fcatv(FILE *f, char *s) |
236 | 239 | { |
... | ... | @@ -256,8 +259,9 @@ fcatv(FILE *f, char *s) |
256 | 259 | } |
257 | 260 | } |
258 | 261 | } |
262 | +*/ | |
259 | 263 | |
260 | -/* String version of fcatv. */ | |
264 | +/* String version of fcatv. */ /* | |
261 | 265 | char * |
262 | 266 | scatv(const char *s, char *buf, size_t len) |
263 | 267 | { |
... | ... | @@ -268,7 +272,7 @@ scatv(const char *s, char *buf, size_t len) |
268 | 272 | char cbuf[5]; |
269 | 273 | char *t = cbuf; |
270 | 274 | |
271 | - /* Expand this character. */ | |
275 | + // Expand this character. | |
272 | 276 | switch (c) { |
273 | 277 | case '\n': |
274 | 278 | (void) strcpy(cbuf, "\\n"); |
... | ... | @@ -288,7 +292,7 @@ scatv(const char *s, char *buf, size_t len) |
288 | 292 | } |
289 | 293 | break; |
290 | 294 | } |
291 | - /* Copy as much as will fit. */ | |
295 | + // Copy as much as will fit. | |
292 | 296 | while ((c = *t++) && len > 0) { |
293 | 297 | *dst++ = c; |
294 | 298 | len--; |
... | ... | @@ -299,6 +303,7 @@ scatv(const char *s, char *buf, size_t len) |
299 | 303 | |
300 | 304 | return buf; |
301 | 305 | } |
306 | +*/ | |
302 | 307 | |
303 | 308 | /* |
304 | 309 | * Definition resource splitter, for resources of the repeating form: |
... | ... | @@ -527,7 +532,7 @@ get_message(const char *key) |
527 | 532 | |
528 | 533 | // #define ex_getenv getenv |
529 | 534 | |
530 | -/* Variable and tilde substitution functions. */ | |
535 | +/* Variable and tilde substitution functions. */ /* | |
531 | 536 | static char * |
532 | 537 | var_subst(const char *s) |
533 | 538 | { |
... | ... | @@ -606,7 +611,7 @@ var_subst(const char *s) |
606 | 611 | (void) strncpy(o, vn_start, vn_len); |
607 | 612 | o += vn_len; |
608 | 613 | state = VS_BASE; |
609 | - continue; /* rescan */ | |
614 | + continue; // rescan | |
610 | 615 | } |
611 | 616 | vn = lib3270_malloc(vn_len + 1); |
612 | 617 | (void) strncpy(vn, vn_start, vn_len); |
... | ... | @@ -617,10 +622,10 @@ var_subst(const char *s) |
617 | 622 | { |
618 | 623 | *o = '\0'; |
619 | 624 | o_len = o_len |
620 | - - 1 /* '$' */ | |
621 | - - (state == VS_VNB) /* { */ | |
622 | - - vn_len /* name */ | |
623 | - - (state == VS_VNB) /* } */ | |
625 | + - 1 // '$' | |
626 | + - (state == VS_VNB) // | |
627 | + - vn_len // name | |
628 | + - (state == VS_VNB) // } | |
624 | 629 | + strlen(vv); |
625 | 630 | ob = Realloc(ob, o_len); |
626 | 631 | o = strchr(ob, '\0'); |
... | ... | @@ -634,7 +639,7 @@ var_subst(const char *s) |
634 | 639 | state = VS_BASE; |
635 | 640 | break; |
636 | 641 | } else { |
637 | - /* Rescan this character */ | |
642 | + // Rescan this character | |
638 | 643 | state = VS_BASE; |
639 | 644 | continue; |
640 | 645 | } |
... | ... | @@ -649,12 +654,14 @@ var_subst(const char *s) |
649 | 654 | } |
650 | 655 | return ob; |
651 | 656 | } |
657 | +*/ | |
652 | 658 | |
653 | -#if !defined(_WIN32) /*[*/ | |
659 | +#if !defined(_WIN32) | |
654 | 660 | /* |
655 | 661 | * Do tilde (home directory) substitution on a string. Returns a malloc'd |
656 | 662 | * result. |
657 | 663 | */ |
664 | + /* | |
658 | 665 | static char * |
659 | 666 | tilde_subst(const char *s) |
660 | 667 | { |
... | ... | @@ -665,11 +672,11 @@ tilde_subst(const char *s) |
665 | 672 | char *r; |
666 | 673 | char *mname = CN; |
667 | 674 | |
668 | - /* Does it start with a "~"? */ | |
675 | + // Does it start with a "~"? | |
669 | 676 | if (*s != '~') |
670 | 677 | return NewString(s); |
671 | 678 | |
672 | - /* Terminate with "/". */ | |
679 | + // Terminate with "/". | |
673 | 680 | slash = strchr(s, '/'); |
674 | 681 | if (slash) { |
675 | 682 | int len = slash - s; |
... | ... | @@ -684,16 +691,16 @@ tilde_subst(const char *s) |
684 | 691 | rest = strchr(name, '\0'); |
685 | 692 | } |
686 | 693 | |
687 | - /* Look it up. */ | |
688 | - if (!strcmp(name, "~")) /* this user */ | |
694 | + // Look it up. | |
695 | + if (!strcmp(name, "~")) // this user | |
689 | 696 | p = getpwuid(getuid()); |
690 | - else /* somebody else */ | |
697 | + else // somebody else | |
691 | 698 | p = getpwnam(name + 1); |
692 | 699 | |
693 | - /* Free any temporary copy. */ | |
700 | + // Free any temporary copy. | |
694 | 701 | lib3270_free(mname); |
695 | 702 | |
696 | - /* Substitute and return. */ | |
703 | + // Substitute and return. | |
697 | 704 | if (p == (struct passwd *)NULL) |
698 | 705 | r = NewString(s); |
699 | 706 | else { |
... | ... | @@ -702,9 +709,9 @@ tilde_subst(const char *s) |
702 | 709 | (void) strcat(r, rest); |
703 | 710 | } |
704 | 711 | return r; |
705 | -} | |
706 | -#endif /*]*/ | |
707 | - | |
712 | +} */ | |
713 | +#endif | |
714 | +/* | |
708 | 715 | char * |
709 | 716 | do_subst(const char *s, Boolean do_vars, Boolean do_tilde) |
710 | 717 | { |
... | ... | @@ -715,7 +722,7 @@ do_subst(const char *s, Boolean do_vars, Boolean do_tilde) |
715 | 722 | char *t; |
716 | 723 | |
717 | 724 | t = var_subst(s); |
718 | -#if !defined(_WIN32) /*[*/ | |
725 | +#if !defined(_WIN32) | |
719 | 726 | if (do_tilde) { |
720 | 727 | char *u; |
721 | 728 | |
... | ... | @@ -723,17 +730,19 @@ do_subst(const char *s, Boolean do_vars, Boolean do_tilde) |
723 | 730 | lib3270_free(t); |
724 | 731 | return u; |
725 | 732 | } |
726 | -#endif /*]*/ | |
733 | +#endif | |
727 | 734 | return t; |
728 | 735 | } |
729 | 736 | |
730 | -#if !defined(_WIN32) /*[*/ | |
737 | +#if !defined(_WIN32) | |
731 | 738 | return tilde_subst(s); |
732 | -#else /*][*/ | |
739 | +#else | |
733 | 740 | return NewString(s); |
734 | -#endif /*]*/ | |
741 | +#endif | |
735 | 742 | } |
736 | 743 | |
744 | +*/ | |
745 | + | |
737 | 746 | /* |
738 | 747 | * ctl_see |
739 | 748 | * Expands a character in the manner of "cat -v". | ... | ... |
src/lib3270/utilc.h
... | ... | @@ -20,12 +20,12 @@ |
20 | 20 | |
21 | 21 | LIB3270_INTERNAL void add_resource(const char *name, const char *value); |
22 | 22 | LIB3270_INTERNAL char *ctl_see(int c); |
23 | -LIB3270_INTERNAL char *do_subst(const char *s, Boolean do_vars, Boolean do_tilde); | |
24 | -LIB3270_INTERNAL void fcatv(FILE *f, char *s); | |
23 | +// LIB3270_INTERNAL char *do_subst(const char *s, Boolean do_vars, Boolean do_tilde); | |
24 | +// LIB3270_INTERNAL void fcatv(FILE *f, char *s); | |
25 | 25 | LIB3270_INTERNAL const char *get_message(const char *key); |
26 | 26 | LIB3270_INTERNAL const char *get_fresource(H3270 *hSession, const char *fmt, ...) printflike(2, 3); |
27 | 27 | LIB3270_INTERNAL const char *get_resource(H3270 *hSession, const char *name); |
28 | -LIB3270_INTERNAL char *scatv(const char *s, char *buf, size_t len); | |
28 | +// LIB3270_INTERNAL char *scatv(const char *s, char *buf, size_t len); | |
29 | 29 | LIB3270_INTERNAL int split_dbcs_resource(const char *value, char sep, char **part1, |
30 | 30 | char **part2); |
31 | 31 | LIB3270_INTERNAL int split_dresource(char **st, char **left, char **right); | ... | ... |