Changeset View
Changeset View
Standalone View
Standalone View
man/man2html.cpp
Show All 12 Lines | |||||
3919 | } | 3919 | } | ||
3920 | while (*c != '\n') c++; | 3920 | while (*c != '\n') c++; | ||
3921 | *c = '\0'; | 3921 | *c = '\0'; | ||
3922 | scan_troff(h, 1, &name); | 3922 | scan_troff(h, 1, &name); | ||
3923 | if (name[3] == '/') | 3923 | if (name[3] == '/') | ||
3924 | h = name + 3; | 3924 | h = name + 3; | ||
3925 | else | 3925 | else | ||
3926 | h = name; | 3926 | h = name; | ||
3927 | | ||||
3928 | // The format of the argument to .so varies among man pages. | ||||
3929 | // Some of them, e.g. pam.8, use "PAM.8". Others, e.g. telinit.8, | ||||
3930 | // use "man8/init.8". So they are not always true relative paths, | ||||
3931 | // although the man(1) command seems to handle them with no problem. | ||||
3932 | // | ||||
3933 | // The code above starting "h = c - 3" attempts to turn the argument | ||||
3934 | // into a relative path, but that is not correct in the case of pam.8 | ||||
3935 | // as above. So this removes the "../" prefix again if there is | ||||
3936 | // no other slash following it. | ||||
3937 | char *firstSlash = strchr(h, '/'); | ||||
3938 | if (firstSlash != 0) | ||||
3939 | { | ||||
3940 | char *nextSlash = strchr(firstSlash + 1, '/'); | ||||
3941 | if (nextSlash == 0) | ||||
3942 | h = firstSlash + 1; | ||||
3943 | } | ||||
3944 | | ||||
3927 | /* this works alright, except for section 3 */ | 3945 | /* this works alright, except for section 3 */ | ||
3928 | buf = read_man_page(h); | 3946 | buf = read_man_page(h); | ||
3929 | if (!buf) | 3947 | if (!buf) | ||
3930 | { | 3948 | { | ||
3931 | qCDebug(KIO_MAN_LOG) << "Unable to open or read file: .so " << (h); | 3949 | qCDebug(KIO_MAN_LOG) << "Unable to open or read file: .so " << (h); | ||
3932 | out_html("<BLOCKQUOTE>" | 3950 | out_html("<BLOCKQUOTE>" | ||
3933 | "man2html: unable to open or read file.\n"); | 3951 | "man2html: unable to open or read file.\n"); | ||
3934 | out_html(h); | 3952 | out_html(h); | ||
Show All 12 Lines |