nulib2/nulib2/NuLib2.h
Andy McFadden 132a8338b9 Fix Mac OS X behavior
Some fixes to the Mac OS X build:

- Replace the Carbon calls that were used to set the creator
and file type with xattr calls.  The Carbon stuff still worked
but caused deprecation warnings.  Stop linking against Carbon.

- Correct the way resource forks are accessed (from "/rsrc" to
"/..namedfork/rsrc").  The native resource fork support is
incomplete and doesn't work quite right, so it's now disabled.
(Which means the corrections to the file name don't actually do
anything, but you can at least play with it.)

- Correct the file/aux type conversion, which appeared to do
useful things but actually didn't in some circumstances (e.g. when
adding files, the code for acquiring the file types needs to be in
NuLib2, not NufxLib).

- Set creator and file type to 'pdos' values when extracting from
a Binary ][ archive.

Also, drop some old purify/quantify stuff.
2015-01-03 15:59:37 -08:00

116 lines
3.7 KiB
C

/*
* NuLib2
* Copyright (C) 2000-2007 by Andy McFadden, All Rights Reserved.
* This is free software; you can redistribute it and/or modify it under the
* terms of the BSD License, see the file COPYING.
*/
#ifndef NULIB2_NULIB2_H
#define NULIB2_NULIB2_H
#include "SysDefs.h" /* system-dependent defs; must come first */
#include <NufxLib.h>
#include "State.h"
#include "MiscStuff.h"
#ifdef USE_DMALLOC
/* enable with something like "dmalloc -l logfile -i 100 medium" */
# include "dmalloc.h"
#endif
/* replace unsupported chars with '%xx' */
#define kForeignIndic '%'
/* use this to separate path components in stored filenames */
#define kStorageFssep ':'
/* make our one-line comments this big */
#define kDefaultCommentLen 200
/* for use with FormatDateShort() */
#define kDateOutputLen 64
/*
* Function prototypes.
*/
/* Add.c */
NuError DoAdd(NulibState* pState);
/* ArcUtils.c */
char* GetSimpleComment(NulibState* pState, const char* pathname, int maxLen);
Boolean IsFilenameStdin(const char* archiveName);
Boolean IsSpecified(NulibState* pState, const NuRecord* pRecord);
NuError OpenArchiveReadOnly(NulibState* pState);
NuError OpenArchiveReadWrite(NulibState* pState);
const NuThread* GetThread(const NuRecord* pRecord, uint32_t idx);
Boolean IsRecordReadOnly(const NuRecord* pRecord);
/* Binary2.c */
NuError BNYDoExtract(NulibState* pState);
NuError BNYDoTest(NulibState* pState);
NuError BNYDoListShort(NulibState* pState);
NuError BNYDoListVerbose(NulibState* pState);
NuError BNYDoListDebug(NulibState* pState);
/* Delete.c */
NuError DoDelete(NulibState* pState);
/* Extract.c */
NuError DoExtract(NulibState* pState);
NuError DoExtractToPipe(NulibState* pState);
NuError DoTest(NulibState* pState);
/* Filename.c */
const char* GetFileTypeString(uint32_t fileType);
const char* NormalizePath(NulibState* pState, NuPathnameProposal* pathProposal);
void InterpretExtension(NulibState* pState, const char* pathName,
uint32_t* pFileType, uint32_t* pAuxType);
Boolean ExtractPreservationString(NulibState* pState, char* pathname,
uint32_t* pFileType, uint32_t* pAuxType, NuThreadID* pThreadID);
void DenormalizePath(NulibState* pState, char* pathBuf);
const char* FilenameOnly(NulibState* pState, const char* pathname);
const char* FindExtension(NulibState* pState, const char* pathname);
/* List.c */
NuError DoListShort(NulibState* pState);
NuError DoListVerbose(NulibState* pState);
NuError DoListDebug(NulibState* pState);
char* FormatDateShort(const NuDateTime* pDateTime, char* buffer);
/* Main.c */
extern const char* gProgName;
/* MiscUtils.c */
void ReportError(NuError err, const char* format, ...)
#if defined(__GNUC__)
__attribute__ ((format(printf, 2, 3)))
#endif
;
#ifdef USE_DMALLOC /* want file and line numbers for calls */
# define Malloc(size) malloc(size)
# define Calloc(size) calloc(1, size)
# define Realloc(ptr, size) realloc(ptr, size)
# define Free(ptr) (ptr != NULL ? free(ptr) : (void)0)
#else
void* Malloc(size_t size);
void* Calloc(size_t size);
void* Realloc(void* ptr, size_t size);
void Free(void* ptr);
#endif
NuResult FreeCallback(NuArchive* pArchive, void* args);
UNICHAR* CopyMORToUNI(const char* stringMOR);
/* SysUtils.c */
NuError NormalizeFileName(NulibState* pState, const char* srcp, long srcLen,
char fssep, char** pDstp, long dstLen);
NuError NormalizeDirectoryName(NulibState* pState, const char* srcp,
long srcLen, char fssep, char** pDstp, long dstLen);
char* MakeTempArchiveName(NulibState* pState);
NuError SetFinderInfo(int fd, uint8_t proType, uint16_t proAux);
NuError AddFile(NulibState* pState, NuArchive* pArchive,
const char* pathname);
NuError Mkdir(const char* dir);
NuError TestFileExistence(const char* fileName, Boolean* pIsDir);
#endif /*NULIB2_NULIB2_H*/