aboutsummaryrefslogtreecommitdiff
path: root/devel/picprog
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2002-11-19 01:40:28 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2002-11-19 01:40:28 +0000
commit2ef72abedc48488b5552aa7cae0e10641ae3cdd3 (patch)
treeb8aaa96e9c24dcdd0a3d294cbea4d09ca2aeb80b /devel/picprog
parenta0239918499bb2391012482ff87bc6dda00dc356 (diff)
downloadports-2ef72abedc48488b5552aa7cae0e10641ae3cdd3.tar.gz
ports-2ef72abedc48488b5552aa7cae0e10641ae3cdd3.zip
Notes
Diffstat (limited to 'devel/picprog')
-rw-r--r--devel/picprog/Makefile1
-rw-r--r--devel/picprog/files/patch-hexfile.cc332
-rw-r--r--devel/picprog/files/patch-hexfile.h22
-rw-r--r--devel/picprog/files/patch-main.cc50
-rw-r--r--devel/picprog/files/patch-picport.cc61
-rw-r--r--devel/picprog/files/patch-program.cc118
-rw-r--r--devel/picprog/files/patch-program.h11
7 files changed, 595 insertions, 0 deletions
diff --git a/devel/picprog/Makefile b/devel/picprog/Makefile
index 9af485e0ecdf..5e563b9d0df0 100644
--- a/devel/picprog/Makefile
+++ b/devel/picprog/Makefile
@@ -7,6 +7,7 @@
PORTNAME= picprog
PORTVERSION= 1.0.1
+PORTREVISION= 1
CATEGORIES= devel
MASTER_SITES= http://hyvatti.iki.fi/~jaakko/pic/
diff --git a/devel/picprog/files/patch-hexfile.cc b/devel/picprog/files/patch-hexfile.cc
new file mode 100644
index 000000000000..a612a1393bd9
--- /dev/null
+++ b/devel/picprog/files/patch-hexfile.cc
@@ -0,0 +1,332 @@
+--- hexfile.cc.orig Tue Nov 19 12:33:41 2002
++++ hexfile.cc Tue Nov 19 12:38:17 2002
+@@ -28,8 +28,8 @@
+
+ */
+
+-#include <iostream.h>
+-#include <iomanip.h>
++#include <iostream>
++#include <iomanip>
+ #include <sysexits.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -50,7 +50,7 @@
+
+ int hexfile::load (const char *name)
+ {
+- ifstream f(name);
++ std::ifstream f(name);
+ char buf [128];
+ int line = 0;
+ enum formats format = unknown;
+@@ -59,14 +59,14 @@
+
+ if (!f) {
+ e = errno;
+- cerr << name << ":unable to load hexfile:" << strerror (e) << endl;
++ std::cerr << name << ":unable to load hexfile:" << strerror (e) << std::endl;
+ return EX_NOINPUT;
+ }
+ while (f.get (buf, sizeof (buf))) {
+ line++;
+ char c;
+ if (f.get (c) && '\n' != c) {
+- cerr << name << ':' << line << ":long input line\n";
++ std::cerr << name << ':' << line << ":long input line\n";
+ return EX_DATAERR;
+ }
+ int len = strlen (buf);
+@@ -85,7 +85,7 @@
+
+ if (i || ':' != buf [0] || 3 != (len & 3) || len < 15
+ || '0' != buf [7] || '0' != buf [8]) {
+- cerr << name << ':' << line << ":invalid input line\n";
++ std::cerr << name << ':' << line << ":invalid input line\n";
+ return EX_DATAERR;
+ }
+ check = strtol (buf + len - 2, 0, 16);
+@@ -99,15 +99,15 @@
+ else if (words * 2 + 11 == len)
+ format = ihx8m;
+ else {
+- cerr << name << ':' << line <<
++ std::cerr << name << ':' << line <<
+ ":unknown input format, only ihx8m and ihx16 accepted\n";
+ return EX_DATAERR;
+ }
+ }
+ if (words * (ihx16 == format ? 4 : 2) + 11 != len) {
+- cerr << name << ':' << line << ":line length mismatch:"
++ std::cerr << name << ':' << line << ":line length mismatch:"
+ << (ihx16 == format ? "ihx16 " : "ihx8m ")
+- << words * (ihx16 == format ? 4 : 2) + 11 << " != " << len << endl;
++ << words * (ihx16 == format ? 4 : 2) + 11 << " != " << len << std::endl;
+ return EX_DATAERR;
+ }
+ sum = words + addr + (addr >> 8);
+@@ -120,8 +120,8 @@
+ || (addr >= 0x2000 && addr+words <= 0x2004)
+ || (addr == 0x2007 && words == 1)
+ || (addr >= 0x2100 && addr+words <= 0x2140))) {
+- cerr << name << ':' << line << ":invalid address " << hex
+- << setw(4) << setfill('0') << addr << dec
++ std::cerr << name << ':' << line << ":invalid address " << std::hex
++ << std::setw(4) << std::setfill('0') << addr << std::dec
+ << ", possibly not a pic16c84 hex file?\n";
+ return EX_DATAERR;
+ }
+@@ -135,20 +135,20 @@
+ pgm [addr + words] = word;
+ }
+ if (sum + check & 0xff) {
+- cerr << name << ':' << line << ":checksum mismatch\n";
++ std::cerr << name << ':' << line << ":checksum mismatch\n";
+ return EX_DATAERR;
+ }
+ }
+ e = errno;
+ if (!f.eof ()) {
+- cerr << name << ':' << line << ':' << strerror (e) << ":\n";
++ std::cerr << name << ':' << line << ':' << strerror (e) << ":\n";
+ return EX_IOERR;
+ }
+- cerr << name << ':' << line << ":warning:unexpected eof\n";
++ std::cerr << name << ':' << line << ":warning:unexpected eof\n";
+ return EX_OK;
+ }
+
+-void hexfile::save_line (ofstream& f, int begin, int len, enum hexfile::formats format) const
++void hexfile::save_line (std::ofstream& f, int begin, int len, enum hexfile::formats format) const
+ {
+ int p_begin, p_len, sum, i;
+
+@@ -160,21 +160,21 @@
+ p_len = len;
+ }
+
+- f << ':' << setw (2) << p_len << setw (4) << p_begin << "00";
++ f << ':' << std::setw (2) << p_len << std::setw (4) << p_begin << "00";
+
+ sum = p_len + p_begin + (p_begin >> 8);
+ for (i = begin; i < begin + len; i++) {
+ int word = pgm [i];
+ if (ihx8m == format)
+ word = (word & 0xff) << 8 | (word & 0xff00) >> 8;
+- f << setw (4) << word;
++ f << std::setw (4) << word;
+ sum += word + (word >> 8);
+ }
+
+- f << setw (2) << (-sum & 0xff) << endl;
++ f << std::setw (2) << (-sum & 0xff) << std::endl;
+ }
+
+-void hexfile::save_region (ofstream& f, int addr, int end, enum hexfile::formats format, bool skip_ones) const
++void hexfile::save_region (std::ofstream& f, int addr, int end, enum hexfile::formats format, bool skip_ones) const
+ {
+ int len;
+
+@@ -201,15 +201,15 @@
+
+ int hexfile::save (const char *name, enum hexfile::formats format, bool skip_ones) const
+ {
+- ofstream f (name);
++ std::ofstream f (name);
+ int e;
+
+ if (!f) {
+ e = errno;
+- cerr << name << ":unable to open save file:" << strerror (e) << endl;
++ std::cerr << name << ":unable to open save file:" << strerror (e) << std::endl;
+ return EX_IOERR;
+ }
+- f << hex << setfill ('0') << setiosflags (ios::uppercase);
++ f << std::hex << std::setfill ('0') << setiosflags (std::ios::uppercase);
+
+ save_region (f, 0, 0x400, format, skip_ones);
+ save_region (f, 0x2000, 0x2004, format, skip_ones);
+@@ -236,24 +236,24 @@
+ && (retval = pic.command (data ? picport::data_from_data
+ : picport::data_from_prog)) != pgm [addr]) {
+ if (-1 == retval) {
+- cerr << pic.port() << ':' << hex << setfill ('0') << setw (4) << addr
+- << dec << ":unable to read pic while programming\n";
++ std::cerr << pic.port() << ':' << std::hex << std::setfill ('0') << std::setw (4) << addr
++ << std::dec << ":unable to read pic while programming\n";
+ return EX_IOERR;
+ }
+ pic.command (data ? picport::data_for_data : picport::data_for_prog,
+ pgm [addr]);
+ pic.command (picport::beg_prog);
+
+- cout << hex << setfill ('0') << setw (4) << addr << ' '
+- << setw (4) << pic.address () << ' '
+- << setw (4) << pgm [addr] << dec << endl;
++ std::cout << std::hex << std::setfill ('0') << std::setw (4) << addr << ' '
++ << std::setw (4) << pic.address () << ' '
++ << std::setw (4) << pgm [addr] << std::dec << std::endl;
+
+ // verify, but do not verify fuses if Code Protect bit is cleared!
+
+ if ((pic.address () != 0x2007 || pgm [addr] & 0x10)
+ && pgm [addr] != pic.command (data ? picport::data_from_data
+ : picport::data_from_prog)) {
+- cerr << pic.port() << ':' << hex << setw (4) << setfill ('0') << addr << dec
++ std::cerr << pic.port() << ':' << std::hex << std::setw (4) << std::setfill ('0') << addr << std::dec
+ << ":unable to verify pic while programming.\n"
+ "Is code protection enabled? "
+ "Use --erase option to disable code protection.\n";
+@@ -280,21 +280,21 @@
+ if (reset) {
+ pic.reset_code_protection ();
+ pic.reset ();
+- cout << "Removed code protection.\n";
++ std::cout << "Removed code protection.\n";
+ }
+
+- cout << "Burning program eeprom,\n";
++ std::cout << "Burning program eeprom,\n";
+ while (pic.address () < 0x400) {
+ if (EX_OK != (retval = program_location (pic, pic.address (), false)))
+ return retval;
+ pic.command (picport::inc_addr);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+ }
+
+- cout << "burning data eeprom,\n";
++ std::cout << "burning data eeprom,\n";
+ while (pic.address () < 0x440) {
+ if (EX_OK != (retval = program_location (pic,
+ pic.address () + 0x2100 - 0x400,
+@@ -302,19 +302,19 @@
+ return retval;
+ pic.command (picport::inc_addr);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+ }
+
+- cout << "burning id words,\n";
++ std::cout << "burning id words,\n";
+ pic.command (picport::load_conf, 0x3fff); // dummy value
+ while (pic.address () < 0x2004) {
+ if (EX_OK != (retval = program_location (pic, pic.address (), false)))
+ return retval;
+ pic.command (picport::inc_addr);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+ }
+@@ -323,17 +323,17 @@
+ pic.command (picport::inc_addr);
+ pic.command (picport::inc_addr);
+
+- cout << "burning fuses,\n";
++ std::cout << "burning fuses,\n";
+ if (EX_OK != (retval = program_location (pic, pic.address (), false)))
+ return retval;
+- cout << "done.\n";
++ std::cout << "done.\n";
+ } // scope of pic
+
+ signal (SIGTERM, save_t);
+ signal (SIGQUIT, save_q);
+ signal (SIGINT, save_i);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+
+@@ -352,47 +352,47 @@
+ {
+ picport pic (port);
+
+- cout << "Reading program eeprom,\n";
++ std::cout << "Reading program eeprom,\n";
+ while (pic.address () < 0x400) {
+ if (-1 == (pgm [pic.address ()] = pic.command (picport::data_from_prog))) {
+- cerr << port << ':' << hex << setfill ('0') << setw (4) << pic.address () << dec
++ std::cerr << port << ':' << std::hex << std::setfill ('0') << std::setw (4) << pic.address () << std::dec
+ << ":unable to read pic\n";
+ return EX_IOERR;
+ }
+ pic.command (picport::inc_addr);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+ }
+
+- cout << "reading data eeprom,\n";
++ std::cout << "reading data eeprom,\n";
+ while (pic.address () < 0x440) {
+ if (-1 == (pgm [pic.address () + 0x2100-0x400]
+ = pic.command (picport::data_from_data))) {
+- cerr << port << ':' << hex << setfill ('0') << setw (4)
+- << pic.address () + 0x2100-0x400 << dec
++ std::cerr << port << ':' << std::hex << std::setfill ('0') << std::setw (4)
++ << pic.address () + 0x2100-0x400 << std::dec
+ << ":unable to read pic data memory\n";
+ return EX_IOERR;
+ }
+ pic.command (picport::inc_addr);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+ }
+ pic.command (picport::load_conf, 0);
+
+- cout << "reading id words,\n";
++ std::cout << "reading id words,\n";
+ while (pic.address () < 0x2004) {
+ if (-1 == (pgm [pic.address ()] = pic.command (picport::data_from_prog))) {
+- cerr << port << ':' << hex << setfill ('0') << setw (4) << pic.address () << dec
++ std::cerr << port << ':' << std::hex << std::setfill ('0') << std::setw (4) << pic.address () << std::dec
+ << ":unable to read pic id words\n";
+ return EX_IOERR;
+ }
+ pic.command (picport::inc_addr);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+ }
+@@ -402,20 +402,20 @@
+ pic.command (picport::inc_addr);
+
+ // fuses
+- cout << "reading fuses,\n";
++ std::cout << "reading fuses,\n";
+ if (-1 == (pgm [pic.address ()] = pic.command (picport::data_from_prog))) {
+- cerr << port << ':' << hex << setfill ('0') << setw (4) << pic.address () << dec
++ std::cerr << port << ':' << std::hex << std::setfill ('0') << std::setw (4) << pic.address () << std::dec
+ << ":unable to read pic fuses\n";
+ return EX_IOERR;
+ }
+- cout << "done.\n";
++ std::cout << "done.\n";
+ } // pic scope
+
+ signal (SIGTERM, save_t);
+ signal (SIGQUIT, save_q);
+ signal (SIGINT, save_i);
+ if (got_signal) {
+- cerr << "Exiting.\n";
++ std::cerr << "Exiting.\n";
+ return EX_UNAVAILABLE;
+ }
+
diff --git a/devel/picprog/files/patch-hexfile.h b/devel/picprog/files/patch-hexfile.h
new file mode 100644
index 000000000000..68ec751e92be
--- /dev/null
+++ b/devel/picprog/files/patch-hexfile.h
@@ -0,0 +1,22 @@
+--- hexfile.h.orig Tue Nov 19 12:23:13 2002
++++ hexfile.h Tue Nov 19 12:23:46 2002
+@@ -43,7 +43,7 @@
+ #ifndef H_HEXFILE
+ #define H_HEXFILE
+
+-#include <fstream.h>
++#include <fstream>
+
+ #include "picport.h"
+
+@@ -57,8 +57,8 @@
+ enum formats { unknown = 0, ihx8m, ihx16 };
+
+ private:
+- void save_line (ofstream& f, int begin, int len, enum formats format) const;
+- void save_region (ofstream& f, int addr, int end, enum formats format, bool skip_ones) const;
++ void save_line (std::ofstream& f, int begin, int len, enum formats format) const;
++ void save_region (std::ofstream& f, int addr, int end, enum formats format, bool skip_ones) const;
+ public:
+
+ hexfile () {
diff --git a/devel/picprog/files/patch-main.cc b/devel/picprog/files/patch-main.cc
new file mode 100644
index 000000000000..7df119152601
--- /dev/null
+++ b/devel/picprog/files/patch-main.cc
@@ -0,0 +1,50 @@
+--- main.cc.orig Sat May 31 17:21:37 1997
++++ main.cc Tue Nov 19 12:31:55 2002
+@@ -28,9 +28,10 @@
+
+ */
+
+-#include <iostream.h>
++#include <iostream>
+ #include <sysexits.h>
+ #include <unistd.h>
++#define HAVE_DECL_GETOPT 0
+ #include <getopt.h>
+
+ #include "hexfile.h"
+@@ -105,7 +106,7 @@
+ }
+
+ if (!opt_quiet || opt_warranty || opt_copying || opt_usage)
+- cerr << "Picprog version 1.0, Copyright © 1997 Jaakko Hyvätti\n"
++ std::cerr << "Picprog version 1.0, Copyright © 1997 Jaakko Hyvätti\n"
+ "Picprog comes with ABSOLUTELY NO WARRANTY; for details\n"
+ "type `" << prog.name << " --warranty'. This is free software,\n"
+ "and you are welcome to redistribute it under certain conditions;\n"
+@@ -118,7 +119,7 @@
+ prog.warranty ();
+
+ if (opt_usage) {
+- cerr << "Full documentation is at "
++ std::cerr << "Full documentation is at "
+ "<URL:http://www.iki.fi/hyvatti/pic/picprog.html>.\n"
+ "The author may be contacted at:\n\n"
+
+@@ -133,7 +134,7 @@
+ return EX_OK;
+
+ if (!opt_input && !opt_output) {
+- cerr << "Please specify either input or output hexfile.\n";
++ std::cerr << "Please specify either input or output hexfile.\n";
+ prog.usage (long_opts, short_opts);
+ }
+
+@@ -150,7 +151,7 @@
+ if (EX_OK != (retval = mem.program (opt_port, opt_erase)))
+ return retval;
+ } else
+- cout << "No --burn option specified, device not programmed\n";
++ std::cout << "No --burn option specified, device not programmed\n";
+
+ if (opt_cc)
+ if (EX_OK != (retval = mem.save (opt_cc, hexfile::formats (opt_format),
diff --git a/devel/picprog/files/patch-picport.cc b/devel/picprog/files/patch-picport.cc
new file mode 100644
index 000000000000..e67dad68d882
--- /dev/null
+++ b/devel/picprog/files/patch-picport.cc
@@ -0,0 +1,61 @@
+--- picport.cc.orig Tue Nov 19 12:32:20 2002
++++ picport.cc Tue Nov 19 12:33:13 2002
+@@ -28,7 +28,7 @@
+
+ */
+
+-#include <iostream.h>
++#include <iostream>
+ #include <sys/ioctl.h>
+ #include <fcntl.h>
+ #include <errno.h>
+@@ -47,7 +47,7 @@
+ {
+ if (0 > (fd = open (tty, O_RDWR))) {
+ int e = errno;
+- cerr << "Unable to open tty " << tty << ":" << strerror (e) << "\n";
++ std::cerr << "Unable to open tty " << tty << ":" << strerror (e) << "\n";
+ exit (EX_IOERR);
+ }
+ tcgetattr (fd, &saved);
+@@ -67,7 +67,7 @@
+ || 0 > ioctl (fd, TIOCMBIC, &picport::dtr_bit)) {
+ int e = errno;
+ tcsetattr (fd, TCSANOW, &saved);
+- cerr << "Unable to clear RTS/DTR on tty " << tty << ":" << strerror (e) << "\n";
++ std::cerr << "Unable to clear RTS/DTR on tty " << tty << ":" << strerror (e) << "\n";
+ exit (EX_IOERR);
+ }
+ usleep (50000);
+@@ -75,7 +75,7 @@
+ int e = errno;
+ ioctl (fd, TIOCCBRK, 0);
+ tcsetattr (fd, TCSANOW, &saved);
+- cerr << "Unable to start break on tty " << tty << ":" << strerror (e) << "\n";
++ std::cerr << "Unable to start break on tty " << tty << ":" << strerror (e) << "\n";
+ exit (EX_IOERR);
+ }
+ usleep (1);
+@@ -182,7 +182,7 @@
+
+ // -1 == error, no programmer present
+
+-int picport::command (enum commands comm, int data = 0)
++int picport::command (enum commands comm, int data)
+ {
+ int tmp1, tmp2;
+
+@@ -216,11 +216,11 @@
+ // This detects if the programmer is not connected to the port.
+
+ if (!tmp1 || !tmp2) {
+- cerr << portname << ":PIC programmer or chip fault\n";
++ std::cerr << portname << ":PIC programmer or chip fault\n";
+ return -1;
+ }
+ if (data_from_data == comm && (shift & 0x3f00) != 0x3f00) {
+- cerr << portname
++ std::cerr << portname
+ << ":PIC programmer or chip fault\n"
+ "Is code protection enabled? "
+ "Use --erase option to disable code protection.\n";
diff --git a/devel/picprog/files/patch-program.cc b/devel/picprog/files/patch-program.cc
new file mode 100644
index 000000000000..7d052e9d834c
--- /dev/null
+++ b/devel/picprog/files/patch-program.cc
@@ -0,0 +1,118 @@
+--- program.cc.orig Tue Nov 19 12:38:52 2002
++++ program.cc Tue Nov 19 12:39:56 2002
+@@ -28,7 +28,7 @@
+
+ */
+
+-#include <iostream.h>
++#include <iostream>
+
+ #include <unistd.h>
+ #include <string.h>
+@@ -258,7 +258,7 @@
+ original licensor to copy, distribute or modify the Program subject to\n\
+ these terms and conditions. You may not impose any further\n\
+ restrictions on the recipients' exercise of the rights granted herein.\n\
+-You are not responsible for enforcing compliance by third parties to\n\
++You are not responsible for enforstd::cing compliance by third parties to\n\
+ this License.\n\
+ \n\
+ 7. If, as a consequence of a court judgment or allegation of patent\n\
+@@ -356,7 +356,7 @@
+ || 0 > ioctl (1, TIOCGWINSZ, &w)
+ || w.ws_row < 2
+ || w.ws_col < 76) {
+- cout << t;
++ std::cout << t;
+ return;
+ }
+
+@@ -368,17 +368,17 @@
+ char *tmps = new char [end-start+1];
+ memcpy (tmps, start, end-start);
+ tmps [end-start] = '\0';
+- cout << tmps;
++ std::cout << tmps;
+ delete [] tmps;
+ lines = 0;
+ start = end;
+- cout << "Press enter to continue" << flush;
+- while (cin.get(c) && '\n' != c)
++ std::cout << "Press enter to continue" << std::flush;
++ while (std::cin.get(c) && '\n' != c)
+ ;
+ }
+ }
+ if (*start)
+- cout << start; // Print the last page.
++ std::cout << start; // Print the last page.
+ }
+
+ void program::warranty ()
+@@ -394,7 +394,7 @@
+ static void wrapif (int& column, int cols, int wid)
+ {
+ if (cols < (column += wid)) {
+- cerr << endl;
++ std::cerr << std::endl;
+ column = wid;
+ }
+ }
+@@ -413,7 +413,7 @@
+ || w.ws_col < 40)
+ w.ws_col = 80;
+
+- cerr << "Usage: " << name;
++ std::cerr << "Usage: " << name;
+ column = 7 + strlen (name);
+ memset (charops, 0, sizeof (charops));
+ for (op = long_opts; op->name; op++) {
+@@ -422,23 +422,23 @@
+ switch (op->has_arg) {
+ case required_argument:
+ wrapif (column, w.ws_col, 5 + strlen (op->name) + 6);
+- cerr << " [ --" << op->name << "=arg ]";
++ std::cerr << " [ --" << op->name << "=arg ]";
+ if (!op->flag) {
+ wrapif (column, w.ws_col, 11);
+- cerr << " [ -" << (char)op->val << " arg ]";
++ std::cerr << " [ -" << (char)op->val << " arg ]";
+ }
+ break;
+ case optional_argument:
+ wrapif (column, w.ws_col, 5 + strlen (op->name) + 9);
+- cerr << " [ --" << op->name << "[=arg ] ]";
++ std::cerr << " [ --" << op->name << "[=arg ] ]";
+ if (!op->flag) {
+ wrapif (column, w.ws_col, 15);
+- cerr << " [ -" << (char)op->val << " [ arg ] ]";
++ std::cerr << " [ -" << (char)op->val << " [ arg ] ]";
+ }
+ break;
+ default:
+ wrapif (column, w.ws_col, 5 + strlen (op->name) + 2);
+- cerr << " [ --" << op->name << " ]";
++ std::cerr << " [ --" << op->name << " ]";
+ if (!op->flag)
+ charops [strlen (charops)] = op->val;
+ }
+@@ -447,16 +447,16 @@
+ if (' ' != *tmp_set && ':' != *tmp_set) {
+ if (':' == tmp_set [1]) {
+ wrapif (column, w.ws_col, 12);
+- cerr << " [ -" << *tmp_set++ << " arg ]";
++ std::cerr << " [ -" << *tmp_set++ << " arg ]";
+ } else
+ charops [strlen (charops)] = *tmp_set;
+ }
+ }
+ if (charops[0]) {
+ wrapif (column, w.ws_col, 4 + strlen (charops) + 2);
+- cerr << " [ -" << charops << " ]";
++ std::cerr << " [ -" << charops << " ]";
+ }
+- cerr << endl;
++ std::cerr << std::endl;
+ exit (EX_USAGE);
+ }
+
diff --git a/devel/picprog/files/patch-program.h b/devel/picprog/files/patch-program.h
new file mode 100644
index 000000000000..60f79eff7da4
--- /dev/null
+++ b/devel/picprog/files/patch-program.h
@@ -0,0 +1,11 @@
+--- program.h.orig Fri May 30 22:24:52 1997
++++ program.h Tue Nov 19 12:40:53 2002
+@@ -31,6 +31,8 @@
+ #ifndef H_PROGRAM
+ #define H_PROGRAM
+
++#include <unistd.h>
++#define HAVE_DECL_GETOPT 1
+ #include <getopt.h>
+
+ class program {