Compare commits

..

3 Commits

Author SHA1 Message Date
tTh
ba7ba3d666 working on patterns 2023-09-22 14:20:26 +02:00
tTh
806c9b0071 a few cleanup + new patterns 2023-09-22 14:15:52 +02:00
tTh
7b10854729 add a zerodivide mollyguard 2023-09-18 15:29:40 +02:00
14 changed files with 125 additions and 84 deletions

View File

@ -9,8 +9,7 @@
#include "../tthimage.h" #include "../tthimage.h"
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_000(Image_Desc *img, int foo)
Image_pattern_000(Image_Desc *img, int foo)
{ {
int x, y, xx, yy, r, g, b; int x, y, xx, yy, r, g, b;
@ -18,11 +17,9 @@ int x, y, xx, yy, r, g, b;
fprintf(stderr, "%s : foo = %d\n", __func__, foo); fprintf(stderr, "%s : foo = %d\n", __func__, foo);
#endif #endif
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{
xx = (x * 256) / img->width; xx = (x * 256) / img->width;
for (y=0; y<img->height; y++) for (y=0; y<img->height; y++) {
{
yy = (y * 256) / img->height; yy = (y * 256) / img->height;
r = xx & yy & foo; r = xx & yy & foo;
g = ((xx * yy) & 0xf8 ); g = ((xx * yy) & 0xf8 );
@ -37,8 +34,7 @@ for (x=0; x<img->width; x++)
return FUNC_IS_BETA; return FUNC_IS_BETA;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_001(Image_Desc *img, int foo)
Image_pattern_001(Image_Desc *img, int foo)
{ {
int x, y; int x, y;
@ -50,11 +46,10 @@ for (x=0; x<img->width; x++)
for (y=0; y<img->height; y++) for (y=0; y<img->height; y++)
Image_plotRGB(img, x, y, x^y^foo, (x*y)>>4, x&y); Image_plotRGB(img, x, y, x^y^foo, (x*y)>>4, x&y);
return FUNC_NOT_FINISH; return FUNC_IS_BETA;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_002(Image_Desc *img, int foo)
Image_pattern_002(Image_Desc *img, int foo)
{ {
int x, y, x2, y2; int x, y, x2, y2;
@ -62,11 +57,9 @@ int x, y, x2, y2;
fprintf(stderr, "Pattern 002: %d\n", foo); fprintf(stderr, "Pattern 002: %d\n", foo);
#endif #endif
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{
x2 = (x * 256) / img->width; x2 = (x * 256) / img->width;
for (y=0; y<img->height; y++) for (y=0; y<img->height; y++) {
{
y2 = (y * 256) / img->height; y2 = (y * 256) / img->height;
Image_plotRGB(img, x, y, (x2/2)&(y2/2)&foo, (x2*y2)>>3, x2^y2); Image_plotRGB(img, x, y, (x2/2)&(y2/2)&foo, (x2*y2)>>3, x2^y2);
} }
@ -75,8 +68,7 @@ for (x=0; x<img->width; x++)
return FUNC_IS_BETA; return FUNC_IS_BETA;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_003(Image_Desc *img, int foo)
Image_pattern_003(Image_Desc *img, int foo)
{ {
int x, x2, y, y2; int x, x2, y, y2;
@ -85,11 +77,9 @@ fprintf(stderr, "Pattern 003: foo is %d\n", foo);
#endif #endif
/* added some ugly code the 28 february 2008 */ /* added some ugly code the 28 february 2008 */
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{
x2 = (x * 256) / img->width; x2 = (x * 256) / img->width;
for (y=0; y<img->height; y++) for (y=0; y<img->height; y++) {
{
y2 = (y * 256) / img->height; y2 = (y * 256) / img->height;
Image_plotRGB(img, x, y, (x2/4)&(y2/4)&foo, (x2*y2)>>5, x2^y2); Image_plotRGB(img, x, y, (x2/4)&(y2/4)&foo, (x2*y2)>>5, x2^y2);
} }
@ -98,8 +88,7 @@ for (x=0; x<img->width; x++)
return FUNC_NOT_FINISH; return FUNC_NOT_FINISH;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_004(Image_Desc *img, int a, int b, int c, int d)
Image_pattern_004(Image_Desc *img, int a, int b, int c, int d)
{ {
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "Pattern 004: %d, %d, %d, %d\n", a, b, c, d); fprintf(stderr, "Pattern 004: %d, %d, %d, %d\n", a, b, c, d);
@ -122,11 +111,9 @@ if (NULL == map) {
return NULL_POINTER; return NULL_POINTER;
} }
for (y=0; y<img->height; y++) for (y=0; y<img->height; y++) {
{
fy = (double)y; fy = (double)y;
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{
fx = (double)x; fx = (double)x;
idx = (int)(127.0+(sin(fx)*cos(fy)*254.99)); idx = (int)(127.0+(sin(fx)*cos(fy)*254.99));
@ -140,8 +127,7 @@ for (y=0; y<img->height; y++)
return FUNC_NOT_FINISH; return FUNC_NOT_FINISH;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_042(Image_Desc *img, int foo)
Image_pattern_042(Image_Desc *img, int foo)
{ {
int x, y, r, g, b; int x, y, r, g, b;
@ -150,10 +136,8 @@ fprintf(stderr, "Pattern 042: threshold level is %d\n", foo);
#endif #endif
r = g = b = 42; r = g = b = 42;
for (x=0; x<img->width; x++) for (x=0; x<img->width; x++) {
{ for (y=0; y<img->height; y++) {
for (y=0; y<img->height; y++)
{
r += rand() % 4; r += rand() % 4;
if (r > foo) r = 0; if (r > foo) r = 0;

View File

@ -16,15 +16,15 @@
/* /*
* c'est quasiment impossible de documenter cette fonction. * c'est quasiment impossible de documenter cette fonction.
*/ */
int int Image_pattern_100(Image_Desc *dst, int kr, int kg, int kb)
Image_pattern_100(Image_Desc *dst, int kr, int kg, int kb)
{ {
int x, y, r,g, b; int x, y, r,g, b;
for (x=0; x<dst->width; x++) fprintf(stderr, ">>> %s ( %p %d %d %d )\n", __func__,
{ dst, kr, kg, kb);
for (y=0; y<dst->height; y++)
{ for (x=0; x<dst->width; x++) {
for (y=0; y<dst->height; y++) {
r = abs(x+y-(dst->width/3)) * kr; r = abs(x+y-(dst->width/3)) * kr;
g = abs(x-y-(dst->height/3)) * kg; g = abs(x-y-(dst->height/3)) * kg;
b = (rand() % 42) + kb; b = (rand() % 42) + kb;
@ -36,19 +36,19 @@ for (x=0; x<dst->width; x++)
return FUNC_IS_BETA; return FUNC_IS_BETA;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_101(Image_Desc *dst, int kr, int kg, int kb)
Image_pattern_101(Image_Desc *dst, int kr, int kg, int kb)
{ {
int x, y, r,g, b; int x, y, r,g, b;
fprintf(stderr, ">>> %s ( %p %d %d %d )\n", __func__,
dst, kr, kg, kb);
if (kr == 0) kr = 1; if (kr == 0) kr = 1;
if (kg == 0) kg = 1; if (kg == 0) kg = 1;
if (kb == 0) kb = 1; if (kb == 0) kb = 1;
for (x=0; x<dst->width; x++) for (x=0; x<dst->width; x++) {
{ for (y=0; y<dst->height; y++) {
for (y=0; y<dst->height; y++)
{
if (x < dst->width/2) if (x < dst->width/2)
{ r=x/kr; g=y/kg; b=x/kb; } { r=x/kr; g=y/kg; b=x/kb; }
else else
@ -59,18 +59,15 @@ for (x=0; x<dst->width; x++)
return FUNC_IS_BETA; return FUNC_IS_BETA;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int int Image_pattern_102(Image_Desc *dst, int param, int kr, int kg, int kb)
Image_pattern_102(Image_Desc *dst, int param, int kr, int kg, int kb)
{ {
int x, y, r,g, b; int x, y, r,g, b;
for (x=0; x<dst->width; x++) for (x=0; x<dst->width; x++) {
{ for (y=0; y<dst->height; y++) {
for (y=0; y<dst->height; y++)
{
r = x ^ kr; r = x ^ kr;
g = y ^ kg; g = y ^ kg;
b = (x+y) ^ kb; b = (x+y+param) ^ kb;
Image_plotRGB(dst, x, y, r, g, b); Image_plotRGB(dst, x, y, r, g, b);
} }
} }
@ -80,26 +77,20 @@ return FUNC_NOT_FINISH;
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
/* hop, 31 mars 2008, une petite evolution stochastique de base... /* hop, 31 mars 2008, une petite evolution stochastique de base...
* */ * */
int int Image_pattern_103(Image_Desc *dst, int param, int kr, int kg, int kb)
Image_pattern_103(Image_Desc *dst, int param, int kr, int kg, int kb)
{ {
int x, y, r, g, b; int x, y, r, g, b;
long surface;
double dx, dy; double dx, dy;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, "%s: acting on image %p\n", __func__, dst); fprintf(stderr, "%s: acting on image %p\n", __func__, dst);
#endif #endif
surface = dst->width * dst->height; for (x=0; x<dst->width; x++) {
for (x=0; x<dst->width; x++)
{
dx = (double)x / (double)dst->width; dx = (double)x / (double)dst->width;
for (y=0; y<dst->height; y++) for (y=0; y<dst->height; y++) {
{
dy = (double)x / (double)dst->height; dy = (double)x / (double)dst->height;
r = (int)round(256.0 * sqrt(dx * dy)); /* XXX */ r = (int)(256.0 * sqrt(dx * dy)); /* XXX */
g = b = rand() & 0xf0; g = b = rand() & 0xf0;
Image_plotRGB(dst, x, y, r, g, b); Image_plotRGB(dst, x, y, r, g, b);
} }

View File

@ -23,6 +23,12 @@ int x, y, v, delta;
delta = high - low; delta = high - low;
if (0 == delta) {
fprintf(stderr, "%s: bad low/high parameters %d %d <- delta is 0\n",
__func__, low, high);
return DIVISOR_IS_ZERO;
}
for (x=0; x<dst->width; x++) for (x=0; x<dst->width; x++)
{ {
for (y=0; y<dst->height; y++) for (y=0; y<dst->height; y++)
@ -44,6 +50,12 @@ int x, y, r, g, b, delta;
delta = high - low; delta = high - low;
if (0 == delta) {
fprintf(stderr, "%s: bad low/high parameters %d %d <- delta is 0\n",
__func__, low, high);
return DIVISOR_IS_ZERO;
}
for (x=0; x<dst->width; x++) for (x=0; x<dst->width; x++)
{ {
for (y=0; y<dst->height; y++) for (y=0; y<dst->height; y++)

View File

@ -43,6 +43,14 @@ Paramètres mal documentés.
## tga_combine ## tga_combine
```
Usage:
tga_combine s1.tga s2.tga MODE d.tga [PARAMS]
```
Il existe plein de façon de combiner deux images, la commande
`testtga list` vous les fera découvrir, la cinquième va vous étonner.
## tga_dither ## tga_dither
Comment drastiquement réduire le nombre de couleurs d'une image ? Comment drastiquement réduire le nombre de couleurs d'une image ?
@ -67,6 +75,9 @@ La génération de diverses image de test ou de calibration.
## tga_pattern ## tga_pattern
Les résultats sont très ésotériques et l'aide en ligne est
vraiment trop nulle...
## tga_remap ## tga_remap
## tga_television ## tga_television

View File

@ -159,6 +159,10 @@ cptr = strtok(cptr, ",");
while (NULL != cptr) { while (NULL != cptr) {
fprintf(stderr, "%3d %p = '%s'\n", idx, cptr, cptr); fprintf(stderr, "%3d %p = '%s'\n", idx, cptr, cptr);
foo = sscanf(cptr, "%d", &val); foo = sscanf(cptr, "%d", &val);
if (1 != foo) {
fprintf(stderr, "%s: err sscanf on '%s'\n", __func__, cptr);
exit(1);
}
/* /*
* no error check ? * no error check ?
*/ */

View File

@ -58,8 +58,8 @@ int main(int argc, char *argv[])
{ {
Image_Desc *src, *dst; Image_Desc *src, *dst;
int foo; int foo;
RGB_map map;
int idx, commande, nbargs; int idx, commande, nbargs;
/* XXX RGB_map map; */
dump_command_line(argc, argv, 0); dump_command_line(argc, argv, 0);

View File

@ -101,14 +101,14 @@ Image_print_version(0);
fputs("Usage:\n", stderr); fputs("Usage:\n", stderr);
fputs("\ttga_combine s1.tga s2.tga MODE d.tga [PARAMS]\n", stderr); fputs("\ttga_combine s1.tga s2.tga MODE d.tga [PARAMS]\n", stderr);
fputs("\n", stderr); fputs("\n", stderr);
if (flag) liste_mots_clefs(les_types, 0); if (flag) liste_mots_clefs(les_types, 42);
exit(0); exit(0);
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int combine_proto(Image_Desc *sa, Image_Desc *sb, Image_Desc *dest) int combine_proto(Image_Desc *sa, Image_Desc *sb, Image_Desc *dest)
{ {
fprintf(stderr, "%p + %p -> %p\n", sa, sb, dest); fprintf(stderr, "%s: %p + %p -> %p\n", __func__, sa, sb, dest);
return 42; return 42;
} }

View File

@ -134,6 +134,10 @@ int contours_du_gris(Image_Desc *src, Image_Desc *dst)
Image_Desc *tmp; Image_Desc *tmp;
int foo; int foo;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p )\n", src, dst);
#endif
tmp = Image_clone(src, 1); tmp = Image_clone(src, 1);
foo = Image_to_gray(src, tmp, 0); foo = Image_to_gray(src, tmp, 0);
@ -142,13 +146,13 @@ fprintf(stderr, "to_gray %d\n", foo);
#endif #endif
foo = Image_seuil_RGB(tmp, tmp, 64, 128, 192); foo = Image_seuil_RGB(tmp, tmp, 64, 128, 192);
#if DEBUG_LEVEL fprintf(stderr, "%s: seuil rgb -> %d\n", __func__, foo);
fprintf(stderr, "seuil rgb %d\n", foo);
#endif
Image_2x2_contours_0(tmp); Image_2x2_contours_0(tmp);
Image_copy(tmp, dst); Image_copy(tmp, dst);
Image_DeAllocate(tmp); free(tmp);
return 42; return 42;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
@ -202,7 +206,7 @@ fprintf(stderr, "%s :\n\t%p %p %s %d\n", __func__,
#endif #endif
foo = Image_Glitch_simple(src, dst, nbre); foo = Image_Glitch_simple(src, dst, nbre);
fprintf(stderr, "glitch simple -> %d\n", foo); fprintf(stderr, "glitch (%s) simple -> %d\n", type, foo);
return 0; return 0;
} }

View File

@ -127,12 +127,13 @@ switch (commande)
break; break;
} }
#if DEBUG_LEVEL if (foo) {
if (foo) fprintf(stderr, "%s: retour = %d, %s\n", argv[0],
fprintf(stderr, "retour = %d, %s\n", foo, Image_err2str(foo)); foo, Image_err2str(foo));
#endif }
foo = Image_TGA_save(argv[3], dst, 0); foo = Image_TGA_save(argv[3], dst, 0);
return 0; return 0;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/

View File

@ -7,7 +7,7 @@
#include "../tthimage.h" #include "../tthimage.h"
#define TGA_OUTILS_VERSION "0.61" #define TGA_OUTILS_VERSION "0.62"
/* /*
* 13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes. * 13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes.
* 11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient) * 11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient)
@ -22,7 +22,7 @@
* 18 Nov 2022: Vx.xx added parse_size_param * 18 Nov 2022: Vx.xx added parse_size_param
*/ */
#define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2022" #define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2023"
#define TGA_WWW_SITE "http://la.buvette.org/devel/libimage/" #define TGA_WWW_SITE "http://la.buvette.org/devel/libimage/"
#define PERR(txt) fprintf(stderr, "\t| %s\n", (txt)) #define PERR(txt) fprintf(stderr, "\t| %s\n", (txt))

View File

@ -28,13 +28,17 @@ struct type
#define TEXTURE_1 21 #define TEXTURE_1 21
#define TEXTURE_2 22 #define TEXTURE_2 22
#define TEXTURE_3 23 #define TEXTURE_3 23
#define EXPOV_0 30 #define EXPOV_0 24
#define PATT_100 30
#define PATT_101 31
#define PATT_102 32 /* new June 2003 */ #define PATT_102 32 /* new June 2003 */
#define GRAYNOISE2 40 #define GRAYNOISE2 40
#define RGBNOISE1 50 #define RGBNOISE1 50
#define RGBNOISE2 51 #define RGBNOISE2 51
#define CHECK_BW 80 #define CHECK_BW 80
#define PATT_000 90 #define PATT_000 90
#define PATT_001 91
#define PATT_002 92
static char no_help[] = "no help..."; static char no_help[] = "no help...";
@ -47,8 +51,12 @@ mot_clef mots_clef[] =
{ "text1", TEXTURE_1, "ii", no_help }, { "text1", TEXTURE_1, "ii", no_help },
{ "text2", TEXTURE_2, "iii", no_help }, { "text2", TEXTURE_2, "iii", no_help },
{ "expov", EXPOV_0, "iii", no_help }, { "expov", EXPOV_0, "iii", no_help },
{ "cent", PATT_100, "iii", "kr kg kb" },
{ "centun", PATT_101, "iii", "kr kg kb" },
{ "centdeux", PATT_102, "iiii", no_help }, { "centdeux", PATT_102, "iiii", no_help },
{ "first", PATT_000, "i", "byte mask" }, { "first", PATT_000, "i", "byte mask" },
{ "second", PATT_001, "i", "magic value" },
{ "third", PATT_002, "i", "magic value" },
{ "graynoise2", GRAYNOISE2, "ii", no_help }, { "graynoise2", GRAYNOISE2, "ii", no_help },
{ "rgbnoise1", RGBNOISE1, "iiiiii", no_help }, { "rgbnoise1", RGBNOISE1, "iiiiii", no_help },
{ "rgbnoise2", RGBNOISE2, "iiiiii", no_help }, { "rgbnoise2", RGBNOISE2, "iiiiii", no_help },
@ -59,7 +67,7 @@ mot_clef mots_clef[] =
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
void usage(int flag) void usage(int flag)
{ {
fprintf(stderr, "* Tga Pattern v 0.0.25 [%s] %s\n", fprintf(stderr, "* Tga Pattern v 0.0.28 [%s] %s\n",
TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT); TGA_OUTILS_VERSION, TGA_OUTILS_COPYLEFT);
Image_print_version(flag); Image_print_version(flag);
@ -87,7 +95,6 @@ RGBA rgba1, rgba2;
int commande, nbargs, idx; int commande, nbargs, idx;
dump_command_line(argc, argv, 0); dump_command_line(argc, argv, 0);
srand(getpid()); srand(getpid());
if (argc==1) usage(0); if (argc==1) usage(0);
@ -134,11 +141,14 @@ switch(commande)
break; break;
case RGBNOISE: case RGBNOISE:
fprintf(stderr, "entering RGBNOISE\n");
foo = Image_rgb_noise_0(dst, GIP(0), GIP(1)); foo = Image_rgb_noise_0(dst, GIP(0), GIP(1));
break; break;
case GRAYNOISE: case GRAYNOISE:
fprintf(stderr, "entering GRAYNOISE\n");
foo = Image_gray_noise_0(dst, GIP(0), GIP(1)); foo = Image_gray_noise_0(dst, GIP(0), GIP(1));
fprintf(stderr, "gray noise -> %d\n", foo);
break; break;
case TEXTURE_1: case TEXTURE_1:
@ -157,6 +167,21 @@ switch(commande)
foo = Image_pattern_000(dst, GIP(0)); foo = Image_pattern_000(dst, GIP(0));
break; break;
case PATT_001:
foo = Image_pattern_001(dst, GIP(0));
break;
case PATT_002:
foo = Image_pattern_002(dst, GIP(0));
break;
case PATT_100:
foo = Image_pattern_100(dst, GIP(0), GIP(1), GIP(2));
break;
case PATT_101:
foo = Image_pattern_101(dst, GIP(0), GIP(1), GIP(2));
break;
case PATT_102: case PATT_102:
foo = Image_pattern_102(dst, GIP(0), GIP(1), GIP(2), GIP(3)); foo = Image_pattern_102(dst, GIP(0), GIP(1), GIP(2), GIP(3));
break; break;

View File

@ -47,7 +47,6 @@ int main(int argc, char *argv[])
Image_Desc *src, *dst; Image_Desc *src, *dst;
int foo, type; int foo, type;
RGB_map map; RGB_map map;
long t_debut, t_fin;
dump_command_line(argc, argv, 0); dump_command_line(argc, argv, 0);

View File

@ -149,6 +149,11 @@ if (w < 1 || h < 1)
img = Image_alloc(w, h, 3); img = Image_alloc(w, h, 3);
Image_clear(img, r, g, b); Image_clear(img, r, g, b);
foo = Image_TGA_save(fname, img, 0); foo = Image_TGA_save(fname, img, 0);
if (foo) {
fprintf(stderr, "%s: saving '%s' -> %d\n", __func__, fname, foo);
return foo;
}
Image_DeAllocate(img), free(img);
return 666; return 666;
} }
@ -197,9 +202,10 @@ if (flag) {
posx = posy = 0; posx = posy = 0;
} }
if (must_be_verbose()) if (must_be_verbose()) {
fprintf(stderr, "%s:\n '%s' to '%s' with '%s' flg %d\n", \ fprintf(stderr, "%s:\n '%s' to '%s' with '%s' flg %d\n", \
__func__, fnin, fnout, txt, flag); __func__, fnin, fnout, txt, flag);
}
if ( (src=Image_TGA_alloc_load(fnin)) == NULL ) if ( (src=Image_TGA_alloc_load(fnin)) == NULL )
{ {
@ -224,6 +230,10 @@ Image_Desc *src;
long hr[256], hg[256], hb[256]; long hr[256], hg[256], hb[256];
int foo; int foo;
if (flags) {
fprintf(stderr, "in %s, flags must be 0\n", __func__);
}
if ( (src=Image_TGA_alloc_load(filename)) == NULL ) if ( (src=Image_TGA_alloc_load(filename)) == NULL )
{ {
fprintf(stderr, "tga_tools, chargement '%s' failed\n", filename); fprintf(stderr, "tga_tools, chargement '%s' failed\n", filename);