Esempio n. 1
0
int
main(int argc, char * argv[]) {

    FILE* ifp;
    bit** bits;
    int rows, cols;
    const char * inputFilename;

    pbm_init(&argc, argv);

    if (argc-1 > 0)
        pm_error("Too many arguments (%d).  The only valid argument is an "
                 "input file name.", argc-1);
    else if (argc-1 == 1) 
        inputFilename = argv[1];
    else
        inputFilename = "-";

    ifp = pm_openr(inputFilename);
    
    bits = pbm_readpbm(ifp, &cols, &rows);

    if (rows > 255)
        pm_error("Image is too high:  %d rows.  Max height: 255 rows", rows);
    if (cols > 255)
        pm_error("Image is too wide:  %d cols.  Max width: 255 cols", cols);

    generateMo(stdout, bits, cols, rows);
    
    pm_close(ifp);

    pbm_freearray(bits, rows);

    exit(0);
}
Esempio n. 2
0
int recv_run(pthread_mutex_t *recv_ready_mutex)
{
	log_trace("recv", "recv thread started");
	log_debug("recv", "capturing responses on %s", zconf.iface);
	if (!zconf.dryrun) {
		recv_init();
	}
	if (zconf.send_ip_pkts) {
		struct ether_header *eth = (struct ether_header *) fake_eth_hdr;
		memset(fake_eth_hdr, 0, sizeof(fake_eth_hdr));
		eth->ether_type = htons(ETHERTYPE_IP);
	}
	// initialize paged bitmap
	seen = pbm_init();
	if (zconf.filter_duplicates) {
		log_debug("recv", "duplicate responses will be excluded from output");
	} else {
		log_debug("recv", "duplicate responses will be included in output");
	}
	if (zconf.filter_unsuccessful) {
		log_debug("recv", "unsuccessful responses will be excluded from output");
	} else {
		log_debug("recv", "unsuccessful responses will be included in output");
	}

	pthread_mutex_lock(recv_ready_mutex);
	zconf.recv_ready = 1;
	pthread_mutex_unlock(recv_ready_mutex);
	zrecv.start = now();
	if (zconf.max_results == 0) {
		zconf.max_results = -1;
	}

	do {
		if (zconf.dryrun) {
			sleep(1);
		} else {
			recv_packets();
			if (zconf.max_results && zrecv.success_unique >= zconf.max_results) {
				break;
			}
		}
	} while (!(zsend.complete && (now()-zsend.finish > zconf.cooldown_secs)));
	zrecv.finish = now();
	// get final pcap statistics before closing
	recv_update_stats();
	if (!zconf.dryrun) {
		pthread_mutex_lock(recv_ready_mutex);
		recv_cleanup();
		pthread_mutex_unlock(recv_ready_mutex);
	}
	zrecv.complete = 1;
	log_debug("recv", "thread finished");
	return 0;
}
Esempio n. 3
0
int
main(int argc, char **argv) {

    FILE *ifp;
    register bit *bitrow, *bP;
    int rows, cols, row, col, charcount;
    unsigned char *data, mask;


    pbm_init ( &argc, argv );

    if ( argc > 2 )
        pm_usage( "[raster obj]" );
    
    if ( argc == 2 )
        ifp = pm_openr( argv[1] );
    else
        ifp = stdin;

    ReadATKRaster( ifp, &cols, &rows, &data );

    pm_close( ifp );

    pbm_writepbminit( stdout, cols, rows, 0 );
    bitrow = pbm_allocrow( cols );

    for ( row = 0; row < rows; ++row )
    {
        charcount = 0;
        mask = 0x80;
        for ( col = 0, bP = bitrow; col < cols; ++col, ++bP )
        {
            if ( charcount >= 8 )
            {
                ++data;
                charcount = 0;
                mask = 0x80;
            }
            *bP = ( *data & mask ) ? PBM_BLACK : PBM_WHITE;
            ++charcount;
            mask >>= 1;
        }
        ++data;
        pbm_writepbmrow( stdout, bitrow, cols, 0 );
    }

    pm_close( stdout );
    exit( 0 );
}
Esempio n. 4
0
int
main(int    argc,
     char * argv[]) {

    FILE * ifP;
    unsigned char * bitrow;
    unsigned int rows, cols, depth;
    unsigned int padright;
    unsigned int row;
    unsigned int itemCount;
    const char * inputFileName;

    pbm_init(&argc, argv);

    if (argc-1 > 1)
        pm_error("Too many arguments (%u).  "
                 "Only argument is optional input file", argc-1);
    if (argc-1 == 1)
        inputFileName = argv[1];
    else
        inputFileName = "-";
    
    ifP = pm_openr(inputFileName);

    readMgrHeader(ifP, &cols, &rows, &depth, &padright);
    if (depth != 1)
        pm_error("MGR file has depth of %u, must be 1", depth);

    pbm_writepbminit(stdout, cols, rows, 0);

    bitrow = pbm_allocrow_packed(cols + padright);
    
    itemCount = (cols + padright ) / 8;

    for (row = 0; row < rows; ++row) {
        /* The raster formats are nearly identical.
           MGR may have rows padded to 16 or 32 bit boundaries.
        */
        size_t bytesRead;
        bytesRead = fread(bitrow, 1, itemCount, ifP);
        if (bytesRead < itemCount)
            pm_error("fread() failed to read mgr bitmap data");

        pbm_writepbmrow_packed(stdout, bitrow, cols, 0);
    }
    pm_close(ifP);
    pm_close(stdout);
    return 0;
}
Esempio n. 5
0
int
main( int argc, char* argv[])
    {
    FILE* ifp;
    bit* bitrow;
    int rows, cols, format, row, col;

    pbm_init( &argc, argv );

    if ( argc > 2 )
        pm_usage( "[pbmfile]" );

    if ( argc == 2 )
        ifp = pm_openr( argv[1] );
    else
        ifp = stdin;

    pbm_readpbminit( ifp, &cols, &rows, &format );

    if( rows>INT16MAX || cols>INT16MAX )
      pm_error ("Input image is too large.");


    bitrow = pbm_allocrow( cols );

    putinit (rows, cols);
    for ( row = 0; row < rows; ++row )
        {
#ifdef DEBUG
        fprintf (stderr, "row %d\n", row);
#endif
        pbm_readpbmrow( ifp, bitrow, cols, format );
        for ( col = 0; col < cols; ++col )
            putbit( bitrow[col] );
        putrow( );
        }
    flushrow ();

    pm_close( ifp );


    exit( 0 );
    }
