sorry, my fault.#
In the original code i used
int argc
What i don't understand is, when i call the programm without any argument it crashes in FreeDOS.
The same EXE works fine if i call it with a given argument, like "/?" "help" or anything.
I wrote it 1995 with qc25 compiler of MSDOS.
The original MSDOS had no Program to rename a directory:
Code:
/* Programm rendir.c benennt Verzeichnisse um */
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
void Autor(void)
{
printf("Test-Version\n");
/* Name of Author */
}
int main(int argc, char *argv[])
{
int frage;
char altername[300], neuername[300];
if(((strcmp(argv[1], "/?")) == 0) || ((strcmp(argv[1], "/h")) == 0) || \
((strcmp(argv[1], "help")) == 0))
{
AUTOR();
printf("\nRENDIR.EXE .... Ein Programm zum Umbenennen von Verzeichnissen");
printf("\ngeschrieben fuer MS-DOS Betriebssysteme");
printf("\nSyntax: rendir alter_Verzeichnissname neuer_Verzeichnissname");
getch();
return(0);
}
if(argc != 3)
goto keinargument;
strcpy(altername, argv[1]);
strcpy(neuername, argv[2]);
goto request;
keinargument: printf("\nRENDIR.EXE .... Ein Programm zum Umbenennen von Verzeichnissen");
printf("\ngeschrieben fuer MS-DOS Betriebssysteme");
printf("\nSyntax: rendir alter_Verzeichnissname neuer_Verzeichnissname");
printf("\nEnde........e oder E");
printf("\nInfo........i oder I");
printf("\nWeiter......beliebige Tate");
frage = getche();
if ((frage == 'e') || (frage == 'E'))
return(0);
if ((frage == 'i') || (frage == 'I'))
{
AUTOR();
return(0);
}
printf("\nAlter Verzeichniss-Name: ");
scanf("%s", altername);
printf("\nNeuer Verzeichniss-Name: ");
scanf("%s", neuername);
request:
printf("\nAlter Name:%s\nNeuerName :%s\n", altername, neuername);
printf("\nWollen Sie wirklich diese Verzeichniss umbenennen(j/n)");
frage = getche();
if ((frage == 'n') || (frage == 'N'))
return(0);
frage = rename( altername, neuername );
if (frage != 0)
{
printf("\nUmbenennung fehlgeschlagen\n");
printf("\nBitte geben Sie beim alten und beim");
printf("\nneuen Verzeichnissnamen den kompletten Pfad an\n");
}
return(0);
}
I work with an emulator qemu-kvm on SUSE Linux tumbleweed. At the same emulated Freedos i have an old
QC25 compiler, with it i have no Problems. Why does progams where compiled for DOS with DJGPP don't like
a call without arguments?
Same results i've got with compile and link with RHIDE.EXE.
Also i compiled and linked on with gcc himself. No other results.