ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/main.C
(Generate patch)

Comparing deliantra/server/server/main.C (file contents):
Revision 1.23 by root, Sun Sep 10 15:59:57 2006 UTC vs.
Revision 1.24 by root, Tue Sep 12 19:20:08 2006 UTC

1
2/*
3 * static char *rcsid_main_c =
4 * "$Id: main.C,v 1.23 2006/09/10 15:59:57 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2001-2003 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2001-2003 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
418 */ 412 */
419char * 413char *
420clean_path (const char *file) 414clean_path (const char *file)
421{ 415{
422 static char newpath[MAX_BUF], *cp; 416 static char newpath[MAX_BUF], *cp;
417 assign (newpath, file);
423 418
424 strncpy (newpath, file, MAX_BUF - 1);
425 newpath[MAX_BUF - 1] = '\0';
426 for (cp = newpath; *cp != '\0'; cp++) 419 for (cp = newpath; *cp != '\0'; cp++)
427 {
428 if (*cp == '/') 420 if (*cp == '/')
429 *cp = '_'; 421 *cp = '_';
430 } 422
431 return newpath; 423 return newpath;
432} 424}
433 425
434 426
435/* unclean_path takes a path and replaces all _ with / 427/* unclean_path takes a path and replaces all _ with /
443unclean_path (const char *src) 435unclean_path (const char *src)
444{ 436{
445 static char newpath[MAX_BUF], *cp; 437 static char newpath[MAX_BUF], *cp;
446 438
447 cp = strrchr (src, '/'); 439 cp = strrchr (src, '/');
448 if (cp) 440 assign (newpath, cp ? cp + 1 : src);
449 strncpy (newpath, cp + 1, MAX_BUF - 1);
450 else
451 strncpy (newpath, src, MAX_BUF - 1);
452 newpath[MAX_BUF - 1] = '\0';
453 441
454 for (cp = newpath; *cp != '\0'; cp++) 442 for (cp = newpath; *cp != '\0'; cp++)
455 {
456 if (*cp == '_') 443 if (*cp == '_')
457 *cp = '/'; 444 *cp = '/';
458 } 445
459 return newpath; 446 return newpath;
460} 447}
461 448
462 449
463/* The player is trying to enter a randomly generated map. In this case, generate the 450/* The player is trying to enter a randomly generated map. In this case, generate the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines