This is ProgressMain.m in view mode; [Download] [Up]
/******************************************************************************
FILE: ProgressMain.m
LANGUAGE: Objective-C
SYSTEM: UNIX
USER-INTERFACE: NEXTSTEP
DESCRIPTION
This UNIX tool displays a progress bar in a small window, showing the
size of the file given as first argument. The 100% corresponds to the
expected size given as second argment. When the size of the file is at
least the expected size, it is deemed completed, and a quit-button shows.
USAGE
tool parameters
progress file expected-size
AUTHORS
<PJB> Pascal J. Bourguignon
MODIFICATIONS
1998/08/12 <PJB> Creation.
BUGS
LEGAL
Copyright Pascal J. Bourguignon 1998 - 1998
The GNU GENERAL PUBLIC LICENSE applies to this software.
See the file named "COPYING".
******************************************************************************/
#import <appkit/appkit.h>
#import <stdio.h>
#import "Progress.h"
void main(int argc,char *argv[])
{
const char* path;
size_t targetSize;
BOOL pathSet=NO;
BOOL targetSizeSet=NO;
int i;
Progress* progress;
i=1;
while((i<argc)&&(!targetSizeSet)){
if(!pathSet){
path=argv[i];
pathSet=YES;
}else if(!targetSizeSet){
targetSizeSet=(1==sscanf(argv[i],"%ld",&targetSize));
}
i++;
}
if(!targetSizeSet){
fprintf(stderr,"%s usage:\n"
" %s file targetSize\n",
argv[0],argv[0]);
exit(1);
}
progress=[[Progress alloc]initWithPath:path expectedSize:targetSize];
if(![progress fileExists]){
fprintf(stderr,"%s: "
"%s does not exist or is not a plain file.\n",
argv[0],path);
exit(1);
}
[Application new];
[NXApp setDelegate:progress];
[NXApp run];
[NXApp free];
exit(0);
}//main;
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.