GCC(1) USER COMMANDS GCC(1) NAME gcc - GNU project C Compiler SYNOPSIS gcc [ options ] files WARNING This man page is an extract of the documentation of the GNU C compiler and is limited to the meaning of the options. It is updated only occasionally, because the GNU project does not use nroff. For complete, current documentation, refer to the Info file gcc or the DVI file gcc.dvi which are made from the Texinfo source file gcc.texinfo. DESCRIPTION The GNU C compiler uses a command syntax much like the Unix C compiler. The gcc program accepts options and file names as operands. Multiple single-letter options may not be grouped: -dr is very different from -d -r. When you invoke GNU CC, it normally does preprocessing, compilation, assem- bly and linking. File names which end in .c are taken as C source to be preprocessed and compiled; file names ending in .i are taken as preprocessor output to be compiled; compiler output files plus any input files with names ending in .s are assembled; then the resulting object files, plus any other input files, are linked together to produce an execut- able. Command options allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker. Then the output consists of object files output by the assembler. Other command options are passed on to one stage of processing. Some options control the preprocessor and others the compiler itself. Yet other options control the assembler and linker; these are not documented here, but you rarely need to use any of them. OPTIONS Here are the options to control the overall compilation pro- cess, including those that say whether to link, whether to assemble, and so on. -o file Place output in file file. This applies regardless to whatever sort of output is being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code. If -o is not specified, the default is to put an exe- cutable file in a.out, the object file source.c in source.o, an assembler file in source.s, and prepro- cessed C on standard output. -c Compile or assemble the source files, but do not link. Version 1.36 Last change: 18 June 1989 1 GCC(1) USER COMMANDS GCC(1) Produce object files with names made by replacing .c or .s with .o at the end of the input file names. Do nothing at all for object files specified as input. -S Compile into assembler code but do not assemble. The assembler output file name is made by replacing .c with .s at the end of the input file name. Do nothing at all for assembler source files or object files speci- fied as input. -E Run only the C preprocessor. Preprocess all the C source files specified and output the results to stan- dard output. -v Compiler driver program prints the commands it executes as it runs the preprocessor, compiler proper, assembler and linker. Some of these are directed to print their own version numbers. -pipe Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trou- ble. -Bprefix Compiler driver program tries prefix as a prefix for each program it tries to run. These programs are cpp, cc1, as and ld. For each subprogram to be run, the compiler driver first tries the -B prefix, if any. If that name is not found, or if -B was not specified, the driver tries two standard prefixes, which are /usr/lib/gcc- and /usr/local/lib/gcc-. If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your PATH environment variable. The run-time support file gnulib is also searched for using the -B prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means. Most of the time, on most machines, you can do without it. You can get a similar result from the environment vari- able GCC_EXEC_PREFIX; if it is defined, its value is used as a prefix in the same way. If both the -B option and the GCC_EXEC_PREFIX variable are present, the -B option is used first and the environment Version 1.36 Last change: 18 June 1989 2 GCC(1) USER COMMANDS GCC(1) variable value second. -bprefix The argument prefix is used as a second prefix for the compiler executables and libraries. This prefix is optional: the compiler tries each file first with it, then without it. This prefix follows the prefix speci- fied with -B or the default prefixes. Thus, -bvax- -Bcc/ in the presence of environment vari- able GCC_EXEC_PREFIX with definition /u/foo/ causes GNU CC to try the following file names for the preprocessor executable: cc/vax-cpp cc/cpp /u/foo/vax-cpp /u/foo/cpp /usr/local/lib/gcc-vax-cpp /usr/local/lib/gcc-cpp /usr/lib/gcc-vax-cpp /usr/lib/gcc-cpp These options control the details of C compilation itself. -ansi Support all ANSI standard C programs. This turns off certain features of GNU C that are incompatible with ANSI C, such as the asm, inline and typeof keywords, and predefined macros such as unix and vax that identify the type of system you are using. It also enables the undesirable and rarely used ANSI tri- graph feature. The alternate keywords __asm__, __inline__ and __typeof__ continue to work despite -ansi. You would not want to use them in an ANSI C program, of course, but it useful to put them in header files that might be included in compilations done with -ansi. Alternate predefined macros such as __unix__ and __vax__ are also available, with or without -ansi. The -ansi option does not cause non-ANSI programs to be rejected gratuitously. For that, -pedantic is required in addition to -ansi. The macro __STRICT_ANSI__ is predefined when the -ansi option is used. Some header files may notice this macro and refrain from declaring certain functions or defining certain macros that the ANSI standard doesn't call for; this is to avoid interfering with any pro- grams that might use these names for other things. Version 1.36 Last change: 18 June 1989 3 GCC(1) USER COMMANDS GCC(1) -traditional Attempt to support some aspects of traditional C com- pilers. Specifically: * All extern declarations take effect globally even if they are written inside of a function definition. This includes implicit declarations of functions. * The keywords typeof, inline, signed, const and volatile are not recognized. * Comparisons between pointers and integers are always allowed. * Integer types unsigned short and unsigned char promote to unsigned int. * Out-of-range floating point literals are not an error. * All automatic variables not declared register are preserved by longjmp(3C). Ordinarily, GNU C follows ANSI C: automatic variables not declared volatile may be clobbered. * In the preprocessor, comments convert to nothing at all, rather than to a space. This allows traditional token concatenation. * In the preprocessor, macro arguments are recognized within string constants in a macro definition (and their values are stringified, though without additional quote marks, when they appear in such a context). The preprocessor always considers a string constant to end at a newline. * The predefined macro __STDC__ is not defined when you use -traditional, but __GNUC__ is (since the GNU exten- sions which __GNUC__ indicates are not affected by -traditional). If you need to write header files that work differently depending on whether -traditional is in use, by testing both of these predefined macros you can distinguish four situations: GNU C, traditional GNU C, other ANSI C compilers, and other old C compilers. -O Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. Without -O, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between statements, you can then assign a new value to any variable or Version 1.36 Last change: 18 June 1989 4 GCC(1) USER COMMANDS GCC(1) change the program counter to any other statement in the function and get exactly the results you would expect from the source code. Without -O, only variables declared register are allo- cated in registers. The resulting compiled code is a little worse than produced by PCC without -O. With -O, the compiler tries to reduce code size and execution time. Some of the -f options described below turn specific kinds of optimization on or off. -g Produce debugging information in the operating system's native format (for DBX or SDB). GDB also can work with this debugging information. Unlike most other C compilers, GNU CC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some state- ments may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops. Nevertheless it proves possi- ble to debug optimized output. This makes it reason- able to use the optimizer for programs that might have bugs. -gg Produce debugging information in GDB's own format. This requires the GNU assembler and linker in order to work. This feature will probably be eliminated. It was intended to enable GDB to read the symbol table faster, but it doesn't result in enough of a speedup to be worth the larger object files and executables. We are working on other ways of making GDB start even faster, which work with DBX format debugging information and could be made to work with SDB format. -w Inhibit all warning messages. -W Print extra warning messages for these events: * An automatic variable is used without first being ini- tialized. These warnings are possible only in optimizing compila- tion, because they require data flow information that Version 1.36 Last change: 18 June 1989 5 GCC(1) USER COMMANDS GCC(1) is computed only when optimizing. If you don't specify -O, you simply won't get these warnings. These warnings occur only for variables that are candi- dates for register allocation. Therefore, they do not occur for a variable that is declared volatile, or whose address is taken, or whose size is other than 1, 2, 4 or 8 bytes. Also, they do not occur for struc- tures, unions or arrays, even when they are in regis- ters. Note that there may be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by data flow analysis before the warnings are printed. These warnings are made optional because GNU CC is not smart enough to see all the reasons why the code might be correct despite appearing to have an error. Here is one example of how this can happen: { int x; switch (y) { case 1: x = 1; break; case 2: x = 4; break; case 3: x = 5; } foo (x); } If the value of y is always 1, 2 or 3, then x is always initialized, but GNU CC doesn't know this. Here is another common case: { int save_y; if (change_y) save_y = y, y = new_y; ... if (change_y) y = save_y; } This has no bug because save_y is used only if it is set. Some spurious warnings can be avoided if you declare as volatile all the functions you use that never return. * A nonvolatile automatic variable might be changed by a Version 1.36 Last change: 18 June 1989 6 GCC(1) USER COMMANDS GCC(1) call to longjmp(3C). These warnings as well are possi- ble only in optimizing compilation. The compiler sees only the calls to setjmp(3C). It cannot know where longjmp(3C) will be called; in fact, a signal handler could call it at any point in the code. As a result, you may get a warning even when there is in fact no problem because longjmp(3C) cannot in fact be called at the place which would cause a problem. * A function can return either with or without a value. (Falling off the end of the function body is considered returning without a value.) For example, this function would evoke such a warning: foo (a) { if (a > 0) return a; } Spurious warnings can occur because GNU CC does not realize that certain functions (including abort(3C) and longjmp(3C)) will never return. * An expression-statement contains no side effects. In the future, other useful warnings may also be enabled by this option. -Wimplicit Warn whenever a function is implicitly declared. -Wreturn-type Warn whenever a function is defined with a return-type that defaults to int. Also warn about any return statement with no return-value in a function whose return-type is not void. -Wunused Warn whenever a local variable is unused aside from its declaration, and whenever a function is declared static but never defined. -Wswitch Warn whenever a switch statement has an index of enumeral type and lacks a case for one or more of the named codes of that enumeration. (The presence of a default label prevents this warning.) case labels out- side the enumeration range also provoke warnings when this option is used. Version 1.36 Last change: 18 June 1989 7 GCC(1) USER COMMANDS GCC(1) -Wcomment Warn whenever a comment-start sequence /* appears in a comment. -Wtrigraphs Warn if any trigraphs are encountered (assuming they are enabled). -Wall All of the above -W options combined. These are all the options which pertain to usage that we do not recommend and that we believe is always easy to avoid, even in conjunction with macros. The other -W... options below are not implied by -Wall because certain kinds of useful macros are almost impossible to write without causing those warnings. -Wshadow Warn whenever a local variable shadows another local variable. -Wid-clash-len Warn whenever two distinct identifiers match in the first len characters. This may help you prepare a pro- gram that will compile with certain obsolete, brain- damaged compilers. -Wpointer-arith Warn about anything that depends on the size of a func- tion type or of void. GNU C assigns these types a size of 1, for convenience in calculations with void * pointers and pointers to functions. -Wcast-qual Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a const char * is cast to an ordinary char *. -Wwrite-strings Give string constants the type const char[length] so that copying the address of one into a non-const char * pointer will get a warning. These warnings will help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using const in declarations and proto- types. Otherwise, it will just be a nuisance; this is why we did not make -Wall request these warnings. -p Generate extra code to write profile information suit- able for the analysis program prof(1). Version 1.36 Last change: 18 June 1989 8 GCC(1) USER COMMANDS GCC(1) -pg Generate extra code to write profile information suit- able for the analysis program gprof(1). -a Generate extra code to write profile information for basic blocks, suitable for the analysis program tcov(1). Eventually GNU gprof(1) should be extended to process this data. -llibrary Search a standard list of directories for a library named library, which is actually a file named liblibrary.a. The linker uses this file as if it had been specified precisely by name. The directories searched include several standard sys- tem directories plus any that you specify with -L. Normally the files found this way are library files-- archive files whose members are object files. The linker handles an archive file by scanning through it for members which define symbols that have so far been referenced but not defined. But if the file that is found is an ordinary object file, it is linked in the usual fashion. The only difference between using an -l option and specifying a file name is that -l searches several directories. -Ldir Add directory dir to the list of directories to be searched for -l. -nostdlib Don't use the standard system libraries and startup files when linking. Only the files you specify (plus gnulib) will be passed to the linker. -mmachinespec Machine-dependent option specifying something about the type of target machine. These options are defined by the macro TARGET_SWITCHES in the machine description. The default for the options is also defined by that macro, which enables you to change the defaults. These are the -m options defined in the 68000 machine description: -m68020 -mc68020 Generate output for a 68020 (rather than a 68000). This is the default if you use the unmodified sources. Version 1.36 Last change: 18 June 1989 9 GCC(1) USER COMMANDS GCC(1) -m68000 -mc68000 Generate output for a 68000 (rather than a 68020). -m68881 Generate output containing 68881 instructions for floating point. This is the default if you use the unmodified sources. -mfpa Generate output containing Sun FPA instructions for floating point. -msoft-float Generate output containing library calls for floating point. -mshort Consider type int to be 16 bits wide, like short int. -mnobitfield Do not use the bit-field instructions. -m68000 implies -mnobitfield. -mbitfield Do use the bit-field instructions. -m68020 implies -mbitfield. This is the default if you use the unmodified sources. -mrtd Use a different function-calling convention, in which functions that take a fixed number of argu- ments return with the rtd instruction, which pops their arguments while returning. This saves one instruction in the caller since there is no need to pop the arguments there. This calling convention is incompatible with the one normally used on Unix, so you cannot use it if you need to call libraries compiled with the Unix compiler. Also, you must provide function prototypes for all functions that take variable numbers of arguments (including printf(3S)); otherwise incorrect code will be generated for calls to those functions. In addition, seriously incorrect code will result if you call a function with too many arguments. (Normally, extra arguments are harmlessly ignored.) Version 1.36 Last change: 18 June 1989 10 GCC(1) USER COMMANDS GCC(1) The rtd instruction is supported by the 68010 and 68020 processors, but not by the 68000. These -m options are defined in the Vax machine description: -munix Do not output certain jump instructions (aobleq and so on) that the Unix assembler for the Vax cannot handle across long ranges. -mgnu Do output those jump instructions, on the assump- tion that you will assemble with the GNU assem- bler. -mg Output code for g-format floating point numbers instead of d-format. These -m switches are supported on the Sparc: -mfpu Generate output containing floating point instruc- tions. This is the default if you use the unmodi- fied sources. -msoft-float Generate output containing library calls for floating point. -mno-epilogue Generate separate return instructions for return statements. This has both advantages and disad- vantages; I don't recall what they are. These -m options are defined in the Convex machine description: -mc1 Generate output for a C1. This is the default when the compiler is configured for a C1. -mc2 Generate output for a C2. This is the default when the compiler is configured for a C2. -margcount Generate code which puts an argument count in the word preceding each argument list. Some nonport- able Convex and Vax programs need this word. (Debuggers don't; this info is in the symbol Version 1.36 Last change: 18 June 1989 11 GCC(1) USER COMMANDS GCC(1) table.) -mnoargcount Omit the argument count word. This is the default if you use the unmodified sources. -fflag Specify machine-independent flags. Most flags have both positive and negative forms; the negative form of -ffoo would be -fno-foo. In the table below, only one of the forms is listed--the one which is not the default. You can figure out the other form by either removing no- or adding it. -fpcc-struct-return Use the same convention for returning struct and union values that is used by the usual C compiler on your system. This convention is less efficient for small structures, and on many machines it fails to be reen- trant; but it has the advantage of allowing intercalla- bility between GCC-compiled code and PCC-compiled code. -ffloat-store Do not store floating-point variables in registers. This prevents undesirable excess precision on machines such as the 68000 where the floating registers (of the 68881) keep more precision than a double is supposed to have. For most programs, the excess precision does only good, but a few programs rely on the precise definition of IEEE floating point. Use -ffloat-store for such pro- grams. -fno-asm Do not recognize asm, inline or typeof as a keyword. These words may then be used as identifiers. You can use __asm__, __inline__ and __typeof__ instead. -fno-defer-pop Always pop the arguments to each function call as soon as that function returns. Normally the compiler (when optimizing) lets arguments accumulate on the stack for several function calls and pops them all at once. -fstrength-reduce Perform the optimizations of loop strength reduction and elimination of iteration variables. -fcombine-regs Allow the combine pass to combine an instruction that copies one register into another. This might or might Version 1.36 Last change: 18 June 1989 12 GCC(1) USER COMMANDS GCC(1) not produce better code when used in addition to -O. I am interested in hearing about the difference this makes. -fforce-mem Force memory operands to be copied into registers before doing arithmetic on them. This may produce better code by making all memory references potential common subexpressions. When they are not common subex- pressions, instruction combination should eliminate the separate register-load. I am interested in hearing about the difference this makes. -fforce-addr Force memory address constants to be copied into regis- ters before doing arithmetic on them. This may produce better code just as -fforce-mem may. I am interested in hearing about the difference this makes. -fomit-frame-pointer Don't keep the frame pointer in a register for func- tions that don't need one. This avoids the instruc- tions to save, set up and restore frame pointers; it also makes an extra register available in many func- tions. It also makes debugging impossible. On some machines, such as the Vax, this flag has no effect, because the standard calling sequence automati- cally handles the frame pointer and nothing is saved by pretending it doesn't exist. The machine-description macro FRAME_POINTER_REQUIRED controls whether a target machine supports this flag. -finline-functions Integrate all simple functions into their callers. The compiler heuristically decides which functions are sim- ple enough to be worth integrating in this way. If all calls to a given function are integrated, and the function is declared static, then the function is normally not output as assembler code in its own right. -fcaller-saves Enable values to be allocated in registers that will be clobbered by function calls, by emitting extra instruc- tions to save and restore the registers around such calls. Such allocation is done only when it seems to result in better code than would otherwise be produced. This option is enabled by default on certain machines, usually those which have no call-preserved registers to use instead. Version 1.36 Last change: 18 June 1989 13 GCC(1) USER COMMANDS GCC(1) -fkeep-inline-functions Even if all calls to a given function are integrated, and the function is declared static, nevertheless out- put a separate run-time callable version of the func- tion. -fwritable-strings Store string constants in the writable data segment and don't uniquize them. This is for compatibility with old programs which assume they can write into string constants. Writing into string constants is a very bad idea; constants should be constant. -fcond-mismatch Allow conditional expressions with mismatched types in the second and third arguments. The value of such an expression is void. -fno-function-cse Do not put function addresses in registers; make each instruction that calls a constant function contain the function's address explicitly. This option results in less efficient code, but some strange hacks that alter the assembler output may be confused by the optimizations performed when this option is not used. -fvolatile Consider all memory references through pointers to be volatile. -fshared-data Requests that the data and non-const variables of this compilation be shared data rather than private data. The distinction makes sense only on certain operating systems, where shared data is shared between processes running the same program, while private data exists in one copy per process. -funsigned-char Let the type char be the unsigned, like unsigned char. Each kind of machine has a default for what char should be. It is either like unsigned char by default or like signed char by default. (Actually, at present, the default is always signed.) The type char is always a distinct type from either signed char or unsigned char, even though its behavior is always just like one of those two. Version 1.36 Last change: 18 June 1989 14 GCC(1) USER COMMANDS GCC(1) Note that this is equivalent to -fno-signed-char, which is the negative form of -fsigned-char. -fsigned-char Let the type char be signed, like signed char. Note that this is equivalent to -fno-unsigned-char, which is the negative form of -funsigned-char. -fdelayed-branch If supported for the target machine, attempt to reorder instructions to exploit instruction slots available after delayed branch instructions. -ffixed-reg Treat the register named reg as a fixed register; gen- erated code should never refer to it (except perhaps as a stack pointer, frame pointer or in some other fixed role). reg must be the name of a register. The register names accepted are machine-specific and are defined in the REGISTER_NAMES macro in the machine description macro file. This flag does not have a negative form, because it specifies a three-way choice. -fcall-used-reg Treat the register named reg as an allocatable register that is clobbered by function calls. It may be allo- cated for temporaries or variables that do not live across a call. Functions compiled this way will not save and restore the register REG. Use of this flag for a register that has a fixed per- vasive role in the machine's execution model, such as the stack pointer or frame pointer, will produce disas- trous results. This flag does not have a negative form, because it specifies a three-way choice. -fcall-saved-reg Treat the register named reg as an allocatable register saved by functions. It may be allocated even for tem- poraries or variables that live across a call. Func- tions compiled this way will save and restore the register reg if they use it. Use of this flag for a register that has a fixed per- vasive role in the machine's execution model, such as Version 1.36 Last change: 18 June 1989 15 GCC(1) USER COMMANDS GCC(1) the stack pointer or frame pointer, will produce disas- trous results. A different sort of disaster will result from the use of this flag for a register in which function values may be returned. This flag does not have a negative form, because it specifies a three-way choice. -dletters Says to make debugging dumps at times specified by letters. Here are the possible letters: r Dump after RTL generation. j Dump after first jump optimization. J Dump after last jump optimization. s Dump after CSE (including the jump optimization that sometimes follows CSE). L Dump after loop optimization. f Dump after flow analysis. c Dump after instruction combination. l Dump after local register allocation. g Dump after global register allocation. d Dump after delayed branch scheduling. m Print statistics on memory usage, at the end of the run. -pedantic Issue all the warnings demanded by strict ANSI standard C; reject all programs that use forbidden extensions. Valid ANSI standard C programs should compile properly with or without this option (though a rare few will require -ansi). However, without this option, certain GNU extensions and traditional C features are supported as well. With this option, they are rejected. There is no reason to use this option; it exists only to satisfy pedants. -pedantic does not cause warning messages for use of Version 1.36 Last change: 18 June 1989 16 GCC(1) USER COMMANDS GCC(1) the alternate keywords whose names begin and end with __. -static On Suns running version 4, this prevents linking with the shared libraries. (-g has the same effect.) These options control the C preprocessor, which is run on each C source file before actual compilation. If you use the `-E' option, nothing is done except C prepro- cessing. Some of these options make sense only together with `-E' because they request preprocessor output that is not suitable for actual compilation. -C Tell the preprocessor not to discard comments. Used with the -E option. -Idir Search directory dir for include files. -I- Any directories specified with -I options before the -I- option are searched only for the case of #include "file"; they are not searched for #include . If additional directories are specified with -I options after the -I-, these directories are searched for all #include directives. (Ordinarily all -I directories are used this way.) In addition, the -I- option inhibits the use of the current directory as the first search directory for #include "file". Therefore, the current directory is searched only if it is requested explicitly with -I.. Specifying both -I- and -I. allows you to control pre- cisely which directories are searched before the current one and which are searched after. -nostdinc Do not search the standard system directories for header files. Only the directories you have specified with -I options (and the current directory, if appropriate) are searched. Between -nostdinc and -I-, you can eliminate all direc- tories from the search path except those you specify. -M Tell the preprocessor to output a rule suitable for make(1) describing the dependencies of each source file. For each source file, the preprocessor outputs one make-rule whose target is the object file name for that source file and whose dependencies are all the files #included in it. This rule may be a single line or may be continued with \-newline if it is long. Version 1.36 Last change: 18 June 1989 17 GCC(1) USER COMMANDS GCC(1) -M implies -E. -MM Like -M but the output mentions only the user-header files included with #include "file". System header files included with #include are omitted. -MM implies -E. -Dmacro Define macro macro with the empty string as its defini- tion. -Dmacro=defn Define macro macro as defn. -Umacro Undefine macro macro. -trigraphs Support ANSI C trigraphs. You don't want to know about this brain-damage. The -ansi option also has this effect. FILES file.c C source file file.s assembly language file file.o object file a.out link edited output /tmp/cc* temporary files LIBDIR/gcc-cpp preprocessor LIBDIR/gcc-cc1 compiler LIBDIR/gcc-gnulib library needed by GCC on some machines /lib/crt[01n].o start-up routine /lib/libc.a standard C library, see intro(3) /usr/include standard directory for #include files LIBDIR/gcc-include standard gcc directory for #include files LIBDIR is usually /usr/local/lib. SEE ALSO as(1), ld(1), adb(1), dbx(1), sdb(1). BUGS Bugs should be reported to bug-gcc@prep.ai.mit.edu. Bugs tend actually to be fixed if they can be isolated, so it is in your interest to report them in such a way that they can be easily reproduced. COPYING Copyright (c) 1988 Free Software Foundation, Inc. Permis- sion is granted to make and distribute verbatim copies of this manual provided the copyright notice and this Version 1.36 Last change: 18 June 1989 18 GCC(1) USER COMMANDS GCC(1) permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above condi- tions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English. AUTHORS See the GNU CC Manual for the contributors to GNU CC. Version 1.36 Last change: 18 June 1989 19 ------------ These are all the binaries for Gnu Gcc V1.36 with all the updates until 09/28/89 applied for atariSt TOS *.ttp files go into GNUEXEC *.olb and crt0.o go into GNULIB NOTE: now gcc-cpp understands the environment var GNUINC, which is optionally the PATH to #include <> files, so you don't necessarily have to have them mixed up with the library objects in GNULIB. NOTE: gcc-ld.ttp now correctly interprets -lFOO as $(GNULIB)\FOO.olb gcc-as.ttp now correctly skips over \r in files edited on atariSt's gcc-as.ttp now correctly understands and adjusts for data alterable adressing modes when it appears as the second operand of instructions such as `cmp? #const, foo'. (bug fix since the last gcc-1.34 distribution). crt0.o - still needs a wrapper for stderr. it currently uses the MWC convention for long command line args (except that it does not look into the _io_vector part). If and when this issue is resolved in comp.sys.atari.st, we can make the necessary adjustments. Gulam users should set `env_style mw' if you want to give long args lines to gcc.ttp. gcc-cpp - now does __DATE__ and __FILE__ correctly gcc - now handles -mshort (16 bit integers). if -mshort is supplied the macro __MSHORT__ gets #defined, and the correct libraries ( $(GNULIB)\FOO16.olb ) are linked. Please carefully examine the prototypes in the #include<> headers for types before using -mshort. now handles long args, so do gcc-cpp, gcc-cc1, gcc-ar and gcc-ld. Gcc has also other minor bugs fixed, see the diffs. Also as a concequence of the new library, forward slashes are permitted in lieu of `\'s. gdb - completely new. thanks very much to john dunning for this fabulous piece of work. sym-ld needed with gdb. see the gdb docs. Also included are new and improved utilities to print and adjust the _stksize of any gcc compiled program. Both the utilities now will lookup the symbol table (so do not use -s) in an executable to find _stksize. NOTE that the executables as distributed are set up for a 1M St. You will certainly have to use these utils to tailor the programs to your environment. printstk -- prints the current value of _stksize from an executable. Usage: printstk [] if is not specified it defaults to .\gcc-cc1.ttp fixstk -- sets the value of _stksize in an executable. Usage: fixstk [] size: specified as # of bytes nnn nnn == integer specified as # of Kilo Bytes nnnK specified as # of Mega Bytes nnnM filename: optional, defaults to \.gcc-cc1.ttp For TOS 1.4 (developers prom version or better) a toglclr is included that toggles the clear above BSS to end of TPA flag for the gemdos loader. send your comments to: -- bang: {any internet host}!dsrgsun.ces.CWRU.edu!bammi jwahar r. bammi domain: bammi@dsrgsun.ces.CWRU.edu GEnie: J.Bammi ---------------------------- # # Sample Gulam script # set up commands for gcc and gas # alias cpp e:\exec\gcc-cpp setenv cpp e:\exec\gcc-cpp.ttp alias cc1 e:\exec\gcc-cc1 setenv cc1 e:\exec\gcc-cc1.ttp alias gas e:\exec\gcc-as setenv gas e:\exec\gcc-as.ttp alias as e:\exec\gcc-as setenv as e:\exec\gcc-as.ttp alias link e:\exec\link setenv link e:\exec\link.ttp alias ar e:\exec\gcc-ar setenv ar e:\exec\gcc-ar.ttp alias ld e:\exec\gcc-ld setenv ld e:\exec\gcc-ld.ttp alias gcc e:\exec\gcc setenv gcc e:\exec\gcc.ttp # alias cc e:\exec\gcc setenv cc e:\exec\gcc.ttp alias xcc e:\exec\gcc -Be:\exec\x setenv xcc e:\exec\gcc.ttp -Be:\exec\x # alias make e:\util\xmake.ttp setenv make e:\util\xmake.ttp # # bison... # alias bison e:\bison\bison.ttp setenv bison e:\bison\bison.ttp setenv BISON_SIMPLE e:\bison\bison.sim setenv BISON_HAIRY e:\bison\bison.hai # # nm: this nm can only applies to .o and library (.old or .a) files # It cannot nm an atari-tos executable # alias nm e:\util\nm.ttp # # Flex # alias flex e:\flex\flex.ttp setenv flex e:\flex\flex.ttp setenv FLEX_DEF e:\flex\flexdef.skl setenv FLEX_FAST e:\flex\flexfast.skl # # General # setenv GNULIB e:\lib setenv GCCEXEC e:\exec\gcc- setenv TEMP h: ------------------------------------ Recent additions: (gcc v1.35 release and later) PLEASE carefully read the file `Changelog' for details Here is a very incomplete list of changes, see `Changelog' for details. - BSD curses library port added - curses widget lib added. - new functions vfork, wait. - system() now does i/o re-direction - new functions stty, gtty - new function tzset - new function console_set_key and new include file keymap.h (see Changelog). -filename mapping now more flexible. a new function that allows user settable filename mapping. (see Changelog) - malloc chunk size now user settable. (see Changelog) - stat, access, bcopy, qsort completely replaced. - scanf overhauled for floats. it was broken. - all pml tests pass now - HUGE defined properly in atof and math.h (aka pmluser.h) - added extern size_t __DEFAULT_BUFSIZ__ it is by default set to BUFSIZ but at any point you can assign to it, and from then onwards all fopen's will use that size for buffering. NOTE: makeing __DEFAULT_BUFSIZ__ == 0 will result in unpredictable behavior. If you want unbuffered streams use other means (like setbuf etc). - added _malloczero(int truth) by calling _malloczero(1) all subsequent malloc's will zero fill memory before returning (very useful with the toglclr util and tos 1.4 or later). - many of the lXXX functions are now just globl labels at the head of appro. functions (when applicable). Note: this may have to change is the behaviour of asm() changes. - added berzerkly'ish sys/dir.h - lseek now supports BSD file extension semantics - line buffered (output) streams now work correctly - bug in dflonum.c corrected - bug fixes in osbind.h - lots of code cleanup. - some stuff dynamisized. - atexit fixed - printf now handles `#' flag - setjmp fixed. it did'nt work at all. - stat fixed for . and .. (Tos 1.4 still seems to have this bug) -following files from the first distribution of this lib (with gcc V1.35) moved to sub-dir `notused/' bcopy.c index.c lbcmp.c lbcopy.c lbzero.c qsort.c remove.c rindex.c fpprint.c sldexp.c printf.c prtfld.c sldexp.c - setlinebuf added - atof, ldexp, frexp, modf etc re-wroked - all formatted print routines re-worked - pml lib passes all tests now - lots of other bug fixes ---------------------------------------------------------------------------- Here's a new library for the TOS version of the GCC. You need at least need GCC 1.31 to use it; if your version of the GCC is less than 1.33 you will need to tweak a few things. ACKNOWLEDGEMENTS: Eric Smith (7103_300%uwovax.uwo.ca@CORNELLC.CIT.CORNELL.EDU, please put attn `Eric Smith' as this is a shared mbox) put this library together and contributed a lot of code, and put a lot of effort in debugging it. The library in its current form is due to his efforts. The original TOS GCC library that came with GCC 1.25, much of which was written by or revamped by John R. Dunning (jrd@STONY-BROOK.SCRC.Symbolics.COM), provided many of the low level routines. Of course we are also very greatful to jrd for his origonal port of gnu. Most of the standard i/o library came from Dale Schumacher's dLibs version 1.2. The string handling stuff is from Henry Spencer. Last but not the least, i would like to thank all the users who have sent in comments / suggestions. Thanks one and all! We have re-organized/hacked the code of others above, and are responsible for the new bugs. please report them! ENHANCEMENTS: Ansi compatibility (i would estimate we are about 90% there). A lot of new functions. Prototypes for everything. I have personally become a believer in them after being a disbeliever. It does help catch some pretty subtle errors (even if you are using 32 bit ints). Some new functionality for old functions, including: New stream I/O functions; fgetc(), fputc(), etc. all do newline translation by default. Appending "b" to the mode argument of fopen() will disable this translation. printf() and scanf() accept more options. printf with e and g floating point formats is sort of working (this could stand repairs!!) For compatibility to the old TOS gcc library, calling the function _binmode(1); at the top of main() will make binary mode the default mode for stream i/o (std in/out/err will do the correct cr mapping as before), and the i/o functions will behave pretty much like before. There is an extern size_t __DEFAULT_BUFSIZ__ that is normally set to BUFSIZ, but you can override it at any point, and get default buffers of that size for buffered i/o (a cheap way to have large buffers, instead of putting setvbuf()'s all over the place, but its ansi non-compatible). The time functions all work with unix style times now, to make porting easier. localtime() etc now look up the env. variable `TZ' and calculate the local time correctly, taking into account DST etc. Functions which work with files accept unix-style path names (with '/' as a directory separator) as well as tos-style ones (with '\' between directories). Process spawn functions handle long args using MWC conventions. If and when the discussion on the net culminates, we can adapt. gulam users may want to set their `env_style mw'. New spawn functions present. Library setup for to generate both a 16 bit int library (-mshort compatible) or a 32 bit int library (See the files CMakefile.16, CMakefile.32 for the cross-compiler, and makefile.16, makefile.32 for the native ST compiler) Posix compatible directory access functions (thanks Doug Gwyn and Eric Smith). osbind.h is now more or less complete. it is setup to generate inline traps by default. This can be overridden by `-D__NO_INLINE__' at compile time (see files straps.cpp for the 16 bit defn, and traps.c for the 32 bit definitions of __NO_INLINE__ gemdos, xbios and bios traps). For use with GDB, MUST use __NO_INLINE__ lineA.h is setup in a similar manner (i am not including it in this distribution as it is a little buggy, will let you have it in a few days once i have had a chance to clean it up a bit). Lots of brand new fuctionality. Docs are in the works. complete reorganization/revaming of #include <> files, please take a moment to become familiar with them. Most of the origonal TOS gcc .h files are there in the same place, so you should not have much trouble when compiling existing code. and lots more! please browse though the header files in ../t-include POSSIBLE GOTCHAS: USE PROTOTYPES TO STAY OUT OF TROUBLE !!!!!!!!!!!!!!!!!!!!!!! (new utility by eric smith `mkproto' provided for this purpose, so the traditional excuses are not applicable :-) Here is a new addition for the hackers dictionary UTFP -- Use The F***ing Prototypes -:) -:) Especially when using -mshort be aware that the TYPE of SIZE_T is UNSIGNED LONG the SIZEOF operator returns a result of the type UNSIGNED LONG NULL is not a 16 bit integer string functions DO NOT restrict you to int sized strings The above choices are both (almost) mandated (see the ansi draft) and deliberate. We were not about to restrict data structures to 64k max sizes when using -mshort (this would be criminal on the 68k architecture, also see the file obstacks.h for another very good reason) In short (pun intended) please look over and use prototypes and supplied header files! NOT HAPPY ABOUT: other than some algorithms that can and will be revamed, we are a little unhappy about the static data size of the library. we are working on cutting this down, and also on dynamicizing more fixed sized structures in the library. Some of the local arrays will also be probably converted to alloca's of dynamically determined appro. sizes. BUGS: No doubt lots of these. Especially look out for places labelled FIXME: these are known to be broken or substandard. Please send your comments/suggestions/contributions/bug reports to both/either/or enjoy, -- Eric R. Smith jwahar r. bammi 7103_300@uwovax.uwo.ca bammi@dsrgsun.ces.cwru.edu 7103_300@uwovax.bitnet {decvax,sun}!cwjcc!dsrgsun!bammi (a shared mailbox: put his name on GEnie: J.Bammi the message, please!) --------------------- previous change history muddled at best (i can track things in my RCS files, but i did'nt keep a log). changes since first release of library with TOS gcc v1.35 in cronologically increasing order: ChangeLog:: ++jrb New file. all makefiles:: ++jrb adjusted, CMakefile.* now add -fstrength-reduce to CFLAGS bcopy.s:: ++jrb replaces bcopy.c -- a better mouse trap :-) bcopy.s has lbcopy() entry point too. bcopy.c moved to notused/ bcmp.c, bzero.c:: ++jrb added lbXX() entry points this makes lbcmp.c & lbzero.c redundant moved to notused/ strchr,strrchr:: ++jrb now have entry points for index()/rindex() index.c & rindex.c moved to notused/ unlink.c:: ++jrb now has entry point for remove() remove.c moved to notused/ atof.c:: ++jrb redefined HUGE (to be ieee inf) HUGE defined in this way in (aka ) too now. ctime.c:: ++jrb cleaned up some ^M's in there dflonum.c:: ++jrb bug fix: defn of XXADDL was wrong (when -O, there were not enough constraints to let gcc know that the `zero' pointer was being decremented, so that it would re-load (XXADDL is used in a loop, this made it worse, since it just assumed it was constant and moved the init out of the loop). lot of constraints cleanup here and in flonum.h redundant defined commented out. dirent.c:: ++jrb moved mydat, olddta into opendir() cleanups (i am trying to put explicit casts for mallocs etc for the sake of compilers that dont understand protos). __DEFAULT_BUFSIZ__ :: ++jrb added an extern size_t __DEFAULT_BUFSIZ__ that is normally set to BUFSIZ, but you can override it at any point, and get default buffers of that size for buffered i/o (a cheap way to have large buffers, instead of putting setvbuf()'s all over the place, but its ansi non-compatible). changes in fxxx.c files refplect this addition. fputc.c:: ++jrb put in support for line buffered streams in main.c, stdout is now initialized line buffered in stdio.h _IOLBF was not unique, changed that. getlogin.c:: ++jrb logname is now dynamically allocated the length is no longer static (used alloca) getpw.c:: ++jrb file always open in text mode should _binmode(1) be in effect lseek.c:: ++jrb now incorporates BSD semantics too, where if you seek past eof you get a zero filled hole. ltoa.c:: ++jrb added strrev proto ifdef __STRICT_ANSI__ (string.h has the ifdef to make it kosher) main:: ++jrb dynamisized _at_exit [] this gets rid of ATEXIT_MAX (ansi says should be at least 32, hopefully we'll meet that and more) the return type of atexit() was opposite -- adjusted this also required adjustment in tmpfile.c stdout is now truely line buffered malloc.c:: ++jrb added _malloczero() that set/unsets flag to tell malloc to zero out blocks useful with TOS 1.4 where TPA clearing above BSS may be turned off. (see new util toglclr.ttp). Some badly written programs (gcc-ar for instance) assume malloc clears. _mallocChunkSize() lets you tune min chunk size. CAUTION: use _mallocChunkSize() to tailor to your environment, do not make the default too large, as the compiler gets screwed on a 1M machine otherwise (stack/heap clash) added entry points for malloc/realloc etc printf.c:: ++jrb added support for `#' flag added `h' flag prtfld.c:: ++jrb needed qsort.c:: ++jrb totally replaced with one from dlib the one from dlibs needed quite a few fixes. read.c, write.c:: ++jrb added entry points for read()/write() when not __MSHORT__ sbrk.c:: ++jrb added entry point for sbrk() setjmp.s:: ++jrb was bug ridden (thanks pekka!) strcat.c, strncat.c:: ++jrb moved check for null src to outer level system.c:: ++jrb cleanups tmpfile.c: everything dynamacized the atexit fn delete_tmpfile() now closes before removing this needed new data str. tmpnam.c:: ++jrb replaced sprintf with strcpy/strcat unx2dos.c:: ++jrb made the file name mapping functions more flex (thanks dale for suggesting the idea). the mapping functions now go through settable (via new function fnmapfunc()) function pointers to call the mapping routines. these pointers are by default initialized to _unx2dos/_dos2unx that were the old functions. scanf.c:: ++jrb float conversions (%ef) were severly broken. fixed. vfork.c:: ers New functions vfork() and wait() added. mktemp.c:: ers Fixed ranges and handling of multiple "mktemp"'s; because of a typo, the old version tried only one number, and if the file existed it gave up. localtime.c:: ers Added global variable timezone to hold timezone offset; also function tzset() to initialize it. (These seem common in Unixes). Fixed bug in calculation of timezone offset (EST5EDT was being translated as EST5:05EDT). system.c:: ers Added I/O redirection, using vfork(). read.c:: ers Fixed some bugs due to evaluation of arguments in macro expansions. stat.c:: ers Fixed up values returned for st_mode to be consistent with chmod(); also added a check for executable files, so most regular files get permissions rw-rw-rw- instead of rwxrwxrwx. Also added a work around to TOS's refusal to find "." or ".." in an Fsfirst without wildcards. rename.c:: ers Changed so that rename(old, new) fails if "new" already exists. H & S claims this is implementation defined, and this way seems more intuitive to me. (If a later draft of the pANS changed this, let me know). access.c:: ers Removed the call to _unx2dos (it wasn't necessary, since stat calls _unx2dos). write.c:: ers Put def'n of __col_pos here instead of in read.c (to avoid pulling in read() unless necessary -- write always gets used). sgtty.c:: ers New functions stty() and gtty() added for compatibility with old code (e.g. curses). varargs.h, stdargs.h:: ers Added some checks to guard against both of these being included. osbind.h:: ers Fixed defn for Mshrink. Fixed defn of PE_CBASEPAGE. Moved defn of struct _dta to here from stat.h. types.h:: ers Removed #include of , added a guarded definition for time_t. time.h:: ers Added a guard to typedef of time_t. stat.h:: ers Moved defn of struct _dta to osbind.h, where it belongs. Made a "real" definition for S_IFREG. NEW LIBRARY curses.olb:: ers . Combines BSD curses with Fred Fish's PD termcap library. Everything seems pretty standard. I made the following enhancements: If no termcap file can be found, the Atari ST's built in VT52 is assumed. A replacement for console_read_byte() is provided that allows binding of macros to keys with the call: console_set_key(int scancode, char *r, char *s, char *a) where "scancode" is the key scan code, "r" is the string to be sent when the key is pressed without any shift keys, "s" the string to be sent when SHIFT+key is pressed, and "a" the string to be sent when ALT+key is pressed. A NULL string leaves the previous key binding unchanged; an empty string "" erases any previous key binding. The new console_read_byte() is slower and takes more memory, so it only gets linked if -lcurses (or -lcurses16) is used and there is a call to console_set_key(). New header files and are provided. has the prototype for console_set_key(), and has various scan codes provided as constants (e.g. F_1 is the scan code for the f1 key). fpprint.c: ++jrb replaced decfrexp with a hopefully better one added rounding at prec+1 (output certainly looks nicer now) scanf.c, printf.c, mktemp.c: ++jrb replaced expressions of the form n * 10 [n a integer] with TEN_MUL(n) == (((n) << 2) + n) << 1 10*n == 2(4n + n) atof.c:: ++jrb added ansi func strtod, atof now calls this. added d|D as valid chars for 'E' notation as per ansi. added proto for strtod to stdlib.h corrected bugs in counting total exp. now passes its builtin test (which is biased!) pulled out old dummy strtod #define from stdlib.h close.c:: ers Fixed bug with isatty status not being properly reset unless an error occured. unx2dos.c:: ers Added a check for two slashes in a row (a common error which can really make GEMDOS confused) and for a directory name with a trailing slash (Unix apparently accepts access("DIR/",0) as well as access("DIR",0)). curses.h:: ers Fixed definition of strlen to agree with definition in (namely size_t strlen(const char *)). osbind.h:: ers Changed definitions of Fcreate, Fopen, and Fdup to cast result to long instead of short. This is because file handles for CON:, AUX:, and PRN: are word negative but not long negative, whereas errors are long negative; casting to short makes Fopen("CON:",2) appear to give an error. getcwd.c:: ers The GCC is too clever with this; I had to add the keyword 'volatile' to an array to stop it from optimizing away the test in: path[2] = '\0'; Dgetpath(path, 0); if (!path[2]) ... fflush.c:: ers Changed test for buffer full from (fp->_cnt) to (fp->_cnt > 0), since when reading fp->_cnt becomes < 0 at EOF, and the subsequent lseek(file,-fp->_cnt,1) call will (now) cause the file to grow. main.c:: ++jrb if stdout !isatty then make it a full buffered stream rather than a line buffered stream; fclose.c:: ++jrb cosmetic changes. fopen.c:: ++jrb freopen() was foobared (see comments there). new coding. setbuf.c :: ++jrb added bezerkly setlinebuf() and a few asserts. include/unixlib.h:: ++jrb added proto for setlinebuf() include/assert.h:: ++jrb changed assert #def'n for !__STDC__ compilers that don't do token pasting. fpprint.c:: ++jrb brought back the old version(sigh!) added rounding at prec This has to be redone. Due to prec. loss for numbers near 1 or near 10 it prints stuff like "0.9:00e0" etc. now that modf() etc work almost exactly, we can re-code using those. Special thanks to peter housel who posted his x86 based floating lib. many of the alg used in the now improved floating support are fashioned after peters alg. norm.c:: ++jrb new file, normalize a ieee double atof.c:: ++jrb totally re-worked, now its much more like i wanted it to be. better test ldexp.c, modf.c, frexp.c:: ++jrb totally reworked. ldexp now always takes an int as it should have, so sldexp is no longer need for shortlib. (see #ifdefs in ldexp.c) better tests (see also pml/envtest) the combined test for ldexp/frexp is in frexp.c sldexp.c:: ++jrb moved to notused/sdlexp.c *akefile.16:: ++jrb took out sldexp.o target from all of them *akefile*:: ++jrb added target norm.o doprnt.c, sprintf.c, fprintf.c:: ++jrb Finally, adopted berkley's PD doprnt(). It does things right and much better than kludges i was trying to get especially the fpprint right (i still cannot come up with a alg for decrexp that does not loose badly on prec). appropriate adjustments made to sprintf.c and fprintf.c. fpprint.c, printf.c, prtfld.c:: ++jrb moved to notused/ because of above. *akefile:: ++jrb adjusted to above two changes. varargs.h, stdarg.h:: ++jrb fixed bugs when va_arg is expanded with type 'char' thanks to dale schumacher for detecting this. *makefile.*:: ers added abs.o (how did we miss this one???) fixed typo in makefile.16 qsort.c:: ers added cast to an argument (needed for -mshort) vfork.c:: ers changed so that child process uses the same stack as the parent; this is what Un*x does, and saves memory. fixed wait() to be Un*x compatible. spawnve.c:: ers made storage for environment+args dynamic; gnu make was losing on big files (e.g. nethack) because 2K wasn't enough. system.c:: ers changed call to wait to agree with changes above. findfile.c:: ers fixed search for extensions (.ttp, .prg, etc) so that it works with _unixmode > 2. doprnt.c,scanf.c:: ers changed __NO_FLOATS__ to __NO_FLOAT__ to agree with makefiles. qsort.c:: ++jrb merged in minix changes (i have to support both!) as per ers change above, adjust arg for _wqsort()and _lqsort() too. additional assumption: if SHORT alignment is desired then it is ok to align a long at a short boundary too. this seems to be generally true (of course someone will come up with a weird machine where it is untrue - maybe intel!). To do : define a threshold and do insertion sort below threshold remove recursion qsort.c :: ++jrb Finally a qsort that kicks ass! (and works :-). the old one moved to notused/dl_qsort.c qsort.c: i started with doug smidth's version, first hacked it to handle SIZE sized items (his was ints only) the performance sucked, so i totally rewamped the algorithm in qsort(), following Sedgewick and suggestions in K V3. dflonum.c:: ++jrb House cleaning. fixnum.s:: ++jrb Merged in kai-uwe's code (thanks kai). Fixed a few bugs. Cleanup. popen.c:: ++jrb Added kau-uwe's popen/pclose with appropriate mods for this library. The basic difference was that this libraries system() already did re-direction, so we take advantage of that fact to avoid doing re-direction in popen/pclose. Thanks again kai-uwe. stdio.h:: ++jrb added protos for popen()/pclose() (in non strict ansi part). *akefile:: ++jrb reflect the addition of popen.c dirent.c:: ers fixed opendir() to work correctly with non-existent directories. Also made seekdir() actually do some work. sys/dir.h:: ers took advantage of undocumented feature of dirent.c, namely that d->reclen contains the length of the name. fixnum.s:: ++jrb kai-uwe's fixnum has problem. pulled it out and re-instated the old one. will look into whats going on. fixnum.s:: ++jrb fixed bugs in kai's version and put it back (it is much more efficient). fcntl.h, close.c, open.c, isatty.c, fhandle.c:: ++jrb replaced char __handle_stat[] with a open files status structure __open_stat[], that keeps more info around about open files, enabling impl of fstat(). later more fields can be added as required. Also Note: while making these changes, took care of the fact that the smallest valid gemdos handle is -3 and not 0. See __SMALLEST_VALID_HANDLE and __OPEN_INDEX macros in stat.c, stat.h :: ++jrb added fstat(int, struct stat *) scanf.c :: ++jrb floating conversion uses our super atof now after collecting the input number as a string. popen.c:: ers fixed up popen(cmd, "r") calls to redirect properly; also they return NULL if cmd fails (return code < 0). vfork.c:: ers changed to reflect the fact that exit codes are really short on the ST. TODO:: scanf when getting from a line buffered isatty stream, flush it before getting (like bezerkley) gnulib2.c:: ++jrb new file. contains long long support for gcc, and a few funcs that moved over from dflonum. *akefile*:: ++jrb added gnulib2 targets close.c:: ers checked that __open_stat.filename was non-null before freeing malloc.c:: ers allowed free(0) to do nothing (I think ANSI wants this) open.c:: ers added _canonical() function to get full pathname of a file, so fstat() can work after a chdir(). textio.c:: ers new functions to read/write text files doing nl conversion (this seems to crop up a lot, especially in GNU stuff) localtime.c:: ers fixed so that days have 24 hours, not 23 :-) strdup.c:: ers new function strdup() added (GNU and system V both use it) unlink.c:: ers changed so unlink of an open file works (well, usually) dup.c:: ers changed dup2 so that it closes the original file, and returns the file descriptor on success