Deleted Added
full compact
uuencode.c (197679) uuencode.c (221420)
1/* $OpenBSD: uuencode.c,v 1.25 2009/03/05 11:30:50 djm Exp $ */
1/* $OpenBSD: uuencode.c,v 1.26 2010/08/31 11:54:45 djm Exp $ */
2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 57 unchanged lines hidden (view full) ---

67 /* and remove trailing whitespace because __b64_pton needs this */
68 *p = '\0';
69 len = __b64_pton(encoded, target, targsize);
70 xfree(encoded);
71 return len;
72}
73
74void
2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 57 unchanged lines hidden (view full) ---

67 /* and remove trailing whitespace because __b64_pton needs this */
68 *p = '\0';
69 len = __b64_pton(encoded, target, targsize);
70 xfree(encoded);
71 return len;
72}
73
74void
75dump_base64(FILE *fp, u_char *data, u_int len)
75dump_base64(FILE *fp, const u_char *data, u_int len)
76{
77 char *buf;
78 int i, n;
79
80 if (len > 65536) {
81 fprintf(fp, "dump_base64: len > 65536\n");
82 return;
83 }
84 buf = xmalloc(2*len);
85 n = uuencode(data, len, buf, 2*len);
86 for (i = 0; i < n; i++) {
87 fprintf(fp, "%c", buf[i]);
88 if (i % 70 == 69)
89 fprintf(fp, "\n");
90 }
91 if (i % 70 != 69)
92 fprintf(fp, "\n");
93 xfree(buf);
94}
76{
77 char *buf;
78 int i, n;
79
80 if (len > 65536) {
81 fprintf(fp, "dump_base64: len > 65536\n");
82 return;
83 }
84 buf = xmalloc(2*len);
85 n = uuencode(data, len, buf, 2*len);
86 for (i = 0; i < n; i++) {
87 fprintf(fp, "%c", buf[i]);
88 if (i % 70 == 69)
89 fprintf(fp, "\n");
90 }
91 if (i % 70 != 69)
92 fprintf(fp, "\n");
93 xfree(buf);
94}