Category : C Source Code
Archive   : LHA211S.ZIP
Filename : PATH.C

 
Output of file : PATH.C contained in archive : LHA211S.ZIP
/***********************************************************
path.c -- convert to MS-DOS's pathname
***********************************************************/
#include
#include
#include "lh.h"

char *form_name(unsigned char *p, int i)
{
int j, kflg;

kflg = 0;
for (j = 0; j < i; j++) {
if (*p == 0) break;
else if (kflg) kflg = 0;
else if (iskanji(*p)) kflg = 1;
else if (strchr("\"*+,./:;<=>?[\\]|\xff", *p) || *p <= ' ' ||
*p == swchar) *p = '_';
p++;
}
if (kflg) p--;
*p = '\0';
return p;
}

void form_identifier(char *p)
{
char *q, *r;

q = strrchr(p, '.');
if (q) {
*q = '\0';
r = form_name(p, 8);
*r++ = '.';
q++;
form_name(q, 3);
strcpy(r, q);
} else {
form_name(p, 8);
}
}

void form_path(char *p)
{
char *q, *r;

if (*p == DELIM) p++;
r = p;
q = strchr(p, DELIM);
while (q) {
*q = '\0';
form_identifier(p);
r = stpcpy(r, p);
*r++ = DELIM;
p = q + 1;
q = strchr(p, DELIM);
}
form_identifier(p);
strcpy(r, p);
}

#ifdef DEBUG
void main(int argc, char *argv[])
{
form_path(argv[1]);
printf("%s\n", argv[1]);
}
#endif


  3 Responses to “Category : C Source Code
Archive   : LHA211S.ZIP
Filename : PATH.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/