1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
|
diff -up --recursive --new-file mopd-2.5.3.macro/Makefile mopd-2.5.3/Makefile
--- mopd-2.5.3.macro/Makefile 1996-08-16 22:38:14.000000000 +0000
+++ mopd-2.5.3/Makefile 2001-10-27 19:51:19.000000000 +0000
@@ -1,5 +1,16 @@
-# $Id: Makefile,v 1.5 1996/08/16 22:37:51 moj Exp $
+AR = ar
+CC = gcc
+RANLIB = ranlib
-SUBDIR= mopd mopprobe moptrace mopchk mopa.out
+CFLAGS = -O2 -g
+LDFLAGS =
-.include <bsd.subdir.mk>
+SUBDIRS = common mopd mopchk mopprobe moptrace
+
+all clean:
+ @for dir in $(SUBDIRS); do \
+ (cd $$dir && \
+ $(MAKE) "AR=$(AR)" "CC=$(CC)" "RANLIB=$(RANLIB)" \
+ "CFLAGS=$(CFLAGS)" "LDFLAGS=$(LDFLAGS)" $@) || \
+ exit 1; \
+ done
diff -up --recursive --new-file mopd-2.5.3.macro/Makefile.inc mopd-2.5.3/Makefile.inc
--- mopd-2.5.3.macro/Makefile.inc 1996-01-28 18:47:57.000000000 +0000
+++ mopd-2.5.3/Makefile.inc 1970-01-01 00:00:00.000000000 +0000
@@ -1,4 +0,0 @@
-# from: @(#)Makefile.inc 5.1 (Berkeley) 5/11/90
-# $Id: Makefile.inc,v 1.0 1996/01/28 18:47:38 moj Exp $
-
-BINDIR?= /usr/sbin
diff -up --recursive --new-file mopd-2.5.3.macro/README-0 mopd-2.5.3/README-0
--- mopd-2.5.3.macro/README-0 1970-01-01 00:00:00.000000000 +0000
+++ mopd-2.5.3/README-0 1997-01-12 04:27:21.000000000 +0000
@@ -0,0 +1,19 @@
+This is a port of Mats O Jansson's mopd to linux, special thanx to David
+Hornsby from the University of Melbourne for the use of pf.c from the
+arns package.
+
+I have booted test images on my Vaxstation 3100 from my PC running Linux
+2.0.20 with an AE-2 NE2000 compatable card. There are bound to be bugs,
+especially with dealing with different network cards etc. Please report
+any bugs you find in this linux version to me and I will do the best I
+can to fix them.
+
+To compile mopd, simply go into the directory and type 'make'. The man
+files have also been included from the BSD version of mopd.
+
+Enjoy
+
+Karl Maftoum
+
+u963870@student.canberra.edu.au
+
diff -up --recursive --new-file mopd-2.5.3.macro/common/Makefile mopd-2.5.3/common/Makefile
--- mopd-2.5.3.macro/common/Makefile 1970-01-01 00:00:00.000000000 +0000
+++ mopd-2.5.3/common/Makefile 2001-10-27 19:41:26.000000000 +0000
@@ -0,0 +1,21 @@
+LIBS = libcommon.a
+OBJS = cmp.o device.o dl.o file.o get.o loop-bsd.o mopdef.o nma.o pf-linux.o \
+ pf.o print.o put.o rc.o version.o
+
+CPPFLAGS =
+
+all: $(LIBS)
+
+libcommon.a: $(OBJS)
+ -rm -f libcommon.a
+ $(AR) cru libcommon.a $(OBJS)
+ $(RANLIB) libcommon.a
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+version.c: VERSION
+ sed 's/.*/char version[] = "&";/' < VERSION > version.c
+
+clean:
+ rm -f core *.a *.o version.c
diff -up --recursive --new-file mopd-2.5.3.macro/common/device.c mopd-2.5.3/common/device.c
--- mopd-2.5.3.macro/common/device.c 1996-08-08 00:01:54.000000000 +0000
+++ mopd-2.5.3/common/device.c 2001-10-27 18:49:32.000000000 +0000
@@ -32,8 +32,8 @@ static char rcsid[] = "$Id: device.c,v 1
#endif
#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
+#include "common.h"
+#include "mopdef.h"
struct if_info *iflist; /* Interface List */
@@ -147,6 +147,13 @@ deviceOpen(ifname, proto, trans)
#ifdef DEV_NEW_CONF
deviceEthAddr(p->if_name,&p->eaddr[0]);
+#elif defined(__linux__)
+ {
+ int s;
+ s = socket(AF_INET,SOCK_DGRAM,0);
+ pfEthAddr(s,p->if_name,&p->eaddr[0]);
+ (void) close(s);
+ }
#else
p->eaddr[0]= tmp.eaddr[0];
p->eaddr[1]= tmp.eaddr[1];
@@ -206,7 +213,11 @@ deviceInitOne(ifname)
/* Ok, get transport information */
+#ifdef __linux__
+ trans = TRANS_ETHER+TRANS_8023+TRANS_AND;
+#else
trans = pfTrans(interface);
+#endif
#ifndef NORC
/* Start with MOP Remote Console */
diff -up --recursive --new-file mopd-2.5.3.macro/common/dl.c mopd-2.5.3/common/dl.c
--- mopd-2.5.3.macro/common/dl.c 1996-08-05 07:39:01.000000000 +0000
+++ mopd-2.5.3/common/dl.c 2001-10-27 18:49:32.000000000 +0000
@@ -32,9 +32,9 @@ static char rcsid[] = "$Id: dl.c,v 1.7 1
#endif
#include "os.h"
-#include "common/get.h"
-#include "common/print.h"
-#include "common/mopdef.h"
+#include "get.h"
+#include "print.h"
+#include "mopdef.h"
void
mopDumpDL(fd, pkt, trans)
diff -up --recursive --new-file mopd-2.5.3.macro/common/file.c mopd-2.5.3/common/file.c
--- mopd-2.5.3.macro/common/file.c 1996-08-16 22:39:41.000000000 +0000
+++ mopd-2.5.3/common/file.c 2001-10-27 21:45:14.000000000 +0000
@@ -32,8 +32,8 @@ static char rcsid[] = "$Id: file.c,v 1.4
#endif
#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
+#include "common.h"
+#include "mopdef.h"
#ifndef NOAOUT
#if defined(__NetBSD__) || defined(__OpenBSD__)
@@ -50,6 +50,8 @@ static char rcsid[] = "$Id: file.c,v 1.4
#endif
#endif
+int fileinfo;
+
void
mopFilePutLX(buf, index, value, cnt)
u_char *buf;
@@ -129,11 +131,11 @@ CheckMopFile(fd)
u_char header[512];
short image_type;
+ (void)lseek(fd, (off_t) 0, SEEK_SET);
+
if (read(fd, header, 512) != 512)
return(-1);
- (void)lseek(fd, (off_t) 0, SEEK_SET);
-
image_type = (u_short)(header[IHD_W_ALIAS+1]*256 +
header[IHD_W_ALIAS]);
@@ -162,6 +164,8 @@ GetMopFileInfo(fd, load, xfr)
short image_type;
u_long load_addr, xfr_addr, isd, iha, hbcnt, isize;
+ (void)lseek(fd, (off_t) 0, SEEK_SET);
+
if (read(fd, header, 512) != 512)
return(-1);
@@ -184,43 +188,43 @@ GetMopFileInfo(fd, load, xfr)
header[iha+IHA_L_TFRADR1+2]*0x10000 +
header[iha+IHA_L_TFRADR1+1]*0x100 +
header[iha+IHA_L_TFRADR1]) & 0x7fffffff;
-#ifdef INFO
- printf("Native Image (VAX)\n");
- printf("Header Block Count: %d\n",hbcnt);
- printf("Image Size: %08x\n",isize);
- printf("Load Address: %08x\n",load_addr);
- printf("Transfer Address: %08x\n",xfr_addr);
-#endif
+ if (fileinfo) {
+ printf("Native Image (VAX)\n");
+ printf("Header Block Count: %d\n",hbcnt);
+ printf("Image Size: %08x\n",isize);
+ printf("Load Address: %08x\n",load_addr);
+ printf("Transfer Address: %08x\n",xfr_addr);
+ }
break;
case IHD_C_RSX: /* RSX image produced by TKB */
hbcnt = header[L_BBLK+1]*256 + header[L_BBLK];
isize = (header[L_BLDZ+1]*256 + header[L_BLDZ]) * 64;
load_addr = header[L_BSA+1]*256 + header[L_BSA];
xfr_addr = header[L_BXFR+1]*256 + header[L_BXFR];
-#ifdef INFO
- printf("RSX Image\n");
- printf("Header Block Count: %d\n",hbcnt);
- printf("Image Size: %08x\n",isize);
- printf("Load Address: %08x\n",load_addr);
- printf("Transfer Address: %08x\n",xfr_addr);
-#endif
+ if (fileinfo) {
+ printf("RSX Image\n");
+ printf("Header Block Count: %d\n",hbcnt);
+ printf("Image Size: %08x\n",isize);
+ printf("Load Address: %08x\n",load_addr);
+ printf("Transfer Address: %08x\n",xfr_addr);
+ }
break;
case IHD_C_BPA: /* BASIC plus analog */
-#ifdef INFO
- printf("BASIC-Plus Image, not supported\n");
-#endif
+ if (fileinfo) {
+ printf("BASIC-Plus Image, not supported\n");
+ }
return(-1);
break;
case IHD_C_ALIAS: /* Alias */
-#ifdef INFO
- printf("Alias, not supported\n");
-#endif
+ if (fileinfo) {
+ printf("Alias, not supported\n");
+ }
return(-1);
break;
case IHD_C_CLI: /* Image is CLI */
-#ifdef INFO
- printf("CLI, not supported\n");
-#endif
+ if (fileinfo) {
+ printf("CLI, not supported\n");
+ }
return(-1);
break;
case IHD_C_PMAX: /* PMAX system image */
@@ -237,13 +241,13 @@ GetMopFileInfo(fd, load, xfr)
header[iha+IHA_L_TFRADR1+2]*0x10000 +
header[iha+IHA_L_TFRADR1+1]*0x100 +
header[iha+IHA_L_TFRADR1]);
-#ifdef INFO
- printf("PMAX Image \n");
- printf("Header Block Count: %d\n",hbcnt);
- printf("Image Size: %08x\n",isize);
- printf("Load Address: %08x\n",load_addr);
- printf("Transfer Address: %08x\n",xfr_addr);
-#endif
+ if (fileinfo) {
+ printf("PMAX Image \n");
+ printf("Header Block Count: %d\n",hbcnt);
+ printf("Image Size: %08x\n",isize);
+ printf("Load Address: %08x\n",load_addr);
+ printf("Transfer Address: %08x\n",xfr_addr);
+ }
break;
case IHD_C_ALPHA: /* ALPHA system image */
isd = (header[EIHD_L_ISDOFF+3]*0x1000000 +
@@ -260,18 +264,18 @@ GetMopFileInfo(fd, load, xfr)
header[isd+EISD_L_SECSIZE]);
load_addr = 0;
xfr_addr = 0;
-#ifdef INFO
- printf("Alpha Image \n");
- printf("Header Block Count: %d\n",hbcnt);
- printf("Image Size: %08x\n",isize);
- printf("Load Address: %08x\n",load_addr);
- printf("Transfer Address: %08x\n",xfr_addr);
-#endif
+ if (fileinfo) {
+ printf("Alpha Image \n");
+ printf("Header Block Count: %d\n",hbcnt);
+ printf("Image Size: %08x\n",isize);
+ printf("Load Address: %08x\n",load_addr);
+ printf("Transfer Address: %08x\n",xfr_addr);
+ }
break;
default:
-#ifdef INFO
- printf("Unknown Image (%d)\n",image_type);
-#endif
+ if (fileinfo) {
+ printf("Unknown Image (%d)\n",image_type);
+ }
return(-1);
}
@@ -412,17 +416,15 @@ CheckAOutFile(fd)
struct exec ex, ex_swap;
int mid = -1;
+ (void)lseek(fd, (off_t) 0, SEEK_SET);
+
/*###416 [cc] `fd' undeclared (first use this function)%%%*/
if (read(fd, (char *)&ex, sizeof(ex)) != sizeof(ex))
return(-1);
- (void)lseek(fd, (off_t) 0, SEEK_SET);
-
- if (read(fd, (char *)&ex_swap, sizeof(ex_swap)) != sizeof(ex_swap))
- return(-1);
+ bcopy(&ex, &ex_swap, sizeof(ex_swap));
+ mopFileSwapX((u_char *)&ex_swap, 0, 4);
- (void)lseek(fd, (off_t) 0, SEEK_SET);
-
mid = getMID(mid, N_GETMID (ex));
if (mid == -1) {
@@ -452,14 +454,12 @@ GetAOutFileInfo(fd, load, xfr, a_text, a
int mid = -1;
u_long magic, clbytes, clofset;
- if (read(fd, (char *)&ex, sizeof(ex)) != sizeof(ex))
- return(-1);
-
(void)lseek(fd, (off_t) 0, SEEK_SET);
- if (read(fd, (char *)&ex_swap, sizeof(ex_swap)) != sizeof(ex_swap))
+ if (read(fd, (char *)&ex, sizeof(ex)) != sizeof(ex))
return(-1);
+ bcopy(&ex, &ex_swap, sizeof(ex_swap));
mopFileSwapX((u_char *)&ex_swap, 0, 4);
mid = getMID(mid, N_GETMID (ex));
@@ -526,83 +526,83 @@ GetAOutFileInfo(fd, load, xfr, a_text, a
/*###525 [cc] syntax error before `}'%%%*/
}
-#ifdef INFO
- printf("a.out image (");
- switch (N_GETMID (ex)) {
- case MID_I386:
- printf("i386");
- break;
+ if (fileinfo) {
+ printf("a.out image (");
+ switch (N_GETMID (ex)) {
+ case MID_I386:
+ printf("i386");
+ break;
#ifdef MID_M68K
- case MID_M68K:
- printf("m68k");
- break;
+ case MID_M68K:
+ printf("m68k");
+ break;
#endif
#ifdef MID_M68K4K
- case MID_M68K4K:
- printf("m68k 4k");
- break;
+ case MID_M68K4K:
+ printf("m68k 4k");
+ break;
#endif
#ifdef MID_NS32532
- case MID_NS32532:
- printf("pc532");
- break;
+ case MID_NS32532:
+ printf("pc532");
+ break;
#endif
- case MID_SPARC:
- printf("sparc");
- break;
+ case MID_SPARC:
+ printf("sparc");
+ break;
#ifdef MID_PMAX
- case MID_PMAX:
- printf("pmax");
- break;
+ case MID_PMAX:
+ printf("pmax");
+ break;
#endif
#ifdef MID_VAX
- case MID_VAX:
- printf("vax");
- break;
+ case MID_VAX:
+ printf("vax");
+ break;
#endif
#ifdef MID_ALPHA
- case MID_ALPHA:
- printf("alpha");
- break;
+ case MID_ALPHA:
+ printf("alpha");
+ break;
#endif
#ifdef MID_MIPS
- case MID_MIPS:
- printf("mips");
- break;
+ case MID_MIPS:
+ printf("mips");
+ break;
#endif
#ifdef MID_ARM6
- case MID_ARM6:
- printf("arm32");
- break;
+ case MID_ARM6:
+ printf("arm32");
+ break;
#endif
- default:
- }
- printf(") Magic: ");
- switch (N_GETMAGIC (ex)) {
- case OMAGIC:
- printf("OMAGIC");
- break;
- case NMAGIC:
- printf("NMAGIC");
- break;
- case ZMAGIC:
- printf("ZMAGIC");
- break;
- case QMAGIC:
- printf("QMAGIC");
- break;
- default:
- printf("Unknown %d",N_GETMAGIC (ex));
+ default: break;
+ }
+ printf(") Magic: ");
+ switch (N_GETMAGIC (ex)) {
+ case OMAGIC:
+ printf("OMAGIC");
+ break;
+ case NMAGIC:
+ printf("NMAGIC");
+ break;
+ case ZMAGIC:
+ printf("ZMAGIC");
+ break;
+ case QMAGIC:
+ printf("QMAGIC");
+ break;
+ default:
+ printf("Unknown %d",N_GETMAGIC (ex));
+ }
+ printf("\n");
+ printf("Size of text: %08x\n",ex.a_text);
+ printf("Size of data: %08x\n",ex.a_data);
+ printf("Size of bss: %08x\n",ex.a_bss);
+ printf("Size of symbol tab: %08x\n",ex.a_syms);
+ printf("Transfer Address: %08x\n",ex.a_entry);
+ printf("Size of reloc text: %08x\n",ex.a_trsize);
+ printf("Size of reloc data: %08x\n",ex.a_drsize);
}
- printf("\n");
- printf("Size of text: %08x\n",ex.a_text);
- printf("Size of data: %08x\n",ex.a_data);
- printf("Size of bss: %08x\n",ex.a_bss);
- printf("Size of symbol tab: %08x\n",ex.a_syms);
- printf("Transfer Address: %08x\n",ex.a_entry);
- printf("Size of reloc text: %08x\n",ex.a_trsize);
- printf("Size of reloc data: %08x\n",ex.a_drsize);
-#endif
magic = N_GETMAGIC (ex);
clbytes = getCLBYTES(mid);
clofset = clbytes - 1;
diff -up --recursive --new-file mopd-2.5.3.macro/common/file.h mopd-2.5.3/common/file.h
--- mopd-2.5.3.macro/common/file.h 1996-08-13 18:36:33.000000000 +0000
+++ mopd-2.5.3/common/file.h 2001-10-27 20:49:08.000000000 +0000
@@ -33,6 +33,8 @@
#ifndef _FILE_H_
#define _FILE_H_
+extern int fileinfo;
+
#ifdef NO__P
void mopFilePutLX (/* u_char *, int, u_long, int */);
void mopFilePutBX (/* u_char *, int, u_long, int */);
diff -up --recursive --new-file mopd-2.5.3.macro/common/get.c mopd-2.5.3/common/get.c
--- mopd-2.5.3.macro/common/get.c 1996-03-31 18:52:56.000000000 +0000
+++ mopd-2.5.3/common/get.c 2001-10-27 18:27:16.000000000 +0000
@@ -32,7 +32,7 @@ static char rcsid[] = "$Id: get.c,v 1.5
#endif
#include <sys/types.h>
-#include "common/mopdef.h"
+#include "mopdef.h"
u_char
mopGetChar(pkt, index)
diff -up --recursive --new-file mopd-2.5.3.macro/common/loop-bsd.c mopd-2.5.3/common/loop-bsd.c
--- mopd-2.5.3.macro/common/loop-bsd.c 1996-08-16 22:41:43.000000000 +0000
+++ mopd-2.5.3/common/loop-bsd.c 2001-10-27 18:49:32.000000000 +0000
@@ -37,13 +37,15 @@ static char rcsid[] = "$Id: loop-bsd.c,v
#if defined(__bsdi__) || defined(__FreeBSD__)
#include <sys/time.h>
#endif
+#if !defined(__linux__)
#include <net/bpf.h>
+#endif
#include <sys/ioctl.h>
#include <sys/errno.h>
#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
+#include "common.h"
+#include "mopdef.h"
int
mopOpenRC(p, trans)
@@ -110,12 +112,16 @@ Loop()
syslog(LOG_ERR, "no interfaces");
exit(0);
}
+#ifndef __linux__
if (iflist->fd != -1) {
if (ioctl(iflist->fd, BIOCGBLEN, (caddr_t) & bufsize) < 0) {
syslog(LOG_ERR, "BIOCGBLEN: %m");
exit(0);
}
}
+#else
+ bufsize = 8192;
+#endif
buf = (u_char *) malloc((unsigned) bufsize);
if (buf == 0) {
syslog(LOG_ERR, "malloc: %m");
@@ -166,6 +172,7 @@ Loop()
#define bhp ((struct bpf_hdr *)bp)
bp = buf;
ep = bp + cc;
+#ifndef __linux__
while (bp < ep) {
register int caplen, hdrlen;
@@ -174,6 +181,11 @@ Loop()
mopProcess(ii, bp + hdrlen);
bp += BPF_WORDALIGN(hdrlen + caplen);
}
+#else
+ if (bp < ep) {
+ mopProcess(ii,buf);
+ }
+#endif
}
}
}
diff -up --recursive --new-file mopd-2.5.3.macro/common/mopdef.c mopd-2.5.3/common/mopdef.c
--- mopd-2.5.3.macro/common/mopdef.c 1995-10-02 16:50:37.000000000 +0000
+++ mopd-2.5.3/common/mopdef.c 2001-10-27 18:27:24.000000000 +0000
@@ -32,7 +32,7 @@ static char rcsid[] = "$Id: mopdef.c,v 1
#endif
#define MOPDEF_SURPESS_EXTERN
-#include "common/mopdef.h"
+#include "mopdef.h"
char dl_mcst[6] = MOP_DL_MULTICAST; /* Dump/Load Multicast */
char rc_mcst[6] = MOP_RC_MULTICAST; /* Remote Console Multicast */
diff -up --recursive --new-file mopd-2.5.3.macro/common/nma.c mopd-2.5.3/common/nma.c
--- mopd-2.5.3.macro/common/nma.c 1995-09-28 13:38:45.000000000 +0000
+++ mopd-2.5.3/common/nma.c 2001-10-27 18:27:27.000000000 +0000
@@ -32,7 +32,7 @@ static char rcsid[] = "$Id: nma.c,v 1.5
#endif
#include <stddef.h>
-#include "common/nmadef.h"
+#include "nmadef.h"
struct commDev {
int val;
diff -up --recursive --new-file mopd-2.5.3.macro/common/os.h mopd-2.5.3/common/os.h
--- mopd-2.5.3.macro/common/os.h 1995-08-05 18:54:02.000000000 +0000
+++ mopd-2.5.3/common/os.h 2001-10-25 22:19:18.000000000 +0000
@@ -33,8 +33,20 @@
#ifndef _OS_H_
#define _OS_H_
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#define DEV_NEW_CONF
+#endif
+
+#if defined(__linux__)
+#define SETPGRP_NOPARAM
+#endif
+
#include <stdio.h>
+#ifndef FILENAME_MAX
+#define FILENAME_MAX 255 /* SunOS 4 is missing it */
+#endif
+
#include <syslog.h>
#include <signal.h>
#include <sys/types.h>
@@ -42,16 +54,24 @@
#include <errno.h>
#include <sys/socket.h>
#include <net/if.h>
+#ifdef DEV_NEW_CONF
#include <net/if_dl.h>
#include <net/if_types.h>
+#endif
#include <sys/ioctl.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <fcntl.h>
+#if defined(sun)
+#include <string.h>
+#else
#include <strings.h>
+#endif
#include <unistd.h>
-#define DEV_NEW_CONF
+#if defined(sun)
+typedef int ssize_t;
+#endif
#endif _OS_H_
diff -up --recursive --new-file mopd-2.5.3.macro/common/pf-linux.c mopd-2.5.3/common/pf-linux.c
--- mopd-2.5.3.macro/common/pf-linux.c 1970-01-01 00:00:00.000000000 +0000
+++ mopd-2.5.3/common/pf-linux.c 2001-10-27 18:49:32.000000000 +0000
@@ -0,0 +1,357 @@
+/*
+ * General Purpose AppleTalk Packet Filter Interface
+ *
+ * Copyright (c) 1992-1995, The University of Melbourne.
+ * All Rights Reserved. Permission to redistribute or
+ * use any part of this software for any purpose must
+ * be obtained in writing from the copyright owner.
+ *
+ * This software is supplied "as is" without express
+ * or implied warranty.
+ *
+ * djh@munnari.OZ.AU
+ *
+ * Supports:
+ * Linux SOCK_PACKET
+ *
+ * $Author: djh $
+ * $Revision: 1.21 $
+ *
+ *
+ * Modified for use with the linux-mopd port by Karl Maftoum
+ * u963870@student.canberra.edu.au
+ *
+ */
+
+#ifdef __linux__
+
+/*
+ * include header files
+ *
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/file.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <sys/errno.h>
+#include <linux/if_ether.h>
+#include <netdb.h>
+#include <ctype.h>
+#include <netinet/in.h>
+#include <unistd.h>
+#include <string.h>
+
+/*
+ * map compatible functions
+ *
+ */
+
+#ifdef MAPFUNCS
+#define bcopy(a,b,l) memcpy((char *)(b),(char *)(a),(l))
+#define bcmp(a,b,l) memcmp((char *)(a),(char *)(b),(l))
+#define bzero(a,l) memset((char *)(a),0,(l))
+#define rindex(s,c) strrchr((char *)(s),(c))
+#define index(s,c) strchr((char *)(s),(c))
+#endif MAPFUNCS
+
+/*
+ * select common modules
+ *
+ */
+
+
+#define USE_SADDMULTI
+
+/*
+ * definitions
+ *
+ */
+
+#define READBUFSIZ 4096
+#define NUMRDS 32
+
+struct RDS {
+ u_short dataLen;
+ u_char *dataPtr;
+};
+
+/*
+ * variables
+ *
+ */
+
+struct socklist {
+ int iflen;
+ struct sockaddr sa;
+} socklist[32];
+
+struct ifreq ifr;
+extern int errno;
+extern int promisc;
+
+struct RDS RDS[NUMRDS];
+
+/*
+ * establish protocol filter
+ *
+ */
+
+int
+setup_pf(s, prot, typ)
+int s, typ;
+u_short prot;
+{
+ int ioarg;
+ u_short offset;
+ return(0);
+}
+
+/*
+ * Open and initialize packet filter
+ * for a particular protocol type.
+ *
+ */
+
+
+int
+pfInit(interface, mode, protocol, typ)
+char *interface;
+u_short protocol;
+int typ, mode;
+{
+ int s;
+ int ioarg;
+ char device[64];
+ unsigned long if_flags;
+
+
+ { u_short prot;
+
+ prot = ((typ == 2) ? htons(ETH_P_802_2) : htons(protocol));
+ if ((s = socket(AF_INET, SOCK_PACKET, prot)) < 0) {
+ perror(interface);
+ return(-1);
+ }
+ if (s >= 32) {
+ close(s);
+ return(-1);
+ }
+ }
+
+ /*
+ * set filter for protocol and type (IPTalk, Phase 1/2)
+ *
+ */
+
+ if (setup_pf(s, protocol, typ) < 0)
+ return(-1);
+
+ /*
+ * set options, bind to underlying interface
+ *
+ */
+
+ strncpy(ifr.ifr_name, interface, sizeof(ifr.ifr_name));
+
+ /* record socket interface name and length */
+ strncpy(socklist[s].sa.sa_data, interface, sizeof(socklist[s].sa.sa_data));
+ socklist[s].iflen = strlen(interface);
+
+ return(s);
+}
+
+/*
+ * get the interface ethernet address
+ *
+ */
+
+int
+pfEthAddr(s, interface, addr)
+int s;
+char *interface;
+u_char *addr;
+{
+ strcpy(ifr.ifr_name, interface);
+ ifr.ifr_addr.sa_family = AF_INET;
+ if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+ perror("SIOCGIFHWADDR");
+ return(-1);
+ }
+ memcpy((char *)addr, ifr.ifr_hwaddr.sa_data, 6);
+ return(0);
+}
+
+/*
+ * add a multicast address to the interface
+ *
+ */
+
+int
+pfAddMulti(s, interface, addr)
+int s;
+char *interface;
+u_char *addr;
+{
+ int sock;
+
+#ifdef USE_SADDMULTI
+
+ strcpy(ifr.ifr_name, interface);
+
+#ifdef UPFILT
+ /* get the real interface name */
+ if (ioctl(s, EIOCIFNAME, &ifr) < 0) {
+ perror("EIOCIFNAME");
+ return(-1);
+ }
+#endif UPFILT
+
+
+
+ ifr.ifr_addr.sa_family = AF_UNSPEC;
+ bcopy((char *)addr, ifr.ifr_addr.sa_data, 6);
+
+ /*
+ * open a socket, temporarily, to use for SIOC* ioctls
+ *
+ */
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ perror("socket()");
+ return(-1);
+ }
+ if (ioctl(sock, SIOCADDMULTI, (caddr_t)&ifr) < 0) {
+ perror("SIOCADDMULTI");
+ close(sock);
+ return(-1);
+ }
+ close(sock);
+#endif USE_SADDMULTI
+ return(0);
+}
+
+/*
+ * delete a multicast address from the interface
+ *
+ */
+
+int
+pfDelMulti(s, interface, addr)
+int s;
+char *interface;
+u_char *addr;
+{
+ int sock;
+
+#ifdef USE_SADDMULTI
+
+ strcpy(ifr.ifr_name, interface);
+
+ ifr.ifr_addr.sa_family = AF_UNSPEC;
+ bcopy((char *)addr, ifr.ifr_addr.sa_data, 6);
+
+ /*
+ * open a socket, temporarily, to use for SIOC* ioctls
+ *
+ */
+ if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ perror("socket()");
+ return(-1);
+ }
+ if (ioctl(sock, SIOCDELMULTI, (caddr_t)&ifr) < 0) {
+ perror("SIOCDELMULTI");
+ close(sock);
+ return(-1);
+ }
+ close(sock);
+#endif USE_SADDMULTI
+
+
+ return(0);
+}
+
+/*
+ * return 1 if ethernet interface capable of multiple opens
+ *
+ */
+
+int
+eth_mopen(phase)
+int phase;
+{
+ if (phase == 2)
+ return(0);
+ return(1);
+}
+
+/*
+ * read a packet
+ * Read Data Structure describes packet(s) received
+ *
+ */
+
+
+
+
+int
+pfRead(fd, buf, len)
+int fd, len;
+u_char *buf;
+{
+ int i, cc;
+
+ int fromlen;
+ struct sockaddr sa;
+
+ RDS[0].dataLen = 0;
+ fromlen = sizeof(struct sockaddr);
+
+ if ((cc = recvfrom(fd, (char *)buf, len, 0, &sa, &fromlen)) <= 0)
+ return(cc);
+
+ /* check if from right interface */
+ for (i = socklist[fd].iflen-1; i >= 0; i--)
+ if (sa.sa_data[i] != socklist[fd].sa.sa_data[i])
+ return(0);
+
+ RDS[0].dataLen = cc;
+ RDS[0].dataPtr = buf;
+ RDS[1].dataLen = 0;
+
+ return(cc);
+}
+
+/*
+ * write a packet
+ *
+ */
+
+int
+pfWrite(fd, buf, len)
+int fd, len;
+u_char *buf;
+{
+
+#ifdef USE_WRITEV
+ struct iovec iov[2];
+ iov[0].iov_base = (caddr_t)buf;
+ iov[0].iov_len = 14;
+ iov[1].iov_base = (caddr_t)buf+14;
+ iov[1].iov_len = len-14;
+
+ if (writev(fd, iov, 2) == len)
+ return(len);
+
+#endif USE_WRITEV
+
+
+ if (sendto(fd, buf, len, 0, &socklist[fd].sa, sizeof(struct sockaddr)) == len)
+ return(len);
+
+ return(-1);
+}
+
+#endif /* __linux__ */
diff -up --recursive --new-file mopd-2.5.3.macro/common/pf.c mopd-2.5.3/common/pf.c
--- mopd-2.5.3.macro/common/pf.c 1996-08-06 14:20:27.000000000 +0000
+++ mopd-2.5.3/common/pf.c 2001-10-27 18:27:34.000000000 +0000
@@ -31,6 +31,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef __linux__
+
#ifndef LINT
static char rcsid[] = "$Id: pf.c,v 1.16 1996/08/06 14:19:48 moj Exp $";
#endif
@@ -58,7 +60,7 @@ static char rcsid[] = "$Id: pf.c,v 1.16
#include <syslog.h>
#include <varargs.h>
-#include "common/mopdef.h"
+#include "mopdef.h"
/*
* Variables
@@ -277,3 +279,4 @@ pfWrite(fd, buf, len, trans)
return(-1);
}
+#endif /* !__linux__ */
diff -up --recursive --new-file mopd-2.5.3.macro/common/print.c mopd-2.5.3/common/print.c
--- mopd-2.5.3.macro/common/print.c 1996-08-16 22:42:26.000000000 +0000
+++ mopd-2.5.3/common/print.c 2001-10-27 18:27:40.000000000 +0000
@@ -35,11 +35,11 @@ static char rcsid[] = "$Id: print.c,v 1.
#include <stdio.h>
#include "os.h"
-#include "common/mopdef.h"
-#include "common/nmadef.h"
-#include "common/nma.h"
-#include "common/cmp.h"
-#include "common/get.h"
+#include "mopdef.h"
+#include "nmadef.h"
+#include "nma.h"
+#include "cmp.h"
+#include "get.h"
#define SHORT_PRINT
diff -up --recursive --new-file mopd-2.5.3.macro/common/put.c mopd-2.5.3/common/put.c
--- mopd-2.5.3.macro/common/put.c 1996-08-16 22:43:15.000000000 +0000
+++ mopd-2.5.3/common/put.c 2001-10-27 18:27:44.000000000 +0000
@@ -34,7 +34,7 @@ static char rcsid[] = "$Id: put.c,v 1.5
#include <stddef.h>
#include <sys/types.h>
#include <time.h>
-#include "common/mopdef.h"
+#include "mopdef.h"
void
mopPutChar(pkt, index, value)
diff -up --recursive --new-file mopd-2.5.3.macro/common/rc.c mopd-2.5.3/common/rc.c
--- mopd-2.5.3.macro/common/rc.c 1995-10-13 19:26:23.000000000 +0000
+++ mopd-2.5.3/common/rc.c 2001-10-27 18:49:32.000000000 +0000
@@ -32,9 +32,9 @@ static char rcsid[] = "$Id: rc.c,v 1.8 1
#endif
#include "os.h"
-#include "common/get.h"
-#include "common/print.h"
-#include "common/mopdef.h"
+#include "get.h"
+#include "print.h"
+#include "mopdef.h"
void
mopDumpRC(fd, pkt, trans)
diff -up --recursive --new-file mopd-2.5.3.macro/mopa.out/Makefile mopd-2.5.3/mopa.out/Makefile
--- mopd-2.5.3.macro/mopa.out/Makefile 1996-08-16 22:44:52.000000000 +0000
+++ mopd-2.5.3/mopa.out/Makefile 2002-11-17 14:54:22.000000000 +0000
@@ -1,10 +1,19 @@
+PROGS = mopa.out
+OBJS = mopa.out.o
+LIBS = ../common/libcommon.a
-# $Id: Makefile,v 1.3 1996/08/16 22:44:35 moj Exp $
+CPPFLAGS = -I..
-PROG= mopa.out
-SRCS= mopa.out.c file.c
+all: $(PROGS)
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common
-.PATH: ${.CURDIR}/../common
+mopa.out: $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o mopa.out $(OBJS) $(LIBS)
-.include <bsd.prog.mk>
+../common/libcommon.a:
+ cd ../common && $(MAKE) libcommon.a
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f core $(PROGS) *.o
diff -up --recursive --new-file mopd-2.5.3.macro/mopa.out/mopa.out.c mopd-2.5.3/mopa.out/mopa.out.c
--- mopd-2.5.3.macro/mopa.out/mopa.out.c 1996-08-16 22:45:27.000000000 +0000
+++ mopd-2.5.3/mopa.out/mopa.out.c 2001-10-27 18:55:02.000000000 +0000
@@ -50,10 +50,6 @@
static char rcsid[] = "$Id: mopa.out.c,v 1.5 1996/08/16 22:44:58 moj Exp $";
#endif
-#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
-#include "common/file.h"
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/exec_aout.h>
#endif
@@ -68,20 +64,24 @@ static char rcsid[] = "$Id: mopa.out.c,v
#define MID_VAX 140
#endif
+#include <common/os.h>
+#include <common/common.h>
+#include <common/mopdef.h>
+#include <common/file.h>
+
u_char header[512]; /* The VAX header we generate is 1 block. */
struct exec ex, ex_swap;
int
main (int argc, char **argv)
{
- FILE *out; /* A FILE because that is easier. */
- int i;
- struct dllist dl;
-
#ifdef NOAOUT
fprintf(stderr, "%s: has no function in OS/BSD\n", argv[0]);
return(1);
-#endif
+#else
+ FILE *out; /* A FILE because that is easier. */
+ int i;
+ struct dllist dl;
if (argc != 3) {
fprintf (stderr, "usage: %s kernel-in sys-out\n", argv[0]);
@@ -151,4 +151,7 @@ main (int argc, char **argv)
}
fclose (out);
+
+ return (0);
+#endif
}
diff -up --recursive --new-file mopd-2.5.3.macro/mopchk/Makefile mopd-2.5.3/mopchk/Makefile
--- mopd-2.5.3.macro/mopchk/Makefile 1996-08-16 22:46:38.000000000 +0000
+++ mopd-2.5.3/mopchk/Makefile 2002-11-17 14:55:42.000000000 +0000
@@ -1,18 +1,19 @@
-# $Id: Makefile,v 1.4 1996/08/16 22:46:24 moj Exp $
+PROGS = mopchk
+OBJS = mopchk.o
+LIBS = ../common/libcommon.a
-PROG= mopchk
-SRCS= mopchk.c device.c version.c pf.c loop-bsd.c file.c
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common -DINFO
-CLEANFILES= version.c version.h
-LDADD= -lkvm
-.PATH: ${.CURDIR}/.. ${.CURDIR}/../common
-
-version.c version.h: ${.CURDIR}/../common/VERSION
- rm -f version.c; \
- sed 's/.*/char version[] = "&";/' ${.ALLSRC} > version.c
- set `sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \2/' ${.ALLSRC}` ; \
- { echo '#define VERSION_MAJOR' $$1 ; \
- echo '#define VERSION_MINOR' $$2 ; } > version.h
+CPPFLAGS = -I..
+all: $(PROGS)
-.include <bsd.prog.mk>
+mopchk: $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o mopchk $(OBJS) $(LIBS)
+
+../common/libcommon.a:
+ cd ../common && $(MAKE) libcommon.a
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f core $(PROGS) *.o
diff -up --recursive --new-file mopd-2.5.3.macro/mopchk/mopchk.c mopd-2.5.3/mopchk/mopchk.c
--- mopd-2.5.3.macro/mopchk/mopchk.c 1996-08-16 22:47:15.000000000 +0000
+++ mopd-2.5.3/mopchk/mopchk.c 2001-10-27 21:08:11.000000000 +0000
@@ -37,12 +37,12 @@ static char rcsid[] = "$Id: mopchk.c,v 1
* Usage: mopchk [-a] [-v] [filename...]
*/
-#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
-#include "common/device.h"
-#include "common/pf.h"
-#include "common/file.h"
+#include <common/os.h>
+#include <common/common.h>
+#include <common/mopdef.h>
+#include <common/device.h>
+#include <common/pf.h>
+#include <common/file.h>
/*
* The list of all interfaces that are being listened to. rarp_loop()
@@ -62,7 +62,8 @@ int AllFlag = 0; /* listen on "all"
int VersionFlag = 0; /* Show version */
int promisc = 0; /* promisc mode not needed */
char *Program;
-char version[];
+
+extern char version[];
void
main(argc, argv)
@@ -100,6 +101,8 @@ main(argc, argv)
/* NOTREACHED */
}
}
+
+ fileinfo = 1;
if (VersionFlag)
printf("%s: Version %s\n",Program,version);
diff -up --recursive --new-file mopd-2.5.3.macro/mopd/Makefile mopd-2.5.3/mopd/Makefile
--- mopd-2.5.3.macro/mopd/Makefile 1996-08-16 22:36:26.000000000 +0000
+++ mopd-2.5.3/mopd/Makefile 2002-11-17 14:56:16.000000000 +0000
@@ -1,20 +1,19 @@
-# $Id: Makefile,v 1.11 1996/08/16 22:36:06 moj Exp $
+PROGS = mopd
+OBJS = mopd.o process.o
+LIBS = ../common/libcommon.a
-PROG= mopd
-SRCS= mopd.c process.c print.c cmp.c get.c put.c mopdef.c nma.c device.c \
- version.c pf.c loop-bsd.c dl.c rc.c file.c
-MAN= mopd.8
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common
-CLEANFILES= version.c version.h
-LDADD= -lkvm
-.PATH: ${.CURDIR}/../common
-
-version.c version.h: ${.CURDIR}/../common/VERSION
- rm -f version.c; \
- sed 's/.*/char version[] = "&";/' ${.ALLSRC} > version.c
- set `sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \2/' ${.ALLSRC}` ; \
- { echo '#define VERSION_MAJOR' $$1 ; \
- echo '#define VERSION_MINOR' $$2 ; } > version.h
+CPPFLAGS = -I..
+all: $(PROGS)
-.include <bsd.prog.mk>
+mopd: $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o mopd $(OBJS) $(LIBS)
+
+../common/libcommon.a:
+ cd ../common && $(MAKE) libcommon.a
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f core $(PROGS) *.o
diff -up --recursive --new-file mopd-2.5.3.macro/mopd/mopd.c mopd-2.5.3/mopd/mopd.c
--- mopd-2.5.3.macro/mopd/mopd.c 1996-03-31 19:21:00.000000000 +0000
+++ mopd-2.5.3/mopd/mopd.c 2001-10-27 18:42:06.000000000 +0000
@@ -38,16 +38,16 @@ static char rcsid[] = "$Id: mopd.c,v 1.1
* mopd [ -d -f -v ] [ -3 | -4 ] interface
*/
-#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
-#include "common/device.h"
-#include "common/print.h"
-#include "common/pf.h"
-#include "common/cmp.h"
-#include "common/get.h"
-#include "common/dl.h"
-#include "common/rc.h"
+#include <common/os.h>
+#include <common/common.h>
+#include <common/mopdef.h>
+#include <common/device.h>
+#include <common/print.h>
+#include <common/pf.h>
+#include <common/cmp.h>
+#include <common/get.h>
+#include <common/dl.h>
+#include <common/rc.h>
#include "process.h"
/*
diff -up --recursive --new-file mopd-2.5.3.macro/mopd/process.c mopd-2.5.3/mopd/process.c
--- mopd-2.5.3.macro/mopd/process.c 1996-08-22 17:07:38.000000000 +0000
+++ mopd-2.5.3/mopd/process.c 2001-10-27 18:49:32.000000000 +0000
@@ -31,18 +31,19 @@
static char rcsid[] = "$Id: process.c,v 1.21 1996/08/22 17:04:07 moj Exp $";
#endif
-#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
-#include "common/nmadef.h"
-#include "common/get.h"
-#include "common/put.h"
-#include "common/print.h"
-#include "common/pf.h"
-#include "common/cmp.h"
-#include "common/dl.h"
-#include "common/rc.h"
-#include "common/file.h"
+#include <common/os.h>
+#include <common/common.h>
+#include <common/mopdef.h>
+#include <common/nmadef.h>
+#include <common/get.h>
+#include <common/put.h>
+#include <common/print.h>
+#include <common/pf.h>
+#include <common/cmp.h>
+#include <common/dl.h>
+#include <common/rc.h>
+#include <common/file.h>
+#include "process.h"
extern u_char buf[];
extern int DebugFlag;
diff -up --recursive --new-file mopd-2.5.3.macro/mopprobe/Makefile mopd-2.5.3/mopprobe/Makefile
--- mopd-2.5.3.macro/mopprobe/Makefile 1996-08-16 22:48:44.000000000 +0000
+++ mopd-2.5.3/mopprobe/Makefile 2002-11-17 14:56:33.000000000 +0000
@@ -1,17 +1,19 @@
-# $Id: Makefile,v 1.10 1996/08/16 22:48:30 moj Exp $
+PROGS = mopprobe
+OBJS = mopprobe.o
+LIBS = ../common/libcommon.a
-PROG= mopprobe
-SRCS= mopprobe.c device.c get.c cmp.c mopdef.c version.c pf.c loop-bsd.c
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common -DNODL
-CLEANFILES= version.c version.h
-LDADD= -lkvm
-.PATH: ${.CURDIR}/../common
-
-version.c version.h: ${.CURDIR}/../common/VERSION
- rm -f version.c; \
- sed 's/.*/char version[] = "&";/' ${.ALLSRC} > version.c
- set `sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \2/' ${.ALLSRC}` ; \
- { echo '#define VERSION_MAJOR' $$1 ; \
- echo '#define VERSION_MINOR' $$2 ; } > version.h
+CPPFLAGS = -I..
-.include <bsd.prog.mk>
+all: $(PROGS)
+
+mopprobe: $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o mopprobe $(OBJS) $(LIBS)
+
+../common/libcommon.a:
+ cd ../common && $(MAKE) libcommon.a
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f core $(PROGS) *.o
diff -up --recursive --new-file mopd-2.5.3.macro/mopprobe/mopprobe.c mopd-2.5.3/mopprobe/mopprobe.c
--- mopd-2.5.3.macro/mopprobe/mopprobe.c 1996-08-11 22:31:43.000000000 +0000
+++ mopd-2.5.3/mopprobe/mopprobe.c 2001-10-27 18:50:09.000000000 +0000
@@ -38,15 +38,15 @@ static char rcsid[] = "$Id: mopprobe.c,v
* mopprobe [ -3 | -4 ] interface
*/
-#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
-#include "common/device.h"
-#include "common/print.h"
-#include "common/get.h"
-#include "common/cmp.h"
-#include "common/pf.h"
-#include "common/nmadef.h"
+#include <common/os.h>
+#include <common/common.h>
+#include <common/mopdef.h>
+#include <common/device.h>
+#include <common/print.h>
+#include <common/get.h>
+#include <common/cmp.h>
+#include <common/pf.h>
+#include <common/nmadef.h>
/*
* The list of all interfaces that are being listened to. rarp_loop()
diff -up --recursive --new-file mopd-2.5.3.macro/moptrace/Makefile mopd-2.5.3/moptrace/Makefile
--- mopd-2.5.3.macro/moptrace/Makefile 1996-08-16 22:49:27.000000000 +0000
+++ mopd-2.5.3/moptrace/Makefile 2002-11-17 14:56:54.000000000 +0000
@@ -1,20 +1,19 @@
-# $Id: Makefile,v 1.6 1996/08/16 22:49:14 moj Exp $
+PROGS = moptrace
+OBJS = moptrace.o
+LIBS = ../common/libcommon.a
-PROG= moptrace
-SRCS= moptrace.c print.c cmp.c get.c mopdef.c nma.c device.c version.c pf.c \
- loop-bsd.c dl.c rc.c
-MAN= moptrace.1
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common
-CLEANFILES= version.c version.h
-LDADD= -lkvm
-.PATH: ${.CURDIR}/../common
-
-version.c version.h: ${.CURDIR}/../common/VERSION
- rm -f version.c; \
- sed 's/.*/char version[] = "&";/' ${.ALLSRC} > version.c
- set `sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \2/' ${.ALLSRC}` ; \
- { echo '#define VERSION_MAJOR' $$1 ; \
- echo '#define VERSION_MINOR' $$2 ; } > version.h
+CPPFLAGS = -I..
+all: $(PROGS)
-.include <bsd.prog.mk>
+moptrace: $(OBJS) $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o moptrace $(OBJS) $(LIBS)
+
+../common/libcommon.a:
+ cd ../common && $(MAKE) libcommon.a
+
+.c.o:
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f core $(PROGS) *.o
diff -up --recursive --new-file mopd-2.5.3.macro/moptrace/moptrace.c mopd-2.5.3/moptrace/moptrace.c
--- mopd-2.5.3.macro/moptrace/moptrace.c 1996-08-07 22:48:04.000000000 +0000
+++ mopd-2.5.3/moptrace/moptrace.c 2001-10-27 18:50:29.000000000 +0000
@@ -38,15 +38,15 @@ static char rcsid[] = "$Id: moptrace.c,v
* moptrace [ -d ] [ -3 | -4 ] interface
*/
-#include "os.h"
-#include "common/common.h"
-#include "common/mopdef.h"
-#include "common/device.h"
-#include "common/print.h"
-#include "common/pf.h"
-#include "common/dl.h"
-#include "common/rc.h"
-#include "common/get.h"
+#include <common/os.h>
+#include <common/common.h>
+#include <common/mopdef.h>
+#include <common/device.h>
+#include <common/print.h>
+#include <common/pf.h>
+#include <common/dl.h>
+#include <common/rc.h>
+#include <common/get.h>
/*
* The list of all interfaces that are being listened to.
|