Esempio n. 6
0
int
main(int argc, char * argv[]) {

    struct cmdlineInfo cmdline;
    FILE * ifP;
    bool eof;

    pbm_init(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFilename);

    eof = FALSE;
    while (!eof) {
        doPage(ifP, cmdline);
        pbm_nextimage(ifP, &eof);
    }

    pm_close(ifP);

    return 0;
}
Esempio n. 7
0
int 
main(int argc,char **argv) {

  struct cmdlineInfo cmdline;
  unsigned int i;

  pbm_init(&argc, argv);

  parseCommandLine(argc, argv, &cmdline);

  sent_xon = FALSE;

  for (i = 0; i < cmdline.nFiles; ++i) {
      FILE *ifP;
      pm_message("opening '%s'", cmdline.inputFile[i]);
      ifP = pm_openr(cmdline.inputFile[i]);
      process_handle(ifP, cmdline.graph_mode, cmdline.passes);
      pm_close(ifP);
  }

  free(cmdline.inputFile);

  return 0;
}
Esempio n. 8
0
int
main(int argc, char * argv[]) {

    FILE* ifp;
    bit* bitrow;
    int rows, cols, format;
    int padright;
    int row;
    const char * inputFilename;
    const char *name;
    int itemsperline;
    int bitsperitem;
    int item;
    int firstitem;
    const char hexchar[] = "0123456789abcdef";

    pbm_init(&argc, argv);

    if (argc-1 > 1)
        pm_error("Too many arguments (%d).  The only valid argument is an "
                 "input file name.", argc-1);
    else if (argc-1 == 1) 
        inputFilename = argv[1];
    else
        inputFilename = "-";

    generateName(inputFilename, &name);
    ifp = pm_openr(inputFilename);
    
    pbm_readpbminit(ifp, &cols, &rows, &format);
    bitrow = pbm_allocrow(cols);
    
    /* Compute padding to round cols up to the nearest multiple of 8. */
    overflow_add(cols, 8);
    padright = ((cols + 7)/8) * 8 - cols;

    printf("#define %s_width %d\n", name, cols);
    printf("#define %s_height %d\n", name, rows);
    printf("static char %s_bits[] = {\n", name);

    itemsperline = 0;
    bitsperitem = 0;
    item = 0;
    firstitem = 1;

#define PUTITEM \
    { \
    if ( firstitem ) \
        firstitem = 0; \
    else \
        putchar( ',' ); \
    if ( itemsperline == 15 ) \
        { \
        putchar( '\n' ); \
        itemsperline = 0; \
        } \
    if ( itemsperline == 0 ) \
        putchar( ' ' ); \
    ++itemsperline; \
    putchar('0'); \
    putchar('x'); \
    putchar(hexchar[item >> 4]); \
    putchar(hexchar[item & 15]); \
    bitsperitem = 0; \
    item = 0; \
    }

#define PUTBIT(b) \
    { \
    if ( bitsperitem == 8 ) \
        PUTITEM; \
    if ( (b) == PBM_BLACK ) \
        item += 1 << bitsperitem; \
    ++bitsperitem; \
    }

    for (row = 0; row < rows; ++row) {
        int col;
        pbm_readpbmrow(ifp, bitrow, cols, format);
        for (col = 0; col < cols; ++col)
            PUTBIT(bitrow[col]);
        for (col = 0; col < padright; ++col)
            PUTBIT(0);
    }

    pm_close(ifp);

    if (bitsperitem > 0)
        PUTITEM;
    printf("};\n");

    pbm_freerow(bitrow);

    strfree(name);

    exit(0);
}
Esempio n. 9
0
int 
main(int argc, char **argv) {
    int n, optstop = 0;
    char *fname = NULL;

    pbm_init(&argc, argv);

    /* Parse options */

    for (n = 1; n < argc; ++n) {
        if (argv[n][0] == '-' && !optstop) {   
            if (argv[n][1] == 'a' || argv[n][1] == 'A') bAscii = 1;
            if (argv[n][1] == 'd' || argv[n][1] == 'D') bScale = 1;
            if (argv[n][1] == 'i' || argv[n][1] == 'I') bInvert = 1;
            if (argv[n][1] == 'h' || argv[n][1] == 'H') usage(argv[0]);
            if (argv[n][1] == '-' && argv[n][2] == 0 && !fname) {
                /* "--" */
                optstop = 1;
            }
            if (argv[n][1] == '-' && (argv[n][2] == 'h' || argv[n][2] == 'H'))
                usage(argv[0]);
        }
        else if (argv[n][0] && !fname) {
            /* Filename */
            fname = argv[n];
        }
    }

    if (fname) 
        infile = pm_openr(fname);
    else
        infile = stdin;

    /* Read MDA file header */

    if (fread(header, 1, 128, infile) < 128)
        pm_error("Not a .MDA file\n");

    if (strncmp((char*) header, ".MDA", 4) && 
        strncmp((char*) header, ".MDP", 4))
        pm_error("Not a .MDA file\n");

    {
        short yy;
        pm_readlittleshort(infile, &yy); nInRows = yy;
        pm_readlittleshort(infile, &yy); nInCols = yy;
    }
    
    overflow2(nOutCols, 8);
    nOutCols = 8 * nInCols;
    nOutRows = nInRows;
    if (bScale) {
        overflow2(nOutRows, 2);
        nOutRows *= 2;
    }

    data = pbm_allocarray(nOutCols, nOutRows);
    
    MALLOCARRAY_NOFAIL(mdrow, nInCols);

    if (header[21] == '0') 
        md2_trans();
    else
        md3_trans();

    pbm_writepbm(stdout, data, nInCols*8, nOutRows, bAscii);

    if (infile != stdin) 
        pm_close(infile);
    fflush(stdout);
    pbm_freearray(data, nOutRows);
    free(mdrow);

    return 0;
}
Esempio n. 10
0
int 
main(int argc, char *argv[]) {

    int argn;
    int got_in=0, got_out=0, do_continue=1;
    FILE *in=stdin, *out=stdout;
    struct stat tmpstat;

    pbm_init(&argc, argv);

    printer.version       = DEFAULT_PRINTER;
    printer.x_offset      = DEFAULT_X_OFFSET;
    printer.y_offset      = DEFAULT_Y_OFFSET;
    printer.top_margin    = DEFAULT_TOP_MARGIN;
    printer.left_margin   = DEFAULT_LEFT_MARGIN;
    printer.right_margin  = DEFAULT_RIGHT_MARGIN;
    printer.bottom_margin = DEFAULT_BOTTOM_MARGIN;
    printer.DPI           = DEFAULT_DPI;
    Width = USWIDTH;
    Height = USHEIGHT;
    set_printer_specific_defaults();

    if(!stat(defaultcfgfile,&tmpstat))
        read_config_file(defaultcfgfile);

    for(argn=1; argn<argc; argn++)
    {
        if(!strcmp(argv[argn],"-h"))
        {
            show_usage(*argv);
            return 0;
        }
        else if(!strcmp(argv[argn],"-d"))
            dump_config();
        else if(argn+1<argc)
        {
            do_continue=1;
            if(!strcmp(argv[argn],"-v"))
                parm_version(argv[++argn]);
            else if(!strcmp(argv[argn],"-x"))
                printer.x_offset+=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-y"))
                printer.y_offset+=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-t"))
                printer.top_margin=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-l"))
                printer.left_margin=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-r"))
                printer.right_margin=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-b"))
                printer.bottom_margin=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-d"))
                printer.DPI=atoi(argv[++argn]);
            else if(!strcmp(argv[argn],"-s"))
            {
                argn++;
                if(!strcmp(argv[argn],"us"))
                {
                    Width = USWIDTH;
                    Height = USHEIGHT;
                }
                else if(!strcmp(argv[argn],"a4"))
                {
                    Width = A4WIDTH;
                    Height = A4HEIGHT;
                }
                else
                    pm_error("unknown paper size %s",argv[argn]);
            }
            else if(!strcmp(argv[argn],"-f"))
                read_config_file(argv[++argn]);
            else do_continue=0;
            if(do_continue) continue;
        }

        if(!got_in)
        {
            if (strcmp (argv[argn], "-") == 0)
                in = stdin;
            else if ((in = fopen (argv[argn], "rb")) == NULL)
                pm_error("main(): couldn't open file '%s'", 
                         argv[argn]);
            got_in=1;
        }
        else if(!got_out)
        {
            if (strcmp (argv[argn], "-") == 0)
                out = stdout;
            else if ((out = fopen (argv[argn], "wb")) == NULL)
                pm_error("main(): couldn't open file '%s'", 
                         argv[argn]);
            got_out=1;
        }
        else
            pm_error("main(): unrecognized parameter '%s'", argv[argn]);
    }

    Pwidth=(Width+7)/8;
    printer.fptr=out;

    return print_pbm (in);
}
Esempio n. 11
0
int
main (int argc, char **argv) {
   int argc_copy = argc ;
   char **argv_copy = argv ;
   int argn;
   const char * const usage = "[-left <nn>] [-right <nn>] [-top <nn>] "
       "[-bottom <nn>] [-formlength <nn>] [pbmfile]";

   /* Options */
   /* These defaults are for a DEC LN03 with A4 paper (2400x3400 pixels) */
   const char *opt_left_margin = "0";
   const char *opt_top_margin = opt_left_margin;
   const char *opt_right_margin = "2400";
   const char *opt_bottom_margin = "3400";
   const char *opt_form_length = opt_bottom_margin;

   int width, height, format ;

   pbm_init (&argc_copy, argv_copy) ;

   argn = 1;
   while( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) {
      if( pm_keymatch(argv[argn], "-left", 2) ) {
         if( ++argn >= argc )
            pm_usage(usage);
         opt_left_margin = argv[argn];
      }
      else
      if( pm_keymatch(argv[argn], "-right", 2) ) {
         if( ++argn >= argc )
            pm_usage(usage);
         opt_right_margin = argv[argn];
      }
      else
      if( pm_keymatch(argv[argn], "-top", 2) ) {
         if( ++argn >= argc )
            pm_usage(usage);
         opt_top_margin = argv[argn];
      }
      else
      if( pm_keymatch(argv[argn], "-bottom", 2) ) {
         if( ++argn >= argc )
            pm_usage(usage);
         opt_bottom_margin = argv[argn];
      }
      else
      if( pm_keymatch(argv[argn], "-formlength", 2) ) {
         if( ++argn >= argc )
            pm_usage(usage);
         opt_form_length = argv[argn];
      }
      else
         pm_usage(usage);
      ++argn;
   }

   if( argn < argc ) {
      input = pm_openr( argv[argn] );
      argn++;
   }
   else
      input = stdin;

   if( argn != argc )
      pm_usage(usage);


   /* Initialise pbm file */
   pbm_readpbminit (input, &width, &height, &format) ;

   if (format != PBM_FORMAT && format != RPBM_FORMAT)
      pm_error ("input not in PBM format") ;

/*
 * In explanation of the sequence below:
 *      <ESC>[!p        DECSTR  soft terminal reset
 *      <ESC>[11h       PUM     select unit of measurement
 *      <ESC>[7 I       SSU     select pixel as size unit
 *      <ESC>[?52l      DECOPM  origin is corner of printable area
 *      <ESC>[%s;%ss    DECSLRM left and right margins
 *      <ESC>[%s;%sr    DECSTBM top and bottom margins
 *      <ESC>[%st       DECSLPP form length
 *      <ESC>P0;0;1q            select sixel graphics mode
 *      "1;1            DECGRA  aspect ratio (1:1)
 */

   /* Initialise sixel file */
   printf ("\033[!p\033[11h\033[7 I\033[?52l\033[%s;%ss\033"
           "[%s;%sr\033[%st\033P0;0;1q\"1;1",
      opt_left_margin, opt_right_margin, opt_top_margin, opt_bottom_margin,
      opt_form_length);

   /* Convert data */
   convert (width, height, format) ;

   /* Terminate sixel data */
   print ("\033\\\n") ;

   /* If the program failed, it previously aborted with nonzero completion
      code, via various function calls.
   */
   return 0;
}
Esempio n. 12
0
int
main(int argc, char* argv[]) {

    FILE* ifP;
    int rows, cols;
    int format;
    unsigned int row, idx, len;
    unsigned int h, v;
    unsigned char *bytes, *cprbytes;
    struct cmdlineInfo cmdline;
    
    pbm_init(&argc, argv);

    parseCommandLine(argc, argv, &cmdline);

    ifP = pm_openr(cmdline.inputFileName);

    pbm_readpbminit(ifP, &cols, &rows, &format);

    bytes = malloc(24*pbm_packed_bytes(cols)+2);
    cprbytes = malloc(2*24*pbm_packed_bytes(cols));
    if (bytes == NULL || cprbytes == NULL)
        pm_error("Cannot allocate memory");

    h = v = 3600/cmdline.resolution;

    /* Set raster graphic mode. */
    printf("%c%c%c%c%c%c", esc, '(', 'G', 1, 0, 1);

    /* Set line spacing in units of 1/360 inches. */
    printf("%c%c%c", esc, '+', 24*h/10);

    /* Write out raster stripes 24 rows high. */
    for (row = 0; row < rows; row += 24) {
        unsigned int const linesThisStripe = (rows-row<24) ? rows%24 : 24;
        printf("%c%c%c%c%c%c%c%c", esc, '.', cmdline.compress, 
               v, h, linesThisStripe, 
               cols%256, cols/256);
        /* Read pbm rows, each padded to full byte */
        for (idx = 0; idx < 24 && row+idx < rows; ++idx)
            pbm_readpbmrow_packed(ifP,bytes+idx*pbm_packed_bytes(cols),
                                  cols,format);
        /* Write raster data. */
        if (cmdline.compress != 0) {
            /* compressed */
            len = enc_epson_rle(linesThisStripe * pbm_packed_bytes(cols), 
                                bytes, cprbytes);
            fwrite(cprbytes,len,1,stdout);
        } else
            /* uncompressed */
            fwrite(bytes, pbm_packed_bytes(cols), linesThisStripe, stdout);    

        if (rows-row >= 24) putchar('\n');
    }
    free(bytes); free(cprbytes);
    pm_close(ifP);

    /* Reset printer. */
    printf("%c%c", esc, '@');

    return 0;
}
Esempio n. 13
0
int
main( int argc, char * argv[])  {

    FILE * ifp;
    int argn, extraskip;
    const char * const usage = "[-extraskip N] [macpfile]";
    int outOfSync;
    int pixelCnt;

    pbm_init( &argc, argv );

    argn = 1;      /* initial value */
    extraskip = 0; /* initial value */

    /* Check for flags. */
    if ( argn < argc && argv[argn][0] == '-' && argv[argn][1] != '\0' ) {
        if ( pm_keymatch( argv[argn], "-extraskip", 2 ) ) {
            argn++;
            if ( argn == argc || sscanf( argv[argn], "%d", &extraskip ) != 1 )
                pm_usage( usage );
        }
        else
            pm_usage( usage );
        argn++;
    }

    if ( argn < argc ) {
        ifp = pm_openr( argv[argn] );
        argn++;
        }
    else
        ifp = stdin;

    if ( argn != argc )
        pm_usage( usage );

    if ( extraskip > 256 * 1024 )
        pm_error("-extraskip value too large");
    else if ( extraskip > 0 )
        skipExtraBytes( ifp, extraskip);
    else
        skipHeader( ifp );

    pbm_writepbminit( stdout, MACP_COLS, MACP_ROWS, 0 );

    ReadMacPaintFile( ifp, &outOfSync, &pixelCnt );
    /* We may not be at EOF.
       Macpaint files often have extra bytes after image data. */
    pm_close( ifp );

    if ( pixelCnt == 0 )
        pm_error("No image data.");

    else if ( pixelCnt < MACP_BYTES )
        pm_error("Compressed image data terminated prematurely.");

    else if ( outOfSync > 0 )
        pm_message("Warning: Corrupt image data.  %d rows misaligned.",
                   outOfSync);

    pm_close( stdout );
    exit( 0 );
}
Esempio n. 14
0
/*{{{  void main(int argc, char **argv)*/
void main(int argc, char **argv)
{
  int i;
  int c;
  char *ptype=NULL;
  extern char *optarg;
  extern int optind;

  pbm_init(&argc, argv);
  
  /*{{{  argument parsing*/
  while((c=getopt(argc, argv,"vhp:"))!=EOF)
    switch(c)
    {
      case 'v' : verbose=1; break;
      case 'h' : printf("Available drivers:\n");
                 for(i=0; i<PRINTERS; i++)
                   printf("  %s\n", printer[i].name);
                 putchar('\n');
                 usage(); break;
      case 'p' : ptype=optarg; break;
    }
  /*}}}  */
  if(verbose) fprintf(stderr, "verbose mode:\n");

  /*{{{  open file or stdin*/
  switch(argc-optind)
  {
    case 1:
            if(verbose) fprintf(stderr, "opening %s ...\n", argv[optind]);
            fp=pm_openr(argv[optind]);
            break;
    case 0:
            if(verbose) fprintf(stderr, "opening stdin ...\n");
            fp=stdin;
            break;
    default: usage();
  }
  /*}}}  */

  /*{{{  check printer, read header and go*/
  i=0;

  /*{{{  check printerdevice*/
  if(ptype)
     while(strcmp(ptype, printer[i].name) && i<PRINTERS) i++;

  if(verbose && i<PRINTERS) fprintf(stderr, "selecting printertype %s\n", printer[i].name);

  if (i>=PRINTERS) {
    fprintf(stderr, "%s: '%s': No such printerdriver\n", argv[0], ptype);
    usage();
  }
  /*}}}  */


  while ((c=fgetc(fp))!=EOF) {         /* read multiple pages */
    ungetc(c, fp);                     /* Anybody has a better idea ? */
    /*{{{  read header*/
    pbm_readpbminit(fp, &cols, &rows, &format);
    if(format==RPBM_FORMAT)
      readpbmrow=my_readpbmrow;
    else
      readpbmrow=pbm_readpbmrow;
    /*}}}  */
    prtdrv[printer[i].prtno](i);       /* go */
  }
  /*}}}  */

  printf("\033@");                     /* reset printer */
  pm_close(fp);
  
  exit(0);
}