Skip to content

Instantly share code, notes, and snippets.

@xyzzy-17-638
Created March 2, 2012 20:32
Show Gist options
  • Save xyzzy-17-638/1961083 to your computer and use it in GitHub Desktop.
Save xyzzy-17-638/1961083 to your computer and use it in GitHub Desktop.
xyzzy文字列、パス比較関数メモ

src/utils.cc

char *find_slash (const char *p);

@desc	SJISZ文字列 p から最初の'/'もしくは'\\'を探す

@param	p	SJISZ 文字列

@retval	0	見つからなかった
@retval	!0	'/'もしくは'\\'が存在するアドレス

const char * を渡すが戻り値がなぜか char * という不思議な関数。

char *find_last_slash (const char *p);

@desc	SJISZ文字列 p から最後の'/'もしくは'\\'の位置を探す

@param	p	SJISZ 文字列

@retval	0	見つからなかった
@retval	!0	'/'もしくは'\\'が存在するアドレス

const char * を渡すが戻り値がなぜか char * という不思議な関数。

void convert_backsl_with_sl (char *path, int f, int t);

@desc	SJISZ文字列で表現されたpath中の文字 f を t で置き換える

@param	path	SJISZ 文字列
@param	f	置き換え元文字
@param	t	置き換え先文字

int strcasecmp (const char *s1, const char *s2);

@desc	SJISZ文字列 s1 と s2 を比較する。比較の際ASCII大文字小文字は同一視する

_stricmp() 互換?

src/fileio.cc

static int pathname_equal (const char *path1, const char *path2);

int same_file_p (const char *path1, const char *path2);

path1 と path2 を比較し、同一ファイルかどうかを返す。
ただし path1, path2 ともに存在するファイルの場合のみ同一ファイルかどうかを判別する。

src/pathname.cc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment