Yeah, looks OK to me, although personally I would be very afraid of
using a compiler with broken ternary code generation. You don't know
what else might be silently broken... (01)
--Ken (02)
> Hi Ken,
>
> If you remember, I was having trouble a while ago getting klh10 to
> compile under gcc 4.x. It works fine under gcc 3.4.x.
>
> I got some help from Alex Bochannek and he was able to get klh10-2.0h
> compiling under gcc 4.x. I tested it on gcc-4.1.1 (glibc-2.5) and it
> seems to run fine.
>
> Would you be willing to take a look at his patch (attached below) and if
> it looks ok to you then incorporate it into your current codebase? It
> would be great to have a new release of klh10 that compiles under gcc 4.x.
>
> Thanks!
>
> Jonathan
>
>
>
> -------- Original Message --------
> Subject: Re: NLS/AUGMENT question.
> Date: Tue, 20 Feb 2007 16:07:49 -0800
> From: Alex Bochannek <alex@p9.com>
> To: Jonathan Cheyer <jonathan@cheyer.biz>
> CC: Eugene Eric Kim <eekim@blueoxen.com>
> References: <umz6st2o2.fsf@p9.com> <456D478B.5060201@blueoxen.com>
> <456E46AF.4040401@cheyer.biz> <u8xge4fk8.fsf@p9.com>
> <usldce5ul.fsf@p9.com> <45D16A8C.5010001@cheyer.biz>
> <uwt2lz3vy.fsf@p9.com> <45D34A9E.1020102@cheyer.biz>
> <uabzg7ayk.fsf@p9.com> <45D5DD7D.6070100@cheyer.biz>
>
> OK, why don't you try the below.
>
> I saw three main issues:
>
> 1) stdlib.h needs to be included if exit() is used since the implicit
> declaration doesn't match exit's real one.
> 2) You can't use logf as a variable name since there is an internal
> logf() function.
> 3) There is something going on with the ternary conditional operator
> in an assignment that results in requesting the address of the
> register variable, which won't work. Can be worked around with an
> if/else, but I'll see if I can find out more about this.
>
> Alex.
>
> [awb@localhost ~]$ diff klh10-2.0h{,.new}/src
> diff klh10-2.0h/src/dpsup.c klh10-2.0h.new/src/dpsup.c
> 42a43
> > #include <stdlib.h> /* For exit */
> diff klh10-2.0h/src/kn10ops.c klh10-2.0h.new/src/kn10ops.c
> 796c796,802
> < if (i > (HBITS*4-2)) d.LO = r ? w10mask : w10zero;
> ---
> > if (i > (HBITS*4-2)) {
> > if (r) {
> > d.LO = w10mask;
> > } else {
> > d.LO = w10zero;
> > }
> > }
> 798c804,808
> < d.HI = r ? w10mask : w10zero;
> ---
> > if (r) {
> > d.HI = w10mask;
> > } else {
> > d.HI = w10zero;
> > }
> 3266c3276,3280
> < qw.D0 = (qbit ? x_dsub(qw.D0, d) : x_dadd(qw.D0, d));
> ---
> > if (qbit) {
> > qw.D0 = x_dsub(qw.D0, d);
> > } else {
> > qw.D0 = x_dadd(qw.D0, d);
> > }
> diff klh10-2.0h/src/osdsup.c klh10-2.0h.new/src/osdsup.c
> 46a47
> > #include <stdlib.h> /* For exit */
> diff klh10-2.0h/src/tapedd.c klh10-2.0h.new/src/tapedd.c
> 246c246
> < FILE *logf = NULL;
> ---
> > FILE *log_file = NULL;
> 366c366
> < fprintf(logf, "; %s: %s\n", t->mt_devname, s);
> ---
> > fprintf(log_file, "; %s: %s\n", t->mt_devname, s);
> 374c374
> < fprintf(logf, "\n?%s\n",errmsg);
> ---
> > fprintf(log_file, "\n?%s\n",errmsg);
> 387c387
> < logf = stderr;
> ---
> > log_file = stderr;
> 402c402
> < logf = stderr;
> ---
> > log_file = stderr;
> 404,406c404,406
> < if ((logf = fopen(sw_logpath, "w")) == NULL) {
> < logf = stderr;
> < fprintf(logf, "; Cannot open log file \"%s\", using stderr.\n",
> ---
> > if ((log_file = fopen(sw_logpath, "w")) == NULL) {
> > log_file = stderr;
> > fprintf(log_file, "; Cannot open log file \"%s\", using stderr.\n",
> 423c423
> < fprintf(logf, "; %s tape spec \"%s\" (Type: %s", \
> ---
> > fprintf(log_file, "; %s tape spec \"%s\" (Type: %s", \
> 426,427c426,427
> < fprintf(logf, " format: %s", vmt_fmtname((d).d_vfmt)); \
> < fprintf(logf, ")\n")
> ---
> > fprintf(log_file, " format: %s", vmt_fmtname((d).d_vfmt)); \
> > fprintf(log_file, ")\n")
> 434c434
> < fprintf(logf, "; Input record size %ld\n", (long)dvi.d_recsiz);
> ---
> > fprintf(log_file, "; Input record size %ld\n", (long)dvi.d_recsiz);
> 436c436
> < fprintf(logf, "; Output record size %ld\n", (long)dvo.d_recsiz);
> ---
> > fprintf(log_file, "; Output record size %ld\n", (long)dvo.d_recsiz);
> 438c438
> < fprintf(logf, "; Max tapemarks (files) to process: %ld\n",
> sw_maxfile);
> ---
> > fprintf(log_file, "; Max tapemarks (files) to process: %ld\n",
>sw_maxfile);
> 440c440
> < fprintf(logf, "; Max records to process: %ld\n", sw_maxrec);
> ---
> > fprintf(log_file, "; Max records to process: %ld\n", sw_maxrec);
> 442c442
> < fprintf(logf, "; Using logging path %s\n", sw_logpath);
> ---
> > fprintf(log_file, "; Using logging path %s\n", sw_logpath);
> 475c475
> < fprintf(logf, "; Copying from \"%s\" to \"%s\"...\n", dvi.d_path,
> ---
> > fprintf(log_file, "; Copying from \"%s\" to \"%s\"...\n", dvi.d_path,
> 478c478
> < fprintf(logf, "; Stopped unexpectedly.\n");
> ---
> > fprintf(log_file, "; Stopped unexpectedly.\n");
> 482c482
> < fprintf(logf, "; Error closing output.\n");
> ---
> > fprintf(log_file, "; Error closing output.\n");
> 487c487
> < fprintf(logf, "; %3s: %ld+%ld errs, %ld files, %ld recs, %"
> ---
> > fprintf(log_file, "; %3s: %ld+%ld errs, %ld files, %ld recs, %"
> 493c493
> < fclose(logf);
> ---
> > fclose(log_file);
> 540c540
> < fprintf(logf, "; Stopped due to output write error: %s\n",
> ---
> > fprintf(log_file, "; Stopped due to output write error: %s\n",
> 579c579
> < fprintf(logf, "; Stopped due to input read error: %s\n",
> ---
> > fprintf(log_file, "; Stopped due to input read error: %s\n",
> 606c606
> < fprintf(logf, "; No input tape directory specified\n");
> ---
> > fprintf(log_file, "; No input tape directory specified\n");
> 610c610
> < fprintf(logf, "; No output tape directory specified\n");
> ---
> > fprintf(log_file, "; No output tape directory specified\n");
> 632c632
> < fprintf(logf,"; Problem with tape desc file \"%s\": %s\n",
> ---
> > fprintf(log_file,"; Problem with tape desc file \"%s\": %s\n",
> 641c641
> < fprintf(logf,"Cannot open tape desc file \"%s\": %s\n",
> ---
> > fprintf(log_file,"Cannot open tape desc file \"%s\": %s\n",
> 883c883
> < fprintf(logf, "; Couldn't mount %sput virtual tape: %s\n",
> ---
> > fprintf(log_file, "; Couldn't mount %sput virtual tape: %s\n",
> 901c901
> < fprintf(logf, "; Cannot malloc data filename\n");
> ---
> > fprintf(log_file, "; Cannot malloc data filename\n");
> 918c918
> < fprintf(logf, "; Couldn't mount %sput virtual tape: %s\n",
> ---
> > fprintf(log_file, "; Couldn't mount %sput virtual tape: %s\n",
> 940c940
> < fprintf(logf, "; Cannot open %sput: %s\n",
> ---
> > fprintf(log_file, "; Cannot open %sput: %s\n",
> 965c965
> < fprintf(logf, "; malloc failed for cpath dupcstr\n");
> ---
> > fprintf(log_file, "; malloc failed for cpath dupcstr\n");
> 972c972
> < fprintf(logf,"Cannot open tape desc file \"%s\": %s\n",
> ---
> > fprintf(log_file,"Cannot open tape desc file \"%s\": %s\n",
> 979c979
> < fprintf(logf, "; Cannot parse tape desc\n");
> ---
> > fprintf(log_file, "; Cannot parse tape desc\n");
> 985c985
> < fprintf(logf, "; malloc failed for rpath dupcstr\n");
> ---
> > fprintf(log_file, "; malloc failed for rpath dupcstr\n");
> 1000c1000
> < fprintf(logf, "; Tapedir forcing larger %sput record size (%ld
> instead of %ld)\n",
> ---
> > fprintf(log_file, "; Tapedir forcing larger %sput record size
>(%ld instead of %ld)\n",
> 1032c1032
> < fprintf(logf, "; Cannot malloc %sput buffer (size %ld)\n",
> ---
> > fprintf(log_file, "; Cannot malloc %sput buffer (size %ld)\n",
> 1094c1094
> < fprintf(logf, "; %sput device read error: %s\n",
> ---
> > fprintf(log_file, "; %sput device read error: %s\n",
> 1164c1164
> < fprintf(logf, "devwerr: td_recapp malloc failed");
> ---
> > fprintf(log_file, "devwerr: td_recapp malloc failed");
> 1181c1181
> < fprintf(logf, "devweof: td_recapp malloc failed");
> ---
> > fprintf(log_file, "devweof: td_recapp malloc failed");
> 1279c1279
> < fprintf(logf, "; Warning: DUMPI won for max rec size %ld!\n",
> ---
> > fprintf(log_file, "; Warning: DUMPI won for max rec size %ld!\n",
> 1290c1290
> < fprintf(logf, "; Tape GDSTS%% error: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "; Tape GDSTS%% error: %s\n",
>os_strerror(-1));
> 1297c1297
> < fprintf(logf, "; Tape DUMPI%% error: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "; Tape DUMPI%% error: %s\n", os_strerror(-1));
> 1305c1305
> < t20status(dp, logf, flgs, acs[3]);
> ---
> > t20status(dp, log_file, flgs, acs[3]);
> 1313c1313
> < fprintf(logf, "; Tape error: %s\n",
> ---
> > fprintf(log_file, "; Tape error: %s\n",
> 1342,1343c1342,1343
> < fprintf(logf, "; Tape read error: %s\n", os_strerror(-1));
> < os_mtstatus(dp, logf); /* Show full status */
> ---
> > fprintf(log_file, "; Tape read error: %s\n", os_strerror(-1));
> > os_mtstatus(dp, log_file); /* Show full status */
> 1349c1349
> < fprintf(logf, "; Cannot proceed past read error,
>aborting...\n");
> ---
> > fprintf(log_file, "; Cannot proceed past read error,
>aborting...\n");
> 1368c1368
> < fprintf(logf, "; Warning: read max rec size %ld!\n",
> ---
> > fprintf(log_file, "; Warning: read max rec size %ld!\n",
> 1400c1400
> < fprintf(logf, "; Tape DUMPO%% error: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "; Tape DUMPO%% error: %s\n", os_strerror(-1));
> 1418c1418
> < fprintf(logf, "; Warning: partial record padded out (%ld => %ld)\n",
> ---
> > fprintf(log_file, "; Warning: partial record padded out (%ld =>
>%ld)\n",
> 1421c1421
> < fprintf(logf, "; Internal bug: padout exceeds buffer (%ld > %ld)\n",
> ---
> > fprintf(log_file, "; Internal bug: padout exceeds buffer (%ld >
>%ld)\n",
> 1440c1440
> < fprintf(logf, "; (Rec %ld, try %d) ",
> ---
> > fprintf(log_file, "; (Rec %ld, try %d) ",
> 1443c1443
> < fprintf(logf, "Tape write error: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "Tape write error: %s\n", os_strerror(-1));
> 1445c1445
> < fprintf(logf, "Tape write truncated: %d, shd be %ld\n",
> ---
> > fprintf(log_file, "Tape write truncated: %d, shd be %ld\n",
> 1455c1455
> < os_mtstatus(dp, logf); /* Show full status */
> ---
> > os_mtstatus(dp, log_file); /* Show full status */
> 1474c1474
> < fprintf(logf, "; MTWEOF ioctl failed: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "; MTWEOF ioctl failed: %s\n", os_strerror(-1));
> 1494c1494
> < fprintf(logf, "; MTFSR ioctl failed: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "; MTFSR ioctl failed: %s\n", os_strerror(-1));
> diff klh10-2.0h/src/vdkfmt.c klh10-2.0h.new/src/vdkfmt.c
> 133c133
> < FILE *logf;
> ---
> > FILE *log_file;
> 247c247
> < fprintf(logf, "; %s: %s\n", t->dk_devname, s);
> ---
> > fprintf(log_file, "; %s: %s\n", t->dk_devname, s);
> 255c255
> < fprintf(logf, "\n?%s\n",errmsg);
> ---
> > fprintf(log_file, "\n?%s\n",errmsg);
> 265c265
> < logf = stderr;
> ---
> > log_file = stderr;
> 275c275
> < logf = stderr;
> ---
> > log_file = stderr;
> 277,279c277,279
> < if ((logf = fopen(sw_logpath, "w")) == NULL) {
> < logf = stderr;
> < fprintf(logf, "; Cannot open log file \"%s\", using stderr.\n",
> ---
> > if ((log_file = fopen(sw_logpath, "w")) == NULL) {
> > log_file = stderr;
> > fprintf(log_file, "; Cannot open log file \"%s\", using stderr.\n",
> 290c290
> < fprintf(logf, "; Input disk spec \"%s\" (Type: %s) Format: %s\n",
> ---
> > fprintf(log_file, "; Input disk spec \"%s\" (Type: %s) Format: %s\n",
> 293c293
> < fprintf(logf, "; Output disk spec \"%s\" (Type: %s) Format: %s\n",
> ---
> > fprintf(log_file, "; Output disk spec \"%s\" (Type: %s) Format: %s\n",
> 298,299c298,299
> < fprintf(logf, "; Drive type: %s\n", dvi.d_dcf.dcf_name);
> < fprintf(logf, "; %ld sectors, %d wds/sec\n", dvi.d_totsec,
> ---
> > fprintf(log_file, "; Drive type: %s\n", dvi.d_dcf.dcf_name);
> > fprintf(log_file, "; %ld sectors, %d wds/sec\n", dvi.d_totsec,
> 301c301
> < fprintf(logf, "; (%d secs, %d trks, %d cyls\n",
> ---
> > fprintf(log_file, "; (%d secs, %d trks, %d cyls\n",
> 306c306
> < fprintf(logf, "; Using logging path %s\n", sw_logpath);
> ---
> > fprintf(log_file, "; Using logging path %s\n", sw_logpath);
> 316c316
> < fprintf(logf, "; Copying from \"%s\" to \"%s\"...\n", dvi.d_path,
> ---
> > fprintf(log_file, "; Copying from \"%s\" to \"%s\"...\n", dvi.d_path,
> 322c322
> < if (!ret) fprintf(logf, "; Stopped unexpectedly.\n");
> ---
> > if (!ret) fprintf(log_file, "; Stopped unexpectedly.\n");
> 329c329
> < fprintf(logf, "; %s: %d+%d errs, %d secs, %ld bytes\n",
> ---
> > fprintf(log_file, "; %s: %d+%d errs, %d secs, %ld bytes\n",
> 336c336
> < fclose(logf);
> ---
> > fclose(log_file);
> 350c350
> < fprintf(logf, "; Pages:\n");
> ---
> > fprintf(log_file, "; Pages:\n");
> 356c356
> < fprintf(logf, "; Aborting loop, last err: %s\n", os_strerror(-1));
> ---
> > fprintf(log_file, "; Aborting loop, last err: %s\n",
>os_strerror(-1));
> 369c369
> < fprintf(logf, "; Aborting loop, last err: %s\n",
> ---
> > fprintf(log_file, "; Aborting loop, last err: %s\n",
> 380c380
> < putc(pagsym[nwrt&03], logf);
> ---
> > putc(pagsym[nwrt&03], log_file);
> 387c387
> < fprintf(logf, "\n");
> ---
> > fprintf(log_file, "\n");
> 518c518
> < fprintf(logf, "; Null mount path\n");
> ---
> > fprintf(log_file, "; Null mount path\n");
> 535c535
> < fprintf(logf, "; Cannot mount device \"%s\": %s\n",
> ---
> > fprintf(log_file, "; Cannot mount device \"%s\": %s\n",
> 550c550
> < fprintf(logf, "; Closing \"%s\"\n", d->d_path);
> ---
> > fprintf(log_file, "; Closing \"%s\"\n", d->d_path);
> 573c573
> < fprintf(logf, "; read daddr=%ld\n", daddr);
> ---
> > fprintf(log_file, "; read daddr=%ld\n", daddr);
> 580c580
> < fprintf(logf, "; read error on %s: %s\n",
> ---
> > fprintf(log_file, "; read error on %s: %s\n",
> 595c595
> < fprintf(logf, "; write daddr=%ld\n", daddr);
> ---
> > fprintf(log_file, "; write daddr=%ld\n", daddr);
> 602c602
> < fprintf(logf, "; write error on %s: %s\n",
> ---
> > fprintf(log_file, "; write error on %s: %s\n",
> (03)
_________________________________________________________________
Message Archives: http://chm.cim3.net/forum/nls-technical/
Shared Files: http://chm.cim3.net/file/work/project/nls-restore/
Community Portal: http://www.computerhistory.org/
To Post: mailto:nls-technical@chm.cim3.net
Community Wiki: http://chm.cim3.net/cgi-bin/wiki.pl?NLS_Restoration (04)
|